zyllos Posted November 16, 2013 Share Posted November 16, 2013 The answer is the near-magical 0x0B 'null-op' statement. This value does nothing but take up space. It takes 1 file byte and 1 memory byte. Sweet. Thanks. Link to comment Share on other sites More sharing options...
zyllos Posted November 16, 2013 Share Posted November 16, 2013 (edited) Ok, I have failed my first attempt at editing a function. I edited the XGFacility_Hanger.DetermineInterceptorStatus to just assign the m_iStatus and m_iHoursDown as straight up values (basically making the interceptor down indefinitely because the call will keep resetting the values). UE Explorer seems to decompile into code that makes sense but I was unsure how to deal with some values with the function. There was a sequence of values, the last 3 words + 3 bytes, I was unsure what to do with but I am going to assume it's needed for the function so I left those alone. The EOS token I added to right before the end of the sequence of values at the end of the function. But the problem is that I was unsure where to put the 0B (None Token) values at, so I placed them all in between the EOS token and the return NONE token. Here is my function call: function DetermineInterceptorStatus(XGShip_Interceptor kInterceptor) { kInterceptor.m_iStatus = 4; kInterceptor.m_iHoursDown = 255; return; } (000/000) [0F 19 00 22 36 00 00 09 00 99 4A 00 00 00 01 99 4A 00 00 2C 04] L(33/21) -> C(30/18) -> LV(9/5) -> IV(9/5) -> ICB(2/2) kInterceptor.m_iStatus = 4 (021/015) [0F 19 00 22 36 00 00 09 00 31 4B 00 00 00 01 31 4B 00 00 2C FF] L(33/21) -> C(30/18) -> LV(9/5) -> IV(9/5) -> ICB(2/2) kInterceptor.m_iHoursDown = 255 (042/02A) [04 0B] R(2/2) -> N(1/1) return (044/02C) [0B] N(1/1) (045/02D) [0B] N(1/1) (046/02E) [0B] N(1/1) (047/02F) [0B] N(1/1) (048/030) [0B] N(1/1) (049/031) [0B] N(1/1) (04A/032) [0B] N(1/1) (04B/033) [0B] N(1/1) (04C/034) [0B] N(1/1) (04D/035) [0B] N(1/1) (04E/036) [0B] N(1/1) (04F/037) [0B] N(1/1) (050/038) [0B] N(1/1) (051/039) [0B] N(1/1) (052/03A) [0B] N(1/1) (053/03B) [0B] N(1/1) (054/03C) [0B] N(1/1) (055/03D) [0B] N(1/1) (056/03E) [0B] N(1/1) (057/03F) [0B] N(1/1) (058/040) [0B] N(1/1) (059/041) [0B] N(1/1) (05A/042) [0B] N(1/1) (05B/043) [0B] N(1/1) (05C/044) [0B] N(1/1) (05D/045) [0B] N(1/1) (05E/046) [0B] N(1/1) (05F/047) [0B] N(1/1) (060/048) [0B] N(1/1) (061/049) [0B] N(1/1) (062/04A) [0B] N(1/1) (063/04B) [0B] N(1/1) (064/04C) [0B] N(1/1) (065/04D) [0B] N(1/1) (066/04E) [0B] N(1/1) (067/04F) [0B] N(1/1) (068/050) [0B] N(1/1) (069/051) [0B] N(1/1) (06A/052) [0B] N(1/1) (06B/053) [0B] N(1/1) (06C/054) [0B] N(1/1) (06D/055) [0B] N(1/1) (06E/056) [0B] N(1/1) (06F/057) [0B] N(1/1) (070/058) [0B] N(1/1) (071/059) [0B] N(1/1) (072/05A) [0B] N(1/1) (073/05B) [0B] N(1/1) (074/05C) [0B] N(1/1) (075/05D) [0B] N(1/1) (076/05E) [0B] N(1/1) (077/05F) [0B] N(1/1) (078/060) [0B] N(1/1) (079/061) [0B] N(1/1) (07A/062) [0B] N(1/1) (07B/063) [0B] N(1/1) (07C/064) [0B] N(1/1) (07D/065) [0B] N(1/1) (07E/066) [0B] N(1/1) (07F/067) [0B] N(1/1) (080/068) [0B] N(1/1) (081/069) [0B] N(1/1) (082/06A) [0B] N(1/1) (083/06B) [0B] N(1/1) (084/06C) [0B] N(1/1) (085/06D) [0B] N(1/1) (086/06E) [0B] N(1/1) (087/06F) [0B] N(1/1) (088/070) [0B] N(1/1) (089/071) [0B] N(1/1) (08A/072) [0B] N(1/1) (08B/073) [0B] N(1/1) (08C/074) [0B] N(1/1) (08D/075) [0B] N(1/1) (08E/076) [0B] N(1/1) (08F/077) [0B] N(1/1) (090/078) [0B] N(1/1) (091/079) [0B] N(1/1) (092/07A) [0B] N(1/1) (093/07B) [0B] N(1/1) (094/07C) [0B] N(1/1) (095/07D) [0B] N(1/1) (096/07E) [0B] N(1/1) (097/07F) [0B] N(1/1) (098/080) [0B] N(1/1) (099/081) [0B] N(1/1) (09A/082) [0B] N(1/1) (09B/083) [0B] N(1/1) (09C/084) [0B] N(1/1) (09D/085) [0B] N(1/1) (09E/086) [0B] N(1/1) (09F/087) [0B] N(1/1) (0A0/088) [0B] N(1/1) (0A1/089) [0B] N(1/1) (0A2/08A) [0B] N(1/1) (0A3/08B) [0B] N(1/1) (0A4/08C) [0B] N(1/1) (0A5/08D) [0B] N(1/1) (0A6/08E) [0B] N(1/1) (0A7/08F) [0B] N(1/1) (0A8/090) [0B] N(1/1) (0A9/091) [0B] N(1/1) (0AA/092) [0B] N(1/1) (0AB/093) [0B] N(1/1) (0AC/094) [0B] N(1/1) (0AD/095) [0B] N(1/1) (0AE/096) [0B] N(1/1) (0AF/097) [0B] N(1/1) (0B0/098) [0B] N(1/1) (0B1/099) [0B] N(1/1) (0B2/09A) [0B] N(1/1) (0B3/09B) [0B] N(1/1) (0B4/09C) [0B] N(1/1) (0B5/09D) [0B] N(1/1) (0B6/09E) [0B] N(1/1) (0B7/09F) [0B] N(1/1) (0B8/0A0) [0B] N(1/1) (0B9/0A1) [0B] N(1/1) (0BA/0A2) [0B] N(1/1) (0BB/0A3) [0B] N(1/1) (0BC/0A4) [0B] N(1/1) (0BD/0A5) [0B] N(1/1) (0BE/0A6) [0B] N(1/1) (0BF/0A7) [0B] N(1/1) (0C0/0A8) [0B] N(1/1) (0C1/0A9) [0B] N(1/1) (0C2/0AA) [0B] N(1/1) (0C3/0AB) [0B] N(1/1) (0C4/0AC) [0B] N(1/1) (0C5/0AD) [0B] N(1/1) (0C6/0AE) [0B] N(1/1) (0C7/0AF) [0B] N(1/1) (0C8/0B0) [0B] N(1/1) (0C9/0B1) [0B] N(1/1) (0CA/0B2) [0B] N(1/1) (0CB/0B3) [0B] N(1/1) (0CC/0B4) [0B] N(1/1) (0CD/0B5) [0B] N(1/1) (0CE/0B6) [0B] N(1/1) (0CF/0B7) [0B] N(1/1) (0D0/0B8) [0B] N(1/1) (0D1/0B9) [0B] N(1/1) (0D2/0BA) [0B] N(1/1) (0D3/0BB) [0B] N(1/1) (0D4/0BC) [0B] N(1/1) (0D5/0BD) [0B] N(1/1) (0D6/0BE) [0B] N(1/1) (0D7/0BF) [0B] N(1/1) (0D8/0C0) [0B] N(1/1) (0D9/0C1) [0B] N(1/1) (0DA/0C2) [0B] N(1/1) (0DB/0C3) [0B] N(1/1) (0DC/0C4) [0B] N(1/1) (0DD/0C5) [0B] N(1/1) (0DE/0C6) [0B] N(1/1) (0DF/0C7) [0B] N(1/1) (0E0/0C8) [0B] N(1/1) (0E1/0C9) [0B] N(1/1) (0E2/0CA) [0B] N(1/1) (0E3/0CB) [0B] N(1/1) (0E4/0CC) [0B] N(1/1) (0E5/0CD) [0B] N(1/1) (0E6/0CE) [0B] N(1/1) (0E7/0CF) [0B] N(1/1) (0E8/0D0) [0B] N(1/1) (0E9/0D1) [0B] N(1/1) (0EA/0D2) [0B] N(1/1) (0EB/0D3) [0B] N(1/1) (0EC/0D4) [0B] N(1/1) (0ED/0D5) [0B] N(1/1) (0EE/0D6) [0B] N(1/1) (0EF/0D7) [0B] N(1/1) (0F0/0D8) [0B] N(1/1) (0F1/0D9) [0B] N(1/1) (0F2/0DA) [0B] N(1/1) (0F3/0DB) [0B] N(1/1) (0F4/0DC) [0B] N(1/1) (0F5/0DD) [0B] N(1/1) (0F6/0DE) [0B] N(1/1) (0F7/0DF) [0B] N(1/1) (0F8/0E0) [0B] N(1/1) (0F9/0E1) [0B] N(1/1) (0FA/0E2) [0B] N(1/1) (0FB/0E3) [0B] N(1/1) (0FC/0E4) [0B] N(1/1) (0FD/0E5) [0B] N(1/1) (0FE/0E6) [0B] N(1/1) (0FF/0E7) [0B] N(1/1) (100/0E8) [0B] N(1/1) (101/0E9) [0B] N(1/1) (102/0EA) [0B] N(1/1) (103/0EB) [0B] N(1/1) (104/0EC) [0B] N(1/1) (105/0ED) [0B] N(1/1) (106/0EE) [0B] N(1/1) (107/0EF) [0B] N(1/1) (108/0F0) [0B] N(1/1) (109/0F1) [0B] N(1/1) (10A/0F2) [0B] N(1/1) (10B/0F3) [0B] N(1/1) (10C/0F4) [0B] N(1/1) (10D/0F5) [0B] N(1/1) (10E/0F6) [0B] N(1/1) (10F/0F7) [0B] N(1/1) (110/0F8) [0B] N(1/1) (111/0F9) [0B] N(1/1) (112/0FA) [0B] N(1/1) (113/0FB) [0B] N(1/1) (114/0FC) [0B] N(1/1) (115/0FD) [0B] N(1/1) (116/0FE) [0B] N(1/1) (117/0FF) [0B] N(1/1) (118/100) [0B] N(1/1) (119/101) [0B] N(1/1) (11A/102) [0B] N(1/1) (11B/103) [0B] N(1/1) (11C/104) [0B] N(1/1) (11D/105) [0B] N(1/1) (11E/106) [0B] N(1/1) (11F/107) [0B] N(1/1) (120/108) [0B] N(1/1) (121/109) [0B] N(1/1) (122/10A) [0B] N(1/1) (123/10B) [0B] N(1/1) (124/10C) [0B] N(1/1) (125/10D) [0B] N(1/1) (126/10E) [0B] N(1/1) (127/10F) [0B] N(1/1) (128/110) [0B] N(1/1) (129/111) [0B] N(1/1) (12A/112) [0B] N(1/1) (12B/113) [53] EOS(1/1) 22 36 00 00 94 25 00 00 00 00 00 00 21 36 00 00 00 00 00 00 00 00 00 00 22 36 00 00 00 00 00 00 04 01 00 00 83 1F 00 00 90 01 00 00 14 01 00 00 0F 19 00 22 36 00 00 09 00 99 4A 00 00 00 01 99 4A 00 00 2C 04 0F 19 00 22 36 00 00 09 00 31 4B 00 00 00 01 31 4B 00 00 2C FF 04 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 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 53 00 00 00 02 00 02 00 03 09 00 00 00 00 00 00 Now, I have not done anything else to to EW, so maybe I need to modify the EXE to get it to read the uncompressed UPK files but I thought I read they no longer check. Not sure where to go from here. Edited November 16, 2013 by zyllos Link to comment Share on other sites More sharing options...
Amineri Posted November 17, 2013 Share Posted November 17, 2013 The code looks correct, and I'm guessing that it's the memory size in the function header that is causing the problem. If this is so then the game will immediately crash when started. Other hex bugs will generally only crash when the code is actually executed. The header is the set of bytes (from your hex): 22 36 00 00 94 25 00 00 00 00 00 00 21 36 00 00 00 00 00 00 00 00 00 00 22 36 00 00 00 00 00 00 04 01 00 00 83 1F 00 00 90 01 00 00 14 01 00 00 The last two 4-byte words are the function's memory size and file size (little-endian), so 0x190 for memory size and 0x114 for file size. File size we can't change so that value never changes. Normally both values are calculated and written to the header by the compiler. However since we are changing the hex and the function's memory size the header value has to be changed. There are a few ways to do this:1) If you know the memory size of all of your hex you can calculate it directly. This usually isn't very practical, time-wise.2) Use UE Explorer's Token View. The EOS (end-of-script) memory/file position is 12B/113. This means that the function size is 12C/114. The 114 corresponds to the 114 in the function header, but the 12C value doesn't match the 190 in the header. This is what is causing the crash. If you change 190 to 12C (i.e. 90 01 00 00 to 2C 01 00 00) then the code likely will run.3) Bertilsson's jump offset tool (http://hem.bredband.net/bertrich/XCOM/JumpRepairTool.htm) will automatically correct the function memory size in the header as well as any of the jump offsets. Handy if you have a bunch of jump offsets to fix too. Link to comment Share on other sites More sharing options...
zyllos Posted November 17, 2013 Share Posted November 17, 2013 The code looks correct, and I'm guessing that it's the memory size in the function header that is causing the problem. If this is so then the game will immediately crash when started. Other hex bugs will generally only crash when the code is actually executed. The header is the set of bytes (from your hex): 22 36 00 00 94 25 00 00 00 00 00 00 21 36 00 00 00 00 00 00 00 00 00 00 22 36 00 00 00 00 00 00 04 01 00 00 83 1F 00 00 90 01 00 00 14 01 00 00 The last two 4-byte words are the function's memory size and file size (little-endian), so 0x190 for memory size and 0x114 for file size. File size we can't change so that value never changes. Normally both values are calculated and written to the header by the compiler. However since we are changing the hex and the function's memory size the header value has to be changed. There are a few ways to do this:1) If you know the memory size of all of your hex you can calculate it directly. This usually isn't very practical, time-wise.2) Use UE Explorer's Token View. The EOS (end-of-script) memory/file position is 12B/113. This means that the function size is 12C/114. The 114 corresponds to the 114 in the function header, but the 12C value doesn't match the 190 in the header. This is what is causing the crash. If you change 190 to 12C (i.e. 90 01 00 00 to 2C 01 00 00) then the code likely will run.3) Bertilsson's jump offset tool (http://hem.bredband.net/bertrich/XCOM/JumpRepairTool.htm) will automatically correct the function memory size in the header as well as any of the jump offsets. Handy if you have a bunch of jump offsets to fix too. Interesting. What I was doing to calculate the function virtual size was by totaling the first number in each (#/#) pair of each token, which ended up being 400 or 0x190. UE Explorer says the first number is Token(Memory Size/...) but apparently this isn't true. So, the function memory size is always just the last (#/#) pair's first number plus the token's memory size? Hmm, looking at the "View Buffer" and the corresponding (#/#) pair, now I see what the problem with what I was doing. Each token shows the memory size alright, but it includes parts of other tokens to make up the entire symbol. Thus, the L (Let) symbol includes the C (Context) symbol and ICB (Int Const Byte) symbol. As such, some of those bytes overlap each other, thus I can't add up each symbol's memory size, but instead I just need to add up each full statement's memory size, or the value presented by UE Explorer. Ok, so here we go... Link to comment Share on other sites More sharing options...
zyllos Posted November 17, 2013 Share Posted November 17, 2013 Well, that did the trick for running the game. But I am not sure if it did anything. Apparently I need to research what that function does. I thought it would be called each time an interceptor is sent out, but that doesn't seem to be the case. How do I go about testing these? I heard that it's been pretty hard to get the console and developer functions available to test these changes so do I just load up the game and start playing? Link to comment Share on other sites More sharing options...
dubiousintent Posted November 17, 2013 Share Posted November 17, 2013 (edited) How do I go about testing these? I heard that it's been pretty hard to get the console and developer functions available to test these changes so do I just load up the game and start playing?See the wiki articles:* Keybind Commands - XCOM:EU 2012;* DefaultCheats.ini - XCOM:EU 2012;* Console Commands - XCOM:EU 2012. Between them you should be able to do anything you used to do on the command console. (And if you can't, let me know what went wrong or just update the articles directly if you figured out a correction.) Edit: The wiki article 'How to enable the XCOM developer shell' has been updated with the info to enable the Shell. The console for EW tweak has not been identified as yet. -Dubious- Edited November 18, 2013 by dubiousintent Link to comment Share on other sites More sharing options...
Bertilsson Posted November 17, 2013 Share Posted November 17, 2013 (edited) @JLI just discovered that there were in fact some code updates in the latest patch for Enemy Unknown. XComGame.upk contains changes to ~40 different functions. Some changes are only default values. The more substantial changes are mostly for, but not limited to AI movement. I'm guessing this adds to the risk that Enemy Unknown will be recompiled whenever Enemy Within is updated. Something in the lines of "Let's add this tiny update to EU while we're at it". Does this affect the plan to repair LW for EU? Edited November 17, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
johnnylump Posted November 17, 2013 Author Share Posted November 17, 2013 Hard to say. It's not difficult -- just time-consuming -- to search & replace for existing code strings. (I don't store absolute offsets, I store hex to search and replace). But if all the variables and jump offsets start changing, and it becomes a massive chore to serve a decreasing player base (who have gone to EW), then at some point it ceases to be worth the trouble. One reason to move slowly on EW, too, until they finish their patch cycle. Link to comment Share on other sites More sharing options...
zyllos Posted November 18, 2013 Share Posted November 18, 2013 (edited) Hard to say. It's not difficult -- just time-consuming -- to search & replace for existing code strings. (I don't store absolute offsets, I store hex to search and replace). But if all the variables and jump offsets start changing, and it becomes a massive chore to serve a decreasing player base (who have gone to EW), then at some point it ceases to be worth the trouble. One reason to move slowly on EW, too, until they finish their patch cycle. I would agree with this also. Man, the amount of work it just took me to do that up there, I couldn't imagine trying to keep all the jump offsets and references straight for both EU and EW with the amount of bytes changed for the Long War mod. Edited November 18, 2013 by zyllos Link to comment Share on other sites More sharing options...
MerchantMan21 Posted November 29, 2013 Share Posted November 29, 2013 Hi there.I wanted to ask something to the creator of this mod.See I'm very much interested in a lot of the features added by Long War, but there are several that I think I wouldn't particularly care for, does the installation of this mod require it to be, I suppose for lack of a better word "whole cloth" is there any way to remove or modify the changes for someone who can't do much more than ini and resource hacking?I suppose alternatively I'd ask whether there is any quick way to emulate the most desirable features of the mod, by themselves. For instance:I very much like the idea of multiple abduction missions per month with 1 abduction site at a time, but I don't particularly care for the "aliens slowly get stronger" aspect. I know it's for balance, which is why I absolutely get that it's in there, but for myself, I think the challenge posed by the other aspects is enough.Another feature I would love to have by itself is the idea of fatigue for soldiers, I essentially already pretend at it, always making sure that I don't redeploy the same soldier over too many missions, but a visible gameplay element would be much more desirable (if only to keep me honest!). Long War seems in itself to be one of the most comprehensive and amazing mods out there, and I plan to try it one way or another, but looking at some of the features I just feel like they take what I already saw as a challenge and put X-Com into the "I will experience physical pain attempting to play this" territory.Another feature I particularly like is the idea of reclaiming lost countries with base raids. Again it just sounds like one fantastic feature after another, but then there is stuff like the extra classes which I don't really care for.To be brief:Is there anyway that some of these features can be broken down into smaller packages so that say I could have these features:- Multiple UFO/Abduction Missions- Soldier Fatigue- Harder UFO Interceptions- Reclaim Countries via Alien Base Without These:- New Classes- Economy Changes- Enemy ResearchAgain, it's not so much that I'm looking for an easier variant or saying that it looks too hard, I can see why the features that are there have been chosen, just that I'm wondering to what extent the mod has to be taken whole as opposed to piecemeal. Link to comment Share on other sites More sharing options...
Recommended Posts