mirror of
https://codeberg.org/KeybadeBlox/JSRF-Decompilation.git
synced 2026-04-07 13:00:24 +03:00
Delink/begin decompiling entry point
That is, xapi0.obj, which has been renamed from crt0.obj because it appears to be part of the Xbox libraries rather than the C runtime.
This commit is contained in:
parent
9b6c91a12e
commit
9cfd8b5bf3
7 changed files with 103 additions and 41 deletions
|
|
@ -14,10 +14,10 @@
|
||||||
"source_path": "src/JSRF/Jet2.cpp"
|
"source_path": "src/JSRF/Jet2.cpp"
|
||||||
},
|
},
|
||||||
"symbol_mappings": {
|
"symbol_mappings": {
|
||||||
"?main_funcinfo@@3UFuncInfo@@A": "$T745",
|
"?main_funcinfo@@3UFuncInfo@@A": "$T747",
|
||||||
"?main_handler@@YAXPAUEHExceptionRecord@@PAKPAXPAU_xDISPATCHER_CONTEXT@@@Z": "$L749",
|
"?main_handler@@YAXPAUEHExceptionRecord@@PAKPAXPAU_xDISPATCHER_CONTEXT@@@Z": "$L751",
|
||||||
"?main_handler_unwind1@@YAXXZ": "$L741",
|
"?main_handler_unwind1@@YAXXZ": "$L743",
|
||||||
"?main_unwindmap@@3PAUUnwindMapEntry@@A": "$T751",
|
"?main_unwindmap@@3PAUUnwindMapEntry@@A": "$T753",
|
||||||
"[.rdata-0]": "[.xdata$x-0]"
|
"[.rdata-0]": "[.xdata$x-0]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -42,6 +42,15 @@
|
||||||
"?finalizeGameData@@YAXXZ": "_$E2",
|
"?finalizeGameData@@YAXXZ": "_$E2",
|
||||||
"?initGameData@@YAXXZ": "_$E1"
|
"?initGameData@@YAXXZ": "_$E1"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "XDK/Xapi/xapi0",
|
||||||
|
"target_path": "target/XDK/Xapi/xapi0.obj",
|
||||||
|
"base_path": "src/XDK/Xapi/xapi0.obj",
|
||||||
|
"metadata": {
|
||||||
|
"complete": false,
|
||||||
|
"source_path": "src/XDK/Xapi/xapi0.c"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/* JSRF Decompilation: XDK/CRT0.c
|
|
||||||
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.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Every program is supposed to have a main(), so we can just assume its
|
|
||||||
// existence with a declaration here
|
|
||||||
int main(void);
|
|
||||||
|
|
||||||
|
|
||||||
void __cdecl mainCRTStartup (void);
|
|
||||||
DWORD __stdcall mainXapiStartup(LPVOID lpThreadParameter);
|
|
||||||
|
|
||||||
|
|
||||||
// Address: 0x00148023
|
|
||||||
// Status: unimplemented
|
|
||||||
void __cdecl 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.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// Address: 0x00147FB4
|
|
||||||
// Status: unimplemented
|
|
||||||
DWORD __stdcall mainXapiStartup(LPVOID const lpThreadParameter) {
|
|
||||||
/* Runs some initialization and then calls main() */
|
|
||||||
main();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -25,7 +25,7 @@ typedef __int64 LONGLONG;
|
||||||
|
|
||||||
typedef unsigned char BYTE;
|
typedef unsigned char BYTE;
|
||||||
typedef unsigned short WORD;
|
typedef unsigned short WORD;
|
||||||
typedef unsigned long DWORD;
|
typedef unsigned long DWORD, * PDWORD;
|
||||||
|
|
||||||
typedef void VOID;
|
typedef void VOID;
|
||||||
typedef void * LPVOID;
|
typedef void * LPVOID;
|
||||||
|
|
@ -45,6 +45,8 @@ union LARGE_INTEGER {
|
||||||
LONGLONG QuadPart;
|
LONGLONG QuadPart;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef void * HANDLE;
|
||||||
|
|
||||||
// Return codes
|
// Return codes
|
||||||
typedef long HRESULT;
|
typedef long HRESULT;
|
||||||
|
|
||||||
|
|
|
||||||
83
decompile/src/XDK/Xapi/xapi0.c
Normal file
83
decompile/src/XDK/Xapi/xapi0.c
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
/* JSRF Decompilation: XDK/Xapi/xapi0.c
|
||||||
|
Entrypoint for Xbox programs.
|
||||||
|
Awkwardly, the placement in the .xbe suggests this is not part of the C runtime
|
||||||
|
(which is normally what provides mainCRTStartup()), but rather part of Xapi.
|
||||||
|
It's been named xapi0 in analogy to crt0 in a C runtime.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../CRT/stddef.h"
|
||||||
|
#include "../Win32.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Things that should get declared in a header somewhere
|
||||||
|
#define XLD_LAUNCH_DASHBOARD_ERROR 1
|
||||||
|
#define XLD_ERROR_INVALID_XBE 1
|
||||||
|
|
||||||
|
extern struct IMAGE_TLS_DIRECTORY {
|
||||||
|
DWORD StartAddressOfRawData;
|
||||||
|
DWORD EndAddressOfRawData;
|
||||||
|
DWORD * AddressOfIndex;
|
||||||
|
void * AddressOfCallbacks;
|
||||||
|
DWORD SizeOfZeroFill;
|
||||||
|
DWORD Characteristics;
|
||||||
|
} _tls_used;
|
||||||
|
|
||||||
|
extern int XapiTlsSize;
|
||||||
|
|
||||||
|
DWORD __stdcall mainXapiStartup(LPVOID lpThreadParameter);
|
||||||
|
BOOL __stdcall CloseHandle (HANDLE hHandle );
|
||||||
|
|
||||||
|
typedef DWORD (__stdcall * LPTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
|
||||||
|
HANDLE __stdcall CreateThread(
|
||||||
|
void * lpThreadAttributes,
|
||||||
|
DWORD dwStackSize,
|
||||||
|
LPTHREAD_START_ROUTINE lpStartAddress,
|
||||||
|
LPVOID lpParameter,
|
||||||
|
DWORD dwCreationFlags,
|
||||||
|
PDWORD lpThreadId
|
||||||
|
);
|
||||||
|
|
||||||
|
void __stdcall XapiBootToDash(
|
||||||
|
DWORD dwReason,
|
||||||
|
DWORD dwParameter1,
|
||||||
|
DWORD dwParameter2
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Every program is supposed to have a main(), so we can just assume its
|
||||||
|
// existence with a declaration here
|
||||||
|
int main(void);
|
||||||
|
|
||||||
|
|
||||||
|
// Address: 0x00147FB4
|
||||||
|
// Status: unimplemented
|
||||||
|
DWORD __stdcall mainXapiStartup(LPVOID lpThreadParameter) {
|
||||||
|
/* Runs some Xbox-specific initialization and then calls main() */
|
||||||
|
main();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Address: 0x00148023
|
||||||
|
// Status: nonmatching
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
HANDLE thread;
|
||||||
|
|
||||||
|
// Figure out available thread-local storage
|
||||||
|
XapiTlsSize = (
|
||||||
|
(_tls_used.EndAddressOfRawData - _tls_used.StartAddressOfRawData) +
|
||||||
|
_tls_used.SizeOfZeroFill
|
||||||
|
) + 15 & 0xFFFFFFF0; // Round up to nearest 0x10
|
||||||
|
*_tls_used.AddressOfIndex = XapiTlsSize / (-4);
|
||||||
|
|
||||||
|
// Launch program as a thread
|
||||||
|
thread = CreateThread(NULL, 0, mainXapiStartup, NULL, 0, NULL);
|
||||||
|
|
||||||
|
// Boot back to dashboard with an error message if launching failed
|
||||||
|
if (thread == NULL)
|
||||||
|
XapiBootToDash(XLD_LAUNCH_DASHBOARD_ERROR, XLD_ERROR_INVALID_XBE, 0);
|
||||||
|
|
||||||
|
CloseHandle(thread);
|
||||||
|
}
|
||||||
0
decompile/target/XDK/CRT/.gitkeep
Normal file
0
decompile/target/XDK/CRT/.gitkeep
Normal file
0
decompile/target/XDK/Xapi/.gitkeep
Normal file
0
decompile/target/XDK/Xapi/.gitkeep
Normal file
|
|
@ -3,13 +3,14 @@ JSRF/Core.obj,true,0x00011000-0x00013FEB,,,0x00186BA0-0x00186C14,,,,,,0x001C4390
|
||||||
JSRF/GameData.obj,true,0x00039B50-0x0003B937,0x0018AD60-0x0018AD75,0x0018C9A0-0x0018C9AA,,,,,,,0x001CA16C-0x001CA3DB,,0x001EB790-0x001EB793,0x001EFC88-0x001F7047,
|
JSRF/GameData.obj,true,0x00039B50-0x0003B937,0x0018AD60-0x0018AD75,0x0018C9A0-0x0018C9AA,,,,,,,0x001CA16C-0x001CA3DB,,0x001EB790-0x001EB793,0x001EFC88-0x001F7047,
|
||||||
JSRF/Jet2.obj,true,0x0006F9E0-0x0006FA6F,,,0x00187710-0x00187724,,,,,,,0x001E620C-0x001E622F,,0x0022FCE0-0x0022FCE3,
|
JSRF/Jet2.obj,true,0x0006F9E0-0x0006FA6F,,,0x00187710-0x00187724,,,,,,,0x001E620C-0x001E622F,,0x0022FCE0-0x0022FCE3,
|
||||||
ADX (need to decompose),false,0x0013A570-0x0014555F,?,?,?,?,,,,,,?,?,?,
|
ADX (need to decompose),false,0x0013A570-0x0014555F,?,?,?,?,,,,,,?,?,?,
|
||||||
XDK Core (need to decompose),false,0x00145560-0x0014B79F,?,?,?,?,,,,,,?,?,?,
|
Xapi (need to decompose),false,0x00145560-0x0014B79F,?,?,?,?,,,,,,?,?,?,
|
||||||
|
XDK/Xapi/xapi0.obj,true,0x00147FB4-0x0014807C,,,,,,,,,,,,,
|
||||||
Smilebit libs (need to decompose),false,0x0014B7A0-0x0017BF3F,?,?,?,?,,,,,,?,?,?-0x0022ED2B,
|
Smilebit libs (need to decompose),false,0x0014B7A0-0x0017BF3F,?,?,?,?,,,,,,?,?,?-0x0022ED2B,
|
||||||
C runtime,false,0x0017BF40-0x00182B80,?,?,?,,,,,?,?,0x0022ED2C-?,?,?,
|
C runtime (need to decompose),false,0x0017BF40-0x00182B80,?,?,?,,,,,?,?,0x0022ED2C-?,?,?,
|
||||||
Unknown MS math lib,false,0x00182B81-0x0018694F,?,?,?,,,,,?,?,?,?,?,
|
Unknown MS math lib,false,0x00182B81-0x0018694F,?,?,?,,,,,?,?,?,?,?,
|
||||||
Another (tiny) Smilebit math lib,false,0x00186950-0x00186B7F,?,?,?,,,,,?,?,?,?,?,
|
Another (tiny) Smilebit math lib,false,0x00186950-0x00186B7F,?,?,?,,,,,?,?,?,?,?,
|
||||||
Direct3D8 (need to decompose),false,,?,,0x0018CB40-0x0019E334,,,,,?,?,?,?,?,
|
Direct3D8 (need to decompose),false,,?,,0x0018CB40-0x0019E334,,,,,?,?,?,?,?,
|
||||||
DirectSound8 (need to decompose),false,,?,?,,,0x0019E340-0x001BA89B,,,,?,?,?,?,0x0027E080-0x00284E17
|
DirectSound8 (need to decompose),false,,?,?,,,0x0019E340-0x001BA89B,,,,?,?,?,?,0x0027E080-0x00284E17
|
||||||
MMatrix.obj,false,,?,,,,0x001BA8A0-0x001BBAAF,,,,,?,?,0x00264BD8-0x00264C13,
|
Smilebit/MMatrix.obj,false,,?,,,,0x001BA8A0-0x001BBAAF,,,,,?,?,0x00264BD8-0x00264C13,
|
||||||
Xgraphics (need to decompose),false,,?,,,,,0x001BBAC0-0x001BC7BB,,,,?,?,,
|
Xgraphics (need to decompose),false,,?,,,,,0x001BBAC0-0x001BC7BB,,,,?,?,,
|
||||||
XDK Peripherals (need to decompose),false,,?,,,,,,0x001BC7C0-0x001C3F57,,,?,?,,
|
XDK Peripherals (need to decompose),false,,?,,,,,,0x001BC7C0-0x001C3F57,,,?,?,,
|
||||||
|
|
|
||||||
|
Loading…
Add table
Add a link
Reference in a new issue