XenonRecomp icon indicating copy to clipboard operation
XenonRecomp copied to clipboard

Can't generate toml file for Spider-man Edge of Time

Open Organizationguy opened this issue 8 months ago • 11 comments

Ive been trying to see if SMEOT generates anything but Im getting inconsistent failures, as in there been one instant where it creaes a blank toml but all others have just done nothing. This is the log from my latest attempt, what am I missing?

Microsoft Windows [Version 10.0.19045.5608] (c) Microsoft Corporation. All rights reserved.

C:\Users\Nevan>cd C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse

C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse> XenonAnalyse Usage: XenonAnalyse [input XEX file path] [output jump table TOML file path] C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse> XenonAnalyse ["C:\Users\Nevan\Desktop\Spider-Man Edge of Time\Default.xex"] ["C:\Users\Nevan\Desktop\Spider-Man Edge of Time"]

C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse>

Organizationguy avatar Mar 30 '25 22:03 Organizationguy

Ive been trying to see if SMEOT generates anything but Im getting inconsistent failures, as in there been one instant where it creaes a blank toml but all others have just done nothing. This is the log from my latest attempt, what am I missing?

Microsoft Windows [Version 10.0.19045.5608] (c) Microsoft Corporation. All rights reserved.

C:\Users\Nevan>cd C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse

C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse> XenonAnalyse Usage: XenonAnalyse [input XEX file path] [output jump table TOML file path] C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse> XenonAnalyse ["C:\Users\Nevan\Desktop\Spider-Man Edge of Time\Default.xex"] ["C:\Users\Nevan\Desktop\Spider-Man Edge of Time"]

C:\Users\Nevan\source\repos\XenonRecomp\out\build\x64-Clang-Debug\XenonAnalyse>

there can be 2 problems, first, your paths are wrong written or XenonAnalyse are unable to read properly the base address from the game and it won't generate the toml, so i'm gonna give you my setup to make it to work properly.

1.-try using XenonAnalyse "C:\Users\Nevan\Desktop\Spider-Man Edge of Time\Default.xex" "C:\Users\Nevan\Desktop\Spider-Man Edge of Time" , do not use the square brackets., maybe you can have some problems for using spaces in the path so you will need to change the folder name to Spider-Man-Edge-of-Time

if the problem persists

2.-try editing the xex.cpp file from XenonUtils like this (only add the red dotted lines of code, watch out because there are 2 lines of code that already exist, these are the contents of the conditionals)

Image

this is how it works for me (i already added the lines of code to my xex.cpp file

Image

the content inside the toml

Image

ENEMY345 avatar Mar 31 '25 06:03 ENEMY345

I couldnt get the first method to work so Ill try the ccp, but what did you use to edit it?

Organizationguy avatar Mar 31 '25 13:03 Organizationguy

I was able to change the cpp and rebuild the project but it doesnt give a toml file.

Organizationguy avatar Mar 31 '25 14:03 Organizationguy

you need to use idapro or ghidra to identify a pattern of the jump tables and modify the XenonAnalyse\main.cpp file so that it fits the logic of your game

Image

Image

derlineUn avatar Mar 31 '25 15:03 derlineUn

I couldnt get the first method to work so Ill try the ccp, but what did you use to edit it?

1.- you need to find the way to get the toml file at least with an empty toml from xenonanalyse (i use visual studio and remember to use clang to debug the project)

Image

2.- if the toml file says "# Generated by XenonAnalyse ---- ABSOLUTE JUMPTABLE ---- ---- COMPUTED JUMPTABLE ---- ---- OFFSETED JUMPTABLE ---- ", probably you will need to find the pattern of the jump tables as @derlineUn says

ENEMY345 avatar Mar 31 '25 16:03 ENEMY345

you need to use idapro or ghidra to identify a pattern of the jump tables and modify the XenonAnalyse\main.cpp file so that it fits the logic of your game

Image

Image

Can you please clarify where I look for the jump tables pattern.

Organizationguy avatar Mar 31 '25 17:03 Organizationguy

at the bottom of the main.cpp file there are some patterns that you can use as a starting point to look for the pattern in your game. You need to use a disassembler to search for the instructions, a free option is ghidra, just search for ".xex plugin for ghidra" and install it, although it is good for beginners, ghidra is very difficult to use, I strongly recommend you use IDA Pro.

derlineUn avatar Mar 31 '25 18:03 derlineUn

Im looking around there, what should I be considering?

Organizationguy avatar Mar 31 '25 19:03 Organizationguy

Im looking around there, what should I be considering?

if you are using Ghidra and the xex plugin you need to search for patterns that appear in the bottom of the main.cpp file in the folder of xenon analyse, and you will need to change the pattern in that file it looks like this

Image this is a quick example from battlefield 2 modern combat

Image As you can see battlefield has that pattern, you can find them quickly in Ghidra by searching for bctr and filtering the results for namespace you will see a text that say switchD label or switchD_some numbers

Image

ENEMY345 avatar Mar 31 '25 21:03 ENEMY345

OK, Ive started going through those now, but how do you know which switch is which, or if it even corresponds to the switch, or if say addi and rlwinm switch places or they contain different terms like subi?

Organizationguy avatar Mar 31 '25 23:03 Organizationguy

Hi. Ive been able to generate the absolute table now but not the others. Im also not sure how to integrate the other terms used into the main.cpp. I assessed and grouped the locations based on the instructions at those locations, but how do you suggest I proceed?

This is what Ive done:

lis, rlwinm, subi, lhzx, lis, addi, ori, add, mtspr, bctr 82375cc4 82296d9c 82293934

lis, rlwinm, addi, lhzx, lis, addi, ori, add, mtspr, bctr 82282774 82345298 823437c8 82245d98

bgt, lis, subi, lbzx, rlwinm, lis, ori, subi, add, mtspr, bctr 8236906c

bgt, lis, addi, lbzx, rlwinm, lis, ori, subi, add, mtspr, bctr 8235de94 82248360 8222e8c4

bgt, lis, rlwinm, addi, lhzx, lis, subi, ori, add, mtspr, bctr 8234abd0

bgt, lis, addi, lbzx, rlwinm, lis, ori, addi, add, mtspr, bctr 82344460

bgtlr, lis, addi, lbzx, rlwinm, lis, ori, subi, add, mtspr, bctr 82339f98

lis, rlwinm, subi, lwzx, mtspr, bctr 8231c5c8 821bec04 821bea8c 821abf10 8217f850 8216eba0 8211ea08 8208f99c 8230c728

Absolute Table lis, rlwinm, addi, lwzx, mtspr, bctr 82315c70 822f74c4 822f0ce0 822f0708 822c7690 82274270 82272060 821da0dc 821c21d0 821c12a8 821c0e58 821c0b64 821c0aa8 821c0a10 821b27f8 821b1ff4 82180e8c 82180784 82176994 82116124

Organizationguy avatar Apr 01 '25 22:04 Organizationguy

From what I have seen with games like Minecraft, Edge of Time, and TASM1, it seems like you will need to adjust the search pattern like @derlineUn mentioned. This is most common in games mader after 2010. ideally, you should for XenonRecomp, replace the main.cpp in XenonAnalyse with this one here:

main.cpp

And run the analysis tool. Then you will generate your jump tables 🙂

Grien25 avatar Sep 05 '25 00:09 Grien25

I was able to get all tables bare a few to work using derlineUns method but I had to give up I just dont have the technical ability to go further unfortunatley

Organizationguy avatar Sep 07 '25 13:09 Organizationguy