Decompile mainCRTStartup()

Incidental changes include fixes for Xapi in the Makefille and
objdiff.json, as well as new compiler flags for Xapi.
This commit is contained in:
KeybadeBlox 2026-02-22 10:41:15 -05:00
parent cbd63865e2
commit 4e20347b7c
4 changed files with 13 additions and 11 deletions

View file

@ -3,7 +3,7 @@
# All object files to link together # All object files to link together
OBJ = src/JSRF/Jet2.obj src/JSRF/Core.obj src/JSRF/GameData.obj\ OBJ = src/JSRF/Jet2.obj src/JSRF/Core.obj src/JSRF/GameData.obj\
src/XDK/CRT/CRT0.obj src/XDK/Xapi/xapi0.obj
# Import library for the only thing we don't compile ourselves, the Xbox kernel # Import library for the only thing we don't compile ourselves, the Xbox kernel
LIB = lib/xboxkrnl.lib LIB = lib/xboxkrnl.lib
@ -14,7 +14,7 @@ all: $(OBJ) # For now, just compile all the object files
## Build commands ## Build commands
.SUFFIXES: .cpp .obj .def .lib .exe.xbe .SUFFIXES: .c .cpp .obj .def .lib .exe.xbe
# Convert compiled executable into a working Xbox executable # Convert compiled executable into a working Xbox executable
# (TODO: we may want to fork cxbe to add section checksums and the game ID) # (TODO: we may want to fork cxbe to add section checksums and the game ID)
@ -32,7 +32,7 @@ src/JSRF/Jet2.exe: $(OBJ) $(LIB)
# Compile object files from source # Compile object files from source
.c.obj: .c.obj:
CL.EXE /nologo /Wall /W4 /Ogityb0 /GfX /Fo$@ /c $< CL.EXE /nologo /Wall /W4 /O1giy /Fo$@ /c $<
.cpp.obj: .cpp.obj:
CL.EXE /nologo /Wall /W4 /Ogityb0 /GfX /Fo$@ /c $< CL.EXE /nologo /Wall /W4 /Ogityb0 /GfX /Fo$@ /c $<
@ -46,4 +46,4 @@ src/JSRF/Core.obj: src/JSRF/Core.hpp src/MUSASHI/MMatrix.hpp\
src/JSRF/GameData.obj: src/JSRF/GameData.hpp src/JSRF/GameData.obj: src/JSRF/GameData.hpp
src/XDK/CRT/CRT0.obj: src/XDK/Win32.h src/XDK/Xapi/xapi0.obj: src/XDK/Win32.h

View file

@ -1,6 +1,8 @@
{ {
"custom_make": "NMAKE.EXE", "custom_make": "NMAKE.EXE",
"watch_patterns": [ "watch_patterns": [
"*.c",
"*.h",
"*.cpp", "*.cpp",
"*.hpp" "*.hpp"
], ],
@ -53,4 +55,4 @@
} }
} }
] ]
} }

View file

@ -58,7 +58,7 @@ DWORD __stdcall mainXapiStartup(LPVOID lpThreadParameter) {
} }
// Address: 0x00148023 // Address: 0x00148023
// Status: nonmatching // Status: matching
void mainCRTStartup(void) { void mainCRTStartup(void) {
/* The true entrypoint of the game, spawning a thread for the rest to run in /* The true entrypoint of the game, spawning a thread for the rest to run in
The linker automatically sets this function to the entrypoint. The linker automatically sets this function to the entrypoint.
@ -66,11 +66,11 @@ The linker automatically sets this function to the entrypoint.
HANDLE thread; HANDLE thread;
// Figure out available thread-local storage // Figure out available thread-local storage
XapiTlsSize = ( XapiTlsSize = 4 + ((
(_tls_used.EndAddressOfRawData - _tls_used.StartAddressOfRawData) + (_tls_used.EndAddressOfRawData - _tls_used.StartAddressOfRawData) +
_tls_used.SizeOfZeroFill _tls_used.SizeOfZeroFill
) + 15 & 0xFFFFFFF0; // Round up to nearest 0x10 ) + 15 & 0xFFFFFFF0); // Round up to nearest 0x10
*_tls_used.AddressOfIndex = XapiTlsSize / (-4); *_tls_used.AddressOfIndex = -1 * XapiTlsSize/4;
// Launch program as a thread // Launch program as a thread
thread = CreateThread(NULL, 0, mainXapiStartup, NULL, 0, NULL); thread = CreateThread(NULL, 0, mainXapiStartup, NULL, 0, NULL);

View file

@ -3,8 +3,8 @@ A matching decompilation of the Xbox game Jet Set Radio Future.
## Progress ## Progress
- Delinking progress: 1.03% (26559 out of 2574172 bytes in XBE address space) - Delinking progress: 1.03% (26559 out of 2574172 bytes in XBE address space)
- Decompilation progress: 18.5% (31 out of the 168 functions delinked so far) - Decompilation progress: 19.0% (32 out of the 168 functions delinked so far)
- **Estimated total progress: 0.19%** (previous two multiplied together) - **Estimated total progress: 0.20%** (previous two multiplied together)
## Roadmap ## Roadmap
The approach of this decompilation is to: The approach of this decompilation is to: