idzhook: Force framed window for ServerBox.exe in graphics hook

This commit is contained in:
Felix Anderson 2021-10-25 09:26:16 +00:00
parent f251283eb6
commit b072f2d82a
Signed by untrusted user: felix
GPG Key ID: 69ADF8AEB6C8B5D1
2 changed files with 26 additions and 0 deletions

View File

@ -1,6 +1,9 @@
#include <windows.h> #include <windows.h>
#include <shlwapi.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <wchar.h>
#include "amex/amex.h" #include "amex/amex.h"
@ -23,6 +26,7 @@
#include "platform/platform.h" #include "platform/platform.h"
#include "util/dprintf.h" #include "util/dprintf.h"
#include "util/lib.h"
static HMODULE idz_hook_mod; static HMODULE idz_hook_mod;
static process_entry_t idz_startup; static process_entry_t idz_startup;
@ -30,6 +34,8 @@ static struct idz_hook_config idz_hook_cfg;
static DWORD CALLBACK idz_pre_startup(void) static DWORD CALLBACK idz_pre_startup(void)
{ {
wchar_t *module_path;
wchar_t *file_name;
HRESULT hr; HRESULT hr;
dprintf("--- Begin idz_pre_startup ---\n"); dprintf("--- Begin idz_pre_startup ---\n");
@ -38,6 +44,25 @@ static DWORD CALLBACK idz_pre_startup(void)
idz_hook_config_load(&idz_hook_cfg, L".\\segatools.ini"); idz_hook_config_load(&idz_hook_cfg, L".\\segatools.ini");
module_path = module_file_name(NULL);
if (module_path != NULL) {
file_name = PathFindFileNameW(module_path);
_wcslwr(file_name);
if (wcsstr(file_name, L"serverbox") != NULL) {
dprintf("Executable filename contains 'ServerBox', disabling full-screen mode\n");
idz_hook_cfg.gfx.windowed = true;
idz_hook_cfg.gfx.framed = true;
}
free(module_path);
module_path = NULL;
}
/* Hook Win32 APIs */ /* Hook Win32 APIs */
serial_hook_init(); serial_hook_init();

View File

@ -8,6 +8,7 @@ shared_library(
dependencies : [ dependencies : [
capnhook.get_variable('hook_dep'), capnhook.get_variable('hook_dep'),
capnhook.get_variable('hooklib_dep'), capnhook.get_variable('hooklib_dep'),
shlwapi_lib,
xinput_lib, xinput_lib,
], ],
link_with : [ link_with : [