mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2024-11-12 01:10:49 +01:00
d3d9exhook: refactor d3d9ex hook from sdvxhook2 to shared library
This commit is contained in:
parent
51a697659b
commit
ddd7853810
@ -83,6 +83,7 @@ include src/main/bstio/Module.mk
|
||||
include src/main/camhook/Module.mk
|
||||
include src/main/cconfig/Module.mk
|
||||
include src/main/config/Module.mk
|
||||
include src/main/d3d9exhook/Module.mk
|
||||
include src/main/ddrhook/Module.mk
|
||||
include src/main/ddrio/Module.mk
|
||||
include src/main/ddrio-smx/Module.mk
|
||||
@ -430,7 +431,7 @@ $(zipdir)/sdvx5.zip: \
|
||||
build/bin/indep-64/sdvxio-kfca.dll \
|
||||
dist/sdvx5/config.bat \
|
||||
dist/sdvx5/gamestart.bat \
|
||||
dist/sdvx5/sdvxhook.conf \
|
||||
dist/sdvx5/sdvxhook2.conf \
|
||||
| $(zipdir)/
|
||||
$(V)echo ... $@
|
||||
$(V)zip -j $@ $^
|
||||
|
2
dist/sdvx5/gamestart.bat
vendored
2
dist/sdvx5/gamestart.bat
vendored
@ -13,4 +13,4 @@ for /R prop\defaults %%D in (*.*) do (
|
||||
if not exist dev\nvram\%%~nxD copy /y prop\defaults\%%~nxD dev\nvram
|
||||
)
|
||||
|
||||
launcher -H 268435456 -K sdvxhook2.dll soundvoltex.dll --options sdvxhook.conf %*
|
||||
launcher -H 268435456 -K sdvxhook2.dll soundvoltex.dll --options sdvxhook2.conf %*
|
||||
|
27
dist/sdvx5/sdvxhook.conf
vendored
27
dist/sdvx5/sdvxhook.conf
vendored
@ -1,27 +0,0 @@
|
||||
# [bool (0/1)]: Run the game in a framed window (requires windowed option)
|
||||
gfx.framed=1
|
||||
|
||||
# [bool (0/1)]: Run the game windowed
|
||||
gfx.windowed=0
|
||||
|
||||
# [int]: Windowed width, -1 for default size
|
||||
gfx.window_width=-1
|
||||
|
||||
# [int]: Windowed height, -1 for default size
|
||||
gfx.window_height=-1
|
||||
|
||||
# [bool (0/1)]: Disable card reader emulation and enable usage of real card reader hardware on COM0 (for games supporting slotted readers)
|
||||
io.disable_card_reader_emulation=0
|
||||
|
||||
# [bool (0/1)]: Disable BIO2 emulation and enable usage of real BIO2 hardware
|
||||
io.disable_bio2_emu=0
|
||||
|
||||
# [bool (0/1)]: Disables the poll limiter, warning very high CPU usage may arise
|
||||
io.disable_poll_limiter=0
|
||||
|
||||
# [bool (0/1)]: Disables the camera emulation
|
||||
cam.disable_emu=0
|
||||
|
||||
# [str]: Override camera device ID detection (copy from device manager, do not escape)
|
||||
cam.device_id1=
|
||||
|
27
dist/sdvx5/sdvxhook2.conf
vendored
Normal file
27
dist/sdvx5/sdvxhook2.conf
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# Disable card reader emulation and enable usage of real card reader hardware on COM0 (for games supporting slotted readers)
|
||||
io.disable_card_reader_emu=false
|
||||
|
||||
# Disable BIO2 emulation and enable usage of real BIO2 hardware
|
||||
io.disable_bio2_emu=false
|
||||
|
||||
# Disables the poll limiter, warning very high CPU usage may arise
|
||||
io.disable_poll_limiter=false
|
||||
|
||||
# Run the game in a framed window (requires windowed option)
|
||||
gfx.framed=true
|
||||
|
||||
# Run the game windowed
|
||||
gfx.windowed=false
|
||||
|
||||
# Windowed width, -1 for default size
|
||||
gfx.window_width=720
|
||||
|
||||
# Windowed height, -1 for default size
|
||||
gfx.window_height=1280
|
||||
|
||||
# Disables the camera emulation
|
||||
cam.disable_emu=false
|
||||
|
||||
# Override camera device ID detection (copy from device manager, do not escape)
|
||||
cam.device_id1=
|
||||
|
8
src/main/d3d9exhook/Module.mk
Normal file
8
src/main/d3d9exhook/Module.mk
Normal file
@ -0,0 +1,8 @@
|
||||
libs += d3d9exhook
|
||||
|
||||
libs_d3d9exhook := \
|
||||
util \
|
||||
|
||||
src_d3d9exhook := \
|
||||
config-gfx.c \
|
||||
d3d9ex.c \
|
116
src/main/d3d9exhook/config-gfx.c
Normal file
116
src/main/d3d9exhook/config-gfx.c
Normal file
@ -0,0 +1,116 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "cconfig/cconfig-util.h"
|
||||
|
||||
#include "d3d9exhook/config-gfx.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FRAMED_KEY "gfx.framed"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_WINDOWED_KEY "gfx.windowed"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY "gfx.window_width"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY "gfx.window_height"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY "gfx.forced_refresh_rate"
|
||||
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE false
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE -1
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE -1
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE -1
|
||||
|
||||
void d3d9exhook_config_gfx_init(struct cconfig *config)
|
||||
{
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FRAMED_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE,
|
||||
"Run the game in a framed window (requires windowed option)");
|
||||
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOWED_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE,
|
||||
"Run the game windowed");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE,
|
||||
"Windowed width, -1 for default size");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE,
|
||||
"Windowed height, -1 for default size");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE,
|
||||
"Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)");
|
||||
}
|
||||
|
||||
void d3d9exhook_config_gfx_get(
|
||||
struct d3d9exhook_config_gfx *config_gfx, struct cconfig *config)
|
||||
{
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FRAMED_KEY,
|
||||
&config_gfx->framed,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_FRAMED_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOWED_KEY,
|
||||
&config_gfx->windowed,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOWED_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
&config_gfx->window_width,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY,
|
||||
&config_gfx->window_height,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||
&config_gfx->forced_refresh_rate,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE);
|
||||
}
|
||||
}
|
19
src/main/d3d9exhook/config-gfx.h
Normal file
19
src/main/d3d9exhook/config-gfx.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef D3D9EXHOOK_CONFIG_GFX_H
|
||||
#define D3D9EXHOOK_CONFIG_GFX_H
|
||||
|
||||
#include "cconfig/cconfig.h"
|
||||
|
||||
struct d3d9exhook_config_gfx {
|
||||
bool framed;
|
||||
bool windowed;
|
||||
int32_t window_width;
|
||||
int32_t window_height;
|
||||
int32_t forced_refresh_rate;
|
||||
};
|
||||
|
||||
void d3d9exhook_config_gfx_init(struct cconfig *config);
|
||||
|
||||
void d3d9exhook_config_gfx_get(
|
||||
struct d3d9exhook_config_gfx *config_gfx, struct cconfig *config);
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
#define LOG_MODULE "d3d9-hook"
|
||||
#define LOG_MODULE "d3d9ex-hook"
|
||||
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9core.h>
|
||||
@ -12,7 +12,7 @@
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "sdvxhook2/d3d9.h"
|
||||
#include "d3d9exhook/d3d9ex.h"
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
// thanks to Felix for reminding Xyen to hook 9Ex instead of 9
|
||||
|
||||
static HWND STDCALL my_CreateWindowExA(
|
||||
DWORD dwExStyle,
|
||||
LPCSTR lpClassName,
|
||||
@ -83,21 +81,21 @@ static BOOL(STDCALL *real_MoveWindow)(
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static char d3d9_pci_id[32];
|
||||
static bool d3d9_windowed;
|
||||
static int32_t d3d9_window_width = -1;
|
||||
static int32_t d3d9_window_height = -1;
|
||||
static bool d3d9_window_framed;
|
||||
static bool d3d9ex_windowed;
|
||||
static int32_t d3d9ex_force_refresh_rate = -1;
|
||||
static int32_t d3d9ex_window_width = -1;
|
||||
static int32_t d3d9ex_window_height = -1;
|
||||
static bool d3d9ex_window_framed;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static const struct hook_symbol d3d9_hook_syms[] = {
|
||||
static const struct hook_symbol d3d9ex_hook_syms[] = {
|
||||
{.name = "Direct3DCreate9Ex",
|
||||
.patch = my_Direct3DCreate9Ex,
|
||||
.link = (void **) &real_Direct3DCreate9Ex},
|
||||
};
|
||||
|
||||
static const struct hook_symbol d3d9_hook_user32_syms[] = {
|
||||
static const struct hook_symbol d3d9ex_hook_user32_syms[] = {
|
||||
{.name = "EnumDisplayDevicesA",
|
||||
.patch = my_EnumDisplayDevicesA,
|
||||
.link = (void **) &real_EnumDisplayDevicesA},
|
||||
@ -125,7 +123,7 @@ static HWND STDCALL my_CreateWindowExA(
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
if (d3d9_windowed && d3d9_window_framed) {
|
||||
if (d3d9ex_windowed && d3d9ex_window_framed) {
|
||||
/* use a different style */
|
||||
dwStyle |= WS_OVERLAPPEDWINDOW;
|
||||
/* also show mouse cursor */
|
||||
@ -152,21 +150,21 @@ static HWND STDCALL my_CreateWindowExA(
|
||||
static BOOL STDCALL
|
||||
my_MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
|
||||
{
|
||||
if (d3d9_windowed && d3d9_window_framed) {
|
||||
if (d3d9ex_windowed && d3d9ex_window_framed) {
|
||||
/* we have to adjust the window size, because the window needs to be a
|
||||
slightly bigger than the rendering resolution (window caption and
|
||||
stuff is included in the window size) */
|
||||
|
||||
if (d3d9_window_width != -1 && d3d9_window_height != -1) {
|
||||
if (d3d9ex_window_width != -1 && d3d9ex_window_height != -1) {
|
||||
log_misc(
|
||||
"Overriding window size from %dx%d with %dx%d",
|
||||
nWidth,
|
||||
nHeight,
|
||||
d3d9_window_width,
|
||||
d3d9_window_height);
|
||||
d3d9ex_window_width,
|
||||
d3d9ex_window_height);
|
||||
|
||||
nWidth = d3d9_window_width;
|
||||
nHeight = d3d9_window_height;
|
||||
nWidth = d3d9ex_window_width;
|
||||
nHeight = d3d9ex_window_height;
|
||||
}
|
||||
|
||||
WINDOWPOS wp;
|
||||
@ -196,10 +194,18 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
IDirect3D9Ex *real = COM_PROXY_UNWRAP(self);
|
||||
HRESULT hr;
|
||||
|
||||
if (d3d9_windowed) {
|
||||
if (d3d9ex_windowed) {
|
||||
fdm = NULL;
|
||||
pp->Windowed = TRUE;
|
||||
pp->FullScreen_RefreshRateInHz = 0;
|
||||
} else {
|
||||
if (d3d9ex_force_refresh_rate != -1) {
|
||||
log_info("Forcing refresh rate %d -> %d", pp->FullScreen_RefreshRateInHz, d3d9ex_force_refresh_rate);
|
||||
pp->FullScreen_RefreshRateInHz = d3d9ex_force_refresh_rate;
|
||||
if (fdm) {
|
||||
fdm->RefreshRate = pp->FullScreen_RefreshRateInHz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr = IDirect3D9Ex_CreateDeviceEx(
|
||||
@ -238,37 +244,33 @@ static BOOL STDCALL my_EnumDisplayDevicesA(
|
||||
|
||||
ok = real_EnumDisplayDevicesA(dev_name, dev_num, info, flags);
|
||||
|
||||
if (ok && d3d9_pci_id[0] != '\0') {
|
||||
/* Apparently Konami didn't read the "Not Used" message in the MSDN
|
||||
docs for DISPLAY_DEVICE */
|
||||
log_misc("Replacing device ID %s with %s", info->DeviceID, d3d9_pci_id);
|
||||
|
||||
str_cpy(info->DeviceID, sizeof(info->DeviceID), d3d9_pci_id);
|
||||
}
|
||||
// force 60Hz here?
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
void d3d9_hook_init(void)
|
||||
void d3d9ex_hook_init(void)
|
||||
{
|
||||
hook_table_apply(
|
||||
NULL, "d3d9.dll", d3d9_hook_syms, lengthof(d3d9_hook_syms));
|
||||
NULL, "d3d9.dll", d3d9ex_hook_syms, lengthof(d3d9ex_hook_syms));
|
||||
|
||||
hook_table_apply(
|
||||
NULL,
|
||||
"user32.dll",
|
||||
d3d9_hook_user32_syms,
|
||||
lengthof(d3d9_hook_user32_syms));
|
||||
d3d9ex_hook_user32_syms,
|
||||
lengthof(d3d9ex_hook_user32_syms));
|
||||
|
||||
log_info("Inserted graphics hooks");
|
||||
}
|
||||
|
||||
void d3d9_set_windowed(bool framed, int32_t width, int32_t height)
|
||||
void d3d9ex_configure(struct d3d9exhook_config_gfx* gfx_config)
|
||||
{
|
||||
d3d9_windowed = true;
|
||||
d3d9_window_framed = framed;
|
||||
d3d9_window_width = width;
|
||||
d3d9_window_height = height;
|
||||
d3d9ex_windowed = gfx_config->windowed;
|
||||
d3d9ex_window_framed = gfx_config->framed;
|
||||
d3d9ex_window_width = gfx_config->window_width;
|
||||
d3d9ex_window_height = gfx_config->window_height;
|
||||
|
||||
d3d9ex_force_refresh_rate = gfx_config->forced_refresh_rate;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
21
src/main/d3d9exhook/d3d9ex.h
Normal file
21
src/main/d3d9exhook/d3d9ex.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef D3D9EXHOOK_D3D9EX_H
|
||||
#define D3D9EXHOOK_D3D9EX_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "d3d9exhook/config-gfx.h"
|
||||
|
||||
/**
|
||||
* Hook some d3d9 functions to patch gfx related stuff
|
||||
* like enabling window mode.
|
||||
*/
|
||||
void d3d9ex_hook_init(void);
|
||||
|
||||
/**
|
||||
* Configure this module by applying the provided config.
|
||||
*
|
||||
* @param gfx_config Config to apply.
|
||||
*/
|
||||
void d3d9ex_configure(struct d3d9exhook_config_gfx* gfx_config);
|
||||
|
||||
#endif
|
@ -15,6 +15,7 @@ libs_sdvxhook2 := \
|
||||
acioemu \
|
||||
bio2emu \
|
||||
camhook \
|
||||
d3d9exhook \
|
||||
sdvxio \
|
||||
hook \
|
||||
hooklib \
|
||||
@ -26,6 +27,4 @@ src_sdvxhook2 := \
|
||||
acio.c \
|
||||
bi2a.c \
|
||||
dllmain.c \
|
||||
d3d9.c \
|
||||
config-gfx.c \
|
||||
config-io.c \
|
||||
|
@ -1,96 +0,0 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "cconfig/cconfig-util.h"
|
||||
|
||||
#include "sdvxhook2/config-gfx.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
#define SDVXHOOK2_CONFIG_GFX_FRAMED_KEY "gfx.framed"
|
||||
#define SDVXHOOK2_CONFIG_GFX_WINDOWED_KEY "gfx.windowed"
|
||||
#define SDVXHOOK2_CONFIG_GFX_WINDOW_WIDTH_KEY "gfx.window_width"
|
||||
#define SDVXHOOK2_CONFIG_GFX_WINDOW_HEIGHT_KEY "gfx.window_height"
|
||||
|
||||
#define SDVXHOOK2_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
|
||||
#define SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOWED_VALUE false
|
||||
#define SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE -1
|
||||
#define SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE -1
|
||||
|
||||
void sdvxhook2_config_gfx_init(struct cconfig *config)
|
||||
{
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_FRAMED_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_FRAMED_VALUE,
|
||||
"Run the game in a framed window (requires windowed option)");
|
||||
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOWED_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOWED_VALUE,
|
||||
"Run the game windowed");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE,
|
||||
"Windowed width, -1 for default size");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOW_HEIGHT_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE,
|
||||
"Windowed height, -1 for default size");
|
||||
}
|
||||
|
||||
void sdvxhook2_config_gfx_get(
|
||||
struct sdvxhook2_config_gfx *config_gfx, struct cconfig *config)
|
||||
{
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_FRAMED_KEY,
|
||||
&config_gfx->framed,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_FRAMED_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
SDVXHOOK2_CONFIG_GFX_FRAMED_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_FRAMED_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOWED_KEY,
|
||||
&config_gfx->windowed,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOWED_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOWED_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOWED_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
&config_gfx->window_width,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOW_WIDTH_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_int(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOW_HEIGHT_KEY,
|
||||
&config_gfx->window_height,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%d'",
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOW_HEIGHT_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#ifndef SDVXHOOK2_CONFIG_GFX_H
|
||||
#define SDVXHOOK2_CONFIG_GFX_H
|
||||
|
||||
#include "cconfig/cconfig.h"
|
||||
|
||||
struct sdvxhook2_config_gfx {
|
||||
bool framed;
|
||||
bool windowed;
|
||||
int32_t window_width;
|
||||
int32_t window_height;
|
||||
};
|
||||
|
||||
void sdvxhook2_config_gfx_init(struct cconfig *config);
|
||||
|
||||
void sdvxhook2_config_gfx_get(
|
||||
struct sdvxhook2_config_gfx *config_gfx, struct cconfig *config);
|
||||
|
||||
#endif
|
@ -1,29 +0,0 @@
|
||||
#ifndef SDVXHOOK2_D3D9_H
|
||||
#define SDVXHOOK2_D3D9_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Hook some d3d9 functions to patch gfx related stuff
|
||||
* like enabling window mode.
|
||||
*/
|
||||
void d3d9_hook_init(void);
|
||||
|
||||
/**
|
||||
* Set the game to window mode.
|
||||
*
|
||||
* @param framed True to add a window frame and make the window
|
||||
* movable, resizable, minizable. False for no frame.
|
||||
*/
|
||||
void d3d9_set_windowed(bool framed, int32_t width, int32_t height);
|
||||
|
||||
/**
|
||||
* Set a framerate limit for the rendering loop.
|
||||
*
|
||||
* Use this if the game won't sync up properly with vsync enabled.
|
||||
*
|
||||
* @limit Number of frames to limit the rendering loop to
|
||||
*/
|
||||
void d3d9_set_frame_rate_limit(int limit);
|
||||
|
||||
#endif
|
@ -19,13 +19,14 @@
|
||||
|
||||
#include "sdvxhook2/acio.h"
|
||||
#include "sdvxhook2/bi2a.h"
|
||||
#include "sdvxhook2/config-gfx.h"
|
||||
#include "sdvxhook2/config-io.h"
|
||||
#include "sdvxhook2/d3d9.h"
|
||||
|
||||
#include "camhook/cam.h"
|
||||
#include "camhook/config-cam.h"
|
||||
|
||||
#include "d3d9exhook/config-gfx.h"
|
||||
#include "d3d9exhook/d3d9ex.h"
|
||||
|
||||
#include "imports/avs.h"
|
||||
|
||||
#include "util/log.h"
|
||||
@ -45,7 +46,7 @@ static const irp_handler_t sdvxhook_handlers[] = {
|
||||
|
||||
struct sdvxhook2_config_io config_io;
|
||||
struct camhook_config_cam config_cam;
|
||||
struct sdvxhook2_config_gfx config_gfx;
|
||||
struct d3d9exhook_config_gfx config_gfx;
|
||||
|
||||
static struct bio2emu_port bio2_emu = {
|
||||
.port = "COM4",
|
||||
@ -62,7 +63,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
config = cconfig_init();
|
||||
|
||||
sdvxhook2_config_io_init(config);
|
||||
sdvxhook2_config_gfx_init(config);
|
||||
d3d9exhook_config_gfx_init(config);
|
||||
camhook_config_cam_init(config, 1);
|
||||
|
||||
if (!cconfig_hook_config_init(
|
||||
@ -74,20 +75,15 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
}
|
||||
|
||||
sdvxhook2_config_io_get(&config_io, config);
|
||||
sdvxhook2_config_gfx_get(&config_gfx, config);
|
||||
camhook_config_cam_get(&config_cam, config, 1);
|
||||
d3d9exhook_config_gfx_get(&config_gfx, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
log_info(SDVXHOOK2_INFO_HEADER);
|
||||
log_info("Initializing sdvxhook2...");
|
||||
|
||||
if (config_gfx.windowed) {
|
||||
d3d9_set_windowed(
|
||||
config_gfx.framed,
|
||||
config_gfx.window_width,
|
||||
config_gfx.window_height);
|
||||
}
|
||||
d3d9ex_configure(&config_gfx);
|
||||
|
||||
/* Start up sdvxio.DLL */
|
||||
if (!config_io.disable_bio2_emu) {
|
||||
@ -173,7 +169,7 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
|
||||
acp_hook_init();
|
||||
adapter_hook_init();
|
||||
d3d9_hook_init();
|
||||
d3d9ex_hook_init();
|
||||
|
||||
end:
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user