mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2024-11-24 06:40:11 +01:00
iidxhook1: Refactor to use new d3d9 module
This commit is contained in:
parent
3e60300273
commit
e0d7596f20
@ -17,6 +17,7 @@
|
||||
#include "ezusb-iidx-emu/node-serial.h"
|
||||
#include "ezusb-iidx-emu/nodes.h"
|
||||
|
||||
#include "hook/d3d9.h"
|
||||
#include "hook/iohook.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
@ -30,7 +31,6 @@
|
||||
#include "iidxhook-util/config-gfx.h"
|
||||
#include "iidxhook-util/config-misc.h"
|
||||
#include "iidxhook-util/config-sec.h"
|
||||
#include "iidxhook-util/d3d8.h"
|
||||
#include "iidxhook-util/d3d9.h"
|
||||
#include "iidxhook-util/eamuse.h"
|
||||
#include "iidxhook-util/effector.h"
|
||||
@ -55,6 +55,10 @@ static const irp_handler_t iidxhook_handlers[] = {
|
||||
settings_hook_dispatch_irp,
|
||||
};
|
||||
|
||||
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
|
||||
iidxhook_util_d3d9_irp_handler,
|
||||
};
|
||||
|
||||
static HANDLE STDCALL my_OpenProcess(DWORD, BOOL, DWORD);
|
||||
static HANDLE (STDCALL *real_OpenProcess)(DWORD, BOOL, DWORD);
|
||||
|
||||
@ -68,6 +72,43 @@ static const struct hook_symbol init_hook_syms[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static void iidxhook1_setup_d3d9_hooks(const struct iidxhook_config_gfx* config_gfx,
|
||||
const struct iidxhook_config_iidxhook1* config_iidxhook1)
|
||||
{
|
||||
struct iidxhook_util_d3d9_config d3d9_config;
|
||||
|
||||
log_warning("d3d8 hook module deprecated, using d3d9 hook modules requiring d3d8to9 to work!");
|
||||
|
||||
iidxhook_util_d3d9_init_config(&d3d9_config);
|
||||
|
||||
d3d9_config.windowed = config_gfx->windowed;
|
||||
d3d9_config.framed = config_gfx->framed;
|
||||
d3d9_config.override_window_width = config_gfx->window_width;
|
||||
d3d9_config.override_window_height = config_gfx->window_height;
|
||||
d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
|
||||
d3d9_config.iidx12_fix_song_select_bg = config_iidxhook1->happy_sky_ms_bg_fix;
|
||||
d3d9_config.iidx11_to_17_fix_uvs_bg_videos = config_gfx->bgvideo_uv_fix;
|
||||
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
|
||||
d3d9_config.iidx09_to_19_monitor_check_cb = iidxhook_util_chart_patch_set_refresh_rate;
|
||||
iidxhook_util_chart_patch_init(IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
|
||||
} else if (config_gfx->monitor_check > 0) {
|
||||
log_info("Manual monitor check, resulting refresh rate: %f", config_gfx->monitor_check);
|
||||
|
||||
iidxhook_util_chart_patch_init(IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
|
||||
iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check);
|
||||
}
|
||||
|
||||
iidxhook_util_d3d9_configure(&d3d9_config);
|
||||
|
||||
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
|
||||
}
|
||||
|
||||
/**
|
||||
* This seems to be a good entry point to intercept
|
||||
* before the game calls anything important
|
||||
@ -144,87 +185,7 @@ static HANDLE STDCALL my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle,
|
||||
|
||||
/* Direct3D and USER32 hooks */
|
||||
|
||||
/* There are a few features that cannot be implemented using d3d8,
|
||||
e.g. GPU based upscaling with filtering. When using d3d8to9, allow
|
||||
using the d3d9 hooks instead because the game is running on d3d9. */
|
||||
if (config_iidxhook1.use_d3d9_hooks) {
|
||||
log_warning("d3d9 hook modules enabled. Requires d3d8to9!");
|
||||
|
||||
d3d9_hook_init();
|
||||
|
||||
if (config_gfx.bgvideo_uv_fix) {
|
||||
/* Red, HS, DistorteD, only */
|
||||
d3d9_iidx_fix_stretched_bg_videos();
|
||||
}
|
||||
|
||||
if (config_gfx.windowed) {
|
||||
d3d9_set_windowed(config_gfx.framed, config_gfx.window_width,
|
||||
config_gfx.window_height);
|
||||
}
|
||||
|
||||
if (config_gfx.frame_rate_limit > 0) {
|
||||
d3d9_set_frame_rate_limit(config_gfx.frame_rate_limit);
|
||||
}
|
||||
|
||||
if (config_gfx.monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
d3d9_enable_monitor_check(iidxhook_util_chart_patch_set_refresh_rate);
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
|
||||
} else if (config_gfx.monitor_check > 0) {
|
||||
log_info("Manual monitor check, resulting refresh rate: %f",
|
||||
config_gfx.monitor_check);
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
|
||||
iidxhook_util_chart_patch_set_refresh_rate(config_gfx.monitor_check);
|
||||
}
|
||||
|
||||
/* Fix Happy Sky 3D background */
|
||||
|
||||
if (config_iidxhook1.happy_sky_ms_bg_fix) {
|
||||
d3d9_iidx_fix_12_song_select_bg();
|
||||
}
|
||||
|
||||
if (config_gfx.scale_back_buffer_width > 0 && config_gfx.scale_back_buffer_height > 0) {
|
||||
d3d9_scale_back_buffer(config_gfx.scale_back_buffer_width, config_gfx.scale_back_buffer_height,
|
||||
config_gfx.scale_back_buffer_filter);
|
||||
}
|
||||
} else {
|
||||
d3d8_hook_init();
|
||||
|
||||
if (config_gfx.bgvideo_uv_fix) {
|
||||
/* Red, HS, DistorteD, only */
|
||||
d3d8_iidx_fix_stretched_bg_videos();
|
||||
}
|
||||
|
||||
if (config_gfx.windowed) {
|
||||
d3d8_set_windowed(config_gfx.framed, config_gfx.window_width,
|
||||
config_gfx.window_height);
|
||||
}
|
||||
|
||||
if (config_gfx.frame_rate_limit > 0) {
|
||||
d3d8_set_frame_rate_limit(config_gfx.frame_rate_limit);
|
||||
}
|
||||
|
||||
if (config_gfx.monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
d3d8_enable_monitor_check(iidxhook_util_chart_patch_set_refresh_rate);
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
|
||||
} else if (config_gfx.monitor_check > 0) {
|
||||
log_info("Manual monitor check, resulting refresh rate: %f",
|
||||
config_gfx.monitor_check);
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
|
||||
iidxhook_util_chart_patch_set_refresh_rate(config_gfx.monitor_check);
|
||||
}
|
||||
|
||||
/* Fix Happy Sky 3D background */
|
||||
|
||||
if (config_iidxhook1.happy_sky_ms_bg_fix) {
|
||||
d3d8_iidx_fix_12_song_select_bg();
|
||||
}
|
||||
}
|
||||
iidxhook1_setup_d3d9_hooks(&config_gfx, &config_iidxhook1);
|
||||
|
||||
/* Disable operator menu clock setting system clock time */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user