This commit is contained in:
2024-09-25 02:19:37 +08:00
parent a2bfc78e8d
commit 47d35aa3a2
95 changed files with 1208 additions and 288 deletions

View File

@@ -1,4 +1,4 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
@@ -8,23 +8,21 @@ extern "C" {
// 0043e1d0
/* Allocate error manager system numbers */
R3ModuleId Erm_fn_ucInitErrMsg(void)
byte Erm_fn_ucInitErrMsg(void)
{
R3ModuleId RVar1;
tdstLastErrorInfo* pdVar2;
byte RVar1;
tdstLastErrorInfo *pdVar2;
int iVar2;
RVar1 = g_ucErmNbOfModule;
if (g_ucErmNbOfModule == R3ModId_unk) {
for(size_t i = 0; i < std::size(g_stErmTheLastErrorInfo); i++) {
if (g_ucErmNbOfModule == 0) {
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);
g_ucErmNbOfModule = g_ucErmNbOfModule + 1;
return RVar1;
}
}

View File

@@ -4,7 +4,7 @@
#include <gh_global.h>
extern "C" {
undefined FUN_0046ecc0(undefined2 param_1, undefined2 param_2); // 0046ecc0 // FUN_0046ecc0
undefined4* FUN_0046ecc0(undefined2 param_1, undefined2 param_2); // 0046ecc0 // FUN_0046ecc0
// 0046f240
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

View File

@@ -8,7 +8,7 @@ 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 r3_initAllModules(void); // 00401000 // r3_initAllModules
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
@@ -87,8 +87,8 @@ int r3_main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR *cmdline,
R3Config &gameConfig = getDefaultConfig();
// Store and change to game directory
chdir(gameConfig.gameDataDir.c_str());
strcpy(r3_main_data_005d28b6.gameDataDir, gameConfig.gameDataDir.c_str());
chdir(gameConfig.gameRootDir.c_str());
strcpy(r3_main_data_005d28b6.gameDataDir, gameConfig.gameRootDir.c_str());
strcpy(languageStr, gameConfig.language.c_str());
sprintf(g_mutexName_Rayman3, s_percents, lpAppName_005b68f0);
@@ -357,91 +357,69 @@ int r3_main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR *cmdline,
// }
// FreeLibrary(hLibModule);
// Run only once
// CreateMutexA((LPSECURITY_ATTRIBUTES)0x0, 1, g_mutexName_Rayman3);
// DVar7 = GetLastError();
// if (DVar7 == 0xb7) {
// /* Mutex already exists */
// return -1;
// }
/* 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 */
strcpy(g_appCmdLine, GetCommandLineA());
/* Read graphics settings */
strcpy(acStack_300, getDefaultConfig().gfxAdapter.c_str());
strcpy(acStack_100, getDefaultConfig().gfxIdentifier.c_str());
strcpy(acStack_200, getDefaultConfig().gfxGliMode.c_str());
// SetErrorMode(1);
/* 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 */
strcpy(g_appCmdLine, GetCommandLineA());
SetErrorMode(1);
char *ccArg = strstr(g_appCmdLine, s_dashCC);
if (ccArg == 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;
r3_initAllModules();
iVar13 = r3_setupWindow(hInstance, showCmd, g_runMaximized);
if (iVar13 == 0) {
return -1;
}
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);
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;
}
}

View File

@@ -1,55 +0,0 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#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;
}
}

View File

@@ -0,0 +1,65 @@
// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
#include <r3/config/static.hpp>
extern "C" {
undefined r3_config_setIdentifier(
const char *param_1); // 00470570 // r3_config_setIdentifier
void r3_config_setTexturesMem(
const char *param_1); // 00470f30 // r3_config_setTexturesMem
void r3_noop(void *p_cTxt1, void *p_cTxt2); // 00401100 // r3_noop
undefined
r3_read_game_config_udp_port(void); // 00446040 // r3_read_game_config_udp_port
undefined
r3_config_setGLIMode(const char *param_1); // 004704e0 // r3_config_setGLIMode
undefined r3_set_GameDataBinPath(
const char *param_1); // 0055a8d0 // r3_set_GameDataBinPath
undefined r3_read_game_config_modem_quality(
void); // 00445fc0 // r3_read_game_config_modem_quality
// 004460c0
void r3_read_gli_config(void) {
R3Config &config = getDefaultConfig();
r3_config_setGLIMode(config.gfxGliMode.c_str());
r3_config_setIdentifier(config.gfxIdentifier.c_str());
r3_config_setTexturesMem(config.gfxTexturesMem.c_str());
g_GLI_adapter = config.gfxAdapter;
r3_config_setIdentifier(config.gfxIdentifier.c_str());
g_config_tex_compressed = config.gfxTexturesCompressed;
g_GLI_tnl = config.gfxTnl;
g_GLI_trilinear = config.gfxTrilinear;
r3_config_setTexturesMem(config.gfxTexturesMem.c_str());
g_config_unused0 = 0;
g_config_camera_hor_axis = config.cameraHorizontalAxis;
g_config_camera_ver_axis = config.cameraVerticalAxis;
r3_set_GameDataBinPath(config.gameDataBinPath.c_str());
// GetPrivateProfileStringA
// (sectionName,s_SingleProcessor_005be308,&lpDefault_005be318,stringBuffer,0x104,local_204
// );
// /* Set single processor mode */
// iVar4 = strcmpi(stringBuffer,(char *)&s_Yes);
// if (iVar4 == 0) {
// sectionName[4] = '\x01';
// sectionName[5] = '\0';
// sectionName[6] = '\0';
// sectionName[7] = '\0';
// sectionName[0] = -0x1a;
// sectionName[1] = 'c';
// sectionName[2] = 'D';
// sectionName[3] = '\0';
// sectionName + Field<0, 4>() = GetCurrentProcess();
// SetProcessAffinityMask((HANDLE)sectionName + Field<0, 4>(),sectionName +
// Field<4, 4>());
// }
// sectionName[4] = -0xe;
// sectionName[5] = 'c';
// sectionName[6] = 'D';
// sectionName[7] = '\0';
// r3_read_game_config_modem_quality();
// r3_read_game_config_udp_port();
return;
}
}