diff --git a/game_re/gh_fix/FUN_0046f240.cxx b/game_re/gh_fix/FUN_0046f240.cxx new file mode 100644 index 00000000..5dd481c7 --- /dev/null +++ b/game_re/gh_fix/FUN_0046f240.cxx @@ -0,0 +1,41 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + +extern "C" { +undefined FUN_0046ecc0(undefined2 param_1, undefined2 param_2); // 0046ecc0 // FUN_0046ecc0 + +// 0046f240 +/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */ + +undefined4 __cdecl FUN_0046f240(short param_1,short param_2,undefined4 *param_3) + +{ + uint uVar1; + undefined4 *puVar2; + uint uVar3; + int iVar4; + + DAT_005e6b04 = 1; + do { + } while (DAT_005e6b00 != 0); + uVar1 = (uint)param_2; + uVar3 = uVar1 & 0x8000000f; + if ((int)uVar3 < 0) { + uVar3 = (uVar3 - 1 | 0xfffffff0) + 1; + } + puVar2 = (undefined4 *)FUN_0046ecc0((int)(uVar1 + ((int)uVar1 >> 0x1f & 0xfU)) >> 4,uVar3); + puVar2[0x19] = 0xffffffff; + puVar2[0x18] = 0; + for (iVar4 = 0x1c; iVar4 != 0; iVar4 = iVar4 + -1) { + *param_3 = *puVar2; + puVar2 = puVar2 + 1; + param_3 = param_3 + 1; + } + DAT_005e6b04 = 0; + return 1; +} + +} + diff --git a/game_re/gh_fix/FUN_0047c150.cxx b/game_re/gh_fix/FUN_0047c150.cxx new file mode 100644 index 00000000..6abbfcc8 --- /dev/null +++ b/game_re/gh_fix/FUN_0047c150.cxx @@ -0,0 +1,30 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + +extern "C" { +undefined FUN_0047c340(dword* param_1, dword* param_2, undefined4 param_3); // 0047c340 // FUN_0047c340 +undefined FUN_0046f240(short param_1, short param_2, undefined4 * param_3); // 0046f240 // FUN_0046f240 +undefined FUN_0046f060(short param_1, undefined4 * param_2); // 0046f060 // FUN_0046f060 + +// 0047c150 +void FUN_0047c150(short param_1,short param_2,int param_3) + +{ + int iVar1; + dword local_d0 [24]; + dword local_70 [28]; + + iVar1 = FUN_0046f060(param_1,local_d0); + if ((iVar1 != 0) && (iVar1 = FUN_0046f240(param_1,param_2,local_70), iVar1 != 0)) { + if (param_3 != 0) { + DAT_005f5e24 = param_3; + } + FUN_0047c340(local_d0,local_70,DAT_005f5e24); + } + return; +} + +} + diff --git a/game_re/gh_fix/getHWND.cxx b/game_re/gh_fix/getHWND.cxx new file mode 100644 index 00000000..ee6d1a3b --- /dev/null +++ b/game_re/gh_fix/getHWND.cxx @@ -0,0 +1,15 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + + +// 00401410 + +HWND getHWND(void) + +{ + return g_gameHWND; +} + + diff --git a/game_re/gh_fix/r3_containsCmdLine.cxx b/game_re/gh_fix/r3_containsCmdLine.cxx new file mode 100644 index 00000000..23908345 --- /dev/null +++ b/game_re/gh_fix/r3_containsCmdLine.cxx @@ -0,0 +1,118 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + +extern "C" { + +// 004028e0 +/* maybe */ + +uint32_t r3_containsCmdLine(uint *param_1,char *param_2) + +{ + char *pcVar1; + char *pcVar2; + char cVar3; + uint uVar4; + uint *puVar5; + char cVar6; + uint uVar7; + char *pcVar8; + uint uVar9; + uint *puVar10; + + cVar3 = *param_2; + if (cVar3 == '\0') { + return (uint32_t)param_1; + } + if (param_2[1] == '\0') { + uVar4 = (uint)param_1 & 3; + while (uVar4 != 0) { + if (*(char *)param_1 == cVar3) { + return (uint32_t)param_1; + } + if (*(char *)param_1 == '\0') { + return 0; + } + uVar4 = (uint)(uint *)((int)param_1 + 1) & 3; + param_1 = (uint *)((int)param_1 + 1); + } + while( true ) { + while( true ) { + uVar4 = *param_1; + uVar9 = uVar4 ^ CONCAT22(CONCAT11(cVar3,cVar3),CONCAT11(cVar3,cVar3)); + uVar7 = uVar4 ^ 0xffffffff ^ uVar4 + 0x7efefeff; + puVar10 = param_1 + 1; + if (((uVar9 ^ 0xffffffff ^ uVar9 + 0x7efefeff) & 0x81010100) != 0) break; + param_1 = puVar10; + if ((uVar7 & 0x81010100) != 0) { + if ((uVar7 & 0x1010100) != 0) { + return 0; + } + if ((uVar4 + 0x7efefeff & 0x80000000) == 0) { + return 0; + } + } + } + uVar4 = *param_1; + if ((char)uVar4 == cVar3) { + return (uint32_t)param_1; + } + if ((char)uVar4 == '\0') { + return 0; + } + cVar6 = (char)(uVar4 >> 8); + if (cVar6 == cVar3) { + return (uint32_t)(char *)((int)param_1 + 1); + } + if (cVar6 == '\0') break; + cVar6 = (char)(uVar4 >> 0x10); + if (cVar6 == cVar3) { + return (uint32_t)(char *)((int)param_1 + 2); + } + if (cVar6 == '\0') { + return 0; + } + cVar6 = (char)(uVar4 >> 0x18); + if (cVar6 == cVar3) { + return (uint32_t)(char *)((int)param_1 + 3); + } + param_1 = puVar10; + if (cVar6 == '\0') { + return 0; + } + } + return 0; + } + do { + cVar6 = *(char *)param_1; + do { + while (puVar10 = param_1, param_1 = (uint *)((int)puVar10 + 1), cVar6 != cVar3) { + if (cVar6 == '\0') { + return 0; + } + cVar6 = *(char *)param_1; + } + cVar6 = *(char *)param_1; + pcVar8 = param_2; + puVar5 = puVar10; + } while (cVar6 != param_2[1]); + do { + if (pcVar8[2] == '\0') { + return (uint32_t)puVar10; + } + if (*(char *)(uint *)((int)puVar5 + 2) != pcVar8[2]) break; + pcVar1 = pcVar8 + 3; + if (*pcVar1 == '\0') { + return (uint32_t)puVar10; + } + pcVar2 = (char *)((int)puVar5 + 3); + pcVar8 = pcVar8 + 2; + puVar5 = (uint *)((int)puVar5 + 2); + } while (*pcVar1 == *pcVar2); + } while( true ); +} + +} + diff --git a/game_re/gh_fix/r3_main.cxx b/game_re/gh_fix/r3_main.cxx new file mode 100644 index 00000000..5ff50d3d --- /dev/null +++ b/game_re/gh_fix/r3_main.cxx @@ -0,0 +1,597 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + +extern "C" { +undefined FUN_00470db0(void); // 00470db0 // FUN_00470db0 +undefined r3_checkDisc(void); // 004464f0 // r3_checkDisc +undefined FUN_00503710(void); // 00503710 // FUN_00503710 +undefined r3_module0_init(void); // 00401000 // r3_module0_init +undefined FUN_00472150(void); // 00472150 // FUN_00472150 +undefined r3_wait_for_dvd(char * param_1, char * param_2, undefined4 param_3); // 0043e540 // r3_wait_for_dvd +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 +undefined gfx_init2(void); // 00470be0 // gfx_init2 +void g_setInitVar0(void); // 00401310 // g_setInitVar0 +int r3_get_gli_height1(void); // 0047bb00 // r3_get_gli_height1 +undefined FUN_004010b0(void); // 004010b0 // FUN_004010b0 +undefined FUN_00401320(void); // 00401320 // FUN_00401320 +void r3_noop(void * p_cTxt1, void * p_cTxt2); // 00401100 // r3_noop +undefined r3_initEngine(void); // 00401220 // r3_initEngine +undefined FUN_005038e0(void); // 005038e0 // FUN_005038e0 +undefined FUN_004fb300(void); // 004fb300 // FUN_004fb300 +undefined spawnThread(void); // 004477d0 // spawnThread +undefined r3_setupWindow(HINSTANCE hInstance, undefined4 param_2, undefined4 maximizeWindow); // 00402140 // r3_setupWindow + +// 00401630 +int r3_main(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR *cmdline,int showCmd) + +{ + undefined4 uVar1; + undefined2 uVar3; + LPSTR pCVar3; + char *pcVar4; + FILE *pFVar5; + LONG LVar6; + HMODULE hLibModule; + DWORD DVar7; + HANDLE hTargetProcessHandle; + HANDLE hSourceHandle; + HANDLE hSourceProcessHandle; + LPSTR *ppCVar8; + uint32_t uVar9; + HWND hWnd; + int iVar10; + int iVar11; + int iVar12; + int iVar13; + uint uVar14; + void *unaff_ESI; + undefined4 *puVar15; + void *unaff_EDI; + undefined4 *puVar16; + char *pcVar17; + 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]; + BOOL BVar18; + char cVar1; + undefined4 chars; + DWORD dwOptions; + tagRECT *lpRect; + HANDLE *lpTargetHandle; + undefined2 uVar2; + undefined4 uVar22; + + /* Append windows dir / ubi.ini */ + GetWindowsDirectoryA(pathToUbi_ini,0x104); + iVar13 = -1; + pcVar4 = pathToUbi_ini; + do { + pcVar17 = pcVar4; + if (iVar13 == 0) break; + iVar13 = iVar13 + -1; + pcVar17 = pcVar4 + 1; + cVar1 = *pcVar4; + pcVar4 = pcVar17; + } while (cVar1 != '\0'); + *(undefined4 *)(pcVar17 + -1) = s_UbiSoft_Ubi_ini + Field<0, 4>(); + *(undefined4 *)(pcVar17 + 3) = s_UbiSoft_Ubi_ini + Field<4, 4>(); + *(undefined4 *)(pcVar17 + 7) = s_UbiSoft_Ubi_ini + Field<8, 4>(); + *(undefined4 *)(pcVar17 + 0xb) = s_UbiSoft_Ubi_ini + Field<12, 4>(); + pcVar17[0xf] = s_UbiSoft_Ubi_ini[0x10]; + pCVar3 = GetCommandLineA(); + pcVar4 = pCVar3 + 1; + iVar13 = -(int)pcVar4; + do { + cVar1 = *pcVar4; + pcVar4[(int)(acStack_810 + iVar13)] = cVar1; + pcVar4 = pcVar4 + 1; + } while (cVar1 != '\0'); + pcVar4 = strrchr(acStack_810,0x5c); + if (pcVar4 == (char *)0x0) { + /* Read from ubi.ini */ + GetPrivateProfileStringA + (lpAppName_005b68f0,s_Directory_005b68f8,s_None,acStack_810,0xff,pathToUbi_ini); + iVar13 = strcmpi(acStack_810,s_None); + } + else { + pcVar4 = strrchr(acStack_810,0x5c); + *pcVar4 = '\0'; + iVar13 = chdir(acStack_810); + if (iVar13 != -1) goto LAB_00401765; + /* Read from ubi.ini */ + GetPrivateProfileStringA + (lpAppName_005b68f0,s_Directory_005b68f8,s_None,acStack_810,0xff,pathToUbi_ini); + iVar13 = strcmpi(acStack_810,s_None); + } + if (iVar13 != 0) { + chdir(acStack_810); + } +LAB_00401765: + /* strcpy */ + iVar13 = 0; + do { + cVar1 = acStack_810[iVar13]; + r3_main_data_005d28b6.gameDataDir[iVar13] = cVar1; + iVar13 = iVar13 + 1; + } while (cVar1 != '\0'); + strlwr(r3_main_data_005d28b6.gameDataDir); + iVar13 = -1; + pcVar4 = r3_main_data_005d28b6.gameDataDir; + do { + if (iVar13 == 0) break; + iVar13 = iVar13 + -1; + cVar1 = *pcVar4; + pcVar4 = pcVar4 + 1; + } while (cVar1 != '\0'); +joined_r0x00401792: + if (iVar13 != -2) { + uVar14 = 0xffffffff; + pcVar4 = r3_main_data_005d28b6.gameDataDir; + do { + if (uVar14 == 0) break; + uVar14 = uVar14 - 1; + cVar1 = *pcVar4; + pcVar4 = pcVar4 + 1; + } while (cVar1 != '\0'); + if (r3_main_data_005d28b6.gameDataDir[~uVar14 - 2] != '\\') goto LAB_004017ce; + uVar14 = 0xffffffff; + pcVar4 = r3_main_data_005d28b6.gameDataDir; + do { + if (uVar14 == 0) break; + uVar14 = uVar14 - 1; + cVar1 = *pcVar4; + pcVar4 = pcVar4 + 1; + } while (cVar1 != '\0'); + r3_main_data_005d28b6.gameDataDir[~uVar14 - 2] = '\0'; + iVar13 = -1; + pcVar4 = r3_main_data_005d28b6.gameDataDir; + do { + if (iVar13 == 0) break; + iVar13 = iVar13 + -1; + cVar1 = *pcVar4; + pcVar4 = pcVar4 + 1; + } while (cVar1 != '\0'); + goto joined_r0x00401792; + } +LAB_004017ce: + pFVar5 = fopen(pathToUbi_ini,fopen_mode_r_text); + GetPrivateProfileStringA + (lpAppName_005b68f0,s_Adapter_005b68e4,(LPCSTR)&lpDefault_005cf96c,acStack_300,0xff, + pathToUbi_ini); + if ((pFVar5 == (FILE *)0x0) || (acStack_300[0] == '\0')) { + /* Concat game data dir with r3 setup exe */ + iVar13 = 0; + do { + cVar1 = r3_main_data_005d28b6.gameDataDir[iVar13]; + acStack_508[iVar13] = cVar1; + iVar13 = iVar13 + 1; + } while (cVar1 != '\0'); + iVar13 = -1; + pcVar4 = acStack_508; + do { + pcVar17 = pcVar4; + if (iVar13 == 0) break; + iVar13 = iVar13 + -1; + pcVar17 = pcVar4 + 1; + cVar1 = *pcVar4; + pcVar4 = pcVar17; + } while (cVar1 != '\0'); + *(undefined4 *)(pcVar17 + -1) = s__R3_Setup_DX8_exe_005b68d0 + Field<0, 4>(); + *(undefined4 *)(pcVar17 + 3) = s__R3_Setup_DX8_exe_005b68d0 + Field<4, 4>(); + *(undefined4 *)(pcVar17 + 7) = s__R3_Setup_DX8_exe_005b68d0 + Field<8, 4>(); + *(undefined4 *)(pcVar17 + 0xb) = s__R3_Setup_DX8_exe_005b68d0 + Field<12, 4>(); + *(undefined2 *)(pcVar17 + 0xf) = s__R3_Setup_DX8_exe_005b68d0 + Field<16, 2>(); + pFVar5 = fopen(acStack_508,fopen_mode_r_binary); + if (pFVar5 == (FILE *)0x0) { + MessageBoxA((HWND)0x0,s_Unable_to_find_R3_Setup_DX8_exe__005b6880,s_Rayman_3_Error_005b68bc, + 0x10); + return -1; + } + fclose(pFVar5); + spawnl(0,acStack_508,acStack_508,0); + pFVar5 = fopen(pathToUbi_ini,fopen_mode_r_text); + if (pFVar5 == (FILE *)0x0) { + return -1; + } + } + fclose(pFVar5); + /* Open reg key + HKEY_LOCAL_MACHINE\\SOFTWARE\\UBI SOFT\\RAYMAN 3 */ + LVar6 = RegOpenKeyExA((HKEY)0x80000002,s_SOFTWARE_UBI_SOFT_RAYMAN_3_005b6864,0,0x20019, + &pHStack_838); + if (LVar6 == 0) { + LVar6 = RegQueryValueExA(pHStack_838,s_CompleteInstall_005b6854,(LPDWORD)0x0,&DStack_824, + aBStack_82c,&DStack_828); + DAT_007d9cc4 = (uint)(LVar6 == 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 */ + iVar13 = strcmpi(languageStr,s_French_005b6828); + if (iVar13 == 0) { + sprintf(s_windowTitleRestoring,s_Restauration_fmt,s_windowTitle); + chars = s_QUITTER + Field<4, 4>(); + puVar15 = (undefined4 *)s_ou_appuyez_sur_Echap_pour_quitte_005b67d0; + puVar16 = (undefined4 *)s_quitting1; + for (iVar13 = 0xb; uVar22 = s_QUITTER + Field<4, 4>(), iVar13 != 0; iVar13 = iVar13 + -1) { + *puVar16 = *puVar15; + puVar15 = puVar15 + 1; + puVar16 = puVar16 + 1; + } + s_wndStrQuiting[0] = s_QUITTER[0]; + s_wndStrQuiting[1] = s_QUITTER[1]; + s_wndStrQuiting[2] = s_QUITTER[2]; + s_wndStrQuiting[3] = s_QUITTER[3]; + /* Wrong decompilation? */ + s_QUITTER[4] = (char)chars; + s_QUITTER[5] = SUB41(chars,1); + s_QUITTER[6] = SUB41(chars,2); + s_QUITTER[7] = SUB41(chars,3); + s_wndStrQuiting[4] = s_QUITTER[4]; + s_wndStrQuiting[5] = s_QUITTER[5]; + s_wndStrQuiting[6] = s_QUITTER[6]; + s_wndStrQuiting[7] = s_QUITTER[7]; + s_QUITTER + Field<4, 4>() = uVar22; + sprintf(lpString_0077d2c0,s__s___Pause_005b67c4,s_windowTitle); + puVar15 = (undefined4 *)s_Restauration; + puVar16 = (undefined4 *)s_wndStrRestoring; + for (iVar13 = 7; iVar13 != 0; iVar13 = iVar13 + -1) { + *puVar16 = *puVar15; + puVar15 = puVar15 + 1; + puVar16 = puVar16 + 1; + } + } + else { + iVar13 = strcmpi(languageStr,s_Spanish_005b67a0); + if (iVar13 == 0) { + sprintf(s_windowTitleRestoring,s__s___Restablecer_datos____005b6784,s_windowTitle); + uVar2 = s_SALIR_005b675c + Field<4, 2>(); + puVar15 = (undefined4 *)s_Pulsa_ESC_para_salir_Rayman_3__005b6764; + puVar16 = (undefined4 *)s_quitting1; + for (iVar13 = 7; chars = s_SALIR_005b675c + Field<0, 4>(), iVar13 != 0; iVar13 = iVar13 + -1) { + *puVar16 = *puVar15; + puVar15 = puVar15 + 1; + puVar16 = puVar16 + 1; + } + *(undefined2 *)puVar16 = *(undefined2 *)puVar15; + *(undefined *)((int)puVar16 + 2) = *(undefined *)((int)puVar15 + 2); + uVar3 = s_SALIR_005b675c + Field<4, 2>(); + uVar22 = s_SALIR_005b675c + Field<0, 4>(); + s_SALIR_005b675c[0] = (char)chars; + s_SALIR_005b675c[1] = SUB41(chars,1); + s_SALIR_005b675c[2] = SUB41(chars,2); + s_SALIR_005b675c[3] = SUB41(chars,3); + s_wndStrQuiting[0] = s_SALIR_005b675c[0]; + s_wndStrQuiting[1] = s_SALIR_005b675c[1]; + s_wndStrQuiting[2] = s_SALIR_005b675c[2]; + s_wndStrQuiting[3] = s_SALIR_005b675c[3]; + s_SALIR_005b675c[4] = (char)uVar2; + s_SALIR_005b675c[5] = SUB21(uVar2,1); + s_wndStrQuiting[4] = s_SALIR_005b675c[4]; + s_wndStrQuiting[5] = s_SALIR_005b675c[5]; + s_SALIR_005b675c + Field<0, 4>() = uVar22; + s_SALIR_005b675c + Field<4, 2>() = uVar3; + sprintf(lpString_0077d2c0,s__s___Rotura_005b6750,s_windowTitle); + puVar15 = (undefined4 *)s_Restablecer_datos____005b6738; + puVar16 = (undefined4 *)s_wndStrRestoring; + for (iVar13 = 5; iVar13 != 0; iVar13 = iVar13 + -1) { + *puVar16 = *puVar15; + puVar15 = puVar15 + 1; + puVar16 = puVar16 + 1; + } + *(undefined *)puVar16 = *(undefined *)puVar15; + } + else { + iVar13 = strcmpi(languageStr,s_Italian_005b6730); + if (iVar13 == 0) { + sprintf(s_windowTitleRestoring,s__s___Ripristino_dati____005b6718,s_windowTitle); + uVar2 = s_USCIRE_005b66ec + Field<4, 2>(); + puVar15 = (undefined4 *)s_Premi_ESC_per_uscire_da_Rayman_3_005b66f4; + puVar16 = (undefined4 *)s_quitting1; + for (iVar13 = 8; cVar1 = s_USCIRE_005b66ec[6], iVar13 != 0; iVar13 = iVar13 + -1) { + *puVar16 = *puVar15; + puVar15 = puVar15 + 1; + puVar16 = puVar16 + 1; + } + s_wndStrQuiting[0] = s_USCIRE_005b66ec[0]; + s_wndStrQuiting[1] = s_USCIRE_005b66ec[1]; + s_wndStrQuiting[2] = s_USCIRE_005b66ec[2]; + s_wndStrQuiting[3] = s_USCIRE_005b66ec[3]; + *(undefined2 *)puVar16 = *(undefined2 *)puVar15; + s_wndStrQuiting + Field<4, 3>() = CONCAT12(cVar1,uVar2); + sprintf(lpString_0077d2c0,s__s___Pausa_005b66e0,s_windowTitle); + s_wndStrRestoring[0] = s_Ripristino_dati____005b66cc[0]; + s_wndStrRestoring[1] = s_Ripristino_dati____005b66cc[1]; + s_wndStrRestoring[2] = s_Ripristino_dati____005b66cc[2]; + s_wndStrRestoring[3] = s_Ripristino_dati____005b66cc[3]; + s_wndStrRestoring[4] = s_Ripristino_dati____005b66cc[4]; + s_wndStrRestoring[5] = s_Ripristino_dati____005b66cc[5]; + s_wndStrRestoring[6] = s_Ripristino_dati____005b66cc[6]; + s_wndStrRestoring[7] = s_Ripristino_dati____005b66cc[7]; + s_wndStrRestoring[8] = s_Ripristino_dati____005b66cc[8]; + s_wndStrRestoring[9] = s_Ripristino_dati____005b66cc[9]; + s_wndStrRestoring[10] = s_Ripristino_dati____005b66cc[10]; + s_wndStrRestoring[0xb] = s_Ripristino_dati____005b66cc[0xb]; + s_wndStrRestoring + Field<12, 4>() = s_Ripristino_dati____005b66cc + Field<12, 4>(); + s_wndStrRestoring + Field<16, 2>() = s_Ripristino_dati____005b66cc + Field<16, 2>(); + s_wndStrRestoring[0x12] = s_Ripristino_dati____005b66cc[0x12]; + } + else { + iVar13 = strcmpi(languageStr,s_German_005b66c4); + if (iVar13 == 0) { + sprintf(s_windowTitleRestoring,s__s___Daten_Reparatur____005b66ac,s_windowTitle); + chars = s_BEENDIGEN_005b6678 + Field<0, 4>(); + puVar15 = (undefined4 *)&CHAR_E_005b6684; + puVar16 = (undefined4 *)s_quitting1; + for (iVar13 = 9; uVar2 = s_BEENDIGEN_005b6678 + Field<8, 2>(), uVar22 = s_BEENDIGEN_005b6678 + Field<4, 4>(), + iVar13 != 0; iVar13 = iVar13 + -1) { + *puVar16 = *puVar15; + puVar15 = puVar15 + 1; + puVar16 = puVar16 + 1; + } + *(undefined2 *)puVar16 = *(undefined2 *)puVar15; + uVar1 = s_BEENDIGEN_005b6678 + Field<0, 4>(); + s_BEENDIGEN_005b6678[0] = (char)chars; + s_BEENDIGEN_005b6678[1] = SUB41(chars,1); + s_BEENDIGEN_005b6678[2] = SUB41(chars,2); + s_BEENDIGEN_005b6678[3] = SUB41(chars,3); + s_wndStrQuiting[0] = s_BEENDIGEN_005b6678[0]; + s_wndStrQuiting[1] = s_BEENDIGEN_005b6678[1]; + s_wndStrQuiting[2] = s_BEENDIGEN_005b6678[2]; + s_wndStrQuiting[3] = s_BEENDIGEN_005b6678[3]; + s_BEENDIGEN_005b6678 + Field<0, 4>() = uVar1; + *(undefined *)((int)puVar16 + 2) = *(undefined *)((int)puVar15 + 2); + uVar3 = s_BEENDIGEN_005b6678 + Field<8, 2>(); + chars = s_BEENDIGEN_005b6678 + Field<4, 4>(); + s_BEENDIGEN_005b6678[4] = (char)uVar22; + s_BEENDIGEN_005b6678[5] = SUB41(uVar22,1); + s_BEENDIGEN_005b6678[6] = SUB41(uVar22,2); + s_BEENDIGEN_005b6678[7] = SUB41(uVar22,3); + s_wndStrQuiting[4] = s_BEENDIGEN_005b6678[4]; + s_wndStrQuiting[5] = s_BEENDIGEN_005b6678[5]; + s_wndStrQuiting[6] = s_BEENDIGEN_005b6678[6]; + s_wndStrQuiting[7] = s_BEENDIGEN_005b6678[7]; + s_BEENDIGEN_005b6678[8] = (char)uVar2; + s_BEENDIGEN_005b6678[9] = SUB21(uVar2,1); + s_wndStrQuiting[8] = s_BEENDIGEN_005b6678[8]; + s_wndStrQuiting[9] = s_BEENDIGEN_005b6678[9]; + s_BEENDIGEN_005b6678 + Field<4, 4>() = chars; + s_BEENDIGEN_005b6678 + Field<8, 2>() = uVar3; + sprintf(lpString_0077d2c0,s__s___Pause_005b67c4,s_windowTitle); + s_wndStrRestoring[0] = s_Daten_Reparatur____005b6664[0]; + s_wndStrRestoring[1] = s_Daten_Reparatur____005b6664[1]; + s_wndStrRestoring[2] = s_Daten_Reparatur____005b6664[2]; + s_wndStrRestoring[3] = s_Daten_Reparatur____005b6664[3]; + s_wndStrRestoring[4] = s_Daten_Reparatur____005b6664[4]; + s_wndStrRestoring[5] = s_Daten_Reparatur____005b6664[5]; + s_wndStrRestoring[6] = s_Daten_Reparatur____005b6664[6]; + s_wndStrRestoring[7] = s_Daten_Reparatur____005b6664[7]; + s_wndStrRestoring[8] = s_Daten_Reparatur____005b6664[8]; + s_wndStrRestoring[9] = s_Daten_Reparatur____005b6664[9]; + s_wndStrRestoring[10] = s_Daten_Reparatur____005b6664[10]; + s_wndStrRestoring[0xb] = s_Daten_Reparatur____005b6664[0xb]; + s_wndStrRestoring[0xc] = s_Daten_Reparatur____005b6664[0xc]; + s_wndStrRestoring[0xd] = s_Daten_Reparatur____005b6664[0xd]; + s_wndStrRestoring[0xe] = s_Daten_Reparatur____005b6664[0xe]; + s_wndStrRestoring[0xf] = s_Daten_Reparatur____005b6664[0xf]; + s_wndStrRestoring[0x10] = s_Daten_Reparatur____005b6664[0x10]; + s_wndStrRestoring[0x11] = s_Daten_Reparatur____005b6664[0x11]; + s_wndStrRestoring[0x12] = s_Daten_Reparatur____005b6664[0x12]; + } + else { + sprintf(s_windowTitleRestoring,s__s___Restoring_data____005b664c,s_windowTitle); + chars = s_QUIT + Field<0, 4>(); + puVar15 = (undefined4 *)s_or_press_ESC_to_quit_Rayman_3__005b662c; + puVar16 = (undefined4 *)s_quitting1; + for (iVar13 = 7; cVar1 = s_QUIT[4], iVar13 != 0; iVar13 = iVar13 + -1) { + *puVar16 = *puVar15; + puVar15 = puVar15 + 1; + puVar16 = puVar16 + 1; + } + *(undefined2 *)puVar16 = *(undefined2 *)puVar15; + *(undefined *)((int)puVar16 + 2) = *(undefined *)((int)puVar15 + 2); + uVar22 = s_QUIT + Field<0, 4>(); + s_QUIT[0] = (char)chars; + s_QUIT[1] = SUB41(chars,1); + s_QUIT[2] = SUB41(chars,2); + s_QUIT[3] = SUB41(chars,3); + s_wndStrQuiting[0] = s_QUIT[0]; + s_wndStrQuiting[1] = s_QUIT[1]; + s_wndStrQuiting[2] = s_QUIT[2]; + s_wndStrQuiting[3] = s_QUIT[3]; + s_wndStrQuiting[4] = cVar1; + s_QUIT + Field<0, 4>() = uVar22; + sprintf(lpString_0077d2c0,s__s___Pause_005b67c4,s_windowTitle); + s_wndStrRestoring[0] = s_Restoring_data_____005b6610[0]; + s_wndStrRestoring[1] = s_Restoring_data_____005b6610[1]; + s_wndStrRestoring[2] = s_Restoring_data_____005b6610[2]; + s_wndStrRestoring[3] = s_Restoring_data_____005b6610[3]; + s_wndStrRestoring[4] = s_Restoring_data_____005b6610[4]; + s_wndStrRestoring[5] = s_Restoring_data_____005b6610[5]; + s_wndStrRestoring[6] = s_Restoring_data_____005b6610[6]; + s_wndStrRestoring[7] = s_Restoring_data_____005b6610[7]; + s_wndStrRestoring[8] = s_Restoring_data_____005b6610[8]; + s_wndStrRestoring[9] = s_Restoring_data_____005b6610[9]; + s_wndStrRestoring[10] = s_Restoring_data_____005b6610[10]; + s_wndStrRestoring[0xb] = s_Restoring_data_____005b6610[0xb]; + s_wndStrRestoring + Field<12, 4>() = s_Restoring_data_____005b6610 + Field<12, 4>(); + s_wndStrRestoring + Field<16, 2>() = s_Restoring_data_____005b6610 + Field<16, 2>(); + s_wndStrRestoring[0x12] = s_Restoring_data_____005b6610[0x12]; + } + } + } + } + /* 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) { + iVar13 = strcmpi(languageStr,s_French_005b6828); + if (iVar13 == 0) { + MessageBoxA((HWND)0x0,lpText_005b6598,s_Erreur_Rayman_3_005b65e4,0x10); + return -1; + } + iVar13 = strcmpi(languageStr,s_Spanish_005b67a0); + if (iVar13 == 0) { + MessageBoxA((HWND)0x0,lpText_005b6540,s_Rayman_3_005b6588,0x10); + return -1; + } + iVar13 = strcmpi(languageStr,s_Italian_005b6730); + if (iVar13 == 0) { + MessageBoxA((HWND)0x0,lpText_005b64f0,s_Rayman_3_005b6588,0x10); + return -1; + } + iVar13 = strcmpi(languageStr,s_German_005b66c4); + if (iVar13 != 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); + DVar7 = GetLastError(); + if (DVar7 == 0xb7) { + /* Mutex already exists */ + return -1; + } + GetWindowsDirectoryA(windowsDir,0x104); + iVar13 = -1; + /* Append ubi.ini */ + pcVar4 = windowsDir; + do { + pcVar17 = pcVar4; + if (iVar13 == 0) break; + iVar13 = iVar13 + -1; + pcVar17 = pcVar4 + 1; + cVar1 = *pcVar4; + pcVar4 = pcVar17; + } while (cVar1 != '\0'); + *(undefined4 *)(pcVar17 + -1) = s_UbiSoft_Ubi_ini + Field<0, 4>(); + *(undefined4 *)(pcVar17 + 3) = s_UbiSoft_Ubi_ini + Field<4, 4>(); + *(undefined4 *)(pcVar17 + 7) = s_UbiSoft_Ubi_ini + Field<8, 4>(); + *(undefined4 *)(pcVar17 + 0xb) = s_UbiSoft_Ubi_ini + Field<12, 4>(); + pcVar17[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')) { + /* For GLIMode + 1 = maximize + 0 = windowed */ + g_runMaximized = (int)(acStack_200[0] != '0'); + r3_checkDisc(); + dwOptions = 0; + BVar18 = 0; + lpTargetHandle = &pvStack_834; + DVar7 = 0x1f03ff; + g_hinstance = hInstance; + hTargetProcessHandle = GetCurrentProcess(); + hSourceHandle = GetCurrentThread(); + hSourceProcessHandle = GetCurrentProcess(); + DuplicateHandle(hSourceProcessHandle,hSourceHandle,hTargetProcessHandle,lpTargetHandle,DVar7, + BVar18,dwOptions); + g_mainThreadHandle = pvStack_834; + /* Copy cmdline */ + ppCVar8 = cmdline; + do { + cVar1 = *(char *)ppCVar8; + *(char *)(((int)g_appCmdLine - (int)cmdline) + (int)ppCVar8) = cVar1; + ppCVar8 = (LPSTR *)((int)ppCVar8 + 1); + } while (cVar1 != '\0'); + SetErrorMode(1); + uVar9 = r3_containsCmdLine((uint *)cmdline,s_dashCC); + if (uVar9 == 0) { + r3_module0_init(); + iVar13 = r3_setupWindow(hInstance,showCmd,g_runMaximized); + if (iVar13 == 0) { + return -1; + } + g_setInitVar0(); + FUN_00401320(); + spawnThread(); + gfx_init2(); + lpRect = &tStack_820; + hWnd = GetDesktopWindow(); + GetWindowRect(hWnd,lpRect); + BVar18 = 1; + iVar13 = r3_get_gli_height1(); + iVar13 = iVar13 + 0x20; + iVar10 = r3_get_gli_width1(); + iVar10 = iVar10 + 0xc; + iVar11 = r3_get_gli_height1(); + iVar11 = (tStack_820.bottom - iVar11) / 2; + iVar12 = r3_get_gli_width1(); + MoveWindow(g_gameHWND,(tStack_820.right - iVar12) / 2,iVar11,iVar10,iVar13,BVar18); + 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; + } + sprintf(acStack_810,s_Please_run_the__s_setup__005b63f4,s_windowTitle); + sprintf(acStack_508,s__s_not_initialized__005b63e0,s_windowTitle); + r3_wait_for_dvd(acStack_810,acStack_508,0); + /* WARNING: Subroutine does not return */ + exit(-1); +} + +} + diff --git a/game_re/gh_fix/r3_module0_init.cxx b/game_re/gh_fix/r3_module0_init.cxx new file mode 100644 index 00000000..c19416bc --- /dev/null +++ b/game_re/gh_fix/r3_module0_init.cxx @@ -0,0 +1,55 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + +extern "C" { +undefined r3_module_big_init(void); // 00443f10 // r3_module_big_init +undefined FUN_0043f830(undefined4 param_1); // 0043f830 // FUN_0043f830 +undefined r3_module1_init(void); // 0043e630 // r3_module1_init +R3ModuleId Erm_fn_ucInitErrMsg(void); // 0043e1d0 // Erm_fn_ucInitErrMsg + +// 00401000 +void r3_module0_init(void) + +{ + char cVar1; + size_t sVar2; + size_t sVar3; + uint uVar4; + char *pcVar5; + CHAR local_200 [255]; + char acStack_101 [257]; + + if (DAT_005bd29c == R3ModId_not_initialized) { + DAT_005bd29c = Erm_fn_ucInitErrMsg(); + } + if (r3_module_id_ff == R3ModId_not_initialized) { + r3_module_id_ff = Erm_fn_ucInitErrMsg(); + } + FUN_0043f830(10); + GetModuleFileNameA((HMODULE)0x0,local_200,0xff); + uVar4 = 0xffffffff; + pcVar5 = local_200; + do { + if (uVar4 == 0) break; + uVar4 = uVar4 - 1; + cVar1 = *pcVar5; + pcVar5 = pcVar5 + 1; + } while (cVar1 != '\0'); + sVar2 = ~uVar4; + do { + sVar3 = sVar2; + sVar2 = sVar3 - 1; + if ((int)sVar2 < 0) break; + } while (local_200[sVar2] != '\\'); + strncpy(acStack_101 + 1,local_200,sVar2); + acStack_101[sVar3] = '\0'; + SetCurrentDirectoryA(acStack_101 + 1); + r3_module1_init(); + r3_module_big_init(); + return; +} + +} + diff --git a/game_re/gh_fix/r3_noop.cxx b/game_re/gh_fix/r3_noop.cxx new file mode 100644 index 00000000..44d26cd3 --- /dev/null +++ b/game_re/gh_fix/r3_noop.cxx @@ -0,0 +1,27 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + + +// 00401100 + +/* Sometimes: Erm_fn_v_PrintErrMsg + Also used as noop function */ + +void r3_noop(void *p_cTxt1,void *p_cTxt2) + +{ + /* 0x1100 145 SND_PrintUsedStaticMemory + 0x1100 205 SND_fn_vChangeVolumeSound + 0x1100 210 SND_fn_vFadeOut + 0x1100 215 SND_fn_vInitStereoSound + 0x1100 230 SND_fn_vSetDopplerFactorSound + 0x1100 231 SND_fn_vSetFadeOutTicks + 0x1100 233 SND_fn_vSetMusicFadeOut + 0x1100 237 SND_fn_vSetReverseStereoSound + 0x1100 239 SND_fn_vSetStereoSound */ + return; +} + + diff --git a/game_re/gh_fix/r3_setupWindow.cxx b/game_re/gh_fix/r3_setupWindow.cxx new file mode 100644 index 00000000..37b9bf69 --- /dev/null +++ b/game_re/gh_fix/r3_setupWindow.cxx @@ -0,0 +1,155 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + +extern "C" { +undefined4 get_one(void); // 00485bd0 // get_one +void set_unk(HWND wnd); // 0043e620 // set_unk +int r3_get_gli_width0(void); // 004012c0 // r3_get_gli_width0 +int r3_get_gli_height0(void); // 004012d0 // r3_get_gli_height0 +undefined4 FUN_0046ed70(char * param_1, short * param_2); // 0046ed70 // FUN_0046ed70 +undefined FUN_0046f640(undefined param_1, short param_2, undefined4 * param_3); // 0046f640 // FUN_0046f640 +void FUN_0047c150(short param_1, short param_2, int param_3); // 0047c150 // FUN_0047c150 +long r3_windowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // 004025e0 // r3_windowProc +int r3_get_gli_width1(void); // 0047baf0 // r3_get_gli_width1 +void r3_load_splash_bitmap(HWND unused); // 00402450 // r3_load_splash_bitmap +int r3_get_gli_height1(void); // 0047bb00 // r3_get_gli_height1 +undefined4 FUN_0046f0b0(short param_1, undefined4 * param_2, short * param_3); // 0046f0b0 // FUN_0046f0b0 +void r3_set_window_wh(undefined4 param_1, undefined4 param_2); // 004012a0 // r3_set_window_wh + +// 00402140 +undefined4 r3_setupWindow(HINSTANCE hInstance,undefined4 param_2,int maximizeWindow) + +{ + ATOM AVar1; + int iVar2; + HWND hWnd; + HWND pHVar3; + bool bVar4; + char acStack_e0 [28]; + int iStack_c4; + int iStack_c0; + undefined4 uStack_bc; + HWND pHStack_b8; + HWND pHStack_b4; + undefined4 uStack_b0; + undefined4 uStack_ac; + undefined4 auStack_80 [5]; + undefined4 uStack_6c; + DWORD dwStyle; + int iVar5; + int iVar6; + undefined local_28 [28]; + HBRUSH pHStack_c; + LPCSTR pCStack_8; + char *pcStack_4; + + INT_0077d0a4 = 1; + /* WindowClassA (overlaps usage below) */ + local_28 + Field<0, 4>() = 0x3003; + local_28 + Field<4, 4>() = r3_windowProc; + local_28 + Field<8, 4>() = 0; + local_28 + Field<12, 4>() = 0; + local_28 + Field<16, 4>() = hInstance; + local_28 + Field<20, 4>() = LoadIconA(hInstance,(LPCSTR)0x65); + local_28 + Field<24, 4>() = LoadCursorA((HINSTANCE)0x0,(LPCSTR)0x7f00); + pHStack_c = (HBRUSH)0x6; + pCStack_8 = (LPCSTR)0x0; + pcStack_4 = g_windowTitle; + AVar1 = RegisterClassA((WNDCLASSA *)local_28); + if (AVar1 != 0) { + bVar4 = maximizeWindow == 0; + if (bVar4) { + iVar5 = GetSystemMetrics(0x20); + iVar5 = iVar5 * 2 + 0x140; + iVar6 = GetSystemMetrics(0x21); + iVar2 = GetSystemMetrics(4); + iVar6 = iVar2 + 0xf0 + iVar6 * 2; + dwStyle = 0x90cf0000; + } + else { + iVar6 = 0xf0; + iVar5 = 0x140; + dwStyle = 0x91000000; + } + uStack_6c = 0x40221d; + hWnd = CreateWindowExA(0,g_windowTitle,g_windowTitle,dwStyle,(uint)bVar4,(uint)bVar4,iVar5,iVar6 + ,(HWND)0x0,(HMENU)0x0,hInstance,(LPVOID)0x0); + g_gameHWND1 = hWnd; + if (hWnd != (HWND)0x0) { + g_gameHWND = hWnd; + SetWindowTextA(hWnd,s_windowTitle); + if (maximizeWindow == 0) { + /* SW_NORMAL */ + iVar5 = 1; + } + else { + /* SW_MAXIMIZE */ + iVar5 = 3; + } + ShowWindow(hWnd,iVar5); + SetWindowPos(hWnd,(HWND)0x0,0,0,0,0,0x43); + EnableWindow(hWnd,1); + SetFocus(hWnd); + UpdateWindow(hWnd); + SetForegroundWindow(hWnd); + pHVar3 = GetFocus(); + while (pHVar3 != hWnd) { + SetWindowPos(hWnd,(HWND)0x0,0,0,0,0,0x43); + EnableWindow(hWnd,1); + SetFocus(hWnd); + UpdateWindow(hWnd); + SetForegroundWindow(hWnd); + pHVar3 = GetFocus(); + } + set_unk(hWnd); + r3_load_splash_bitmap(hWnd); + INT_0077d0a4 = 1; + iVar5 = get_one(); + /* always taken */ + if (iVar5 != 0) { + iVar5 = get_one(); + /* never taken */ + if (iVar5 == 0) { + /* WARNING: Subroutine does not return */ + exit(-1); + } + iVar5 = r3_get_gli_height1(); + iVar6 = r3_get_gli_width1(); + r3_set_window_wh(iVar6,iVar5); + GetClientRect(g_gameHWND,(LPRECT)(local_28 + 0x18)); + uStack_b0 = 1; + iStack_c4 = r3_get_gli_width0(); + iStack_c0 = r3_get_gli_height0(); + uStack_bc = 0x10; + pHStack_b8 = g_gameHWND; + pHStack_b4 = g_gameHWND; + uStack_ac = 10; + iVar5 = FUN_0046ed70(acStack_e0,(short *)&WORD_0077d4d4); + if (iVar5 != 0) { + local_28 + Field<0, 4>() = 0; + local_28 + Field<4, 4>() = (WNDPROC)0x0; + iVar5 = FUN_0046f0b0(WORD_0077d4d4,auStack_80,(short *)&WORD_0077d4d6); + if ((iVar5 != 0) && + (iVar5 = FUN_0046f640((char)WORD_0077d4d4,WORD_0077d4d6,&DWORD_0077d4d8), iVar5 != 0)) + { + if (DWORD_0077d4d8 != 0) { + FUN_0047c150(WORD_0077d4d4,WORD_0077d4d6,DWORD_0077d4d8); + } + return 1; + } + } + /* Failed */ + return 0; + } + /* WARNING: Subroutine does not return */ + exit(-1); + } + } + /* Failed */ + return 0; +} + +} + diff --git a/game_re/gh_fix/r3_windowProc.cxx b/game_re/gh_fix/r3_windowProc.cxx new file mode 100644 index 00000000..25a6b338 --- /dev/null +++ b/game_re/gh_fix/r3_windowProc.cxx @@ -0,0 +1,63 @@ +// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!! + +#include +#include "../gh_global.h" + +extern "C" { +undefined FUN_004013a0(void); // 004013a0 // FUN_004013a0 +undefined FUN_00401320(void); // 00401320 // FUN_00401320 + +// 004025e0 +long r3_windowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) + +{ + long lVar1; + + if (uMsg < WM_SETCURSOR + 1) { + if (uMsg == WM_SETCURSOR) { + if (((g_engineShouldRun != 0) && (g_engineRunning != 0)) && (g_runMaximized != 0)) { + FUN_00401320(); + return 1; + } + } + else { + if (uMsg == WM_CLOSE) { + FUN_004013a0(); + DAT_0077d0b8 = 1; + if (g_drawSemaphore != (HANDLE)0x0) { + CloseHandle(g_drawSemaphore); + } + g_drawSemaphore = (HANDLE)0x0; + PostQuitMessage(0); + return 0; + } + if (uMsg == WM_ACTIVATEAPP) { + g_engineShouldRun = wParam; + } + } + } + else { + if (uMsg != WM_NCHITTEST) { + if (uMsg != WM_SYSCOMMAND) goto LAB_004026ab; + /* handle SYSCOMMAND */ + if (wParam < SC_MAXIMIZE + 1) { + if ((wParam != SC_MAXIMIZE) && ((wParam != SC_SIZE && (wParam != SC_MOVE)))) + goto LAB_004026ab; + } + else if ((wParam != SC_KEYMENU) && (wParam != SC_MONITORPOWER)) goto LAB_004026ab; + } + /* WM_NCHITTEST + */ + if (g_runMaximized != 0) { + return 1; + } + } +LAB_004026ab: + /* WARNING: Could not recover jumptable at 0x004026b3. Too many branches */ + /* WARNING: Treating indirect jump as call */ + lVar1 = DefWindowProcA(hwnd,uMsg,wParam,lParam); + return lVar1; +} + +} +