From faa171b56bc22b64243524bcb98333dd52281938 Mon Sep 17 00:00:00 2001 From: Guus Waals <_@guusw.nl> Date: Tue, 24 Sep 2024 04:40:28 +0800 Subject: [PATCH] WIP --- game_re/binders/gh_auto_binder.h | 24 +- game_re/binders/gh_base.h | 29 ++ game_re/gh_fix/r3_main.cxx | 421 ------------------ game_re/gh_global.cxx | 94 ++-- game_re/gh_global.h | 94 ++-- ...etupWindow.cxx => Erm_fn_ucInitErrMsg.cxx} | 8 +- game_re/gh_stub/FUN_004013a0.cxx | 14 + game_re/gh_stub/FUN_0043f830.cxx | 14 + game_re/gh_stub/FUN_0046ecc0.cxx | 14 + game_re/gh_stub/FUN_0046ed70.cxx | 14 + game_re/gh_stub/FUN_0046f060.cxx | 14 + game_re/gh_stub/FUN_0046f0b0.cxx | 14 + game_re/gh_stub/FUN_0046f640.cxx | 14 + game_re/gh_stub/FUN_0047c340.cxx | 14 + game_re/gh_stub/get_one.cxx | 14 + game_re/gh_stub/r3_get_gli_height0.cxx | 14 + game_re/gh_stub/r3_get_gli_width0.cxx | 14 + game_re/gh_stub/r3_get_gli_width1.cxx | 2 +- game_re/gh_stub/r3_load_splash_bitmap.cxx | 14 + ...3_module0_init.cxx => r3_module1_init.cxx} | 8 +- game_re/gh_stub/r3_module_big_init.cxx | 14 + game_re/gh_stub/r3_set_window_wh.cxx | 14 + game_re/gh_stub/r3_wait_for_dvd.cxx | 2 +- game_re/gh_stub/set_unk.cxx | 14 + game_re/globals.txt | 94 ++-- scripts/re3lib/FunctionDumper.java | 24 +- scripts/re3lib/GlobalDumper.java | 18 +- 27 files changed, 464 insertions(+), 564 deletions(-) delete mode 100644 game_re/gh_fix/r3_main.cxx rename game_re/gh_stub/{r3_setupWindow.cxx => Erm_fn_ucInitErrMsg.cxx} (54%) create mode 100644 game_re/gh_stub/FUN_004013a0.cxx create mode 100644 game_re/gh_stub/FUN_0043f830.cxx create mode 100644 game_re/gh_stub/FUN_0046ecc0.cxx create mode 100644 game_re/gh_stub/FUN_0046ed70.cxx create mode 100644 game_re/gh_stub/FUN_0046f060.cxx create mode 100644 game_re/gh_stub/FUN_0046f0b0.cxx create mode 100644 game_re/gh_stub/FUN_0046f640.cxx create mode 100644 game_re/gh_stub/FUN_0047c340.cxx create mode 100644 game_re/gh_stub/get_one.cxx create mode 100644 game_re/gh_stub/r3_get_gli_height0.cxx create mode 100644 game_re/gh_stub/r3_get_gli_width0.cxx create mode 100644 game_re/gh_stub/r3_load_splash_bitmap.cxx rename game_re/gh_stub/{r3_module0_init.cxx => r3_module1_init.cxx} (65%) create mode 100644 game_re/gh_stub/r3_module_big_init.cxx create mode 100644 game_re/gh_stub/r3_set_window_wh.cxx create mode 100644 game_re/gh_stub/set_unk.cxx diff --git a/game_re/binders/gh_auto_binder.h b/game_re/binders/gh_auto_binder.h index 00a36160..9a01cb3c 100644 --- a/game_re/binders/gh_auto_binder.h +++ b/game_re/binders/gh_auto_binder.h @@ -9,7 +9,7 @@ #ifdef _WIN32 #include #include -#else +#else #include #endif @@ -28,10 +28,26 @@ template <> struct _FieldBinderSizeTraits<3> { using type = undefined3; }; +template struct FieldBinder { + void *dst; + using ExpectedType = typename _FieldBinderSizeTraits::type; + + operator ExpectedType &() const { + return *reinterpret_cast(dst); + } + + template T *operator=(T *src) { + return reinterpret_cast(dst) = src; + } + ExpectedType& operator=(ExpectedType src) { + return *reinterpret_cast(dst) = src; + } +}; + template -inline typename _FieldBinderSizeTraits::type & -operator+(const void *str, Field offset) { - return *reinterpret_cast::type *>((uint8_t *)str + offset); +inline FieldBinder operator+(const void *str, + Field offset) { + return FieldBinder{.dst = (uint8_t *)str + offset}; } #endif /* B8D59B54_1674_4C0F_AA2C_611385FF5D03 */ diff --git a/game_re/binders/gh_base.h b/game_re/binders/gh_base.h index feb3684c..2c1a6e71 100644 --- a/game_re/binders/gh_base.h +++ b/game_re/binders/gh_base.h @@ -13,10 +13,19 @@ typedef uint8_t undefined; typedef uint32_t undefined4; typedef uint16_t undefined2; +typedef uint16_t word; +typedef uint32_t dword; struct undefined3 { uint8_t _0; uint8_t _1; uint8_t _2; + + undefined3& operator=(const uint32_t& other) { + _0 = other & 0xff; + _1 = (other >> 8) & 0xff; + _2 = (other >> 16) & 0xff; + return *this; + } }; typedef unsigned char byte; typedef byte undefined1; @@ -32,6 +41,11 @@ enum R3ModuleId : uint8_t { typedef uint32_t cc_type_t; + +template +inline constexpr cc_type_t CONCAT12(T0 a, T1 b) { + return cc_type_t(a) << 16 | cc_type_t(b); +} template inline constexpr cc_type_t CONCAT11(T0 a, T1 b) { return cc_type_t(a) << 8 | cc_type_t(b); @@ -51,6 +65,21 @@ inline constexpr cc_type_t CONCAT23(T0 a, T1 b) { return cc_type_t(a) << 24 | cc_type_t(b); } +template +inline constexpr char SUB21(T0 a, size_t b) { + return cc_type_t(a) >> (b * 8); +} + +template +inline constexpr char SUB41(T0 a, size_t b) { + return cc_type_t(a) >> (b * 8); +} + +template +inline constexpr uint16_t SUB42(T0 a, size_t b) { + return cc_type_t(a) >> (b * 8); +} + // Can not export enums for some reason #endif /* A523F6DB_0645_4DEB_8AEB_3792CB732B49 */ diff --git a/game_re/gh_fix/r3_main.cxx b/game_re/gh_fix/r3_main.cxx deleted file mode 100644 index 60467aef..00000000 --- a/game_re/gh_fix/r3_main.cxx +++ /dev/null @@ -1,421 +0,0 @@ -// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! - -#include -#include "../gh_global.h" - -extern "C" { -undefined r3_initEngine(void); // 00401220 // r3_initEngine -extern undefined r3_module0_init(void); // 00401000 // r3_module0_init -extern uint32_t -r3_containsCmdLine(uint *param_1, - char *param_2); // 004028e0 // r3_containsCmdLine -extern undefined FUN_004010b0(void); // 004010b0 // FUN_004010b0 -extern undefined FUN_004464f0(void); // 004464f0 // FUN_004464f0 -extern undefined FUN_00503710(void); // 00503710 // FUN_00503710 -extern undefined -r3_setupWindow(HINSTANCE hInstance, undefined4 param_2, - undefined4 param_3); // 00402140 // r3_setupWindow -extern undefined FUN_00401320(void); // 00401320 // FUN_00401320 -extern undefined spawnThread(void); // 004477d0 // spawnThread -extern undefined FUN_005038e0(void); // 005038e0 // FUN_005038e0 -extern undefined FUN_004fb300(void); // 004fb300 // FUN_004fb300 -extern void g_setInitVar0(void); // 00401310 // g_setInitVar0 -extern void r3_noop(void *p_cTxt1, - void *p_cTxt2); // 00401100 // r3_noop -extern undefined r3_checkDisc(void); // 004464f0 // r3_checkDisc -extern undefined gfx_init2(void); // 00470be0 // gfx_init2 -extern undefined4 __cdecl r3_get_gli_width( - void); // 0047baf0 // r3_get_gli_width -extern undefined FUN_00472150(void); // 00472150 // FUN_00472150 -extern undefined FUN_00470db0(void); // 00470db0 // FUN_00470db0 -extern int __cdecl r3_get_gli_height(void); // 0047bb00 // r3_get_gli_height -extern undefined FUN_0043e540(undefined4 param_1, undefined4 param_2, - undefined4 param_3); // 0043e540 // FUN_0043e540 -extern undefined FUN_004725a0(void); // 004725a0 // FUN_004725a0 - -// 00401630 - -int r3_main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR *cmdline, - int showCmd) - -{ - char cVar1; - undefined4 uVar2; - undefined4 uVar3; - undefined4 uVar4; - undefined2 uVar5; - undefined2 uVar6; - LPSTR pCVar7; - char *pcVar8; - FILE *file; - LONG LVar9; - HMODULE hLibModule; - DWORD DVar10; - HANDLE hTargetProcessHandle; - HANDLE hSourceHandle; - HANDLE hSourceProcessHandle; - LPSTR *ppCVar11; - uint32_t hasCCarg; - HWND hWnd; - int iVar12; - int iVar13; - int iVar14; - int iVar15; - uint uVar16; - void *unaff_ESI; - undefined4 *puVar17; - void *unaff_EDI; - undefined4 *puVar18; - char *pcVar19; - HANDLE *lpTargetHandle; - BOOL BVar20; - DWORD dwOptions; - tagRECT *lpRect; - undefined4 uStack_83c; - HKEY pHStack_838; - HANDLE pvStack_834; - UINT UStack_830; - BYTE aBStack_82c[4]; - DWORD DStack_828; - DWORD DStack_824; - tagRECT tStack_820; - char acStack_810[260]; - CHAR languageStr[256]; - CHAR pathToUbi_ini[260]; - char acStack_508[260]; - CHAR windowsDir[260]; - char acStack_300[256]; - char acStack_200[256]; - char acStack_100[256]; - - /* Append windows dir / ubi.ini */ - GetWindowsDirectoryA(pathToUbi_ini, 0x104); - iVar15 = -1; - pcVar8 = pathToUbi_ini; - do { - pcVar19 = pcVar8; - if (iVar15 == 0) - break; - iVar15 = iVar15 + -1; - pcVar19 = pcVar8 + 1; - cVar1 = *pcVar8; - pcVar8 = pcVar19; - } while (cVar1 != '\0'); - *(undefined4 *)(pcVar19 + -1) = s_UbiSoft_Ubi_ini + Field<0, 4>(); - *(undefined4 *)(pcVar19 + 3) = s_UbiSoft_Ubi_ini + Field<4, 4>(); - *(undefined4 *)(pcVar19 + 7) = s_UbiSoft_Ubi_ini + Field<8, 4>(); - *(undefined4 *)(pcVar19 + 0xb) = s_UbiSoft_Ubi_ini + Field<12, 4>(); - pcVar19[0xf] = s_UbiSoft_Ubi_ini[0x10]; - pCVar7 = GetCommandLineA(); - pcVar8 = pCVar7 + 1; - iVar15 = -(int)pcVar8; - do { - cVar1 = *pcVar8; - pcVar8[(int)(acStack_810 + iVar15)] = cVar1; - pcVar8 = pcVar8 + 1; - } while (cVar1 != '\0'); - pcVar8 = strrchr(acStack_810, 0x5c); - if (pcVar8 == (char *)0x0) { - /* Read from ubi.ini */ - GetPrivateProfileStringA(lpAppName_005b68f0, s_Directory_005b68f8, s_None, - acStack_810, 0xff, pathToUbi_ini); - iVar15 = strcmpi(acStack_810, s_None); - } else { - pcVar8 = strrchr(acStack_810, 0x5c); - *pcVar8 = '\0'; - iVar15 = chdir(acStack_810); - if (iVar15 != -1) - goto LAB_00401765; - /* Read from ubi.ini */ - GetPrivateProfileStringA(lpAppName_005b68f0, s_Directory_005b68f8, s_None, - acStack_810, 0xff, pathToUbi_ini); - iVar15 = strcmpi(acStack_810, s_None); - } - if (iVar15 != 0) { - chdir(acStack_810); - } -LAB_00401765: - /* strcpy */ - iVar15 = 0; - do { - cVar1 = acStack_810[iVar15]; - r3_main_data_005d28b6.gameDataDir[iVar15] = cVar1; - iVar15 = iVar15 + 1; - } while (cVar1 != '\0'); - strlwr(r3_main_data_005d28b6.gameDataDir); - iVar15 = -1; - pcVar8 = r3_main_data_005d28b6.gameDataDir; - do { - if (iVar15 == 0) - break; - iVar15 = iVar15 + -1; - cVar1 = *pcVar8; - pcVar8 = pcVar8 + 1; - } while (cVar1 != '\0'); -joined_r0x00401792: - if (iVar15 != -2) { - uVar16 = 0xffffffff; - pcVar8 = r3_main_data_005d28b6.gameDataDir; - do { - if (uVar16 == 0) - break; - uVar16 = uVar16 - 1; - cVar1 = *pcVar8; - pcVar8 = pcVar8 + 1; - } while (cVar1 != '\0'); - if (r3_main_data_005d28b6.gameDataDir[~uVar16 - 2] != '\\') - goto LAB_004017ce; - uVar16 = 0xffffffff; - pcVar8 = r3_main_data_005d28b6.gameDataDir; - do { - if (uVar16 == 0) - break; - uVar16 = uVar16 - 1; - cVar1 = *pcVar8; - pcVar8 = pcVar8 + 1; - } while (cVar1 != '\0'); - r3_main_data_005d28b6.gameDataDir[~uVar16 - 2] = '\0'; - iVar15 = -1; - pcVar8 = r3_main_data_005d28b6.gameDataDir; - do { - if (iVar15 == 0) - break; - iVar15 = iVar15 + -1; - cVar1 = *pcVar8; - pcVar8 = pcVar8 + 1; - } while (cVar1 != '\0'); - goto joined_r0x00401792; - } -LAB_004017ce: - file = fopen(pathToUbi_ini, fopen_mode_r_text); - GetPrivateProfileStringA(lpAppName_005b68f0, s_Adapter_005b68e4, - (LPCSTR)&lpDefault_005cf96c, acStack_300, 0xff, - pathToUbi_ini); - if ((file == (FILE *)0x0) || (acStack_300[0] == '\0')) { - /* Concat game data dir with r3 setup exe */ - iVar15 = 0; - do { - cVar1 = r3_main_data_005d28b6.gameDataDir[iVar15]; - acStack_508[iVar15] = cVar1; - iVar15 = iVar15 + 1; - } while (cVar1 != '\0'); - iVar15 = -1; - pcVar8 = acStack_508; - do { - pcVar19 = pcVar8; - if (iVar15 == 0) - break; - iVar15 = iVar15 + -1; - pcVar19 = pcVar8 + 1; - cVar1 = *pcVar8; - pcVar8 = pcVar19; - } while (cVar1 != '\0'); - *(undefined4 *)(pcVar19 + -1) = - s__R3_Setup_DX8_exe_005b68d0 + Field<0, 4>(); - *(undefined4 *)(pcVar19 + 3) = s__R3_Setup_DX8_exe_005b68d0 + Field<4, 4>(); - *(undefined4 *)(pcVar19 + 7) = s__R3_Setup_DX8_exe_005b68d0 + Field<8, 4>(); - *(undefined4 *)(pcVar19 + 0xb) = - s__R3_Setup_DX8_exe_005b68d0 + Field<12, 4>(); - *(undefined2 *)(pcVar19 + 0xf) = 0; - auto &q = (s__R3_Setup_DX8_exe_005b68d0 + Field<16, 2>()); - file = fopen(acStack_508, fopen_mode_r_binary); - if (file == (FILE *)0x0) { - MessageBoxA((HWND)0x0, s_Unable_to_find_R3_Setup_DX8_exe__005b6880, - s_Rayman_3_Error_005b68bc, 0x10); - return -1; - } - fclose(file); - spawnl(0, acStack_508, acStack_508, 0); - file = fopen(pathToUbi_ini, fopen_mode_r_text); - if (file == (FILE *)0x0) { - return -1; - } - } - fclose(file); - /* Open reg key - HKEY_LOCAL_MACHINE\\SOFTWARE\\UBI SOFT\\RAYMAN 3 */ - LVar9 = RegOpenKeyExA((HKEY)0x80000002, s_SOFTWARE_UBI_SOFT_RAYMAN_3_005b6864, - 0, 0x20019, &pHStack_838); - if (LVar9 == 0) { - LVar9 = - RegQueryValueExA(pHStack_838, s_CompleteInstall_005b6854, (LPDWORD)0x0, - &DStack_824, aBStack_82c, &DStack_828); - DAT_007d9cc4 = (uint)(LVar9 == 0); - if (pHStack_838 != (HKEY)0x0) { - RegCloseKey(pHStack_838); - } - } else { - DAT_007d9cc4 = 0; - } - GetPrivateProfileStringA(lpAppName_005b68f0, s_Language_005b6840, - s_English_005b684c, languageStr, 0xff, - pathToUbi_ini); - sprintf(g_mutexName_Rayman3, s_percents, lpAppName_005b68f0); - sprintf(g_windowTitle, s_percents, s_windowTitle); - /* Setup localized quiting/restoring strings */ - sprintf(s_windowTitleRestoring, s__s___Restoring_data____005b664c, - s_windowTitle); - uVar2 = s_QUIT + Field<0, 4>(); - puVar17 = (undefined4 *)s_or_press_ESC_to_quit_Rayman_3__005b662c; - puVar18 = (undefined4 *)&DAT_007825c0; - for (iVar15 = 7; cVar1 = s_QUIT[4], iVar15 != 0; iVar15 = iVar15 + -1) { - *puVar18 = *puVar17; - puVar17 = puVar17 + 1; - puVar18 = puVar18 + 1; - } - *(undefined2 *)puVar18 = *(undefined2 *)puVar17; - *(undefined *)((int)puVar18 + 2) = *(undefined *)((int)puVar17 + 2); - strcpy(s_wndStrQuiting, s_QUIT); - sprintf(lpString_0077d2c0, s__s___Pause_005b67c4, s_windowTitle); - strcpy(s_wndStrRestoring, s_Restoring_data_____005b6610); - /* Create draw semaphore - Initial count = 1 - Maximum count = 1 */ - g_drawSemaphore = - CreateSemaphoreA((LPSECURITY_ATTRIBUTES)0x0, 1, 1, s_DRAWSEM_005b6608); - if (hPrevInstance != (HINSTANCE)0x0) { - return -1; - } - /* Load DirectPlay probably unused */ - hLibModule = LoadLibraryA(s_dpnhpast_dll_005b65f8); - if (hLibModule == (HMODULE)0x0) { - iVar15 = strcmpi(languageStr, s_French_005b6828); - if (iVar15 == 0) { - MessageBoxA((HWND)0x0, lpText_005b6598, s_Erreur_Rayman_3_005b65e4, 0x10); - return -1; - } - iVar15 = strcmpi(languageStr, s_Spanish_005b67a0); - if (iVar15 == 0) { - MessageBoxA((HWND)0x0, lpText_005b6540, s_Rayman_3_005b6588, 0x10); - return -1; - } - iVar15 = strcmpi(languageStr, s_Italian_005b6730); - if (iVar15 == 0) { - MessageBoxA((HWND)0x0, lpText_005b64f0, s_Rayman_3_005b6588, 0x10); - return -1; - } - iVar15 = strcmpi(languageStr, s_German_005b66c4); - if (iVar15 != 0) { - MessageBoxA((HWND)0x0, s_Check_your_version_of_DirectX__V_005b6430, - s_Rayman_3_Error_005b68bc, 0x10); - return -1; - } - MessageBoxA((HWND)0x0, lpText_005b6478, s_Rayman_3_005b6588, 0x10); - return -1; - } - FreeLibrary(hLibModule); - CreateMutexA((LPSECURITY_ATTRIBUTES)0x0, 1, g_mutexName_Rayman3); - DVar10 = GetLastError(); - if (DVar10 == 0xb7) { - /* Mutex already exists */ - return -1; - } - GetWindowsDirectoryA(windowsDir, 0x104); - iVar15 = -1; - /* Append ubi.ini */ - pcVar8 = windowsDir; - do { - pcVar19 = pcVar8; - if (iVar15 == 0) - break; - iVar15 = iVar15 + -1; - pcVar19 = pcVar8 + 1; - cVar1 = *pcVar8; - pcVar8 = pcVar19; - } while (cVar1 != '\0'); - *(undefined4 *)(pcVar19 + -1) = s_UbiSoft_Ubi_ini + Field<0, 4>(); - *(undefined4 *)(pcVar19 + 3) = s_UbiSoft_Ubi_ini + Field<4, 4>(); - *(undefined4 *)(pcVar19 + 7) = s_UbiSoft_Ubi_ini + Field<8, 4>(); - *(undefined4 *)(pcVar19 + 0xb) = s_UbiSoft_Ubi_ini + Field<12, 4>(); - pcVar19[0xf] = s_UbiSoft_Ubi_ini[0x10]; - /* Read graphics settings */ - GetPrivateProfileStringA(lpAppName_005b68f0, s_Adapter_005b68e4, - (LPCSTR)&lpDefault_005cf96c, acStack_300, 0xff, - windowsDir); - GetPrivateProfileStringA(lpAppName_005b68f0, s_Identifier_005b6420, - (LPCSTR)&lpDefault_005cf96c, acStack_100, 0xff, - windowsDir); - GetPrivateProfileStringA(lpAppName_005b68f0, s_Gli_Mode_005b6414, - (LPCSTR)&lpDefault_005cf96c, acStack_200, 0xff, - windowsDir); - /* If they're all set */ - if (((acStack_300[0] != '\0') && (acStack_100[0] != '\0')) && - (acStack_200[0] != '\0')) { - /* always true */ - hasGLIMode = (uint)(acStack_200[0] != '0'); - // r3_checkDisc(); - dwOptions = 0; - BVar20 = 0; - lpTargetHandle = &pvStack_834; - DVar10 = 0x1f03ff; - g_hinstance = hInstance; - hTargetProcessHandle = GetCurrentProcess(); - hSourceHandle = GetCurrentThread(); - hSourceProcessHandle = GetCurrentProcess(); - DuplicateHandle(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, - lpTargetHandle, DVar10, BVar20, dwOptions); - g_mainThreadHandle = pvStack_834; - /* Copy cmdline */ - ppCVar11 = cmdline; - do { - cVar1 = *(char *)ppCVar11; - *(char *)(((int)g_appCmdLine - (int)cmdline) + (int)ppCVar11) = cVar1; - ppCVar11 = (LPSTR *)((int)ppCVar11 + 1); - } while (cVar1 != '\0'); - SetErrorMode(1); - hasCCarg = r3_containsCmdLine((uint *)cmdline, s_dashCC); - if (hasCCarg == 0) { - r3_module0_init(); - iVar15 = r3_setupWindow(hInstance, showCmd, hasGLIMode); - if (iVar15 == 0) { - return -1; - } - g_setInitVar0(); - FUN_00401320(); - spawnThread(); - r3_noop(unaff_EDI, unaff_ESI); - gfx_init2(); - lpRect = &tStack_820; - hWnd = GetDesktopWindow(); - GetWindowRect(hWnd, lpRect); - BVar20 = 1; - iVar15 = r3_get_gli_height(); - iVar15 = iVar15 + 0x20; - iVar12 = r3_get_gli_width(); - iVar12 = iVar12 + 0xc; - iVar13 = r3_get_gli_height(); - iVar13 = (tStack_820.bottom - iVar13) / 2; - iVar14 = r3_get_gli_width(); - MoveWindow(g_gameHWND, (tStack_820.right - iVar14) / 2, iVar13, iVar12, - iVar15, BVar20); - FUN_004010b0(); - SystemParametersInfoA(0x10, 0, &UStack_830, 0); - SystemParametersInfoA(0x11, 0, (PVOID)0x0, 0); - ShowCursor(0); - uStack_83c = 0; - SystemParametersInfoA(0x61, 1, &uStack_83c, 0); - g_engineRunning = 1; - r3_initEngine(); - FUN_004725a0(); - FUN_005038e0(); - FUN_00503710(); - FUN_004fb300(); - FUN_00472150(); - FUN_00470db0(); - uStack_83c = 0; - SystemParametersInfoA(0x61, 0, &uStack_83c, 0); - ShowCursor(1); - SystemParametersInfoA(0x11, UStack_830, (PVOID)0x0, 0); - CloseHandle(pvStack_834); - } - return 0; - } - - // Please run the setup - sprintf(acStack_810, s_Please_run_the__s_setup__005b63f4, s_windowTitle); - sprintf(acStack_508, s__s_not_initialized__005b63e0, s_windowTitle); - // FUN_0043e540(acStack_810, acStack_508, 0); - MessageBoxA(g_gameHWND, acStack_810, acStack_508, 0 | 0x10000); - exit(1); -} -} diff --git a/game_re/gh_global.cxx b/game_re/gh_global.cxx index 6268acfe..2d988975 100644 --- a/game_re/gh_global.cxx +++ b/game_re/gh_global.cxx @@ -1,46 +1,46 @@ // AUTO-GENERATED FILE #include -const char* s__s_not_initialized__005b63e0 = "%s not initialized."; // 005b63e0 -const char* s_Please_run_the__s_setup__005b63f4 = "Please run the %s setup."; // 005b63f4 +char(&s__s_not_initialized__005b63e0)[20] = *reinterpret_cast(GH_MEM(0x005b63e0)); +char(&s_Please_run_the__s_setup__005b63f4)[28] = *reinterpret_cast(GH_MEM(0x005b63f4)); char(&s_dashCC)[4] = *reinterpret_cast(GH_MEM(0x005b6410)); -const char* s_Gli_Mode_005b6414 = "Gli_Mode"; // 005b6414 -const char* s_Identifier_005b6420 = "Identifier"; // 005b6420 -const char* s_Check_your_version_of_DirectX__V_005b6430 = "Check your version of DirectX. Version 8.1 or higher is required."; // 005b6430 -const char* lpText_005b6478 = "ᅵberprfen Sie, welche DirectX-Version auf Ihrem PC derzeit installiert ist. Sie ben￶tigen DirectX 8.1 oder h￶her."; // 005b6478 -const char* lpText_005b64f0 = "Controlla la tua versione di DirectX. ￈ necessaria la versione 8.1 o superiore."; // 005b64f0 -const char* lpText_005b6540 = "Comprueba tu versi￳n de DirectX. Se necesita la versi￳n 8.1 o superior."; // 005b6540 -const char* s_Rayman_3_005b6588 = "Rayman 3"; // 005b6588 -const char* lpText_005b6598 = "V←rifiez votre version de DirectX. La version 8.1 minimum est n←cessaire."; // 005b6598 -const char* s_Erreur_Rayman_3_005b65e4 = "Erreur Rayman 3 "; // 005b65e4 -const char* s_dpnhpast_dll_005b65f8 = "dpnhpast.dll"; // 005b65f8 -const char* s_DRAWSEM_005b6608 = "DRAWSEM"; // 005b6608 -const char* s_Restoring_data_____005b6610 = "Restoring data ..."; // 005b6610 +char(&s_Gli_Mode_005b6414)[12] = *reinterpret_cast(GH_MEM(0x005b6414)); +char(&s_Identifier_005b6420)[16] = *reinterpret_cast(GH_MEM(0x005b6420)); +char(&s_Check_your_version_of_DirectX__V_005b6430)[72] = *reinterpret_cast(GH_MEM(0x005b6430)); +char(&lpText_005b6478)[120] = *reinterpret_cast(GH_MEM(0x005b6478)); +char(&lpText_005b64f0)[80] = *reinterpret_cast(GH_MEM(0x005b64f0)); +char(&lpText_005b6540)[72] = *reinterpret_cast(GH_MEM(0x005b6540)); +char(&s_Rayman_3_005b6588)[16] = *reinterpret_cast(GH_MEM(0x005b6588)); +char(&lpText_005b6598)[76] = *reinterpret_cast(GH_MEM(0x005b6598)); +char(&s_Erreur_Rayman_3_005b65e4)[20] = *reinterpret_cast(GH_MEM(0x005b65e4)); +char(&s_dpnhpast_dll_005b65f8)[16] = *reinterpret_cast(GH_MEM(0x005b65f8)); +char(&s_DRAWSEM_005b6608)[8] = *reinterpret_cast(GH_MEM(0x005b6608)); +char(&s_Restoring_data_____005b6610)[20] = *reinterpret_cast(GH_MEM(0x005b6610)); char(&s_QUIT)[8] = *reinterpret_cast(GH_MEM(0x005b6624)); -const char* s_or_press_ESC_to_quit_Rayman_3__005b662c = "or press ESC to quit Rayman 3."; // 005b662c -const char* s__s___Restoring_data____005b664c = "%s - Restoring data..."; // 005b664c -const char* s_Daten_Reparatur____005b6664 = "Daten-Reparatur..."; // 005b6664 -undefined& s_BEENDIGEN_005b6678= (undefined&) GH_MEM(0x005b6678); -undefined2& DAT_005b6684= (undefined2&) GH_MEM(0x005b6684); -const char* s__s___Daten_Reparatur____005b66ac = "%s - Daten-Reparatur..."; // 005b66ac -const char* s_German_005b66c4 = "German"; // 005b66c4 -const char* s_Ripristino_dati____005b66cc = "Ripristino dati..."; // 005b66cc -const char* s__s___Pausa_005b66e0 = "%s - Pausa"; // 005b66e0 -undefined& s_USCIRE_005b66ec= (undefined&) GH_MEM(0x005b66ec); -const char* s_Premi_ESC_per_uscire_da_Rayman_3_005b66f4 = "Premi ESC per uscire da Rayman 3."; // 005b66f4 -const char* s__s___Ripristino_dati____005b6718 = "%s - Ripristino dati..."; // 005b6718 -const char* s_Italian_005b6730 = "Italian"; // 005b6730 -const char* s_Restablecer_datos____005b6738 = "Restablecer datos..."; // 005b6738 -const char* s__s___Rotura_005b6750 = "%s - Rotura"; // 005b6750 -undefined& s_SALIR_005b675c= (undefined&) GH_MEM(0x005b675c); -const char* s_Pulsa_ESC_para_salir_Rayman_3__005b6764 = "Pulsa ESC para salir Rayman 3."; // 005b6764 -const char* s__s___Restablecer_datos____005b6784 = "%s - Restablecer datos..."; // 005b6784 -const char* s_Spanish_005b67a0 = "Spanish"; // 005b67a0 -const char* s_Restauration = "Restauration des donn←es..."; // 005b67a8 -const char* s__s___Pause_005b67c4 = "%s - Pause"; // 005b67c4 -const char* s_ou_appuyez_sur_Echap_pour_quitte_005b67d0 = "ou appuyez sur Echap pour quitter Rayman 3."; // 005b67d0 +char(&s_or_press_ESC_to_quit_Rayman_3__005b662c)[32] = *reinterpret_cast(GH_MEM(0x005b662c)); +char(&s__s___Restoring_data____005b664c)[24] = *reinterpret_cast(GH_MEM(0x005b664c)); +char(&s_Daten_Reparatur____005b6664)[20] = *reinterpret_cast(GH_MEM(0x005b6664)); +char(&s_BEENDIGEN_005b6678)[12] = *reinterpret_cast(GH_MEM(0x005b6678)); +char& CHAR_E_005b6684= (char&) GH_MEM(0x005b6684); +char(&s__s___Daten_Reparatur____005b66ac)[24] = *reinterpret_cast(GH_MEM(0x005b66ac)); +char(&s_German_005b66c4)[8] = *reinterpret_cast(GH_MEM(0x005b66c4)); +char(&s_Ripristino_dati____005b66cc)[20] = *reinterpret_cast(GH_MEM(0x005b66cc)); +char(&s__s___Pausa_005b66e0)[12] = *reinterpret_cast(GH_MEM(0x005b66e0)); +char(&s_USCIRE_005b66ec)[8] = *reinterpret_cast(GH_MEM(0x005b66ec)); +char(&s_Premi_ESC_per_uscire_da_Rayman_3_005b66f4)[36] = *reinterpret_cast(GH_MEM(0x005b66f4)); +char(&s__s___Ripristino_dati____005b6718)[24] = *reinterpret_cast(GH_MEM(0x005b6718)); +char(&s_Italian_005b6730)[8] = *reinterpret_cast(GH_MEM(0x005b6730)); +char(&s_Restablecer_datos____005b6738)[24] = *reinterpret_cast(GH_MEM(0x005b6738)); +char(&s__s___Rotura_005b6750)[12] = *reinterpret_cast(GH_MEM(0x005b6750)); +char(&s_SALIR_005b675c)[8] = *reinterpret_cast(GH_MEM(0x005b675c)); +char(&s_Pulsa_ESC_para_salir_Rayman_3__005b6764)[32] = *reinterpret_cast(GH_MEM(0x005b6764)); +char(&s__s___Restablecer_datos____005b6784)[28] = *reinterpret_cast(GH_MEM(0x005b6784)); +char(&s_Spanish_005b67a0)[8] = *reinterpret_cast(GH_MEM(0x005b67a0)); +char(&s_Restauration)[28] = *reinterpret_cast(GH_MEM(0x005b67a8)); +char(&s__s___Pause_005b67c4)[11] = *reinterpret_cast(GH_MEM(0x005b67c4)); +char(&s_ou_appuyez_sur_Echap_pour_quitte_005b67d0)[44] = *reinterpret_cast(GH_MEM(0x005b67d0)); char(&s_QUITTER)[8] = *reinterpret_cast(GH_MEM(0x005b67fc)); -const char* s_Restauration_fmt = "%s - Restauration des donn←es..."; // 005b6804 -const char* s_French_005b6828 = "French"; // 005b6828 +char(&s_Restauration_fmt)[36] = *reinterpret_cast(GH_MEM(0x005b6804)); +char(&s_French_005b6828)[8] = *reinterpret_cast(GH_MEM(0x005b6828)); char(&s_windowTitle)[12] = *reinterpret_cast(GH_MEM(0x005b6830)); char(&s_percents)[4] = *reinterpret_cast(GH_MEM(0x005b683c)); const char* s_Language_005b6840 = "Language"; // 005b6840 @@ -57,6 +57,8 @@ const char* lpAppName_005b68f0 = "Rayman3"; // 005b68f0 const char* s_Directory_005b68f8 = "Directory"; // 005b68f8 const char* s_None = "None"; // 005b6904 const char* s_UbiSoft_Ubi_ini = "/UbiSoft/Ubi.ini"; // 005b690c +R3ModuleId& DAT_005bd29c= (R3ModuleId&) GH_MEM(0x005bd29c); +R3ModuleId& r3_module_id_ff= (R3ModuleId&) GH_MEM(0x005bd58c); const char* s_UbiSoft_bmp_005bda4c = "UbiSoft.bmp"; // 005bda4c const char* s_R3_DVD_005bdfd8 = "R3_DVD"; // 005bdfd8 const char* s_R3_DVD_005be0ec = "R3_DVD"; // 005be0ec @@ -73,13 +75,20 @@ undefined& DAT_005be500= (undefined&) GH_MEM(0x005be500); const char* s_fmt_c_colon_s = "%c:%s"; // 005be540 const char* s_r3_program_files = "\\program files\\Ubi Soft\\Rayman3"; // 005be548 undefined *& PTR_DAT_005be568= (undefined *&) GH_MEM(0x005be568); +HWND& g_gameHWND1= (HWND&) GH_MEM(0x005cf964); long& lpDefault_005cf96c= (long&) GH_MEM(0x005cf96c); undefined4& DAT_005d2660= (undefined4&) GH_MEM(0x005d2660); undefined1& DAT_005d26a8= (undefined1&) GH_MEM(0x005d26a8); undefined& lpVolumeNameBuffer_005d27b0= (undefined&) GH_MEM(0x005d27b0); r3_main_data& r3_main_data_005d28b6= (r3_main_data&) GH_MEM(0x005d28b6); -uint& hasGLIMode= (uint&) GH_MEM(0x0077d0a8); -undefined4& g_engineRunning= (undefined4&) GH_MEM(0x0077d0b4); +int& DAT_005e6b00= (int&) GH_MEM(0x005e6b00); +undefined& DAT_005e6b04= (undefined&) GH_MEM(0x005e6b04); +int& DAT_005f5e24= (int&) GH_MEM(0x005f5e24); +int& INT_0077d0a4= (int&) GH_MEM(0x0077d0a4); +int& g_runMaximized= (int&) GH_MEM(0x0077d0a8); +WPARAM& g_engineShouldRun= (WPARAM&) GH_MEM(0x0077d0b0); +int& g_engineRunning= (int&) GH_MEM(0x0077d0b4); +undefined4& DAT_0077d0b8= (undefined4&) GH_MEM(0x0077d0b8); HANDLE& g_drawSemaphore= (HANDLE&) GH_MEM(0x0077d0bc); char(&g_mutexName_Rayman3)[256] = *reinterpret_cast(GH_MEM(0x0077d0c0)); char(&g_windowTitle)[256] = *reinterpret_cast(GH_MEM(0x0077d1c0)); @@ -88,9 +97,12 @@ char(&s_windowTitleRestoring)[256] = *reinterpret_cast(GH_MEM(0x00 HINSTANCE& g_hinstance= (HINSTANCE&) GH_MEM(0x0077d4c0); HWND& g_gameHWND= (HWND&) GH_MEM(0x0077d4c4); HANDLE& g_mainThreadHandle= (HANDLE&) GH_MEM(0x0077d4c8); +word& WORD_0077d4d4= (word&) GH_MEM(0x0077d4d4); +word& WORD_0077d4d6= (word&) GH_MEM(0x0077d4d6); +dword& DWORD_0077d4d8= (dword&) GH_MEM(0x0077d4d8); char(&g_appCmdLine)[256] = *reinterpret_cast(GH_MEM(0x0077d4e0)); char(&s_wndStrRestoring)[256] = *reinterpret_cast(GH_MEM(0x0077d5e0)); -undefined2& DAT_007825c0= (undefined2&) GH_MEM(0x007825c0); +char(&s_quitting1)[64] = *reinterpret_cast(GH_MEM(0x007825c0)); char(&s_wndStrQuiting)[56] = *reinterpret_cast(GH_MEM(0x00782600)); undefined& DAT_007d7d84= (undefined&) GH_MEM(0x007d7d84); undefined2& DAT_007d7ea8= (undefined2&) GH_MEM(0x007d7ea8); diff --git a/game_re/gh_global.h b/game_re/gh_global.h index 31b2cce0..daf50b2d 100644 --- a/game_re/gh_global.h +++ b/game_re/gh_global.h @@ -5,47 +5,47 @@ #include -extern const char* s__s_not_initialized__005b63e0; // 005b63e0 -extern const char* s_Please_run_the__s_setup__005b63f4; // 005b63f4 +extern char(&s__s_not_initialized__005b63e0)[20]; // 005b63e0 +extern char(&s_Please_run_the__s_setup__005b63f4)[28]; // 005b63f4 extern char(&s_dashCC)[4]; // 005b6410 -extern const char* s_Gli_Mode_005b6414; // 005b6414 -extern const char* s_Identifier_005b6420; // 005b6420 -extern const char* s_Check_your_version_of_DirectX__V_005b6430; // 005b6430 -extern const char* lpText_005b6478; // 005b6478 -extern const char* lpText_005b64f0; // 005b64f0 -extern const char* lpText_005b6540; // 005b6540 -extern const char* s_Rayman_3_005b6588; // 005b6588 -extern const char* lpText_005b6598; // 005b6598 -extern const char* s_Erreur_Rayman_3_005b65e4; // 005b65e4 -extern const char* s_dpnhpast_dll_005b65f8; // 005b65f8 -extern const char* s_DRAWSEM_005b6608; // 005b6608 -extern const char* s_Restoring_data_____005b6610; // 005b6610 +extern char(&s_Gli_Mode_005b6414)[12]; // 005b6414 +extern char(&s_Identifier_005b6420)[16]; // 005b6420 +extern char(&s_Check_your_version_of_DirectX__V_005b6430)[72]; // 005b6430 +extern char(&lpText_005b6478)[120]; // 005b6478 +extern char(&lpText_005b64f0)[80]; // 005b64f0 +extern char(&lpText_005b6540)[72]; // 005b6540 +extern char(&s_Rayman_3_005b6588)[16]; // 005b6588 +extern char(&lpText_005b6598)[76]; // 005b6598 +extern char(&s_Erreur_Rayman_3_005b65e4)[20]; // 005b65e4 +extern char(&s_dpnhpast_dll_005b65f8)[16]; // 005b65f8 +extern char(&s_DRAWSEM_005b6608)[8]; // 005b6608 +extern char(&s_Restoring_data_____005b6610)[20]; // 005b6610 extern char(&s_QUIT)[8]; // 005b6624 -extern const char* s_or_press_ESC_to_quit_Rayman_3__005b662c; // 005b662c -extern const char* s__s___Restoring_data____005b664c; // 005b664c -extern const char* s_Daten_Reparatur____005b6664; // 005b6664 -extern undefined& s_BEENDIGEN_005b6678; // 005b6678 -extern undefined2& DAT_005b6684; // 005b6684 -extern const char* s__s___Daten_Reparatur____005b66ac; // 005b66ac -extern const char* s_German_005b66c4; // 005b66c4 -extern const char* s_Ripristino_dati____005b66cc; // 005b66cc -extern const char* s__s___Pausa_005b66e0; // 005b66e0 -extern undefined& s_USCIRE_005b66ec; // 005b66ec -extern const char* s_Premi_ESC_per_uscire_da_Rayman_3_005b66f4; // 005b66f4 -extern const char* s__s___Ripristino_dati____005b6718; // 005b6718 -extern const char* s_Italian_005b6730; // 005b6730 -extern const char* s_Restablecer_datos____005b6738; // 005b6738 -extern const char* s__s___Rotura_005b6750; // 005b6750 -extern undefined& s_SALIR_005b675c; // 005b675c -extern const char* s_Pulsa_ESC_para_salir_Rayman_3__005b6764; // 005b6764 -extern const char* s__s___Restablecer_datos____005b6784; // 005b6784 -extern const char* s_Spanish_005b67a0; // 005b67a0 -extern const char* s_Restauration; // 005b67a8 -extern const char* s__s___Pause_005b67c4; // 005b67c4 -extern const char* s_ou_appuyez_sur_Echap_pour_quitte_005b67d0; // 005b67d0 +extern char(&s_or_press_ESC_to_quit_Rayman_3__005b662c)[32]; // 005b662c +extern char(&s__s___Restoring_data____005b664c)[24]; // 005b664c +extern char(&s_Daten_Reparatur____005b6664)[20]; // 005b6664 +extern char(&s_BEENDIGEN_005b6678)[12]; // 005b6678 +extern char& CHAR_E_005b6684; // 005b6684 +extern char(&s__s___Daten_Reparatur____005b66ac)[24]; // 005b66ac +extern char(&s_German_005b66c4)[8]; // 005b66c4 +extern char(&s_Ripristino_dati____005b66cc)[20]; // 005b66cc +extern char(&s__s___Pausa_005b66e0)[12]; // 005b66e0 +extern char(&s_USCIRE_005b66ec)[8]; // 005b66ec +extern char(&s_Premi_ESC_per_uscire_da_Rayman_3_005b66f4)[36]; // 005b66f4 +extern char(&s__s___Ripristino_dati____005b6718)[24]; // 005b6718 +extern char(&s_Italian_005b6730)[8]; // 005b6730 +extern char(&s_Restablecer_datos____005b6738)[24]; // 005b6738 +extern char(&s__s___Rotura_005b6750)[12]; // 005b6750 +extern char(&s_SALIR_005b675c)[8]; // 005b675c +extern char(&s_Pulsa_ESC_para_salir_Rayman_3__005b6764)[32]; // 005b6764 +extern char(&s__s___Restablecer_datos____005b6784)[28]; // 005b6784 +extern char(&s_Spanish_005b67a0)[8]; // 005b67a0 +extern char(&s_Restauration)[28]; // 005b67a8 +extern char(&s__s___Pause_005b67c4)[11]; // 005b67c4 +extern char(&s_ou_appuyez_sur_Echap_pour_quitte_005b67d0)[44]; // 005b67d0 extern char(&s_QUITTER)[8]; // 005b67fc -extern const char* s_Restauration_fmt; // 005b6804 -extern const char* s_French_005b6828; // 005b6828 +extern char(&s_Restauration_fmt)[36]; // 005b6804 +extern char(&s_French_005b6828)[8]; // 005b6828 extern char(&s_windowTitle)[12]; // 005b6830 extern char(&s_percents)[4]; // 005b683c extern const char* s_Language_005b6840; // 005b6840 @@ -62,6 +62,8 @@ extern const char* lpAppName_005b68f0; // 005b68f0 extern const char* s_Directory_005b68f8; // 005b68f8 extern const char* s_None; // 005b6904 extern const char* s_UbiSoft_Ubi_ini; // 005b690c +extern R3ModuleId& DAT_005bd29c; // 005bd29c +extern R3ModuleId& r3_module_id_ff; // 005bd58c extern const char* s_UbiSoft_bmp_005bda4c; // 005bda4c extern const char* s_R3_DVD_005bdfd8; // 005bdfd8 extern const char* s_R3_DVD_005be0ec; // 005be0ec @@ -78,13 +80,20 @@ extern undefined& DAT_005be500; // 005be500 extern const char* s_fmt_c_colon_s; // 005be540 extern const char* s_r3_program_files; // 005be548 extern undefined *& PTR_DAT_005be568; // 005be568 +extern HWND& g_gameHWND1; // 005cf964 extern long& lpDefault_005cf96c; // 005cf96c extern undefined4& DAT_005d2660; // 005d2660 extern undefined1& DAT_005d26a8; // 005d26a8 extern undefined& lpVolumeNameBuffer_005d27b0; // 005d27b0 extern r3_main_data& r3_main_data_005d28b6; // 005d28b6 -extern uint& hasGLIMode; // 0077d0a8 -extern undefined4& g_engineRunning; // 0077d0b4 +extern int& DAT_005e6b00; // 005e6b00 +extern undefined& DAT_005e6b04; // 005e6b04 +extern int& DAT_005f5e24; // 005f5e24 +extern int& INT_0077d0a4; // 0077d0a4 +extern int& g_runMaximized; // 0077d0a8 +extern WPARAM& g_engineShouldRun; // 0077d0b0 +extern int& g_engineRunning; // 0077d0b4 +extern undefined4& DAT_0077d0b8; // 0077d0b8 extern HANDLE& g_drawSemaphore; // 0077d0bc extern char(&g_mutexName_Rayman3)[256]; // 0077d0c0 extern char(&g_windowTitle)[256]; // 0077d1c0 @@ -93,9 +102,12 @@ extern char(&s_windowTitleRestoring)[256]; // 0077d3c0 extern HINSTANCE& g_hinstance; // 0077d4c0 extern HWND& g_gameHWND; // 0077d4c4 extern HANDLE& g_mainThreadHandle; // 0077d4c8 +extern word& WORD_0077d4d4; // 0077d4d4 +extern word& WORD_0077d4d6; // 0077d4d6 +extern dword& DWORD_0077d4d8; // 0077d4d8 extern char(&g_appCmdLine)[256]; // 0077d4e0 extern char(&s_wndStrRestoring)[256]; // 0077d5e0 -extern undefined2& DAT_007825c0; // 007825c0 +extern char(&s_quitting1)[64]; // 007825c0 extern char(&s_wndStrQuiting)[56]; // 00782600 extern undefined& DAT_007d7d84; // 007d7d84 extern undefined2& DAT_007d7ea8; // 007d7ea8 diff --git a/game_re/gh_stub/r3_setupWindow.cxx b/game_re/gh_stub/Erm_fn_ucInitErrMsg.cxx similarity index 54% rename from game_re/gh_stub/r3_setupWindow.cxx rename to game_re/gh_stub/Erm_fn_ucInitErrMsg.cxx index 26ab067c..3f0f431e 100644 --- a/game_re/gh_stub/r3_setupWindow.cxx +++ b/game_re/gh_stub/Erm_fn_ucInitErrMsg.cxx @@ -6,9 +6,9 @@ #include "../gh_global.h" #include -// 00402140 -// r3_setupWindow -extern "C" undefined r3_setupWindow(undefined4 hInstance, undefined4 param_2, undefined4 maximizeWindow) { +// 0043e1d0 +// Erm_fn_ucInitErrMsg +extern "C" R3ModuleId Erm_fn_ucInitErrMsg(void) { // TODO: Implement this function - throw std::runtime_error("Function not implemented: r3_setupWindow"); + throw std::runtime_error("Function not implemented: Erm_fn_ucInitErrMsg"); } diff --git a/game_re/gh_stub/FUN_004013a0.cxx b/game_re/gh_stub/FUN_004013a0.cxx new file mode 100644 index 00000000..e5559ebb --- /dev/null +++ b/game_re/gh_stub/FUN_004013a0.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 004013a0 +// FUN_004013a0 +extern "C" undefined FUN_004013a0(void) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_004013a0"); +} diff --git a/game_re/gh_stub/FUN_0043f830.cxx b/game_re/gh_stub/FUN_0043f830.cxx new file mode 100644 index 00000000..7efb4d99 --- /dev/null +++ b/game_re/gh_stub/FUN_0043f830.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0043f830 +// FUN_0043f830 +extern "C" undefined FUN_0043f830(undefined4 param_1) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_0043f830"); +} diff --git a/game_re/gh_stub/FUN_0046ecc0.cxx b/game_re/gh_stub/FUN_0046ecc0.cxx new file mode 100644 index 00000000..a9a8e8cd --- /dev/null +++ b/game_re/gh_stub/FUN_0046ecc0.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0046ecc0 +// FUN_0046ecc0 +extern "C" undefined FUN_0046ecc0(undefined2 param_1, undefined2 param_2) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_0046ecc0"); +} diff --git a/game_re/gh_stub/FUN_0046ed70.cxx b/game_re/gh_stub/FUN_0046ed70.cxx new file mode 100644 index 00000000..c23613ef --- /dev/null +++ b/game_re/gh_stub/FUN_0046ed70.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0046ed70 +// FUN_0046ed70 +extern "C" undefined4 FUN_0046ed70(char * param_1, short * param_2) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_0046ed70"); +} diff --git a/game_re/gh_stub/FUN_0046f060.cxx b/game_re/gh_stub/FUN_0046f060.cxx new file mode 100644 index 00000000..af4a621f --- /dev/null +++ b/game_re/gh_stub/FUN_0046f060.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0046f060 +// FUN_0046f060 +extern "C" undefined FUN_0046f060(short param_1, undefined4 * param_2) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_0046f060"); +} diff --git a/game_re/gh_stub/FUN_0046f0b0.cxx b/game_re/gh_stub/FUN_0046f0b0.cxx new file mode 100644 index 00000000..5a6a485c --- /dev/null +++ b/game_re/gh_stub/FUN_0046f0b0.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0046f0b0 +// FUN_0046f0b0 +extern "C" undefined4 FUN_0046f0b0(short param_1, undefined4 * param_2, short * param_3) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_0046f0b0"); +} diff --git a/game_re/gh_stub/FUN_0046f640.cxx b/game_re/gh_stub/FUN_0046f640.cxx new file mode 100644 index 00000000..fb992699 --- /dev/null +++ b/game_re/gh_stub/FUN_0046f640.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0046f640 +// FUN_0046f640 +extern "C" undefined FUN_0046f640(undefined param_1, short param_2, undefined4 * param_3) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_0046f640"); +} diff --git a/game_re/gh_stub/FUN_0047c340.cxx b/game_re/gh_stub/FUN_0047c340.cxx new file mode 100644 index 00000000..af8f861b --- /dev/null +++ b/game_re/gh_stub/FUN_0047c340.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0047c340 +// FUN_0047c340 +extern "C" undefined FUN_0047c340(undefined4 param_1, undefined4 param_2, undefined4 param_3) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: FUN_0047c340"); +} diff --git a/game_re/gh_stub/get_one.cxx b/game_re/gh_stub/get_one.cxx new file mode 100644 index 00000000..63a74072 --- /dev/null +++ b/game_re/gh_stub/get_one.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 00485bd0 +// get_one +extern "C" undefined4 get_one(void) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: get_one"); +} diff --git a/game_re/gh_stub/r3_get_gli_height0.cxx b/game_re/gh_stub/r3_get_gli_height0.cxx new file mode 100644 index 00000000..bb3dad62 --- /dev/null +++ b/game_re/gh_stub/r3_get_gli_height0.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 004012d0 +// r3_get_gli_height0 +extern "C" int r3_get_gli_height0(void) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: r3_get_gli_height0"); +} diff --git a/game_re/gh_stub/r3_get_gli_width0.cxx b/game_re/gh_stub/r3_get_gli_width0.cxx new file mode 100644 index 00000000..16a0046a --- /dev/null +++ b/game_re/gh_stub/r3_get_gli_width0.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 004012c0 +// r3_get_gli_width0 +extern "C" int r3_get_gli_width0(void) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: r3_get_gli_width0"); +} diff --git a/game_re/gh_stub/r3_get_gli_width1.cxx b/game_re/gh_stub/r3_get_gli_width1.cxx index 9b1b85cd..10464d0f 100644 --- a/game_re/gh_stub/r3_get_gli_width1.cxx +++ b/game_re/gh_stub/r3_get_gli_width1.cxx @@ -8,7 +8,7 @@ // 0047baf0 // r3_get_gli_width1 -extern "C" undefined4 r3_get_gli_width1(void) { +extern "C" int r3_get_gli_width1(void) { // TODO: Implement this function throw std::runtime_error("Function not implemented: r3_get_gli_width1"); } diff --git a/game_re/gh_stub/r3_load_splash_bitmap.cxx b/game_re/gh_stub/r3_load_splash_bitmap.cxx new file mode 100644 index 00000000..dc647912 --- /dev/null +++ b/game_re/gh_stub/r3_load_splash_bitmap.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 00402450 +// r3_load_splash_bitmap +extern "C" void r3_load_splash_bitmap(HWND unused) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: r3_load_splash_bitmap"); +} diff --git a/game_re/gh_stub/r3_module0_init.cxx b/game_re/gh_stub/r3_module1_init.cxx similarity index 65% rename from game_re/gh_stub/r3_module0_init.cxx rename to game_re/gh_stub/r3_module1_init.cxx index 5b4be8d9..4bc6f737 100644 --- a/game_re/gh_stub/r3_module0_init.cxx +++ b/game_re/gh_stub/r3_module1_init.cxx @@ -6,9 +6,9 @@ #include "../gh_global.h" #include -// 00401000 -// r3_module0_init -extern "C" undefined r3_module0_init(void) { +// 0043e630 +// r3_module1_init +extern "C" undefined r3_module1_init(void) { // TODO: Implement this function - throw std::runtime_error("Function not implemented: r3_module0_init"); + throw std::runtime_error("Function not implemented: r3_module1_init"); } diff --git a/game_re/gh_stub/r3_module_big_init.cxx b/game_re/gh_stub/r3_module_big_init.cxx new file mode 100644 index 00000000..ac633ff4 --- /dev/null +++ b/game_re/gh_stub/r3_module_big_init.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 00443f10 +// r3_module_big_init +extern "C" undefined r3_module_big_init(void) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: r3_module_big_init"); +} diff --git a/game_re/gh_stub/r3_set_window_wh.cxx b/game_re/gh_stub/r3_set_window_wh.cxx new file mode 100644 index 00000000..ce384804 --- /dev/null +++ b/game_re/gh_stub/r3_set_window_wh.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 004012a0 +// r3_set_window_wh +extern "C" void r3_set_window_wh(undefined4 param_1, undefined4 param_2) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: r3_set_window_wh"); +} diff --git a/game_re/gh_stub/r3_wait_for_dvd.cxx b/game_re/gh_stub/r3_wait_for_dvd.cxx index f41993ad..b9c9f800 100644 --- a/game_re/gh_stub/r3_wait_for_dvd.cxx +++ b/game_re/gh_stub/r3_wait_for_dvd.cxx @@ -8,7 +8,7 @@ // 0043e540 // r3_wait_for_dvd -extern "C" undefined r3_wait_for_dvd(undefined4 param_1, undefined4 param_2, undefined4 param_3) { +extern "C" undefined r3_wait_for_dvd(char * param_1, char * param_2, undefined4 param_3) { // TODO: Implement this function throw std::runtime_error("Function not implemented: r3_wait_for_dvd"); } diff --git a/game_re/gh_stub/set_unk.cxx b/game_re/gh_stub/set_unk.cxx new file mode 100644 index 00000000..f70b7e3c --- /dev/null +++ b/game_re/gh_stub/set_unk.cxx @@ -0,0 +1,14 @@ +// AUTO-GENERATED FILE!!!! +// This function has yet to be decompiled using 'Dump Current Function' in ghidra +// with possible manualy fixes + +#include +#include "../gh_global.h" +#include + +// 0043e620 +// set_unk +extern "C" void set_unk(HWND wnd) { + // TODO: Implement this function + throw std::runtime_error("Function not implemented: set_unk"); +} diff --git a/game_re/globals.txt b/game_re/globals.txt index 5480c677..4c8cd5eb 100644 --- a/game_re/globals.txt +++ b/game_re/globals.txt @@ -1,44 +1,44 @@ -005b63e0 || s__s_not_initialized__005b63e0 || / || string -005b63f4 || s_Please_run_the__s_setup__005b63f4 || / || string +005b63e0 || s__s_not_initialized__005b63e0 || / || char[20] +005b63f4 || s_Please_run_the__s_setup__005b63f4 || / || char[28] 005b6410 || s_dashCC || / || char[4] -005b6414 || s_Gli_Mode_005b6414 || / || string -005b6420 || s_Identifier_005b6420 || / || string -005b6430 || s_Check_your_version_of_DirectX__V_005b6430 || / || string -005b6478 || lpText_005b6478 || / || TerminatedCString -005b64f0 || lpText_005b64f0 || / || TerminatedCString -005b6540 || lpText_005b6540 || / || TerminatedCString -005b6588 || s_Rayman_3_005b6588 || / || string -005b6598 || lpText_005b6598 || / || TerminatedCString -005b65e4 || s_Erreur_Rayman_3_005b65e4 || / || string -005b65f8 || s_dpnhpast_dll_005b65f8 || / || string -005b6608 || s_DRAWSEM_005b6608 || / || string -005b6610 || s_Restoring_data_____005b6610 || / || string +005b6414 || s_Gli_Mode_005b6414 || / || char[12] +005b6420 || s_Identifier_005b6420 || / || char[16] +005b6430 || s_Check_your_version_of_DirectX__V_005b6430 || / || char[72] +005b6478 || lpText_005b6478 || / || char[120] +005b64f0 || lpText_005b64f0 || / || char[80] +005b6540 || lpText_005b6540 || / || char[72] +005b6588 || s_Rayman_3_005b6588 || / || char[16] +005b6598 || lpText_005b6598 || / || char[76] +005b65e4 || s_Erreur_Rayman_3_005b65e4 || / || char[20] +005b65f8 || s_dpnhpast_dll_005b65f8 || / || char[16] +005b6608 || s_DRAWSEM_005b6608 || / || char[8] +005b6610 || s_Restoring_data_____005b6610 || / || char[20] 005b6624 || s_QUIT || / || char[8] -005b662c || s_or_press_ESC_to_quit_Rayman_3__005b662c || / || string -005b664c || s__s___Restoring_data____005b664c || / || string -005b6664 || s_Daten_Reparatur____005b6664 || / || string -005b6678 || s_BEENDIGEN_005b6678 || / || undefined -005b6684 || DAT_005b6684 || / || undefined2 -005b66ac || s__s___Daten_Reparatur____005b66ac || / || string -005b66c4 || s_German_005b66c4 || / || string -005b66cc || s_Ripristino_dati____005b66cc || / || string -005b66e0 || s__s___Pausa_005b66e0 || / || string -005b66ec || s_USCIRE_005b66ec || / || undefined -005b66f4 || s_Premi_ESC_per_uscire_da_Rayman_3_005b66f4 || / || string -005b6718 || s__s___Ripristino_dati____005b6718 || / || string -005b6730 || s_Italian_005b6730 || / || string -005b6738 || s_Restablecer_datos____005b6738 || / || string -005b6750 || s__s___Rotura_005b6750 || / || string -005b675c || s_SALIR_005b675c || / || undefined -005b6764 || s_Pulsa_ESC_para_salir_Rayman_3__005b6764 || / || string -005b6784 || s__s___Restablecer_datos____005b6784 || / || string -005b67a0 || s_Spanish_005b67a0 || / || string -005b67a8 || s_Restauration || / || TerminatedCString -005b67c4 || s__s___Pause_005b67c4 || / || string -005b67d0 || s_ou_appuyez_sur_Echap_pour_quitte_005b67d0 || / || string +005b662c || s_or_press_ESC_to_quit_Rayman_3__005b662c || / || char[32] +005b664c || s__s___Restoring_data____005b664c || / || char[24] +005b6664 || s_Daten_Reparatur____005b6664 || / || char[20] +005b6678 || s_BEENDIGEN_005b6678 || / || char[12] +005b6684 || CHAR_E_005b6684 || / || char +005b66ac || s__s___Daten_Reparatur____005b66ac || / || char[24] +005b66c4 || s_German_005b66c4 || / || char[8] +005b66cc || s_Ripristino_dati____005b66cc || / || char[20] +005b66e0 || s__s___Pausa_005b66e0 || / || char[12] +005b66ec || s_USCIRE_005b66ec || / || char[8] +005b66f4 || s_Premi_ESC_per_uscire_da_Rayman_3_005b66f4 || / || char[36] +005b6718 || s__s___Ripristino_dati____005b6718 || / || char[24] +005b6730 || s_Italian_005b6730 || / || char[8] +005b6738 || s_Restablecer_datos____005b6738 || / || char[24] +005b6750 || s__s___Rotura_005b6750 || / || char[12] +005b675c || s_SALIR_005b675c || / || char[8] +005b6764 || s_Pulsa_ESC_para_salir_Rayman_3__005b6764 || / || char[32] +005b6784 || s__s___Restablecer_datos____005b6784 || / || char[28] +005b67a0 || s_Spanish_005b67a0 || / || char[8] +005b67a8 || s_Restauration || / || char[28] +005b67c4 || s__s___Pause_005b67c4 || / || char[11] +005b67d0 || s_ou_appuyez_sur_Echap_pour_quitte_005b67d0 || / || char[44] 005b67fc || s_QUITTER || / || char[8] -005b6804 || s_Restauration_fmt || / || TerminatedCString -005b6828 || s_French_005b6828 || / || string +005b6804 || s_Restauration_fmt || / || char[36] +005b6828 || s_French_005b6828 || / || char[8] 005b6830 || s_windowTitle || / || char[12] 005b683c || s_percents || / || char[4] 005b6840 || s_Language_005b6840 || / || string @@ -55,6 +55,8 @@ 005b68f8 || s_Directory_005b68f8 || / || string 005b6904 || s_None || / || TerminatedCString 005b690c || s_UbiSoft_Ubi_ini || / || TerminatedCString +005bd29c || DAT_005bd29c || / || R3ModuleId +005bd58c || r3_module_id_ff || / || R3ModuleId 005bda4c || s_UbiSoft_bmp_005bda4c || / || string 005bdfd8 || s_R3_DVD_005bdfd8 || / || string 005be0ec || s_R3_DVD_005be0ec || / || string @@ -71,13 +73,20 @@ 005be540 || s_fmt_c_colon_s || / || string 005be548 || s_r3_program_files || / || string 005be568 || PTR_DAT_005be568 || / || undefined * +005cf964 || g_gameHWND1 || /windef.h || HWND 005cf96c || lpDefault_005cf96c || / || long 005d2660 || DAT_005d2660 || / || undefined4 005d26a8 || DAT_005d26a8 || / || undefined1 005d27b0 || lpVolumeNameBuffer_005d27b0 || / || undefined 005d28b6 || r3_main_data_005d28b6 || / || r3_main_data -0077d0a8 || hasGLIMode || / || uint -0077d0b4 || g_engineRunning || / || undefined4 +005e6b00 || DAT_005e6b00 || / || int +005e6b04 || DAT_005e6b04 || / || undefined +005f5e24 || DAT_005f5e24 || / || int +0077d0a4 || INT_0077d0a4 || / || int +0077d0a8 || g_runMaximized || / || int +0077d0b0 || g_engineShouldRun || /WinDef.h || WPARAM +0077d0b4 || g_engineRunning || / || int +0077d0b8 || DAT_0077d0b8 || / || undefined4 0077d0bc || g_drawSemaphore || /winnt.h || HANDLE 0077d0c0 || g_mutexName_Rayman3 || / || char[256] 0077d1c0 || g_windowTitle || / || char[256] @@ -86,9 +95,12 @@ 0077d4c0 || g_hinstance || /windef.h || HINSTANCE 0077d4c4 || g_gameHWND || /windef.h || HWND 0077d4c8 || g_mainThreadHandle || /winnt.h || HANDLE +0077d4d4 || WORD_0077d4d4 || / || word +0077d4d6 || WORD_0077d4d6 || / || word +0077d4d8 || DWORD_0077d4d8 || / || dword 0077d4e0 || g_appCmdLine || / || char[256] 0077d5e0 || s_wndStrRestoring || / || char[256] -007825c0 || DAT_007825c0 || / || undefined2 +007825c0 || s_quitting1 || / || char[64] 00782600 || s_wndStrQuiting || / || char[56] 007d7d84 || DAT_007d7d84 || / || undefined 007d7ea8 || DAT_007d7ea8 || / || undefined2 diff --git a/scripts/re3lib/FunctionDumper.java b/scripts/re3lib/FunctionDumper.java index 59690bcd..b3bc0170 100644 --- a/scripts/re3lib/FunctionDumper.java +++ b/scripts/re3lib/FunctionDumper.java @@ -156,6 +156,11 @@ public class FunctionDumper { // Parse preliminary line tokens for (int i = 0; i < line.getNumTokens(); i++) { ClangToken token = line.getToken(i); + if (token.getText().equals("__cdecl") || token.getText().equals("__thiscall") + || token.getText().equals("__stdcall")) { + // Remove function declaration + continue; + } if (!token.getText().isEmpty()) tokens.add(token); } @@ -208,8 +213,14 @@ public class FunctionDumper { address = gsym.getStorage().getMinAddress(); } + // Check if it's a function pointer, otherwise add to globals if (address.isMemoryAddress()) { - globalDumper.addGlobal(address, gsym); + Function maybeFunction = script.getFunctionAt(address); + if (maybeFunction != null) { + externalFunctionCalls.add(maybeFunction); + } else { + globalDumper.addGlobal(address, gsym); + } } } @@ -223,10 +234,6 @@ public class FunctionDumper { Function calledFunction = script.getFunctionAt(callAddr); if (calledFunction != null) { if (isValidFunction(calledFunction)) { - String proto = calledFunction.getSignature().getPrototypeString(false); - headers.add("" + proto - + "; // " + calledFunction.getEntryPoint() + " // " - + calledFunction.getName()); externalFunctionCalls.add(calledFunction); } } @@ -243,6 +250,13 @@ public class FunctionDumper { codeWriter.write('\n'); } + for (Function externalFunction : externalFunctionCalls) { + String proto = externalFunction.getSignature().getPrototypeString(false); + headers.add("" + proto + + "; // " + externalFunction.getEntryPoint() + " // " + + externalFunction.getName()); + } + for (String header : headers) { writer2.println(header); } diff --git a/scripts/re3lib/GlobalDumper.java b/scripts/re3lib/GlobalDumper.java index 7de4704d..eb68b50c 100644 --- a/scripts/re3lib/GlobalDumper.java +++ b/scripts/re3lib/GlobalDumper.java @@ -103,6 +103,21 @@ public class GlobalDumper { public void addGlobal(Address addr, HighSymbol sym) { DataType dt = sym.getDataType(); + // if(symb.get + if (sym.getDataType().getName() == "undefined") { + // script.println("UNDEFINED: " + addr + " - " + dt.getDisplayName() + " - " + + // dt.getClass().getName()); + Data data = script.getDataAt(addr); + if (data != null) { + dt = data.getDataType(); + // script.println("DATA: " + addr + " - " + dt.getDisplayName()); + } + } + // if(sym.getName().startsWith("s_SALIR")) { + // script.println("SALIR: " + addr + " - " + dt.getDisplayName() + " - " + + // dt.getClass().getName()); + // // script.println("SALIR: " + sym.getdata()); + // } if (dt == null) { script.println("WARNING: Missing type for global: " + sym.getName() + " at " + addr); return; @@ -195,7 +210,8 @@ public class GlobalDumper { Array adt = (Array) dt; DataType baseType = adt.getDataType(); hwriter.println( - linkagePrefix + baseType.getDisplayName() + "(&" + name + ")[" + adt.getNumElements() + "]; // " + addr); + linkagePrefix + baseType.getDisplayName() + "(&" + name + ")[" + adt.getNumElements() + "]; // " + + addr); cwriter.println( baseType.getDisplayName() + "(&" + name + ")[" + adt.getNumElements() + "] = *reinterpret_cast<" + baseType.getDisplayName() + "(*)[" + adt.getNumElements() + "]>(GH_MEM(0x" + addr + "));");