Tiny steps towards implementing C runtime

This commit is contained in:
KeybadeBlox 2026-02-14 12:34:28 -05:00
parent ccd2cd37a5
commit c38d9b5628
6 changed files with 65 additions and 14 deletions

View file

@ -1,10 +1,27 @@
all: src/JSRF/Jet2.obj
# JSRF Decompilation Makefile
# An NMAKE Makefile to compile the game with the Visual C++ 7.0 toolchain
# All object files to link together
OBJ = src/JSRF/Jet2.obj src/JSRF/Core.obj src/JSRF/GameData.obj\
src/XDK/CRT/CRT0.obj
# Linking into an executable; expect this to fail with undefined references
# until we've made at least stubs for everything in the game
#all: src/JSRF/Jet2.exe
#src/JSRF/Jet2.exe: $(OBJ)
# LINK.EXE /NOLOGO /NODEFAULTLIB /MERGE:.CRT=.data /OUT:$@ $**
# For now, just compile all the object files
all: $(OBJ)
# Simple inference rule for producing object files
.SUFFIXES: .cpp .obj
.cpp.obj:
CL.EXE /nologo /Wall /W4 /Ogityb0 /GfX /Fo$@ /c $<
# Header files used for each object
src/JSRF/Jet2.obj: src/JSRF/Core.hpp src/Std.hpp src/XDK/D3D.hpp\
src/XDK/Win32.hpp
@ -13,3 +30,5 @@ src/JSRF/Core.obj: src/JSRF/Core.hpp src/Smilebit/MMatrix.hpp src/Std.hpp\
src/XDK/D3D.hpp src/XDK/Win32.hpp
src/JSRF/GameData.obj: src/JSRF/GameData.hpp
src/XDK/CRT/CRT0.obj: src/XDK/Win32.hpp

View file

@ -14,10 +14,10 @@
"source_path": "src/JSRF/Jet2.cpp"
},
"symbol_mappings": {
"?main_funcinfo@@3UFuncInfo@@A": "$T754",
"?main_handler@@YAXPAUEHExceptionRecord@@PAKPAXPAU_xDISPATCHER_CONTEXT@@@Z": "$L758",
"?main_handler_unwind1@@YAXXZ": "$L750",
"?main_unwindmap@@3PAUUnwindMapEntry@@A": "$T760",
"?main_funcinfo@@3UFuncInfo@@A": "$T745",
"?main_handler@@YAXPAUEHExceptionRecord@@PAKPAXPAU_xDISPATCHER_CONTEXT@@@Z": "$L749",
"?main_handler_unwind1@@YAXXZ": "$L741",
"?main_unwindmap@@3PAUUnwindMapEntry@@A": "$T751",
"[.rdata-0]": "[.xdata$x-0]"
}
},

View file

@ -0,0 +1,32 @@
/* JSRF Decompilation: XDK/CRT0.cpp
C runtime initialization.
Like other CRT code, there's some magic here with symbols that get special
treatment from the compiler and linker.
*/
#include "Win32.hpp"
// Every program is supposed to have a main(), so we can just assume its
// existence with a declaration here
int main();
void __stdcall mainCRTStartup ();
static DWORD _mainXapiStartup(LPVOID lpThreadParameter);
// Address: 0x00148023
// Matching: no
void __stdcall mainCRTStartup() {
/* The true entrypoint of the game, spawning a thread for the rest to run in
The linker automatically sets this function to the entrypoint.
*/
}
// Address: 0x00147FB4
// Matching: no
DWORD _mainXapiStartup(LPVOID const lpThreadParameter) {
/* Runs some initialization and then calls main() */
main();
}

View file

@ -32,10 +32,6 @@ typedef int BOOL;
// 64-bit integer compatibility type
union LARGE_INTEGER {
struct {
DWORD LowPart;
LONG HighPart;
};
struct {
DWORD LowPart;
LONG HighPart;