Jump to content

UPK Utils


wghost81

Recommended Posts

Yes, you're right. But pure locale independent ASCII is 7-bit 128 characters set. I specifically restricted all the mod files to use locale independent ASCII symbols only, as those are the same in all code tables. I can remove this check, but it will potentially lead to people using unicode and/or locale-specific characters in text strings and this can cause the game to CTD, as unicode strings are handled differently in UE and XCOM is not using unicode in upk files.

 

Using m_strCreditsPrefix is better anyway, as it was already defined as localized string. You can find usage examples by using "Search in classes" UEE feature:

 

class'XGScreenMgr'.default.m_strCreditsPrefix $ strAmount
Link to comment
Share on other sites

  • Replies 235
  • Created
  • Last Reply

Top Posters In This Topic

I realize I could totally test this and find out on my own, but I'm a lazy lazy man :(

 

If using BEFORE/AFTER _ CODE do jump offsets get updated in the rest of the function not in the code you're updating?

 

Example, let's say the original function was

 

 

bAwesome = true;

if (bAwesome)

{

iGift = cPony;

}

else

{

iGift = cLumpOfCoal;

}

 

return iGift;

 

 

 

And let's say the patch file modified the iGift = cPony line and changed it to 10 lines of various crap. Would the jumps for the rest of the function stay sane, or would you need to basically modify everything from that IF statement down?

 

Thanks,

 

PM

Link to comment
Share on other sites

".pgui" extension is used for batch files.

 

BEFORE/AFTER hex will not update jump offsets for you. And jump labels only work with REPLACEMENT_CODE.

 

You can use HexToPseudoCode decompiler to obtain ready-to-modify code with all the jumps replaced with labels. In this case if you insert a new code inside some jump operator, Patcher will re-calculate and update all the jumps.

Link to comment
Share on other sites

...

 

BEFORE/AFTER hex will not update jump offsets for you. And jump labels only work with REPLACEMENT_CODE.

 

You can use HexToPseudoCode decompiler to obtain ready-to-modify code with all the jumps replaced with labels. In this case if you insert a new code inside some jump operator, Patcher will re-calculate and update all the jumps.

Added this to the note in the "Using modding tools II" sub-section of the "Hex editing UPK files" article. Seem the most appropriate place for it.

 

-Dubious-

Link to comment
Share on other sites

The webpage is cool and all, but I would expect the documentation to be in the txt's included with UPK tools. I'm not even sure there's a link to the web page in that doco.

 

Thank you for the answers. I know I can replace the whole function, it's just that it makes the mod a lot less friendly with other mods, so it would be nice if I could change small chunks instead of the whole thing. Thank you again.

 

PM.

Link to comment
Share on other sites

projectmercy, anything that changes jump offsets makes the mod incompatible with the other mods, which change the same function. If you want to make your mods compatible, plan your modifications so they fit the original memory size. Another trick is to use goto operator to jump out of the current part of the code into another one, execute a big chunk of the new code, and then jump back. If you place your new code in between return and EOS tokens, the rest of the function will look like it wasn't changed. We used this trick a lot with big functions and states with the lot of jumps. Example:

if (something)
{
     do something;
}
else
{
    do something else;
}

This can be changed into:

if (something)
{
     goto new code;
     filler code to fit memory and size;
     "jump back here"
}
else
{
    do something else;
}
...
return something;
new code with lots of things;
goto "jump back here";
EOS

I certainly can include links and\or copies of wiki articles into UPKUtils. The thing is, it's not UPKUtils specific, but rather general information on handling bytecode. People were modding XCOM long before PatcherGUI, myself included. :smile: Those articles were created by the others and helped me a lot. And now I'm trying to give back to the community by updating them.

Edited by wghost81
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...