wghost81 Posted March 30, 2015 Author Share Posted March 30, 2015 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 More sharing options...
wghost81 Posted April 3, 2015 Author Share Posted April 3, 2015 Critical update in v.7.2 (UPKUtils package): - fixed bug with some reference labels not generated properly by HexToPseudoCode. - added infinite loop detection in PatchUPK. Those aren't relevant for PatcherGUI users. Link to comment Share on other sites More sharing options...
projectmercy Posted April 3, 2015 Share Posted April 3, 2015 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 More sharing options...
projectmercy Posted April 4, 2015 Share Posted April 4, 2015 Question, I noticed PatcherGUI has a ".pgui" extension in it's file filter; but it doesn't seem to actually work if your patch has that extension. I can run them fine with .txt, but renaming them to .pgui causes a "Patch Error" dialog to pop up. Link to comment Share on other sites More sharing options...
wghost81 Posted April 4, 2015 Author Share Posted April 4, 2015 ".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 More sharing options...
dubiousintent Posted April 4, 2015 Share Posted April 4, 2015 ... 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 More sharing options...
wghost81 Posted April 4, 2015 Author Share Posted April 4, 2015 (edited) dubiousintent, good, thanks. Might be better to move it to "Changing a big part of the script" section, though, after it's finished. Edited April 4, 2015 by wghost81 Link to comment Share on other sites More sharing options...
projectmercy Posted April 5, 2015 Share Posted April 5, 2015 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 More sharing options...
wghost81 Posted April 5, 2015 Author Share Posted April 5, 2015 (edited) 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"; EOSI 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 April 5, 2015 by wghost81 Link to comment Share on other sites More sharing options...
dubiousintent Posted April 6, 2015 Share Posted April 6, 2015 Nice tip. Added to "Hex editing UPK files" article. -Dubious- Link to comment Share on other sites More sharing options...
Recommended Posts