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

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