Added fixed call point for sfall initialization

This commit is contained in:
NovaRain
2021-12-17 09:56:52 +08:00
parent 095dfae544
commit 53be017f0b
4 changed files with 17 additions and 9 deletions
+1
View File
@@ -119,6 +119,7 @@
#define FO_VAR_gmouse_current_cursor 0x518C0C
#define FO_VAR_gmovie_played_list 0x596C78
#define FO_VAR_GNW_win_init_flag 0x51E3E0
#define FO_VAR_GNW95_hDDrawLib 0x51E44C
#define FO_VAR_GNW95_isActive 0x51E444
#define FO_VAR_GNW95_repeat_delay 0x51E240
#define FO_VAR_GNW95_repeat_rate 0x51E23C
+2
View File
@@ -940,7 +940,9 @@ static long gmouse_handle_event_hook() {
if (fo::func::mouse_click_in(rect->left, rect->top, rect->right, rect->bottom)) return 0; // 0 - block clicking in the window area
}
}
if (IFACE_BAR_MODE) return 1;
// if IFACE_BAR_MODE is not enabled, check the display_win window area
win = fo::func::GNW_find(fo::var::getInt(FO_VAR_display_win));
RECT *rect = &win->wRect;
+13 -9
View File
@@ -214,13 +214,11 @@ static int CheckEXE() {
return std::strncmp((const char*)0x53C938, "FALLOUT Mapper", 14);
}
static void SfallInit() {
if (!CheckEXE()) return;
static HMODULE SfallInit() {
char filepath[MAX_PATH];
GetModuleFileName(0, filepath, MAX_PATH);
if (!CRC(filepath)) return;
if (!CRC(filepath)) return 0;
LoggingInit();
@@ -304,12 +302,15 @@ defaultIni:
InitReplacementHacks();
InitModules();
fo::var::setInt(FO_VAR_GNW95_hDDrawLib) = (long)ddraw.sfall;
return ddraw.sfall;
}
}
static bool LoadOriginalDll(DWORD dwReason) {
switch (dwReason) {
static bool LoadOriginalDll(DWORD fdwReason) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
char path[MAX_PATH];
CopyMemory(path + GetSystemDirectoryA(path , MAX_PATH - 10), "\\ddraw.dll", 11); // path to original dll
@@ -347,9 +348,12 @@ static bool LoadOriginalDll(DWORD dwReason) {
return false;
}
bool __stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) {
if (LoadOriginalDll(dwReason)) {
sfall::SfallInit();
bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
if (LoadOriginalDll(fdwReason)) {
if (sfall::CheckEXE()) {
ddraw.sfall = hinstDLL;
sfall::MakeCall(0x4DE8DE, sfall::SfallInit); // LoadDirectX_
}
}
return true;
}
+1
View File
@@ -39,6 +39,7 @@
#include "IniReader.h"
struct ddrawDll {
HMODULE sfall;
HMODULE dll;
FARPROC DirectDrawEnumerateExA;
FARPROC DirectDrawCreate;