Drakous79 Posted December 29, 2012 Share Posted December 29, 2012 H = header size in hex. 0x30FJ = offset to which it should jump to in file in hex. e.g: 0x59 in the above exampleI = number of Index objects read.DWORD = 4 bytesO = offset for jump We see four bytes on the script but the loader adds 4 more essentially making it 64 bits rather than 32.FJ - H + (I * DWORD) = OWonderful! It is strange 35 jump in CanFacilityBeBuilt is not DWORD aligned. Dec 53 / 4 = 13,25. Or is my math wrong? You will also note that if you ever need to use something like DynamicArrayAddItemToken where for example you wish to add a value to an array: 55 01 C7 16 00 00 03 00 2C 06 16 Which adds an int constant value of 6 to the array at index 16c7 and the 3 is the number of btyes to the end of the expression If the value is another index you must add the 4 bytes again. e.g: 55 01 C7 16 00 00 0A 00 01 C4 16 00 00 16. One would expect the 0A to be a 6 as the end is 6 bytes away. But the loader expands the index to 8 bytes! So we need to tell it to read 10 bytes! Any way in my jump for the loop the address is 16 bytes out! That is four i's. With the formula. 0x5B - 0x30 + (4 * 4) = 3B I have 3F... if I put 3B the code does not decompile correctly... It seems there is 5 indexs?Great find, but still it's really crazy. Saw something similar in logical comparisons, where is 18 xx 00 between conditions.// !m_bIsIronman 18 0D 00 81 2D 01 41 20 00 00 16 16 // length 0D ... Dec 13 - 4 = 9 to the end // kMPGRI == none 18 0D 00 72 00 82 20 00 00 2A 16 16 // length 0D ... Dec 13 - 4 = 9 to the end // iItem == 135 18 0E 00 9A 00 DA 35 00 00 2C 87 16 16 // 0E ... Dec 14 - 4 = 10 to the end Indexes are hard to figure out. If I look at CanBeSold and 8C jump, I see 6 possible index calls. And another 3 before the conditional: local TItem kItem; kItem = Item(iItem); // End:0x8c if(kItem.iCategory == 1 || kItem.iCategory == 2 || kItem.iCategory == 3)8C length (FJ = 90) is 60 leaving me with 2C for 11 indexes. So I am 2 indexes short (6 + 3). It could be local TItem kItem; but I don't see this defined in the bytecode. Checking kItem.iCategory in UE Explorer, I see 3 index calls, what makes it 9 indexes for the conditional and 3 before it ... 12 indexes! I would be 1 index over 2C! Maybe there are indexes and indexes? Got some info from EliotVU, when I asked about kTarget.m_bInDenseSmoke, but it is different construction, 19 Context instead of 35 Struct. 1A 7D 00 00 is kTarget and F7 30 00 00 is m_bInDenseSmoke. kItem.iCategory is 35 B9 02 00 00 C8 02 00 00 00 00 00 D8 35 00 00. 19 00 1A 7D 00 00 0A 00 F7 30 00 00 00 2D 01 F7 30 00 00 ... kTarget.m_bInDenseSmoke19 = ContextToken00 = LocalVariable1A 7D 00 00 = objectIndex(8bytes)0A 00 = skipSizeF7 30 00 00 = propertyIndex(8bytes)00 = propertyType2D = BoolToken01 = InstanceTokenF7 30 00 00 = objectIndex(8bytes)Note propertyIndex and objectIndex. There are no objects within an object, just a sequence of thousands of objects throughout the whole package, each table item describes where each object is located in the package, the table will also mention its class so it’s possible to determine what kind of data it’s pointing at, where I then can determine what objects are “within” the object, which is done by object indexes, in fact those indexes poin to the table item rather than the actual object, but well UE Explorer figures this out automatically. Btw I'm glad you got it working :) Have you fixed dllimport by correcting script's size (number of index calls) in the header? Link to comment Share on other sites More sharing options...
twinj Posted December 29, 2012 Author Share Posted December 29, 2012 Yeah I fixed it I posted it up on Squad sizes which you have already seen. It also seems like you may be counting jumps wrong. No need to count lengths. Just find the position in the file to jump to. Then from that - the header size and plus all the bytes from all index reads up to that point. I am finding it much easier now with that. Also you can use UE Explorer Token view to find the exact locations if your code is compilable. Link to comment Share on other sites More sharing options...
Drakous79 Posted December 29, 2012 Share Posted December 29, 2012 Aye, it is easier as you say. Lengths help me to understand number of index reads. Link to comment Share on other sites More sharing options...
Recommended Posts