Replies: 4 comments
-
tomsons26
|
Beta Was this translation helpful? Give feedback.
-
Duncanspumpkin
|
Beta Was this translation helpful? Give feedback.
-
In my opinion, best case assembler compare tool, for Thyme, would work like this:
With such tool, it should be straight forward to crawl through the assembler diffs and tick them off, even if there are already some custom code changes in Thyme.
|
Beta Was this translation helpful? Give feedback.
-
I expect the most critical parts are:
Once we have these core mechanisms, the rest should be straight forward to build around. 1 Properly locate matching function begin and end in both Thyme DLL and game.datFor game.dat we either need a function pdb or custom function to address lookup table. This needs to be just generated once and is expected to be correct and complete. For Thyme we simply need the EXE or DLL and its pdb. We can enumerate symbols with dbghelp's SymEnumSymbols function: 2 Properly match the Thyme DLL assembler with the Thyme source codeWe can locate source files and line of address with dbghelp's SymGetLineFromAddr function: It also possible to walk adjacent source lines with SymGetLineNext, SymGetLinePrev: 3 Void/Normalize all addresses and offsets in both Thyme DLL and game.datWe need to make sure that all relative addresses are normalized to same bases, or void them for comparisons. According to tomsons26, point 3 is covered with 4 Functionality to walk x86 assembler instructionsThere is x86 reference. To walk assembler instructions, we need x86 assembler parser, that has knowledge of opcodes and their respective operand counts and operand sizes. When this info is available, we can walk from one instruction to another and compare one by one and get accurate records of which instruction(s) differ. tomsons26 has linked to following projects achieving that: I expect that we can take disasm code from ollydbg project as a basis. It has full knowledge of x86 assembler. |
Beta Was this translation helpful? Give feedback.
-
The overall game code complexity is quite large. This is problematic for keeping error counts in check when reimplementing original game functions and classes. I wonder how feasible it would be to automate this a bit. Assuming we would compile Thyme with the same compiler and compile flags EA Games used for it, then we should get the same assembler output, minus the static addresses. Maybe we could have a system that compares Thyme and hooked function assembly on initialization and assert if the function contents don't match. This way it would be easier to catch deviances. Ideally such functionality can be toggled on and off for individual functions. And ideally it is used on as many functions as possible to validate correctness. Such approach would strengthen confidence in correctness of Thyme. For best results, all custom Thyme code in game functions would have to be compiled out.
Beta Was this translation helpful? Give feedback.
All reactions