mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2025-02-21 04:48:42 +01:00
sdvxhook: remove pci override for gfx hooks and general cleanup
This commit is contained in:
parent
412ece18fc
commit
51a697659b
8
dist/sdvx5/sdvxhook.conf
vendored
8
dist/sdvx5/sdvxhook.conf
vendored
@ -4,6 +4,12 @@ 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
|
||||
|
||||
@ -17,5 +23,5 @@ io.disable_poll_limiter=0
|
||||
cam.disable_emu=0
|
||||
|
||||
# [str]: Override camera device ID detection (copy from device manager, do not escape)
|
||||
cam.device_id=
|
||||
cam.device_id1=
|
||||
|
||||
|
@ -77,7 +77,7 @@ HRESULT ac_io_port_dispatch_irp(struct irp *irp)
|
||||
break;
|
||||
|
||||
case AC_IO_BROADCAST:
|
||||
log_warning("Broadcast(?) message on IIDX ACIO bus?");
|
||||
log_warning("Broadcast? (0x70) message on BIO2 bus");
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
#define LOG_MODULE "sdvxhook2-bi2a"
|
||||
|
||||
#include "sdvxhook2/bi2a.h"
|
||||
#include "bio2emu/emu.h"
|
||||
|
||||
#include <windows.h> /* for _BitScanForward */
|
||||
|
||||
#include <stdint.h>
|
||||
@ -10,6 +7,8 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "acioemu/emu.h"
|
||||
#include "bio2emu/emu.h"
|
||||
#include "sdvxhook2/bi2a.h"
|
||||
|
||||
#include "bemanitools/sdvxio.h"
|
||||
|
||||
@ -32,6 +31,7 @@ void bio2_emu_bi2a_init(
|
||||
bio2emu_port_init(bio2_emu);
|
||||
|
||||
poll_delay = !disable_poll_limiter;
|
||||
|
||||
if (!poll_delay) {
|
||||
log_warning("bio2_emu_bi2a_init: poll_delay has been disabled");
|
||||
}
|
||||
@ -162,7 +162,7 @@ static uint8_t check_pin(uint16_t value, uint8_t pin)
|
||||
return (value >> pin) & 1;
|
||||
}
|
||||
|
||||
static uint32_t _assign_light(uint32_t shift, uint32_t value)
|
||||
static uint32_t assign_light(uint32_t shift, uint32_t value)
|
||||
{
|
||||
if (!value) {
|
||||
return 0;
|
||||
@ -188,13 +188,13 @@ bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
|
||||
memset(pin, 0, sizeof(*pin));
|
||||
|
||||
uint32_t gpio = 0;
|
||||
gpio |= _assign_light(0x0C, pout->gpio[0]);
|
||||
gpio |= _assign_light(0x0D, pout->gpio[1]);
|
||||
gpio |= _assign_light(0x0E, pout->gpio[2]);
|
||||
gpio |= _assign_light(0x0F, pout->gpio[3]);
|
||||
gpio |= _assign_light(0x00, pout->gpio[4]);
|
||||
gpio |= _assign_light(0x01, pout->gpio[5]);
|
||||
gpio |= _assign_light(0x02, pout->gpio[6]);
|
||||
gpio |= assign_light(0x0C, pout->gpio[0]);
|
||||
gpio |= assign_light(0x0D, pout->gpio[1]);
|
||||
gpio |= assign_light(0x0E, pout->gpio[2]);
|
||||
gpio |= assign_light(0x0F, pout->gpio[3]);
|
||||
gpio |= assign_light(0x00, pout->gpio[4]);
|
||||
gpio |= assign_light(0x01, pout->gpio[5]);
|
||||
gpio |= assign_light(0x02, pout->gpio[6]);
|
||||
|
||||
sdvx_io_set_gpio_lights(gpio);
|
||||
|
||||
@ -228,24 +228,24 @@ bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
|
||||
uint16_t gpio1 = sdvx_io_get_input_gpio(1);
|
||||
|
||||
// TODO: Make a counter or smth to counteract the accuracy lost in *4
|
||||
pin->ANALOGS[0].a_val = sdvx_io_get_spinner_pos(0);
|
||||
pin->ANALOGS[1].a_val = sdvx_io_get_spinner_pos(1);
|
||||
pin->analogs[0].a_val = sdvx_io_get_spinner_pos(0);
|
||||
pin->analogs[1].a_val = sdvx_io_get_spinner_pos(1);
|
||||
|
||||
pin->ANALOGS[0].a_coin = check_pin(sys, SDVX_IO_IN_GPIO_SYS_COIN);
|
||||
pin->ANALOGS[0].a_test = check_pin(sys, SDVX_IO_IN_GPIO_SYS_TEST);
|
||||
pin->ANALOGS[0].a_service = check_pin(sys, SDVX_IO_IN_GPIO_SYS_SERVICE) ||
|
||||
pin->analogs[0].a_coin = check_pin(sys, SDVX_IO_IN_GPIO_SYS_COIN);
|
||||
pin->analogs[0].a_test = check_pin(sys, SDVX_IO_IN_GPIO_SYS_TEST);
|
||||
pin->analogs[0].a_service = check_pin(sys, SDVX_IO_IN_GPIO_SYS_SERVICE) ||
|
||||
check_pin(sys, SDVX_IO_IN_GPIO_SYS_COIN);
|
||||
pin->raw[0] = ac_io_u16(pin->raw[0]);
|
||||
pin->raw[1] = ac_io_u16(pin->raw[1]);
|
||||
|
||||
pin->BUTTONS1.b_start = check_pin(gpio0, SDVX_IO_IN_GPIO_0_START);
|
||||
pin->BUTTONS1.b_headphone = check_pin(gpio0, SDVX_IO_IN_GPIO_0_HEADPHONE);
|
||||
pin->BUTTONS1.b_a = check_pin(gpio0, SDVX_IO_IN_GPIO_0_A);
|
||||
pin->BUTTONS1.b_b = check_pin(gpio0, SDVX_IO_IN_GPIO_0_B);
|
||||
pin->BUTTONS1.b_c = check_pin(gpio0, SDVX_IO_IN_GPIO_0_C);
|
||||
pin->BUTTONS1.b_d = check_pin(gpio1, SDVX_IO_IN_GPIO_1_D);
|
||||
pin->BUTTONS1.b_fxl = check_pin(gpio1, SDVX_IO_IN_GPIO_1_FX_L);
|
||||
pin->BUTTONS2.b_fxr = check_pin(gpio1, SDVX_IO_IN_GPIO_1_FX_R);
|
||||
pin->buttons_1.b_start = check_pin(gpio0, SDVX_IO_IN_GPIO_0_START);
|
||||
pin->buttons_1.b_headphone = check_pin(gpio0, SDVX_IO_IN_GPIO_0_HEADPHONE);
|
||||
pin->buttons_1.b_a = check_pin(gpio0, SDVX_IO_IN_GPIO_0_A);
|
||||
pin->buttons_1.b_b = check_pin(gpio0, SDVX_IO_IN_GPIO_0_B);
|
||||
pin->buttons_1.b_c = check_pin(gpio0, SDVX_IO_IN_GPIO_0_C);
|
||||
pin->buttons_1.b_d = check_pin(gpio1, SDVX_IO_IN_GPIO_1_D);
|
||||
pin->buttons_1.b_fxl = check_pin(gpio1, SDVX_IO_IN_GPIO_1_FX_L);
|
||||
pin->buttons_2.b_fxr = check_pin(gpio1, SDVX_IO_IN_GPIO_1_FX_R);
|
||||
|
||||
ac_io_emu_response_push(emu, &resp, 0);
|
||||
}
|
||||
|
@ -46,11 +46,11 @@ struct bio2_bi2a_state {
|
||||
union {
|
||||
uint16_t raw[8];
|
||||
struct {
|
||||
struct bi2a_sdvx_analog ANALOGS[4];
|
||||
uint8_t UNK; // coin mech?
|
||||
struct bi2a_sdvx_buttons1 BUTTONS1;
|
||||
struct bi2a_sdvx_buttons2 BUTTONS2;
|
||||
uint8_t UNK2[5];
|
||||
struct bi2a_sdvx_analog analogs[4];
|
||||
uint8_t unk_1; // coin mech?
|
||||
struct bi2a_sdvx_buttons1 buttons_1;
|
||||
struct bi2a_sdvx_buttons2 buttons_2;
|
||||
uint8_t unk_2[5];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -7,13 +7,11 @@
|
||||
#include "util/log.h"
|
||||
|
||||
#define SDVXHOOK2_CONFIG_GFX_FRAMED_KEY "gfx.framed"
|
||||
#define SDVXHOOK2_CONFIG_GFX_PCI_ID_KEY "gfx.pci_id"
|
||||
#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_PCI_ID_VALUE "1002:7146"
|
||||
#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
|
||||
@ -26,15 +24,6 @@ void sdvxhook2_config_gfx_init(struct cconfig *config)
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_FRAMED_VALUE,
|
||||
"Run the game in a framed window (requires windowed option)");
|
||||
|
||||
cconfig_util_set_str(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_PCI_ID_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_PCI_ID_VALUE,
|
||||
"Patch the GPU device ID detection (leave empty to"
|
||||
" disable), format XXXX:YYYY, two 4 digit hex numbers (vid:pid)."
|
||||
" Examples: 1002:7146 (RV515, Radeon X1300), 1002:95C5 (RV620 LE,"
|
||||
" Radeon HD3450)");
|
||||
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOWED_KEY,
|
||||
@ -57,10 +46,6 @@ void sdvxhook2_config_gfx_init(struct cconfig *config)
|
||||
void sdvxhook2_config_gfx_get(
|
||||
struct sdvxhook2_config_gfx *config_gfx, struct cconfig *config)
|
||||
{
|
||||
char tmp[10];
|
||||
char *vid;
|
||||
char *pid;
|
||||
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_FRAMED_KEY,
|
||||
@ -73,34 +58,6 @@ void sdvxhook2_config_gfx_get(
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_FRAMED_VALUE);
|
||||
}
|
||||
|
||||
if (!cconfig_util_get_str(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_PCI_ID_KEY,
|
||||
tmp,
|
||||
sizeof(tmp) - 1,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_PCI_ID_VALUE)) {
|
||||
log_warning(
|
||||
"Invalid value for key '%s' specified, fallback "
|
||||
"to default '%s'",
|
||||
SDVXHOOK2_CONFIG_GFX_PCI_ID_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_PCI_ID_VALUE);
|
||||
}
|
||||
|
||||
if (tmp[4] != ':') {
|
||||
log_warning(
|
||||
"Invalid format for value for key '%s' specified, fallback "
|
||||
"to default '%s'",
|
||||
SDVXHOOK2_CONFIG_GFX_PCI_ID_KEY,
|
||||
SDVXHOOK2_CONFIG_GFX_DEFAULT_PCI_ID_VALUE);
|
||||
strcpy(tmp, SDVXHOOK2_CONFIG_GFX_DEFAULT_PCI_ID_VALUE);
|
||||
}
|
||||
|
||||
tmp[4] = '\0';
|
||||
vid = tmp;
|
||||
pid = &tmp[5];
|
||||
config_gfx->pci_id_vid = strtol(vid, NULL, 16);
|
||||
config_gfx->pci_id_pid = strtol(pid, NULL, 16);
|
||||
|
||||
if (!cconfig_util_get_bool(
|
||||
config,
|
||||
SDVXHOOK2_CONFIG_GFX_WINDOWED_KEY,
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
struct sdvxhook2_config_gfx {
|
||||
bool framed;
|
||||
uint16_t pci_id_vid;
|
||||
uint16_t pci_id_pid;
|
||||
bool windowed;
|
||||
int32_t window_width;
|
||||
int32_t window_height;
|
||||
|
@ -177,6 +177,7 @@ my_MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
|
||||
nWidth = wp.cx;
|
||||
nHeight = wp.cy;
|
||||
}
|
||||
|
||||
BOOL result = real_MoveWindow(hWnd, X, Y, nWidth, nHeight, bRepaint);
|
||||
|
||||
return result;
|
||||
@ -270,12 +271,6 @@ void d3d9_set_windowed(bool framed, int32_t width, int32_t height)
|
||||
d3d9_window_height = height;
|
||||
}
|
||||
|
||||
void d3d9_set_pci_id(uint16_t vid, uint16_t pid)
|
||||
{
|
||||
str_format(
|
||||
d3d9_pci_id, sizeof(d3d9_pci_id), "PCI\\VEN_%04X&DEV_%04X", vid, pid);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static void calc_win_size_with_framed(
|
||||
|
@ -17,15 +17,6 @@ void d3d9_hook_init(void);
|
||||
*/
|
||||
void d3d9_set_windowed(bool framed, int32_t width, int32_t height);
|
||||
|
||||
/**
|
||||
* Patch the GPU device ID detection to allow running the game with
|
||||
* other GPUs than the ones it is locked to.
|
||||
*
|
||||
* @param vid Vendor ID to patch.
|
||||
* @param pid Product ID to patch.
|
||||
*/
|
||||
void d3d9_set_pci_id(uint16_t vid, uint16_t pid);
|
||||
|
||||
/**
|
||||
* Set a framerate limit for the rendering loop.
|
||||
*
|
||||
|
@ -16,12 +16,12 @@
|
||||
#include "hooklib/rs232.h"
|
||||
|
||||
#include "bio2emu/emu.h"
|
||||
#include "sdvxhook2/bi2a.h"
|
||||
|
||||
#include "sdvxhook2/acio.h"
|
||||
#include "sdvxhook2/d3d9.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"
|
||||
@ -89,10 +89,6 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
config_gfx.window_height);
|
||||
}
|
||||
|
||||
if (config_gfx.pci_id_pid != 0 && config_gfx.pci_id_vid != 0) {
|
||||
d3d9_set_pci_id(config_gfx.pci_id_pid, config_gfx.pci_id_vid);
|
||||
}
|
||||
|
||||
/* Start up sdvxio.DLL */
|
||||
if (!config_io.disable_bio2_emu) {
|
||||
log_info("Starting sdvx IO backend");
|
||||
|
Loading…
x
Reference in New Issue
Block a user