mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2025-02-21 04:48:42 +01:00
ddr: Fix windowed mode regressions
This commit is contained in:
parent
da736d2968
commit
4cc81f48f3
@ -35,8 +35,9 @@ static BOOL STDCALL my_SetWindowPos(
|
||||
HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
|
||||
|
||||
static bool gfx_windowed;
|
||||
static bool gfx_is_modern;
|
||||
|
||||
static const struct hook_symbol misc_user32_syms[] = {
|
||||
static const struct hook_symbol gfx_user32_syms[] = {
|
||||
{
|
||||
.name = "ChangeDisplaySettingsExA",
|
||||
.patch = my_ChangeDisplaySettingsExA,
|
||||
@ -121,6 +122,11 @@ static LONG STDCALL my_SetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
static BOOL STDCALL my_SetWindowPos(
|
||||
HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
|
||||
{
|
||||
// Causes DDR A to have a really wide window
|
||||
if (gfx_get_is_modern()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gfx_get_windowed()) {
|
||||
WINDOWPOS wp;
|
||||
|
||||
@ -138,7 +144,7 @@ static BOOL STDCALL my_SetWindowPos(
|
||||
void gfx_insert_hooks(HMODULE target)
|
||||
{
|
||||
hook_table_apply(
|
||||
target, "user32.dll", misc_user32_syms, lengthof(misc_user32_syms));
|
||||
target, "user32.dll", gfx_user32_syms, lengthof(gfx_user32_syms));
|
||||
|
||||
log_info("Initialized d3d9 hooks");
|
||||
}
|
||||
@ -153,6 +159,16 @@ void gfx_set_windowed(void)
|
||||
gfx_windowed = true;
|
||||
}
|
||||
|
||||
bool gfx_get_is_modern(void)
|
||||
{
|
||||
return gfx_is_modern;
|
||||
}
|
||||
|
||||
void gfx_set_is_modern(void)
|
||||
{
|
||||
gfx_is_modern = true;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static void gfx_d3d9_patch_window(struct hook_d3d9_irp *irp)
|
||||
|
@ -13,6 +13,9 @@ struct ddrhook1_d3d9_config {
|
||||
bool gfx_get_windowed(void);
|
||||
void gfx_set_windowed(void);
|
||||
|
||||
bool gfx_get_is_modern(void);
|
||||
void gfx_set_is_modern(void);
|
||||
|
||||
void gfx_d3d9_calc_win_size_with_framed(
|
||||
HWND hwnd, DWORD x, DWORD y, DWORD width, DWORD height, LPWINDOWPOS wp);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
static LRESULT(STDCALL *real_SendMessageW)(
|
||||
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
static HWND(STDCALL *real_CreateWindowExW)(
|
||||
DWORD dwExStyle,
|
||||
LPCWSTR lpClassName,
|
||||
@ -30,6 +31,7 @@ static HWND(STDCALL *real_CreateWindowExW)(
|
||||
static SHORT STDCALL my_GetKeyState(int vk);
|
||||
static LRESULT STDCALL
|
||||
my_SendMessageW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
static HWND STDCALL my_CreateWindowExA(
|
||||
DWORD dwExStyle,
|
||||
LPCSTR lpClassName,
|
||||
@ -92,6 +94,23 @@ static HWND STDCALL my_CreateWindowExW(
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
// This breaks DDR X, X2 and X3
|
||||
if (gfx_get_is_modern()) {
|
||||
return real_CreateWindowExW(
|
||||
dwExStyle,
|
||||
lpClassName,
|
||||
lpWindowName,
|
||||
dwStyle,
|
||||
X,
|
||||
Y,
|
||||
nWidth,
|
||||
nHeight,
|
||||
hWndParent,
|
||||
hMenu,
|
||||
hInstance,
|
||||
lpParam);
|
||||
}
|
||||
|
||||
if (gfx_get_windowed()) {
|
||||
/* use a different style */
|
||||
dwStyle |= WS_OVERLAPPEDWINDOW;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "ddrhook1/master.h"
|
||||
|
||||
#include "ddrhook-util/dinput.h"
|
||||
#include "ddrhook-util/gfx.h"
|
||||
#include "ddrhook-util/monitor.h"
|
||||
|
||||
#include "hook/table.h"
|
||||
@ -52,6 +53,7 @@ void ddrhook1_master_insert_hooks(HMODULE target)
|
||||
|
||||
p3io_setupapi_insert_hooks(target);
|
||||
monitor_setupapi_insert_hooks(target);
|
||||
gfx_insert_hooks(target);
|
||||
dinput_init(target);
|
||||
|
||||
/* Insert dynamic loader hooks so that we can hook late-loaded modules */
|
||||
|
@ -33,10 +33,6 @@ static bool my_dll_entry_main(void);
|
||||
bool standard_def;
|
||||
bool _15khz;
|
||||
|
||||
static const hook_d3d9_irp_handler_t ddrhook2_d3d9_handlers[] = {
|
||||
gfx_d3d9_irp_handler,
|
||||
};
|
||||
|
||||
static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
{
|
||||
int argc;
|
||||
@ -87,6 +83,10 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
|
||||
args_free(argc, argv);
|
||||
|
||||
#if AVS_VERSION >= 1508
|
||||
gfx_set_is_modern();
|
||||
#endif
|
||||
|
||||
iohook_push_handler(p3io_emu_dispatch_irp);
|
||||
iohook_push_handler(extio_dispatch_irp);
|
||||
iohook_push_handler(spike_dispatch_irp);
|
||||
@ -97,8 +97,6 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
iohook_push_handler(com4_dispatch_irp);
|
||||
}
|
||||
|
||||
hook_d3d9_init(ddrhook2_d3d9_handlers, lengthof(ddrhook2_d3d9_handlers));
|
||||
|
||||
rs232_hook_init();
|
||||
|
||||
ddrhook2_master_insert_hooks(NULL);
|
||||
|
@ -16,6 +16,11 @@ static HMODULE(STDCALL *real_LoadLibraryA)(const char *name);
|
||||
|
||||
static HMODULE STDCALL my_LoadLibraryA(const char *name);
|
||||
|
||||
|
||||
static const hook_d3d9_irp_handler_t ddrhook2_d3d9_handlers[] = {
|
||||
gfx_d3d9_irp_handler,
|
||||
};
|
||||
|
||||
static const struct hook_symbol master_kernel32_syms[] = {
|
||||
{
|
||||
.name = "LoadLibraryA",
|
||||
@ -58,6 +63,8 @@ void ddrhook2_master_insert_hooks(HMODULE target)
|
||||
dinput_init(target);
|
||||
gfx_insert_hooks(target);
|
||||
|
||||
hook_d3d9_init(ddrhook2_d3d9_handlers, lengthof(ddrhook2_d3d9_handlers));
|
||||
|
||||
/* Insert dynamic loader hooks so that we can hook late-loaded modules */
|
||||
|
||||
hook_table_apply(
|
||||
|
Loading…
x
Reference in New Issue
Block a user