Fix upscaling feature on IIDX 20 to 26 #250

Merged
icex2 merged 6 commits from fix-upscaling-iidx-hd into master 2023-04-15 23:37:07 +03:00
27 changed files with 3321 additions and 24 deletions
+2
View File
@@ -99,6 +99,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/d3d9-util/Module.mk
include src/main/d3d9exhook/Module.mk
include src/main/ddrhook-util/Module.mk
include src/main/ddrhook1/Module.mk
@@ -133,6 +134,7 @@ include src/main/iidx-bio2-exit-hook/Module.mk
include src/main/iidx-ezusb-exit-hook/Module.mk
include src/main/iidx-ezusb2-exit-hook/Module.mk
include src/main/iidx-irbeat-patch/Module.mk
include src/main/iidxhook-d3d9/Module.mk
include src/main/iidxhook-util/Module.mk
include src/main/iidxhook1/Module.mk
include src/main/iidxhook2/Module.mk
@@ -0,0 +1,57 @@
# IIDX 24 GFX upscaling notes
Date: 2023-04-15
Author: icex2
Notes about my work on fixing the upscaling/downscaling feature of bemanitools for IIDX 20 to 26.
I realized that the render backend changed significantly that the old method that worked fine
doesn't work anymore.
The tool used in the screenshots is [apitrace](https://github.com/apitrace/apitrace).
## IIDX 24
The GFX engine in IIDX from 20 to 26 has a changed render loop that includes built-in scaling to
implement the SD and HD/HD* screen settings that are selectable in the operator menu
### Frame 0 - GFX init part
Setting up the context and device, as well as the frame buffer. This also creates the intermediate
texture that is configured as the render target once it begins drawing the scene.
![](2023-04-13-iidx-24-gfx-upscaling/init.png)
### Frame 1 - A clean main render path
Start the scene and set the render target to the intermediate texture.
![](2023-04-13-iidx-24-gfx-upscaling/beginscene.png)
After done drawing the scene, the intermediate texture is blended to the framebuffer. With a target
2D plane having the size of the target resolution, the blending applies linear scaling to either
up- or downscale the final image.
![](2023-04-13-iidx-24-gfx-upscaling/scaling.png)
## IIDX 10
A recap of the old stuff, see also [my previous notes](2019-10-07-iidx-gfx-rendering-loops.md),
as I had to look at everything again to properly understand the differences.
### Frame 0 - GFX init part
Setting up the context and device, as well as the frame buffer. Renders directly to the frame
buffer.
![](2023-04-13-iidx-24-gfx-upscaling/init10.png)
### Frame 1 - A clean main render path
Beginning the scene excerpt. The viewport needs to match the target resolution to display the
final image correctly.
![](2023-04-13-iidx-24-gfx-upscaling/beginscene10.png)
Ending the scene excerpt, nothing fancy here, just swapping the back buffer.
![](2023-04-13-iidx-24-gfx-upscaling/endscene10.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

+3 -2
View File
@@ -669,7 +669,7 @@ bool convert_path_to_fakesym(const char *path, wchar_t *sym, char *extra_o)
pidstr,
mistr,
extra);
mbstowcs(sym, buffer, CAMERA_DATA_STRING_SIZE);
return true;
@@ -837,7 +837,8 @@ void camhook_init(struct camhook_config_cam *config_cam)
NULL, "Mf.dll", camhook_mf_syms, lengthof(camhook_mf_syms));
log_info("Inserted cam hooks for %d cams", (int) num_setup);
// If the user has manually disabled all cams, don't print this in the log
// If the user has manually disabled all cams, don't print this in the
// log
} else if (num_addressed_cams != config_cam->num_devices) {
log_info("No cams detected, not hooking");
}
+14 -13
View File
@@ -14,9 +14,10 @@ const char *camhook_config_disable_camera[CAMHOOK_CONFIG_CAM_MAX] = {
"cam.disable_camera2",
};
const int camhook_config_disable_camera_default_values[CAMHOOK_CONFIG_CAM_MAX] = {
false,
false,
const int camhook_config_disable_camera_default_values[CAMHOOK_CONFIG_CAM_MAX] =
{
false,
false,
};
const char *camhook_config_device_id_keys[CAMHOOK_CONFIG_CAM_MAX] = {
@@ -83,16 +84,16 @@ void camhook_config_cam_get(
camhook_config_disable_camera_default_values[i]);
}
if (!cconfig_util_get_str(
config,
camhook_config_device_id_keys[i],
config_cam->device_id[i],
sizeof(config_cam->device_id[i]) - 1,
camhook_config_device_default_values[i])) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%s'",
camhook_config_device_id_keys[i],
camhook_config_device_default_values[i]);
config,
camhook_config_device_id_keys[i],
config_cam->device_id[i],
sizeof(config_cam->device_id[i]) - 1,
camhook_config_device_default_values[i])) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%s'",
camhook_config_device_id_keys[i],
camhook_config_device_default_values[i]);
}
}
}
+6
View File
@@ -0,0 +1,6 @@
libs += d3d9-util
libs_d3d9-util := \
src_d3d9-util := \
dxerr9.c \
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
// Source:
// https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/libsrc/dxerr9.c
/*
dxerr9.c - DirectX 9 Error Functions
Written by Filip Navara <xnavara@volny.cz>
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#define DXGetErrorString DXGetErrorString9A
#define DXGetErrorDescription DXGetErrorDescription9A
#define DXTrace DXTraceA
#define DXERROR9(v, n, d) {v, n, d},
#define DXERROR9LAST(v, n, d) \
{ \
v, n, d \
}
#include "dxerr.c"
+67
View File
@@ -0,0 +1,67 @@
// Source:
// https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/direct-x/include/dxerr9.h
/*
* Copyright (C) 2004 Robert Reif
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DXERR9_H
#define __WINE_DXERR9_H
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
const char *WINAPI DXGetErrorString9A(HRESULT hr);
const WCHAR *WINAPI DXGetErrorString9W(HRESULT hr);
#define DXGetErrorString9 __MINGW_NAME_AW(DXGetErrorString9)
const char *WINAPI DXGetErrorDescription9A(HRESULT hr);
const WCHAR *WINAPI DXGetErrorDescription9W(HRESULT hr);
#define DXGetErrorDescription9 __MINGW_NAME_AW(DXGetErrorDescription9)
HRESULT WINAPI DXTraceA(
const char *strFile,
DWORD dwLine,
HRESULT hr,
const char *strMsg,
WINBOOL bPopMsgBox);
HRESULT WINAPI DXTraceW(
const char *strFile,
DWORD dwLine,
HRESULT hr,
const WCHAR *strMsg,
WINBOOL bPopMsgBox);
#define DXTrace __MINGW_NAME_AW(DXTrace)
#if defined(DEBUG) || defined(_DEBUG)
#define DXTRACE_MSG(str) DXTrace(__FILE__, (DWORD) __LINE__, 0, str, FALSE)
#define DXTRACE_ERR(str, hr) DXTrace(__FILE__, (DWORD) __LINE__, hr, str, TRUE)
#define DXTRACE_ERR_NOMSGBOX(str, hr) \
DXTrace(__FILE__, (DWORD) __LINE__, hr, str, FALSE)
#else
#define DXTRACE_MSG(str) __MSABI_LONG(0)
#define DXTRACE_ERR(str, hr) (hr)
#define DXTRACE_ERR_NOMSGBOX(str, hr) (hr)
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif /* __WINE_DXERR9_H */
+23
View File
@@ -0,0 +1,23 @@
#ifndef D3D9_UTIL_H
#define D3D9_UTIL_H
#include <stdbool.h>
#include <stdint.h>
struct d3d9_util_vertex {
float x;
float y;
float z;
uint32_t color;
uint32_t unknown;
float tu;
float tv;
};
inline bool
d3d9_util_vertex_in_range(float v, float lower_bound_inc, float upper_bound_inc)
{
return v >= lower_bound_inc && v <= upper_bound_inc;
}
#endif
+41
View File
@@ -80,6 +80,9 @@ static HRESULT(STDCALL *real_SetViewport)(
static HRESULT(STDCALL *real_SetVertexShader)(
IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader);
static HRESULT(STDCALL *real_SetScissorRect)(
IDirect3DDevice9 *self, const RECT *pRect);
/* ------------------------------------------------------------------------------------------------------------------
*/
@@ -154,6 +157,9 @@ my_SetViewport(IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport);
static HRESULT STDCALL
my_SetVertexShader(IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader);
static HRESULT STDCALL
my_SetScissorRect(IDirect3DDevice9 *self, const RECT *pRect);
/* ------------------------------------------------------------------------------------------------------------------
*/
@@ -220,6 +226,9 @@ hook_d3d9_irp_handler_real_dev_set_viewport(struct hook_d3d9_irp *irp);
static HRESULT
hook_d3d9_irp_handler_real_dev_set_vertex_shader(struct hook_d3d9_irp *irp);
static HRESULT
hook_d3d9_irp_handler_real_dev_set_scissor_rect(struct hook_d3d9_irp *irp);
/* ------------------------------------------------------------------------------------------------------------------
*/
@@ -249,6 +258,8 @@ static const hook_d3d9_irp_handler_t hook_d3d9_irp_real_handlers[] = {
hook_d3d9_irp_handler_real_dev_set_viewport,
[HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER] =
hook_d3d9_irp_handler_real_dev_set_vertex_shader,
[HOOK_D3D9_IRP_OP_DEV_SET_SCISSOR_RECT] =
hook_d3d9_irp_handler_real_dev_set_scissor_rect,
};
static const hook_d3d9_irp_handler_t *hook_d3d9_handlers;
@@ -570,6 +581,23 @@ my_Reset(IDirect3DDevice9 *self, D3DPRESENT_PARAMETERS *pp)
return hr;
}
static HRESULT STDCALL
my_SetScissorRect(IDirect3DDevice9 *self, const RECT *pRect)
{
struct hook_d3d9_irp irp;
HRESULT hr;
memset(&irp, 0, sizeof(irp));
irp.op = HOOK_D3D9_IRP_OP_DEV_SET_SCISSOR_RECT;
irp.args.dev_set_scissor_rect.self = self;
irp.args.dev_set_scissor_rect.pRect = pRect;
hr = hook_d3d9_irp_invoke_next(&irp);
return hr;
}
/* ------------------------------------------------------------------------------------------------------------------
*/
@@ -748,6 +776,9 @@ hook_d3d9_irp_handler_real_dev_create_device(struct hook_d3d9_irp *irp)
real_SetVertexShader = api_vtbl->SetVertexShader;
api_vtbl->SetVertexShader = my_SetVertexShader;
real_SetScissorRect = api_vtbl->SetScissorRect;
api_vtbl->SetScissorRect = my_SetScissorRect;
*irp->args.ctx_create_device.pdev = (IDirect3DDevice9 *) api_proxy;
return hr;
@@ -848,6 +879,16 @@ hook_d3d9_irp_handler_real_dev_set_vertex_shader(struct hook_d3d9_irp *irp)
irp->args.dev_set_vertex_shader.pShader);
}
static HRESULT
hook_d3d9_irp_handler_real_dev_set_scissor_rect(struct hook_d3d9_irp *irp)
{
log_assert(irp);
return real_SetScissorRect(
irp->args.dev_set_scissor_rect.self,
irp->args.dev_set_scissor_rect.pRect);
}
/* ------------------------------------------------------------------------------------------------------------------
*/
+9
View File
@@ -36,6 +36,7 @@ enum hook_d3d9_irp_op {
HOOK_D3D9_IRP_OP_DEV_RESET = 12,
HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT = 13,
HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER = 14,
HOOK_D3D9_IRP_OP_DEV_SET_SCISSOR_RECT = 15,
};
/**
@@ -188,6 +189,14 @@ struct hook_d3d9_irp {
IDirect3DDevice9 *self;
IDirect3DVertexShader9 *pShader;
} dev_set_vertex_shader;
/**
* Params of IDIrect3DDevice9_SetScissorRect
*/
struct {
IDirect3DDevice9 *self;
const RECT *pRect;
} dev_set_scissor_rect;
} args;
size_t next_handler;
+8
View File
@@ -0,0 +1,8 @@
libs += iidxhook-d3d9
libs_iidxhook-d3d9 := \
util \
d3d9-util \
src_iidxhook-d3d9 := \
bb-scale-hd.c \
+163
View File
@@ -0,0 +1,163 @@
#define LOG_MODULE "iidxhook-d3d9-bb-scale-hd"
#include <windows.h>
#include "d3d9-util/vertex.h"
#include "bb-scale-hd.h"
#include "util.h"
#include "util/log.h"
static bool iidxhook_d3d9_bb_scale_initialized;
static uint16_t iidxhook_d3d9_bb_scale_hd_width;
static uint16_t iidxhook_d3d9_bb_scale_hd_height;
void iidxhook_d3d9_bb_scale_hd_init(uint16_t width, uint16_t height)
{
iidxhook_d3d9_bb_scale_hd_width = width;
iidxhook_d3d9_bb_scale_hd_height = height;
iidxhook_d3d9_bb_scale_initialized = true;
log_info("Initialized, width %d, height %d", width, height);
}
static bool iidxhook_d3d9_bb_scale_hd_in_range_of_2d_coords(
struct d3d9_util_vertex *vertex, float x, float y, float error_margin)
{
return vertex->x >= x - error_margin && vertex->x <= x + error_margin &&
vertex->y >= y - error_margin && vertex->y <= y + error_margin;
}
static bool iidxhook_d3d9_bb_scale_hd_match_2d_plane(
struct d3d9_util_vertex *vertices,
float origin_x,
float origin_y,
float size_x,
float size_y,
float error_margin)
{
return
// top left
iidxhook_d3d9_bb_scale_hd_in_range_of_2d_coords(
&vertices[0], origin_x, origin_y, error_margin) &&
// top right
iidxhook_d3d9_bb_scale_hd_in_range_of_2d_coords(
&vertices[1], origin_x + size_x, origin_y, error_margin) &&
// bottom right
iidxhook_d3d9_bb_scale_hd_in_range_of_2d_coords(
&vertices[2], origin_x + size_x, origin_y + size_y, error_margin) &&
// bottom left
iidxhook_d3d9_bb_scale_hd_in_range_of_2d_coords(
&vertices[3], origin_x, origin_y + size_y, error_margin);
}
static void iidxhook_d3d9_bb_scale_hd_set_plane(
struct d3d9_util_vertex *vertices,
float origin_x,
float origin_y,
float size_x,
float size_y)
{
// top left
vertices[0].x = origin_x;
vertices[0].y = origin_y;
// top right
vertices[1].x = origin_x + size_x;
vertices[1].y = origin_y;
// bottom right
vertices[2].x = origin_x + size_x;
vertices[2].y = origin_y + size_y;
// bottom left
vertices[3].x = origin_x;
vertices[3].y = origin_y + size_y;
}
HRESULT iidxhook_d3d9_bb_scale_hd_d3d9_irp_handler(struct hook_d3d9_irp *irp)
{
log_assert(irp);
if (!iidxhook_d3d9_bb_scale_initialized) {
return hook_d3d9_irp_invoke_next(irp);
}
if (irp->op == HOOK_D3D9_IRP_OP_CTX_CREATE_DEVICE) {
// Scale the backbuffer accordingly
// The game renders to an intermediate texture by default to provide the
// SD vs. HD feature already
irp->args.ctx_create_device.pp->BackBufferWidth =
iidxhook_d3d9_bb_scale_hd_width;
irp->args.ctx_create_device.pp->BackBufferHeight =
iidxhook_d3d9_bb_scale_hd_height;
return hook_d3d9_irp_invoke_next(irp);
} else if (irp->op == HOOK_D3D9_IRP_OP_DEV_DRAW_PRIMITIVE_UP) {
if (irp->args.dev_draw_primitive_up.primitive_type ==
D3DPT_TRIANGLEFAN &&
irp->args.dev_draw_primitive_up.primitive_count == 2 &&
irp->args.dev_draw_primitive_up.stride == 28) {
struct d3d9_util_vertex *vertices =
(struct d3d9_util_vertex *)
irp->args.dev_draw_primitive_up.data;
// The engine draws everything to a separate texture as the primary
// render target Depending on the game mode selected, SD vs. HD/HD*,
// the texture's size is either 640x480 or 1280x720 After drawing
// the scene is finished (after EndScene), the game blends the
// texture with the game's rendered output to the actual frame
// buffer
if (iidxhook_d3d9_bb_scale_hd_match_2d_plane(
vertices, 0, 0, 640, 480, 1.0) ||
iidxhook_d3d9_bb_scale_hd_match_2d_plane(
vertices, 0, 0, 1280, 720, 1.0)) {
// Note: Original plane is not at origin 0.0/0.0?
// Example for SD plane:
// -0.500000/-0.500000 639.500000/-0.500000
// 639.500000/479.500000 -0.500000/479.500000 Patch to set it to
// 0.0/0.0
// Scale the 2D output plane primitive to the right resolution
// (upscale or downscale) The render parameter for the blending
// operation will automatically scale the selected source
// texture, the intermediate render buffer with the game's final
// frame, to the actual frame buffer once the DrawPrimitiveUP
// call completed
iidxhook_d3d9_bb_scale_hd_set_plane(
vertices,
0.0,
0.0,
iidxhook_d3d9_bb_scale_hd_width,
iidxhook_d3d9_bb_scale_hd_height);
}
}
return hook_d3d9_irp_invoke_next(irp);
} else if (irp->op == HOOK_D3D9_IRP_OP_DEV_RESET) {
// Gets called when changing the "definition type" in the operator
// menu. needs to be patched to keep the right back buffer size
irp->args.dev_reset.pp->BackBufferWidth =
iidxhook_d3d9_bb_scale_hd_width;
irp->args.dev_reset.pp->BackBufferHeight =
iidxhook_d3d9_bb_scale_hd_height;
return hook_d3d9_irp_invoke_next(irp);
} else if (irp->op == HOOK_D3D9_IRP_OP_DEV_SET_SCISSOR_RECT) {
// Blending to the frame buffer applies scissors which needs to be
// patched to match the final frame buffer's size
RECT *rect = (RECT *) irp->args.dev_set_scissor_rect.pRect;
// Only adjust scissoring when applied to full frame
// Otherwise, this also scissors various UI elements
if (rect->left == 0 && rect->left == 0 && rect->right == 1280 &&
rect->bottom == 720) {
rect->right = iidxhook_d3d9_bb_scale_hd_width;
rect->bottom = iidxhook_d3d9_bb_scale_hd_height;
}
return hook_d3d9_irp_invoke_next(irp);
} else {
return hook_d3d9_irp_invoke_next(irp);
}
}
+13
View File
@@ -0,0 +1,13 @@
#ifndef IIDXHOOK_D3D9_HD_H
#define IIDXHOOK_D3D9_HD_H
#include <stdbool.h>
#include <stdint.h>
#include "hook/d3d9.h"
void iidxhook_d3d9_bb_scale_hd_init(uint16_t width, uint16_t height);
HRESULT iidxhook_d3d9_bb_scale_hd_d3d9_irp_handler(struct hook_d3d9_irp *irp);
#endif
+22
View File
@@ -0,0 +1,22 @@
#ifndef IIDXHOOK_D3D9_UTIL_H
#define IIDXHOOK_D3D9_UTIL_H
#include <windows.h>
#include "d3d9-util/dxerr9.h"
#include "util/log.h"
inline void
iidxhook_d3d9_util_check_and_handle_failure(HRESULT hr, const char *msg)
{
if (FAILED(hr)) {
log_fatal(
"%s\nDX error: %s, DX error description: %s",
msg,
DXGetErrorString9(hr),
DXGetErrorDescription9(hr));
}
}
#endif
+1
View File
@@ -7,6 +7,7 @@ deplibs_iidxhook6 := \
avs \
libs_iidxhook6 := \
iidxhook-d3d9 \
iidxhook-util \
ezusb-emu \
ezusb-iidx-16seg-emu \
+12 -3
View File
@@ -25,6 +25,8 @@
#include "hooklib/rs232.h"
#include "hooklib/setupapi.h"
#include "iidxhook-d3d9/bb-scale-hd.h"
#include "iidxhook-util/acio.h"
#include "iidxhook-util/config-gfx.h"
#include "iidxhook-util/config-io.h"
@@ -44,6 +46,7 @@
"Usage: launcher.exe -K iidxhook6.dll <bm2dx.dll> [options...]"
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
iidxhook_d3d9_bb_scale_hd_d3d9_irp_handler,
iidxhook_util_d3d9_irp_handler,
};
@@ -63,14 +66,20 @@ iidxhook6_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
d3d9_config.pci_vid = config_gfx->pci_id_vid;
d3d9_config.pci_pid = config_gfx->pci_id_pid;
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;
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
d3d9_config.device_adapter = config_gfx->device_adapter;
iidxhook_util_d3d9_configure(&d3d9_config);
// The "old"/current scaling feature does not work with 20-26 because
// the render engine changed and provides its own built-in scaling feature
if (config_gfx->scale_back_buffer_width > 0 &&
config_gfx->scale_back_buffer_height > 0) {
iidxhook_d3d9_bb_scale_hd_init(
config_gfx->scale_back_buffer_width,
config_gfx->scale_back_buffer_height);
}
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
}
+2
View File
@@ -2,11 +2,13 @@ avsdlls += iidxhook7
ldflags_iidxhook7 := \
-liphlpapi \
-ld3d9 \
deplibs_iidxhook7 := \
avs \
libs_iidxhook7 := \
iidxhook-d3d9 \
iidxhook-util \
cconfig \
ezusb-emu \
+12 -3
View File
@@ -25,6 +25,8 @@
#include "hooklib/rs232.h"
#include "hooklib/setupapi.h"
#include "iidxhook-d3d9/bb-scale-hd.h"
#include "iidxhook-util/acio.h"
#include "iidxhook-util/config-gfx.h"
#include "iidxhook-util/config-io.h"
@@ -44,6 +46,7 @@
"Usage: launcher.exe -K iidxhook7.dll <bm2dx.dll> [options...]"
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
iidxhook_d3d9_bb_scale_hd_d3d9_irp_handler,
iidxhook_util_d3d9_irp_handler,
};
@@ -63,14 +66,20 @@ iidxhook7_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
d3d9_config.pci_vid = config_gfx->pci_id_vid;
d3d9_config.pci_pid = config_gfx->pci_id_pid;
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;
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
d3d9_config.device_adapter = config_gfx->device_adapter;
iidxhook_util_d3d9_configure(&d3d9_config);
// The "old"/current scaling feature does not work with 20-26 because
// the render engine changed and provides its own built-in scaling feature
if (config_gfx->scale_back_buffer_width > 0 &&
config_gfx->scale_back_buffer_height > 0) {
iidxhook_d3d9_bb_scale_hd_init(
config_gfx->scale_back_buffer_width,
config_gfx->scale_back_buffer_height);
}
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
}
+1
View File
@@ -12,6 +12,7 @@ deplibs_iidxhook8 := \
avs \
libs_iidxhook8 := \
iidxhook-d3d9 \
iidxhook-util \
acioemu \
bio2emu \
+12 -3
View File
@@ -18,6 +18,8 @@
#include "hooklib/rs232.h"
#include "hooklib/setupapi.h"
#include "iidxhook-d3d9/bb-scale-hd.h"
#include "iidxhook-util/acio.h"
#include "iidxhook-util/config-gfx.h"
#include "iidxhook-util/d3d9.h"
@@ -43,6 +45,7 @@
"Usage: launcher.exe -K iidxhook8.dll <bm2dx.dll> [options...]"
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
iidxhook_d3d9_bb_scale_hd_d3d9_irp_handler,
iidxhook_util_d3d9_irp_handler,
};
@@ -60,14 +63,20 @@ iidxhook8_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
d3d9_config.pci_vid = config_gfx->pci_id_vid;
d3d9_config.pci_pid = config_gfx->pci_id_pid;
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;
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
d3d9_config.device_adapter = config_gfx->device_adapter;
iidxhook_util_d3d9_configure(&d3d9_config);
// The "old"/current scaling feature does not work with 20-26 because
// the render engine changed and provides its own built-in scaling feature
if (config_gfx->scale_back_buffer_width > 0 &&
config_gfx->scale_back_buffer_height > 0) {
iidxhook_d3d9_bb_scale_hd_init(
config_gfx->scale_back_buffer_width,
config_gfx->scale_back_buffer_height);
}
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
}