Decompiling/Deobfuscating the Ultima Online Demo scripts

Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Batlin on Thu Sep 17, 2009 1:22 pm

One of the big mysteries inside the Ultima Online DAT file were the .m (.m.q) files. Those files, like the directory name suggests, contain code. As it turns out, the scripts are obfuscated but by analyzing the script execution engine inside uodemo.exe I was able to figure it all out.

More technical explanation can be found on the wiki : http://uodemo.joinuo.com/index.php?title=Scripts

There are 1615 scripts in total, 814 of them assign behaviours to objects. The other 801 are the behaviours themselves, the skills & dungeon scripts (quests). OSI magery is spread over more than 120 scripts (2 scripts per spell).

How to "decompile" the scripts:
1) Extract the "scripts" directory from the DAT file : http://forum.joinuo.com/viewtopic.php?f=32&t=318
2) Download the Mass M Decompiler : http://uodemo.joinuo.com/index.php?title=Mass_M_Decompiler
3) Run the "Mass M Decompiler" and point it to the "scripts" directory
4) Press the Dump All button when decompilation is complete

You will find that the variable names inside the scripts are obfuscated.
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby xantier on Sun Jan 03, 2010 4:32 am

Nothing is changed.. Mass decompile button doesnt work. :(
xantier
 
Posts: 11
Joined: Sun Jan 03, 2010 4:28 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Batlin on Sun Jan 03, 2010 10:18 am

Hello xantier

You have to press the "..." button and select the directory that contains the .m files & the sdb.txt file.
Screenshot Mass M Decompiler.JPG
Screenshot Mass M Decompiler.JPG (100 KiB) Viewed 671 times

If you have VB.Net installed (Express editions should work), set a break-point at the ScanAndDecompileAll procedure at see what happens there.
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Sen on Sun Jan 03, 2010 6:17 pm

Link doesn't work for me.
Image
Sen
 
Posts: 16
Joined: Wed Jun 10, 2009 2:27 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Stuck on Fri Jun 04, 2010 4:31 pm

I can't get the Mass Decompile to work either. I've selected the correct directory, but still nothing. :(

edit: Nevermind, I got it working after messing around with it in visual studio a bit.

Btw, thank you for all of this Batlin. :)

Now I just gotta figure out a way to re-compile the scripts. ;p
Stuck
 
Posts: 7
Joined: Thu Jun 03, 2010 12:44 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Batlin on Tue Jun 29, 2010 8:00 am

edit: Nevermind, I got it working after messing around with it in visual studio a bit.

Can you tell me what you changed? I'm getting reports from other people that it doesn't work and I have no clue why :(
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Stuck on Fri Jul 16, 2010 2:24 am

Batlin wrote:
edit: Nevermind, I got it working after messing around with it in visual studio a bit.

Can you tell me what you changed? I'm getting reports from other people that it doesn't work and I have no clue why :(


I can't remember exactly what I did, but I ended up opening the source code and recompiling it and it worked.

edit: i just replied to your pm with more details i remembered.
Stuck
 
Posts: 7
Joined: Thu Jun 03, 2010 12:44 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Batlin on Sat Aug 21, 2010 9:21 pm

I've uploaded a new version of the Mass M Decompiler which fixes a bug that Garret reported me 9 months ago. Sorry for the delay.

To fix the bug manually in your already decompiled scripts: replace "location usedon" by "location place" in those scripts that implement the "targetloc" event.
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am


Re: Decompiling/Deobfuscating the Ultima Online Demo scripts

Postby Batlin on Sat Sep 18, 2010 6:24 am

I've uploaded a new version, Publish 4: http://download.joinuo.com/Mass%20M%20Decompiler/Mass%20M%20Decompiler%20(Publish%204).zip

This version fixes a decompilation bug where the variable-type and the variable-name got merged into one string if they were equal. The following scripts were affected by this bug and need re-compilation if you were using an older version:
    ballofyarn.m.C
    bldsprtsbase.m.C
    drink.m.C
    furniture.m.C
    grapevine.m.C
    hintgivetest.m.C
    hintupdate.m.C
    itemmanip.m.C
    mongen.m.C
    openflour.m.C
    preparefish.m.C
    scissors.m.C
    shipstuff.m.C
    tailor.m.C
    userisfishing.m.C

(Thank you Derrick for finding and reporting this bug)
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am



Return to UO Demo

Who is online

Users browsing this forum: No registered users and 1 guest