xboxscene.org forums

OG Xbox Forums => Official MediaXMenu (MXM) Forum => Dashboard Forums => MXM WIP Beta forum => Topic started by: flattspott on June 18, 2004, 11:03:00 PM

Title: How This For A Script Snippet Koldfuzion?
Post by: flattspott on June 18, 2004, 11:03:00 PM
CODE
// GUID Generator

Set GUID ""
For I = 1 To 5
  Set GUID%I% ""
Next

Set Part1 8
Set Part2 4
Set Part3 4
Set Part4 4
Set Part5 12
Set Split -

Set g1 $SerialNumber$
Set g2 $XboxVersion$
Set g3 $MAC$
Set g4 $Time$
Set g5 $Timer$

Set Table "0123456789abcdef"
SetFunc Count Length %Table%

For I = 0 To %Count%
  SetFunc Char%I% Mid %I% 1 %Table%
Next

For S = 1 To 5
  For I = 1 To %Part{S}%
     :Again
     Set Current $rand$
     Mod Current %Count%
     If# %Current% < 0 Goto Again
     Set GUID%S% %GUID{S}%%Char{Current}%
     Set GUID%S% %GUID{S}%%g{S}%
     SetFunc GUID%S% MD5 %GUID{S}%
     SetFunc GUID%S% Left %Part{S}% %GUID{S}%
  Next
  If# %S% == 5 Then
     Set Split ""
  EndIf
  Set GUID %GUID%%GUID{S}%%Split%
Next

Set GUID {%GUID%}
MsgBox "GUID is %GUID%"
Quit


EDIT. I changed it a little...

This post has been edited by flattspott: Jun 19 2004, 04:21 PM <
Title: How This For A Script Snippet Koldfuzion?
Post by: geniusalz on June 18, 2004, 11:08:00 PM
But you're defeating the purpose of a GUID being a GUID.  I think there's more to it than just random numbers.

Anyway, KF, your inbox is full.

The script reminds me of a bug: the mod command sometimes returns negatives when using $rand$.  <
Title: How This For A Script Snippet Koldfuzion?
Post by: pelago on June 18, 2004, 11:59:00 PM
Yeah, to generate GUIDs 'properly', you're supposed to use the machines MAC address, current time, and various other things I can't remember. The idea is that no two machines can create the same GUID twice. http://hegel.ittc.uk...ds-guids-01.txt I think is the definitive reference, but it may have been superceded.
Title: How This For A Script Snippet Koldfuzion?
Post by: koldfuzion on June 19, 2004, 04:46:00 AM
QUOTE
Anyway, KF, your inbox is full.


yea, i saw that, its been cleaned up but i think i still got the msg.

 <
Title: How This For A Script Snippet Koldfuzion?
Post by: Yuyu on June 19, 2004, 05:16:00 AM
QUOTE (pelago @ Jun 19 2004, 03:59 AM)
Yeah, to generate GUIDs 'properly', you're supposed to use the machines MAC address, current time, and various other things I can't remember. The idea is that no two machines can create the same GUID twice. http://hegel.ittc.uk...ds-guids-01.txt I think is the definitive reference, but it may have been superceded.

Yeah, we have a real GUID creator on the mediaxmenu website, in the scripting section, already... I believe flattspott was just messing around with a concept...
Title: How This For A Script Snippet Koldfuzion?
Post by: flattspott on June 19, 2004, 08:23:00 AM
Well what I I were to do this

65BD716E%XBOXMAC% > MD5 > First 8 letters
DC1A%XBOXMAC% > MD5 > First 4 letters
4d07%XBOXMAC% > MD5 > First 4 letters
9FCD%XBOXMAC% > MD5 > First 4 letters
0C2FFE3B78FE%XBOXMAC% > MD5 > First 12 letters

Hopefully you get the idea. Wouldn't that be unique?

The point was so I could could convert xas files to Modules and install then in the File Manager.  <
Title: How This For A Script Snippet Koldfuzion?
Post by: geniusalz on June 19, 2004, 08:39:00 AM
The actual GUID is designed to be globally unique until the next century or so.  Meaning, any ID's being generated on any machine in the world will be different.

However, on the xbox, we will probably not need that 'secure' uniqueness, because the chances of a matching ID are pretty slim.  So you could work with completely random digits.  

From what I know, a part of the ID is generated using the current time on the machine, and then another part of it is generated from the MAC.  Therefore, every machine will generate different ID's at different times, and every machine will generate different ID's even at the same time because of the MAC.  <
Title: How This For A Script Snippet Koldfuzion?
Post by: flattspott on June 19, 2004, 08:46:00 AM
QUOTE
The script reminds me of a bug: the mod command sometimes returns negatives when using $rand$.


Thats what I said back in the day. Everyone thought I was retarded or something.
That's why I put If# %Current% < 0 Goto Again in it.


Anywho, I thought the script what pretty good seeing how simple it is.   <
Title: How This For A Script Snippet Koldfuzion?
Post by: flattspott on June 19, 2004, 09:35:00 AM
I just put the whole thing into a For Loop and spit out each GUID to a file 1000 times. Then using UltraEdit I sorted the list to check for dupes. Everyone was unique.

 <
Title: How This For A Script Snippet Koldfuzion?
Post by: geniusalz on June 19, 2004, 10:16:00 AM
Someone called you retarded?  <
Title: How This For A Script Snippet Koldfuzion?
Post by: koldfuzion on June 19, 2004, 10:23:00 AM
btw.. i concur.  

you were setting

QUOTE
Set g1 $SerialNumber$
Set g2 $XboxVersion$
Set g3 $MAC$
Set g4 $Time$
Set g5 $Timer$



but nowhere in the script did i see you use them in the guid creation.


you could probably just use something like

MD5($SerialNumber$$RANDOMNUMBER$XboxVersion$$MAC$$Time$)

and format it accordinly to get a decent GUID for the xbox.




 <
Title: How This For A Script Snippet Koldfuzion?
Post by: geniusalz on June 19, 2004, 09:18:00 AM
QUOTE
     Set GUID%S% %GUID{S}%%g{S}%


I don't know when it was added, but it's there.

Edit: Maybe you shouldn't use serial numbers in there ph34r.gif
Title: How This For A Script Snippet Koldfuzion?
Post by: BenJeremy on June 19, 2004, 10:50:00 AM
Oh, BTW....random numbers are generated as DWORDs (unsigned 32 bit), but when examining values as numbers, it looks at them as signed. I'll have to take a quick look at the random "special"  to make sure it's formatting it as unsigned.  <
Title: How This For A Script Snippet Koldfuzion?
Post by: flattspott on June 19, 2004, 11:13:00 AM
That reminds me %($rand%100)% and  dont work right.

Am I doing it right?  <
Title: How This For A Script Snippet Koldfuzion?
Post by: BenJeremy on June 19, 2004, 11:17:00 AM
Yes, but Geniusalz has said that the mod operator wasn't working, so I'll take a look at it shortly.  <
Title: How This For A Script Snippet Koldfuzion?
Post by: BenJeremy on June 19, 2004, 10:44:00 AM
Well, easily fixed. The original code (not that I'm pointing fingers at you, Geniusalz), but the parser was lacking the '%' in the case statement. Easily solved.


I also will make sure all (int) casts are changed to (__int64) casts.

Doing some more checks...
Title: How This For A Script Snippet Koldfuzion?
Post by: geniusalz on June 19, 2004, 10:50:00 AM
Another stupid bug which doesn't really affect anything is that the 'length' parameter for the evaluate function is treated as 'end+1'.  It doesn't matter, because all strings passed are trimmed before passing.

Just wondering: does mxm do anything with 'cout's?  They should be changed to 'real' error messages.
Title: How This For A Script Snippet Koldfuzion?
Post by: BenJeremy on June 19, 2004, 12:13:00 PM
QUOTE (geniusalz @ Jun 19 2004, 02:50 PM)
Another stupid bug which doesn't really affect anything is that the 'length' parameter for the evaluate function is treated as 'end+1'.  It doesn't matter, because all strings passed are trimmed before passing.

Just wondering: does mxm do anything with 'cout's?  They should be changed to 'real' error messages.

OK, I've converted them to LOGMSG calls.

I was getting an odd "FATX: found unrecognized signature" message repeated times in the last run. I have no clue as to what causes the message (something buried inthe Kernel, to be sure).
Title: How This For A Script Snippet Koldfuzion?
Post by: geniusalz on June 19, 2004, 12:37:00 PM
That might be the cause of some "Unable to read file" errors I've been getting in the gamesave manager, even though I open/close all files properly.
Title: How This For A Script Snippet Koldfuzion?
Post by: BenJeremy on June 19, 2004, 01:05:00 PM
Strange.

Well, I'm alternating between MXM and watching Band Of Brothers with my older son.... hopefully, there will be a WIP update tonight.
Title: How This For A Script Snippet Koldfuzion?
Post by: chilin_dude on June 19, 2004, 01:09:00 PM
QUOTE (BenJeremy @ Jun 19 2004, 10:05 PM)
watching Band Of Brothers with my older son.... hopefully, there will be a WIP update tonight.

Sorry but I've got to jump in here, that program rocked so much, there were 10 episodes I believe, are you enjoying it? THis reminded me I haven't cracked open my box set I got a couple of weeks back.. I really enjoyed this show, nearly as much as 24  ohmy.gif
Title: How This For A Script Snippet Koldfuzion?
Post by: BenJeremy on June 19, 2004, 02:32:00 PM
QUOTE (chilin_dude @ Jun 19 2004, 05:09 PM)
Sorry but I've got to jump in here, that program rocked so much, there were 10 episodes I believe, are you enjoying it? THis reminded me I haven't cracked open my box set I got a couple of weeks back.. I really enjoyed this show, nearly as much as 24  ohmy.gif

Yes, I missed most of it the first time around.... I think I finally caught it for the episode where they liberated the death camp.

Title: How This For A Script Snippet Koldfuzion?
Post by: flattspott on June 19, 2004, 03:00:00 PM
tongue.gif
Title: How This For A Script Snippet Koldfuzion?
Post by: koldfuzion on June 19, 2004, 04:10:00 PM
smile.gif
Title: How This For A Script Snippet Koldfuzion?
Post by: flattspott on June 19, 2004, 04:21:00 PM
beerchug.gif
Title: How This For A Script Snippet Koldfuzion?
Post by: koldfuzion on June 22, 2004, 03:18:00 PM
smile.gif