WIP
This commit is contained in:
parent
ae2fb42e87
commit
648d8256ad
|
@ -0,0 +1,30 @@
|
||||||
|
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
|
||||||
|
|
||||||
|
#include <r3/binders/auto.h>
|
||||||
|
#include <gh_global.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
// 0043e1d0
|
||||||
|
/* Allocate error manager system numbers */
|
||||||
|
|
||||||
|
R3ModuleId Erm_fn_ucInitErrMsg(void)
|
||||||
|
|
||||||
|
{
|
||||||
|
R3ModuleId RVar1;
|
||||||
|
tdstLastErrorInfo* pdVar2;
|
||||||
|
int iVar2;
|
||||||
|
|
||||||
|
RVar1 = g_ucErmNbOfModule;
|
||||||
|
if (g_ucErmNbOfModule == R3ModId_unk) {
|
||||||
|
for(size_t i = 0; i < std::size(g_stErmTheLastErrorInfo); i++) {
|
||||||
|
g_stErmTheLastErrorInfo[i].lastErr = 0;
|
||||||
|
g_stErmTheLastErrorInfo[i].ulChannelId = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_ucErmNbOfModule = R3ModuleId(g_ucErmNbOfModule + 1);
|
||||||
|
return RVar1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ undefined FUN_0046ecc0(undefined2 param_1, undefined2 param_2); // 0046ecc0 // F
|
||||||
// 0046f240
|
// 0046f240
|
||||||
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
|
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
|
||||||
|
|
||||||
undefined4 __cdecl FUN_0046f240(short param_1,short param_2,undefined4 *param_3)
|
undefined4 FUN_0046f240(short param_1,short param_2,undefined4 *param_3)
|
||||||
|
|
||||||
{
|
{
|
||||||
uint uVar1;
|
uint uVar1;
|
||||||
|
|
|
@ -13,8 +13,6 @@ undefined FUN_00472150(void); // 00472150 // FUN_00472150
|
||||||
undefined r3_wait_for_dvd(char *param_1, char *param_2,
|
undefined r3_wait_for_dvd(char *param_1, char *param_2,
|
||||||
undefined4 param_3); // 0043e540 // r3_wait_for_dvd
|
undefined4 param_3); // 0043e540 // r3_wait_for_dvd
|
||||||
undefined FUN_004725a0(void); // 004725a0 // FUN_004725a0
|
undefined FUN_004725a0(void); // 004725a0 // FUN_004725a0
|
||||||
uint32_t r3_containsCmdLine(uint *param_1,
|
|
||||||
char *param_2); // 004028e0 // r3_containsCmdLine
|
|
||||||
int r3_get_gli_width1(void); // 0047baf0 // r3_get_gli_width1
|
int r3_get_gli_width1(void); // 0047baf0 // r3_get_gli_width1
|
||||||
undefined gfx_init2(void); // 00470be0 // gfx_init2
|
undefined gfx_init2(void); // 00470be0 // gfx_init2
|
||||||
void g_setInitVar0(void); // 00401310 // g_setInitVar0
|
void g_setInitVar0(void); // 00401310 // g_setInitVar0
|
||||||
|
@ -379,7 +377,7 @@ int r3_main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR *cmdline,
|
||||||
1 = maximize
|
1 = maximize
|
||||||
0 = windowed */
|
0 = windowed */
|
||||||
g_runMaximized = (int)(acStack_200[0] != '0');
|
g_runMaximized = (int)(acStack_200[0] != '0');
|
||||||
r3_checkDisc();
|
// r3_checkDisc();
|
||||||
dwOptions = 0;
|
dwOptions = 0;
|
||||||
BVar18 = 0;
|
BVar18 = 0;
|
||||||
lpTargetHandle = &pvStack_834;
|
lpTargetHandle = &pvStack_834;
|
||||||
|
@ -392,15 +390,10 @@ int r3_main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR *cmdline,
|
||||||
lpTargetHandle, DVar7, BVar18, dwOptions);
|
lpTargetHandle, DVar7, BVar18, dwOptions);
|
||||||
g_mainThreadHandle = pvStack_834;
|
g_mainThreadHandle = pvStack_834;
|
||||||
/* Copy cmdline */
|
/* Copy cmdline */
|
||||||
ppCVar8 = cmdline;
|
strcpy(g_appCmdLine, GetCommandLineA());
|
||||||
do {
|
|
||||||
cVar1 = *(char *)ppCVar8;
|
|
||||||
*(char *)(((int)g_appCmdLine - (int)cmdline) + (int)ppCVar8) = cVar1;
|
|
||||||
ppCVar8 = (LPSTR *)((int)ppCVar8 + 1);
|
|
||||||
} while (cVar1 != '\0');
|
|
||||||
SetErrorMode(1);
|
SetErrorMode(1);
|
||||||
uVar9 = r3_containsCmdLine((uint *)cmdline, s_dashCC);
|
char *ccArg = strstr(g_appCmdLine, s_dashCC);
|
||||||
if (uVar9 == 0) {
|
if (ccArg == 0) {
|
||||||
r3_module0_init();
|
r3_module0_init();
|
||||||
iVar13 = r3_setupWindow(hInstance, showCmd, g_runMaximized);
|
iVar13 = r3_setupWindow(hInstance, showCmd, g_runMaximized);
|
||||||
if (iVar13 == 0) {
|
if (iVar13 == 0) {
|
||||||
|
|
|
@ -79,6 +79,7 @@ undefined2& DAT_005c0f20= (undefined2&) GH_MEM(0x005c0f20);
|
||||||
char& DAT_005c0f22= (char&) GH_MEM(0x005c0f22);
|
char& DAT_005c0f22= (char&) GH_MEM(0x005c0f22);
|
||||||
HWND& g_gameHWND1= (HWND&) GH_MEM(0x005cf964);
|
HWND& g_gameHWND1= (HWND&) GH_MEM(0x005cf964);
|
||||||
long& lpDefault_005cf96c= (long&) GH_MEM(0x005cf96c);
|
long& lpDefault_005cf96c= (long&) GH_MEM(0x005cf96c);
|
||||||
|
R3ModuleId& g_ucErmNbOfModule= (R3ModuleId&) GH_MEM(0x005d2638);
|
||||||
undefined4& DAT_005d2660= (undefined4&) GH_MEM(0x005d2660);
|
undefined4& DAT_005d2660= (undefined4&) GH_MEM(0x005d2660);
|
||||||
undefined1& DAT_005d26a8= (undefined1&) GH_MEM(0x005d26a8);
|
undefined1& DAT_005d26a8= (undefined1&) GH_MEM(0x005d26a8);
|
||||||
undefined& lpVolumeNameBuffer_005d27b0= (undefined&) GH_MEM(0x005d27b0);
|
undefined& lpVolumeNameBuffer_005d27b0= (undefined&) GH_MEM(0x005d27b0);
|
||||||
|
@ -106,6 +107,10 @@ char(&g_appCmdLine)[256] = reinterpret_cast<char(&)[256]>(GH_MEM(0x0077d4e0));
|
||||||
char(&s_wndStrRestoring)[256] = reinterpret_cast<char(&)[256]>(GH_MEM(0x0077d5e0));
|
char(&s_wndStrRestoring)[256] = reinterpret_cast<char(&)[256]>(GH_MEM(0x0077d5e0));
|
||||||
char(&s_quitting1)[64] = reinterpret_cast<char(&)[64]>(GH_MEM(0x007825c0));
|
char(&s_quitting1)[64] = reinterpret_cast<char(&)[64]>(GH_MEM(0x007825c0));
|
||||||
char(&s_wndStrQuiting)[56] = reinterpret_cast<char(&)[56]>(GH_MEM(0x00782600));
|
char(&s_wndStrQuiting)[56] = reinterpret_cast<char(&)[56]>(GH_MEM(0x00782600));
|
||||||
|
tdstLastErrorInfo(&g_stErmTheLastErrorInfo)[3] = reinterpret_cast<tdstLastErrorInfo(&)[3]>(GH_MEM(0x00782640));
|
||||||
|
pointer& g_errDat4= (pointer&) GH_MEM(0x00782644);
|
||||||
|
tdstBlockInfoPriv *(&g_a_p_stMmgModuleBlocksInfo)[255] = reinterpret_cast<tdstBlockInfoPriv *(&)[255]>(GH_MEM(0x0078f6a0));
|
||||||
|
char(&g_a_ucBlocksNbInModule)[255] = reinterpret_cast<char(&)[255]>(GH_MEM(0x0078fac0));
|
||||||
undefined& DAT_007d7d84= (undefined&) GH_MEM(0x007d7d84);
|
undefined& DAT_007d7d84= (undefined&) GH_MEM(0x007d7d84);
|
||||||
undefined2& DAT_007d7ea8= (undefined2&) GH_MEM(0x007d7ea8);
|
undefined2& DAT_007d7ea8= (undefined2&) GH_MEM(0x007d7ea8);
|
||||||
short& DAT_007d80f8= (short&) GH_MEM(0x007d80f8);
|
short& DAT_007d80f8= (short&) GH_MEM(0x007d80f8);
|
||||||
|
|
|
@ -84,6 +84,7 @@ extern undefined2& DAT_005c0f20; // 005c0f20
|
||||||
extern char& DAT_005c0f22; // 005c0f22
|
extern char& DAT_005c0f22; // 005c0f22
|
||||||
extern HWND& g_gameHWND1; // 005cf964
|
extern HWND& g_gameHWND1; // 005cf964
|
||||||
extern long& lpDefault_005cf96c; // 005cf96c
|
extern long& lpDefault_005cf96c; // 005cf96c
|
||||||
|
extern R3ModuleId& g_ucErmNbOfModule; // 005d2638
|
||||||
extern undefined4& DAT_005d2660; // 005d2660
|
extern undefined4& DAT_005d2660; // 005d2660
|
||||||
extern undefined1& DAT_005d26a8; // 005d26a8
|
extern undefined1& DAT_005d26a8; // 005d26a8
|
||||||
extern undefined& lpVolumeNameBuffer_005d27b0; // 005d27b0
|
extern undefined& lpVolumeNameBuffer_005d27b0; // 005d27b0
|
||||||
|
@ -111,6 +112,10 @@ extern char(&g_appCmdLine)[256]; // 0077d4e0
|
||||||
extern char(&s_wndStrRestoring)[256]; // 0077d5e0
|
extern char(&s_wndStrRestoring)[256]; // 0077d5e0
|
||||||
extern char(&s_quitting1)[64]; // 007825c0
|
extern char(&s_quitting1)[64]; // 007825c0
|
||||||
extern char(&s_wndStrQuiting)[56]; // 00782600
|
extern char(&s_wndStrQuiting)[56]; // 00782600
|
||||||
|
extern tdstLastErrorInfo(&g_stErmTheLastErrorInfo)[3]; // 00782640
|
||||||
|
extern pointer& g_errDat4; // 00782644
|
||||||
|
extern tdstBlockInfoPriv *(&g_a_p_stMmgModuleBlocksInfo)[255]; // 0078f6a0
|
||||||
|
extern char(&g_a_ucBlocksNbInModule)[255]; // 0078fac0
|
||||||
extern undefined& DAT_007d7d84; // 007d7d84
|
extern undefined& DAT_007d7d84; // 007d7d84
|
||||||
extern undefined2& DAT_007d7ea8; // 007d7ea8
|
extern undefined2& DAT_007d7ea8; // 007d7ea8
|
||||||
extern short& DAT_007d80f8; // 007d80f8
|
extern short& DAT_007d80f8; // 007d80f8
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
// AUTO-GENERATED FILE!!!!
|
|
||||||
// This function has yet to be decompiled using 'Dump Current Function' in ghidra
|
|
||||||
// with possible manualy fixes
|
|
||||||
|
|
||||||
#include <r3/binders/auto.h>
|
|
||||||
#include <gh_global.h>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
// 0043e1d0
|
|
||||||
// Erm_fn_ucInitErrMsg
|
|
||||||
extern "C" R3ModuleId Erm_fn_ucInitErrMsg(void) {
|
|
||||||
// TODO: Implement this function
|
|
||||||
throw std::runtime_error("Function not implemented: Erm_fn_ucInitErrMsg");
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -77,6 +77,7 @@
|
||||||
005c0f22 || DAT_005c0f22 || / || char
|
005c0f22 || DAT_005c0f22 || / || char
|
||||||
005cf964 || g_gameHWND1 || /windef.h || HWND
|
005cf964 || g_gameHWND1 || /windef.h || HWND
|
||||||
005cf96c || lpDefault_005cf96c || / || long
|
005cf96c || lpDefault_005cf96c || / || long
|
||||||
|
005d2638 || g_ucErmNbOfModule || / || R3ModuleId
|
||||||
005d2660 || DAT_005d2660 || / || undefined4
|
005d2660 || DAT_005d2660 || / || undefined4
|
||||||
005d26a8 || DAT_005d26a8 || / || undefined1
|
005d26a8 || DAT_005d26a8 || / || undefined1
|
||||||
005d27b0 || lpVolumeNameBuffer_005d27b0 || / || undefined
|
005d27b0 || lpVolumeNameBuffer_005d27b0 || / || undefined
|
||||||
|
@ -104,6 +105,10 @@
|
||||||
0077d5e0 || s_wndStrRestoring || / || char[256]
|
0077d5e0 || s_wndStrRestoring || / || char[256]
|
||||||
007825c0 || s_quitting1 || / || char[64]
|
007825c0 || s_quitting1 || / || char[64]
|
||||||
00782600 || s_wndStrQuiting || / || char[56]
|
00782600 || s_wndStrQuiting || / || char[56]
|
||||||
|
00782640 || g_stErmTheLastErrorInfo || / || tdstLastErrorInfo[3]
|
||||||
|
00782644 || g_errDat4 || / || pointer
|
||||||
|
0078f6a0 || g_a_p_stMmgModuleBlocksInfo || /mmg.h || tdstBlockInfoPriv *[255]
|
||||||
|
0078fac0 || g_a_ucBlocksNbInModule || / || char[255]
|
||||||
007d7d84 || DAT_007d7d84 || / || undefined
|
007d7d84 || DAT_007d7d84 || / || undefined
|
||||||
007d7ea8 || DAT_007d7ea8 || / || undefined2
|
007d7ea8 || DAT_007d7ea8 || / || undefined2
|
||||||
007d80f8 || DAT_007d80f8 || / || short
|
007d80f8 || DAT_007d80f8 || / || short
|
||||||
|
|
|
@ -42,14 +42,18 @@ template <size_t Size> struct FieldBinder {
|
||||||
template <typename T> T *operator=(T *src) {
|
template <typename T> T *operator=(T *src) {
|
||||||
union V {
|
union V {
|
||||||
T *a;
|
T *a;
|
||||||
void* b;
|
void *b;
|
||||||
};
|
};
|
||||||
V* trick = reinterpret_cast<V*>(this);
|
V *trick = reinterpret_cast<V *>(this);
|
||||||
return trick->a = src;
|
return trick->a = src;
|
||||||
}
|
}
|
||||||
ExpectedType& operator=(ExpectedType src) {
|
ExpectedType &operator=(ExpectedType src) {
|
||||||
return *reinterpret_cast<ExpectedType *>(dst) = src;
|
return *reinterpret_cast<ExpectedType *>(dst) = src;
|
||||||
}
|
}
|
||||||
|
ExpectedType &operator=(FieldBinder<Size> &other) {
|
||||||
|
return *reinterpret_cast<ExpectedType *>(dst) =
|
||||||
|
*reinterpret_cast<ExpectedType *>(other.dst);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t Offset, size_t Size>
|
template <size_t Offset, size_t Size>
|
||||||
|
@ -83,18 +87,15 @@ inline constexpr cc_type_t CONCAT23(T0 a, T1 b) {
|
||||||
return cc_type_t(a) << 24 | cc_type_t(b);
|
return cc_type_t(a) << 24 | cc_type_t(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T0>
|
template <typename T0> inline constexpr char SUB21(T0 a, size_t b) {
|
||||||
inline constexpr char SUB21(T0 a, size_t b) {
|
|
||||||
return cc_type_t(a) >> (b * 8);
|
return cc_type_t(a) >> (b * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T0>
|
template <typename T0> inline constexpr char SUB41(T0 a, size_t b) {
|
||||||
inline constexpr char SUB41(T0 a, size_t b) {
|
|
||||||
return cc_type_t(a) >> (b * 8);
|
return cc_type_t(a) >> (b * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T0>
|
template <typename T0> inline constexpr uint16_t SUB42(T0 a, size_t b) {
|
||||||
inline constexpr uint16_t SUB42(T0 a, size_t b) {
|
|
||||||
return cc_type_t(a) >> (b * 8);
|
return cc_type_t(a) >> (b * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,11 @@
|
||||||
extern "C" int r3_main(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
extern "C" int r3_main(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
LPSTR *cmdline, int showCmd);
|
LPSTR *cmdline, int showCmd);
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char **argv) {
|
||||||
try {
|
try {
|
||||||
gh_init_data_segment();
|
gh_init_data_segment();
|
||||||
r3_main(GetModuleHandle(NULL), NULL, NULL, SW_SHOW);
|
|
||||||
|
r3_main(GetModuleHandle(NULL), NULL, argv, SW_SHOW);
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
SPDLOG_ERROR("Unhandled exception: {}", e.what());
|
SPDLOG_ERROR("Unhandled exception: {}", e.what());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue