From 1c415eb207f4bc090369b5af5a491b2f29bae4b2 Mon Sep 17 00:00:00 2001 From: Will Xyen Date: Sat, 12 Oct 2019 14:15:28 -0400 Subject: [PATCH] bio2emu: Remove requirement for bio2emu_init_end to be called Instead bio2emu_setupapi_hook_init is called during init, this is safe because the game's IO thread isn't initialized at this point, and nothing could be attempting to open devices at this point in time. --- src/main/bio2emu/emu.c | 6 +----- src/main/bio2emu/emu.h | 7 +++---- src/main/iidxhook8/dllmain.c | 5 +---- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/bio2emu/emu.c b/src/main/bio2emu/emu.c index abca733..c7f3604 100644 --- a/src/main/bio2emu/emu.c +++ b/src/main/bio2emu/emu.c @@ -28,13 +28,9 @@ static struct array bio2_active_ports; -void bio2emu_init_start() +void bio2emu_init() { array_init(&bio2_active_ports); -} - -void bio2emu_init_end() -{ bio2emu_setupapi_hook_init(&bio2_active_ports); } diff --git a/src/main/bio2emu/emu.h b/src/main/bio2emu/emu.h index fc37ed9..68f8dc8 100644 --- a/src/main/bio2emu/emu.h +++ b/src/main/bio2emu/emu.h @@ -1,5 +1,5 @@ -#ifndef BIO2EMU_H -#define BIO2EMU_BIO2EMU_H +#ifndef BIO2EMU_EMU_H +#define BIO2EMU_EMU_H #include "hook/iohook.h" #include "acioemu/emu.h" @@ -17,8 +17,7 @@ struct bio2emu_port { }; -void bio2emu_init_start(); -void bio2emu_init_end(); +void bio2emu_init(); void bio2emu_port_init(struct bio2emu_port* bio2emu_emu); void bio2emu_port_fini(struct bio2emu_port* bio2emu_emu); diff --git a/src/main/iidxhook8/dllmain.c b/src/main/iidxhook8/dllmain.c index 900ae19..dbbb526 100644 --- a/src/main/iidxhook8/dllmain.c +++ b/src/main/iidxhook8/dllmain.c @@ -149,11 +149,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param) rs232_hook_limit_hooks(); if (!iidxhook8_config_io.disable_bio2_emu) { - bio2emu_init_start(); - + bio2emu_init(); bio2_emu_bi2a_init(&bio2_emu, iidxhook8_config_io.disable_poll_limiter); - - bio2emu_init_end(); } if (!iidxhook8_config_io.disable_card_reader_emu) {