From 43428a65026925ceafc7b25ecc3aef984244d6ce Mon Sep 17 00:00:00 2001 From: 85be42b2ce67a8e34b32793360824b056c0c2444 <85be42b2ce67a8e34b32793360824b056c0c2444@redacted> Date: Tue, 19 May 2020 22:09:38 +0200 Subject: [PATCH] Add support for specifing monitor number for dx9 games --- dist/chuni/segatools.ini | 2 ++ hooklib/config.c | 1 + hooklib/gfx.c | 4 +++- hooklib/gfx.h | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dist/chuni/segatools.ini b/dist/chuni/segatools.ini index 7fc0d82..06bfd51 100644 --- a/dist/chuni/segatools.ini +++ b/dist/chuni/segatools.ini @@ -30,6 +30,8 @@ subnet=192.168.100.0 windowed=1 ; Add a frame to the game window if running windowed. framed=1 +; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen) +monitor=0 ; ----------------------------------------------------------------------------- ; Input settings diff --git a/hooklib/config.c b/hooklib/config.c index d52e6ff..1c4c9c4 100644 --- a/hooklib/config.c +++ b/hooklib/config.c @@ -15,4 +15,5 @@ void gfx_config_load(struct gfx_config *cfg, const wchar_t *filename) cfg->enable = GetPrivateProfileIntW(L"gfx", L"enable", 1, filename); cfg->windowed = GetPrivateProfileIntW(L"gfx", L"windowed", 0, filename); cfg->framed = GetPrivateProfileIntW(L"gfx", L"framed", 1, filename); + cfg->monitor = GetPrivateProfileIntW(L"gfx", L"monitor", 0, filename); } diff --git a/hooklib/gfx.c b/hooklib/gfx.c index f442de9..30a576a 100644 --- a/hooklib/gfx.c +++ b/hooklib/gfx.c @@ -147,7 +147,9 @@ static HRESULT STDMETHODCALLTYPE my_CreateDevice( gfx_frame_window(hwnd); } - return IDirect3D9_CreateDevice(real, adapter, type, hwnd, flags, pp, pdev); + dprintf("Gfx: IDirect3D9:: Using Display No %x\n", gfx_config.monitor); + + return IDirect3D9_CreateDevice(real, gfx_config.monitor, type, hwnd, flags, pp, pdev); } static HRESULT gfx_frame_window(HWND hwnd) diff --git a/hooklib/gfx.h b/hooklib/gfx.h index 5088e0e..9a7e27c 100644 --- a/hooklib/gfx.h +++ b/hooklib/gfx.h @@ -6,6 +6,7 @@ struct gfx_config { bool enable; bool windowed; bool framed; + int monitor; }; void gfx_hook_init(const struct gfx_config *cfg);