Usecode howtos
Posted: Thu Jul 05, 2007 4:55 pm
I want to edit some U7 usecode, for the fun of it. Unfortunately I found that the info on how to work with usecode and the tools is spread out all over the place, including some sites that no longer exist (esguides.com).
This is what I know, thus far:
----------------------------------------------------------------------------
- Usecode can be edited like this:
----------------------------------------------------------------------------
1. Extract all functions with cmd: "rip all"
2. Decompile .uco files with cmd: "wud compiled.uco -a > decompiled.uc
3. *do some editing*
4. Recompile .uc files with cmd: "wuc decompiled.uc compiled.uco"
5. Recreate usecode using cmd: "rip glue"
Problem with this approach:
1. wud decompiles to assembler-like code
2. rip needs all functions to recreate usecode
----------------------------------------------------------------------------
- ucxt can be used to decompile usecode into "exult script"
----------------------------------------------------------------------------
eg: ucxt -bg -ac -fs -ofile 00B2
creates a "file" containing decompiled function "00B2" in exult script format.
Problem with this approach:
1. ucc doesn't compile exult script correctly (get parse errors all the time)
----------------------------------------------------------------------------
- deploying custom usecode
----------------------------------------------------------------------------
Custom usecode can be put into a
"ultima/mods/modname/data" folder.
Config file for mods can be created with ExultStudio
....this is where my wisdom ends....
----------------------------------------------------------------------------
and this is what I wanted to do:
I decompiled a few functions (conversation functions, because I wanted something that I could change easily to see if it worked) using ucxt:
ucxt -bg -ac -fs -ofile 0415
ucxt -bg -ac -fs -ofile 044A
every call to ucxt created a file named "file", which I renamed to the function number + .uc
I changed the conversation text a little, and tried to recompile using ucc:
ucc 0415.uc Result: 0415.uc:43: parse error
ucc 044A.uc Result: 044A.uc:33: parse error
Then I read in some old form topics that ucc is not compatible with ucxt output.
Now, what I would like to know:
1. How can I edit usecode in exult script format and recompile it?
2. How do I create my custom "usecode" file only containining my own functions, without having to include all 1MB worth of usecode like when using "rip"?
3. Can I replace existing functions by creating my own function using
an already existing function number?
4. What is the difference between wuc and ucc?
5. What else is good to know?
Any help on any of these questions appreciated.
This is what I know, thus far:
----------------------------------------------------------------------------
- Usecode can be edited like this:
----------------------------------------------------------------------------
1. Extract all functions with cmd: "rip all"
2. Decompile .uco files with cmd: "wud compiled.uco -a > decompiled.uc
3. *do some editing*
4. Recompile .uc files with cmd: "wuc decompiled.uc compiled.uco"
5. Recreate usecode using cmd: "rip glue"
Problem with this approach:
1. wud decompiles to assembler-like code
2. rip needs all functions to recreate usecode
----------------------------------------------------------------------------
- ucxt can be used to decompile usecode into "exult script"
----------------------------------------------------------------------------
eg: ucxt -bg -ac -fs -ofile 00B2
creates a "file" containing decompiled function "00B2" in exult script format.
Problem with this approach:
1. ucc doesn't compile exult script correctly (get parse errors all the time)
----------------------------------------------------------------------------
- deploying custom usecode
----------------------------------------------------------------------------
Custom usecode can be put into a
"ultima/mods/modname/data" folder.
Config file for mods can be created with ExultStudio
....this is where my wisdom ends....
----------------------------------------------------------------------------
and this is what I wanted to do:
I decompiled a few functions (conversation functions, because I wanted something that I could change easily to see if it worked) using ucxt:
ucxt -bg -ac -fs -ofile 0415
ucxt -bg -ac -fs -ofile 044A
every call to ucxt created a file named "file", which I renamed to the function number + .uc
I changed the conversation text a little, and tried to recompile using ucc:
ucc 0415.uc Result: 0415.uc:43: parse error
ucc 044A.uc Result: 044A.uc:33: parse error
Then I read in some old form topics that ucc is not compatible with ucxt output.
Now, what I would like to know:
1. How can I edit usecode in exult script format and recompile it?
2. How do I create my custom "usecode" file only containining my own functions, without having to include all 1MB worth of usecode like when using "rip"?
3. Can I replace existing functions by creating my own function using
an already existing function number?
4. What is the difference between wuc and ucc?
5. What else is good to know?
Any help on any of these questions appreciated.