Acid81 Posted September 18, 2013 Share Posted September 18, 2013 If i had to rewright a function that has or uses jump tokens how would they be determend ? Link to comment Share on other sites More sharing options...
Amineri Posted September 18, 2013 Share Posted September 18, 2013 Zybertryx wrote up a pretty good tutorial about how to re-compute jump offsets : http://forums.nexusmods.com/index.php?/topic/1038192-rewriting-hidden-potential-tutorial/ I'm not sure if it ever got turned into a wiki article, so I'm just linking to the original forum post. Link to comment Share on other sites More sharing options...
dubiousintent Posted September 19, 2013 Share Posted September 19, 2013 (edited) While we do have a section on re-writing functions in the Wiki article 'Hex editing UPK files', and discuss jumps and go-tos, that tutorial hasn't made it in. (I'll work on that next month when I get home.) The article instead suggests using the 'XCom jump offset mod assistant' to work them out. -Dubious- Edited September 19, 2013 by dubiousintent Link to comment Share on other sites More sharing options...
Bertilsson Posted September 19, 2013 Share Posted September 19, 2013 Just as a little side-note I have planed to make a complete rewrite of the Jump offset mod assistant for quite some time. The current version is built on comparing new and old code, more or less qualified assumptions and is generally not very user friendly at all. The new tool will be more of a validating and repairing nature which will not require any original byte code or original view tokens data.It will also most likely present the finished object code with drop downs inside it to allow for very simple and intuitive selection of jump offsets. Not sure when I will get around to implementing it, but hopefully before Enemy within arrives as I expect that there will be A LOT of rewrite needed for the existing mods by then. Link to comment Share on other sites More sharing options...
Acid81 Posted September 22, 2013 Author Share Posted September 22, 2013 Ok, Iv recently changed one very small factore of the XComGame.upk by hexing. Iv looked over everything and taken screenshot comparisions of the original unchanged XGUnit function and cant find anything wrong. UE is able to load it and read it without any probloms but what i was concerned about is that it says at the very top of the function, protected dllimport final k2override invariant latent simulated exec event () What does this mean ? Link to comment Share on other sites More sharing options...
Acid81 Posted September 23, 2013 Author Share Posted September 23, 2013 Is there any way i could check for syntax errors ? Iv made changes to a function and the game cant read it. I have no idea whats wrong. Link to comment Share on other sites More sharing options...
johnnylump Posted September 23, 2013 Share Posted September 23, 2013 You could have done any number of things wrong; you'll really need to be more specific for both of your previous posts and walk us through what you've done, including posting UExplorer's output. Tokens view is particularly helpful. UE will sometimes decompile things and display them so they appear correct, but they're actually wrong and the game won't work properly. Link to comment Share on other sites More sharing options...
Acid81 Posted September 23, 2013 Author Share Posted September 23, 2013 (edited) Ok, What i was wanting to try is changing the number of rockets you startout with in the XGUnit.UpdateItemCharges, i'll post the code Heres what i have looks like function UpdateItemCharges() { // End:0xB6 if(GetCharacter().HasUpgrade(48)) { SetMediKitCharges(GetInventory().GetNumItems(76) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.3); } // End:0xE2 else { SetMediKitCharges(GetInventory().GetNumItems(76)); } // End:0x116 if(GetCharacter().HasUpgrade(93)) { SetRockets(3); } // End:0x122 else { SetRockets(2); } // End:0x152 if(GetCharacter().HasUpgrade(22)) { SetShredderRockets(1); } // End:0x2D2 if(GetCharacter().HasUpgrade(44)) { // End:0x269 if(GetCharacter().HasUpgrade(92)) { SetSmokeGrenadeCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1 + XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1); } // End:0x2D2 else { SetSmokeGrenadeCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1); } } // End:0x361 if(GetCharacter().HasUpgrade(8)) { SetBattleScannerCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2); } // End:0x4A5 if(GetCharacter().HasUpgrade(24)) { SetFragGrenades(GetInventory().GetNumItems(85) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2); SetAlienGrenades(GetInventory().GetNumItems(88) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2); } // End:0x4FD else { SetFragGrenades(GetInventory().GetNumItems(85)); SetAlienGrenades(GetInventory().GetNumItems(88)); } SetGhostCharges(4); SetArcThrowerCharges(GetInventory().GetNumItems(80) * 2); //return; }Just the lines were the rockets are. Although it looks to be correct the game cant make sense of it. Here it is in code 5D B1 00 00 50 55 00 00 00 00 00 00 48 B1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 25 0C 00 00 E9 89 01 00 57 06 00 00 B7 04 00 00 07 B6 00 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 30 16 1B 4B 62 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 4C 16 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 03 16 16 06 E2 00 1B 4B 62 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 4C 16 16 07 16 01 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 5D 16 1B AC 62 00 00 00 00 00 00 2C 03 16 06 22 01 1B AC 62 00 00 00 00 00 00 2C 02 16 07 52 01 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 16 16 1B C8 62 00 00 00 00 00 00 26 16 07 D2 02 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 2C 16 07 69 02 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 5C 16 1B DA 62 00 00 00 00 00 00 92 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 16 16 06 D2 02 1B DA 62 00 00 00 00 00 00 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 16 07 61 03 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 08 16 1B 63 61 00 00 00 00 00 00 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 02 16 07 A5 04 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 18 16 1B E9 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 55 16 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 02 16 16 1B 40 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 58 16 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 02 16 16 06 FD 04 1B E9 61 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 55 16 16 1B 40 61 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 58 16 16 1B FE 61 00 00 00 00 00 00 2C 04 16 1B 58 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 50 16 2C 02 16 16 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 04 0B 53 Edited September 23, 2013 by Acid81 Link to comment Share on other sites More sharing options...
johnnylump Posted September 24, 2013 Share Posted September 24, 2013 (edited) All right, I think I see it. You didn't update the header with the new virtual size. That will cause the game to crash.The first 48 bytes are the header of the function. Don't touch any of them except the virtual size. 5D B1 00 00 50 55 00 00 00 00 00 00 48 B1 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0025 0C 00 00 E9 89 01 00 57 06 00 00 B7 04 00 00 Every function you add or remove variable references from, and/or use more or less context tokens, changes the function's virtual size. The virtual size is the actual size PLUS some amount. The VS is always the next-to-last four bytes ... in this case 57 06 00 00 --> That's a virtual size of 657. Because you removed those extensive m_kgamecore references and replaced them with constants, your VS decreased significantly. The good news is it's easy to learn your VS. 1) Go to View Tokens for the function.2) Scroll to bottom.3) You'll see a line notation for EOS (end of script, the "53" in the code), like this (from the vanilla version of this function): (656/4B6) [53] EOS(1/1) The virtual size is the first number (in hex!) plus one. So the virtual size of this function is 657. Figure out your new EOS position and fix the header, and then you've solved that problem, at least. If you add references to a function, your VS will get bigger, and UE won't tell you the new one because the EOS line will disappear in tokens view. You have to change the VS to something larger than the EOS position (ff ff should always work), and then you'll see where it is, and lower your VS again. Edited September 24, 2013 by johnnylump Link to comment Share on other sites More sharing options...
Acid81 Posted September 27, 2013 Author Share Posted September 27, 2013 That did the trick. This was very informative, thank you. Link to comment Share on other sites More sharing options...
Recommended Posts