Removed the pop-up message box about not finding the original ddraw.dll, now the error is reported in the log file.

Added a note about setting a custom background for the character screen to the hero appearance mod.
This commit is contained in:
NovaRain
2018-11-09 10:01:10 +08:00
parent 09b3bf3aed
commit cce9437d19
2 changed files with 33 additions and 30 deletions
+1
View File
@@ -370,6 +370,7 @@ ProcessorIdle=-1
LoadProtoMaxLimit=-1 LoadProtoMaxLimit=-1
;Set to 1 if using the hero appearance mod ;Set to 1 if using the hero appearance mod
;You can add AppChCrt.frm and AppChEdt.frm files to art/intrface/ to set a custom background for the character screen
EnableHeroAppearanceMod=0 EnableHeroAppearanceMod=0
;Set to 1 to skip the 3 opening movies ;Set to 1 to skip the 3 opening movies
+11 -9
View File
@@ -64,6 +64,8 @@
#include "Cpp11_emu.h" #include "Cpp11_emu.h"
#endif #endif
ddrawDll ddraw;
bool IsDebug = false; bool IsDebug = false;
char ini[65]; char ini[65];
@@ -1575,18 +1577,13 @@ static void CompatModeCheck(HKEY root, const char* filepath, int extra) {
} }
} }
ddrawDll ddraw;
static bool LoadOriginalDll(DWORD dwReason) { static bool LoadOriginalDll(DWORD dwReason) {
switch (dwReason) { switch (dwReason) {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
char path[MAX_PATH]; char path[MAX_PATH];
CopyMemory(path + GetSystemDirectoryA(path , MAX_PATH - 10), "\\ddraw.dll", 11); // path to original dll CopyMemory(path + GetSystemDirectoryA(path , MAX_PATH - 10), "\\ddraw.dll", 11); // path to original dll
ddraw.dll = LoadLibrary(path); ddraw.dll = LoadLibraryA(path);
if (!ddraw.dll || ddraw.dll == INVALID_HANDLE_VALUE) { if (ddraw.dll) {
MessageBox(0, "Cannot load the original ddraw.dll library.", "sfall", MB_ICONERROR);
ExitProcess(-1);
break;
}
ddraw.AcquireDDThreadLock = GetProcAddress(ddraw.dll, "AcquireDDThreadLock"); ddraw.AcquireDDThreadLock = GetProcAddress(ddraw.dll, "AcquireDDThreadLock");
ddraw.CheckFullscreen = GetProcAddress(ddraw.dll, "CheckFullscreen"); ddraw.CheckFullscreen = GetProcAddress(ddraw.dll, "CheckFullscreen");
ddraw.CompleteCreateSysmemSurface = GetProcAddress(ddraw.dll, "CompleteCreateSysmemSurface"); ddraw.CompleteCreateSysmemSurface = GetProcAddress(ddraw.dll, "CompleteCreateSysmemSurface");
@@ -1609,6 +1606,7 @@ static bool LoadOriginalDll(DWORD dwReason) {
ddraw.GetSurfaceFromDC = GetProcAddress(ddraw.dll, "GetSurfaceFromDC"); ddraw.GetSurfaceFromDC = GetProcAddress(ddraw.dll, "GetSurfaceFromDC");
ddraw.RegisterSpecialCase = GetProcAddress(ddraw.dll, "RegisterSpecialCase"); ddraw.RegisterSpecialCase = GetProcAddress(ddraw.dll, "RegisterSpecialCase");
ddraw.ReleaseDDThreadLock = GetProcAddress(ddraw.dll, "ReleaseDDThreadLock"); ddraw.ReleaseDDThreadLock = GetProcAddress(ddraw.dll, "ReleaseDDThreadLock");
}
return true; return true;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
FreeLibrary(ddraw.dll); FreeLibrary(ddraw.dll);
@@ -1623,6 +1621,7 @@ bool _stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) {
IsDebug = (GetPrivateProfileIntA("Debugging", "Enable", 0, ".\\ddraw.ini") != 0); IsDebug = (GetPrivateProfileIntA("Debugging", "Enable", 0, ".\\ddraw.ini") != 0);
if (IsDebug) { if (IsDebug) {
LoggingInit(); LoggingInit();
if (!ddraw.dll) dlog("Error: Cannot load the original ddraw.dll library.\n", DL_MAIN);
} }
HookCall(0x4DE7D2, &OnExitFunc); HookCall(0x4DE7D2, &OnExitFunc);
@@ -1674,13 +1673,16 @@ bool _stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) {
strcpy_s(ini, ".\\"); strcpy_s(ini, ".\\");
strcat_s(ini, cmdline); strcat_s(ini, cmdline);
HANDLE h = CreateFileA(cmdline, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); HANDLE h = CreateFileA(cmdline, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
if (h != INVALID_HANDLE_VALUE) CloseHandle(h); if (h != INVALID_HANDLE_VALUE)
CloseHandle(h);
else { else {
MessageBox(0, "You gave a command line argument to fallout, but it couldn't be matched to a file\n" \ MessageBox(0, "You gave a command line argument to fallout, but it couldn't be matched to a file\n" \
"Using default ddraw.ini instead", "Warning", MB_TASKMODAL); "Using default ddraw.ini instead", "Warning", MB_TASKMODAL);
strcpy_s(ini, ".\\ddraw.ini"); strcpy_s(ini, ".\\ddraw.ini");
} }
} else strcpy_s(ini, ".\\ddraw.ini"); } else {
strcpy_s(ini, ".\\ddraw.ini");
}
GetPrivateProfileStringA("Main", "TranslationsINI", "./Translations.ini", translationIni, 65, ini); GetPrivateProfileStringA("Main", "TranslationsINI", "./Translations.ini", translationIni, 65, ini);