feat: bemanitools 6 initial refactoring drop, alpha 1
**THIS IS A HIGHLY WORK/DEVELOPMENT IN PROGRESS VERSION**
**THINGS ARE BROKEN AND EVERYTHING IS SUBJECT TO CHANGE**
First cut after massive refactoring with most critical and fundamental changes implemented.
We need to start somewhere, and this might be as good as anything else, so we can get started
with testing, bug fixing and iterating for the next releases.
The following list is non-exhaustive, does not guarantee anything does work, yet, and is supposed
to give a high level idea of what all of this is about. Updated documentation will reflect all of
this at some later point in time in more detail.
* A common "core" now abstracts logging, thread, property and configuration infrastructure and
provides a common interface. This is used by bemanitools internally as well as all tools, hooks
and APIs provided and don't depend on the game, version of the game or AVS version available
anymore
* New bemanitools (public) API
* Versioned API allowing for handling incremental API changes as well as breaking changes by
providing a new/different version when necessary
* Unified interfaces for bemanitools core API, i.e. logging, threads, configuration
* SDK with examples (TBD)
* Dogfooding approach: Bemanitools uses its own (public) API to implement and provide fundamental
features like configurable keyboard implementations for IO or hooks for different games and
versions
* All bemanitools hooks and IO libraries have been or are about to be re-worked to use the new APIs
* New hook API allows for more fine grained runtime control when stages of the hook are to be
executed, i.e. pre AVS, before main game, iat hooking instead of relying purely on DllMain
(which is still a compatible option though)
* launcher as a replacement for bootstrap: Bring it significantly closer to the original bootstrap
by supporting completely vanilla data and bootstrap.xml configurations to run the games. Note
that bemanitools does not include any code or means to run DRM'd data, only decrypted
* inject is also being reworked to use as much of the same "infrastructure" as launcher to provide
a more seamless bootstrapping process for games that keeps pre-eapki data as vanilla as possible
Summary:
Test Plan:
Summary:
Test Plan:
Summary:
Test Plan:
Summary:
Test Plan:
This commit is contained in:
@@ -11,19 +11,23 @@ ldflags_sdvxhook2 := \
|
||||
deplibs_sdvxhook2 := \
|
||||
avs \
|
||||
|
||||
avslibs_sdvxhook2 := \
|
||||
avs-ext \
|
||||
|
||||
libs_sdvxhook2 := \
|
||||
avs-util \
|
||||
core \
|
||||
acioemu \
|
||||
bio2emu \
|
||||
camhook \
|
||||
d3d9exhook \
|
||||
sdvxio \
|
||||
hook \
|
||||
hooklib \
|
||||
cconfig \
|
||||
util \
|
||||
eamio \
|
||||
iface \
|
||||
iface-io \
|
||||
iface-core \
|
||||
module \
|
||||
|
||||
src_sdvxhook2 := \
|
||||
acio.c \
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
#include "acioemu/emu.h"
|
||||
#include "acioemu/icca.h"
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
#include "hooklib/rs232.h"
|
||||
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "sdvxhook2/acio.h"
|
||||
|
||||
#include "imports/avs.h"
|
||||
|
||||
+39
-38
@@ -10,7 +10,7 @@
|
||||
#include "bio2emu/emu.h"
|
||||
#include "sdvxhook2/bi2a.h"
|
||||
|
||||
#include "bemanitools/sdvxio.h"
|
||||
#include "iface-io/sdvx.h"
|
||||
|
||||
static void bio2_emu_bi2a_cmd_send_version(
|
||||
struct ac_io_emu *emu, const struct ac_io_message *req);
|
||||
@@ -209,44 +209,44 @@ bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
|
||||
gpio |= assign_light(0x01, pout->gpio[5]);
|
||||
gpio |= assign_light(0x02, pout->gpio[6]);
|
||||
|
||||
sdvx_io_set_gpio_lights(gpio);
|
||||
bt_io_sdvx_gpio_lights_set(gpio);
|
||||
|
||||
sdvx_io_set_pwm_light(0x0, pout->wingUpper[0]);
|
||||
sdvx_io_set_pwm_light(0x1, pout->wingUpper[1]);
|
||||
sdvx_io_set_pwm_light(0x2, pout->wingUpper[2]);
|
||||
sdvx_io_set_pwm_light(0x3, pout->wingUpper[0]);
|
||||
sdvx_io_set_pwm_light(0x4, pout->wingUpper[1]);
|
||||
sdvx_io_set_pwm_light(0x5, pout->wingUpper[2]);
|
||||
bt_io_sdvx_pwm_light_set(0x0, pout->wingUpper[0]);
|
||||
bt_io_sdvx_pwm_light_set(0x1, pout->wingUpper[1]);
|
||||
bt_io_sdvx_pwm_light_set(0x2, pout->wingUpper[2]);
|
||||
bt_io_sdvx_pwm_light_set(0x3, pout->wingUpper[0]);
|
||||
bt_io_sdvx_pwm_light_set(0x4, pout->wingUpper[1]);
|
||||
bt_io_sdvx_pwm_light_set(0x5, pout->wingUpper[2]);
|
||||
|
||||
sdvx_io_set_pwm_light(0x6, pout->wingLower[0]);
|
||||
sdvx_io_set_pwm_light(0x7, pout->wingLower[1]);
|
||||
sdvx_io_set_pwm_light(0x8, pout->wingLower[2]);
|
||||
sdvx_io_set_pwm_light(0x9, pout->wingLower[0]);
|
||||
sdvx_io_set_pwm_light(0xA, pout->wingLower[1]);
|
||||
sdvx_io_set_pwm_light(0xB, pout->wingLower[2]);
|
||||
bt_io_sdvx_pwm_light_set(0x6, pout->wingLower[0]);
|
||||
bt_io_sdvx_pwm_light_set(0x7, pout->wingLower[1]);
|
||||
bt_io_sdvx_pwm_light_set(0x8, pout->wingLower[2]);
|
||||
bt_io_sdvx_pwm_light_set(0x9, pout->wingLower[0]);
|
||||
bt_io_sdvx_pwm_light_set(0xA, pout->wingLower[1]);
|
||||
bt_io_sdvx_pwm_light_set(0xB, pout->wingLower[2]);
|
||||
|
||||
sdvx_io_set_pwm_light(0xC, pout->woof_r);
|
||||
sdvx_io_set_pwm_light(0xD, pout->woof_g);
|
||||
sdvx_io_set_pwm_light(0xE, pout->woof_b);
|
||||
bt_io_sdvx_pwm_light_set(0xC, pout->woof_r);
|
||||
bt_io_sdvx_pwm_light_set(0xD, pout->woof_g);
|
||||
bt_io_sdvx_pwm_light_set(0xE, pout->woof_b);
|
||||
|
||||
sdvx_io_set_pwm_light(0xF, pout->controller[0]);
|
||||
sdvx_io_set_pwm_light(0x10, pout->controller[1]);
|
||||
sdvx_io_set_pwm_light(0x11, pout->controller[2]);
|
||||
bt_io_sdvx_pwm_light_set(0xF, pout->controller[0]);
|
||||
bt_io_sdvx_pwm_light_set(0x10, pout->controller[1]);
|
||||
bt_io_sdvx_pwm_light_set(0x11, pout->controller[2]);
|
||||
|
||||
sdvx_io_write_output();
|
||||
bt_io_sdvx_output_write();
|
||||
|
||||
sdvx_io_read_input();
|
||||
uint8_t sys = sdvx_io_get_input_gpio_sys();
|
||||
uint16_t gpio0 = sdvx_io_get_input_gpio(0);
|
||||
uint16_t gpio1 = sdvx_io_get_input_gpio(1);
|
||||
bt_io_sdvx_input_read();
|
||||
uint8_t sys = bt_io_sdvx_input_gpio_sys_get();
|
||||
uint16_t gpio0 = bt_io_sdvx_input_gpio_get(0);
|
||||
uint16_t gpio1 = bt_io_sdvx_input_gpio_get(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 = bt_io_sdvx_spinner_pos_get(0);
|
||||
pin->analogs[1].a_val = bt_io_sdvx_spinner_pos_get(1);
|
||||
|
||||
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, BT_IO_SDVX_IN_GPIO_SYS_TEST);
|
||||
pin->analogs[0].a_service = check_pin(sys, BT_IO_SDVX_IN_GPIO_SYS_SERVICE);
|
||||
pin->analogs[0].a_coin = check_pin(sys, BT_IO_SDVX_IN_GPIO_SYS_COIN);
|
||||
|
||||
if (pin->analogs[0].a_coin) {
|
||||
if (!coin_latch) {
|
||||
@@ -263,17 +263,18 @@ bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
|
||||
pin->raw[0] = ac_io_u16(pin->raw[0]);
|
||||
pin->raw[1] = ac_io_u16(pin->raw[1]);
|
||||
|
||||
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_start = check_pin(gpio0, BT_IO_SDVX_IN_GPIO_0_START);
|
||||
pin->buttons_1.b_headphone =
|
||||
check_pin(gpio0, BT_IO_SDVX_IN_GPIO_0_HEADPHONE);
|
||||
if (force_headphones_on) {
|
||||
pin->buttons_1.b_headphone = 1;
|
||||
}
|
||||
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);
|
||||
pin->buttons_1.b_a = check_pin(gpio0, BT_IO_SDVX_IN_GPIO_0_A);
|
||||
pin->buttons_1.b_b = check_pin(gpio0, BT_IO_SDVX_IN_GPIO_0_B);
|
||||
pin->buttons_1.b_c = check_pin(gpio0, BT_IO_SDVX_IN_GPIO_0_C);
|
||||
pin->buttons_1.b_d = check_pin(gpio1, BT_IO_SDVX_IN_GPIO_1_D);
|
||||
pin->buttons_1.b_fxl = check_pin(gpio1, BT_IO_SDVX_IN_GPIO_1_FX_L);
|
||||
pin->buttons_2.b_fxr = check_pin(gpio1, BT_IO_SDVX_IN_GPIO_1_FX_R);
|
||||
|
||||
ac_io_emu_response_push(emu, &resp, 0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "cconfig/cconfig-util.h"
|
||||
|
||||
#include "core/log.h"
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "sdvxhook2/config-io.h"
|
||||
|
||||
|
||||
@@ -5,16 +5,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "avs-util/core-interop.h"
|
||||
|
||||
#include "bemanitools/eamio.h"
|
||||
#include "bemanitools/sdvxio.h"
|
||||
#include "avs-ext/log.h"
|
||||
#include "avs-ext/thread.h"
|
||||
|
||||
#include "cconfig/cconfig-hook.h"
|
||||
|
||||
#include "core/log.h"
|
||||
#include "core/thread.h"
|
||||
|
||||
#include "hooklib/acp.h"
|
||||
#include "hooklib/adapter.h"
|
||||
#include "hooklib/app.h"
|
||||
@@ -22,6 +17,15 @@
|
||||
#include "hooklib/memfile.h"
|
||||
#include "hooklib/rs232.h"
|
||||
|
||||
#include "iface-core/log.h"
|
||||
#include "iface-core/thread.h"
|
||||
|
||||
#include "iface-io/eam.h"
|
||||
#include "iface-io/sdvx.h"
|
||||
|
||||
#include "module/io-ext.h"
|
||||
#include "module/io.h"
|
||||
|
||||
#include "bio2emu/emu.h"
|
||||
|
||||
#include "sdvxhook2/acio.h"
|
||||
@@ -51,6 +55,9 @@ struct camhook_config_cam config_cam;
|
||||
struct d3d9exhook_config_gfx config_gfx;
|
||||
struct hooklib_config_adapter config_adapter;
|
||||
|
||||
static module_io_t *_sdvxhook2_module_io_sdvx;
|
||||
static module_io_t *_sdvxhook2_module_io_eam;
|
||||
|
||||
static struct bio2emu_port bio2_emu = {
|
||||
.port = "COM4",
|
||||
.wport = L"\\\\.\\COM4",
|
||||
@@ -72,6 +79,26 @@ static void attach_dest_fd_intercept(const char *sidcode)
|
||||
memfile_hook_add_fd(target_file, ENDING_MATCH, NULL, 0);
|
||||
}
|
||||
|
||||
static void _sdvxhook2_io_sdvx_init(module_io_t **module)
|
||||
{
|
||||
bt_io_sdvx_api_t api;
|
||||
|
||||
module_io_ext_load_and_init(
|
||||
"sdvxio.dll", "bt_module_io_sdvx_api_get", module);
|
||||
module_io_api_get(*module, &api);
|
||||
bt_io_sdvx_api_set(&api);
|
||||
}
|
||||
|
||||
static void _sdvxhook2_io_eam_init(module_io_t **module)
|
||||
{
|
||||
bt_io_eam_api_t api;
|
||||
|
||||
module_io_ext_load_and_init(
|
||||
"eamio.dll", "bt_module_io_eam_api_get", module);
|
||||
module_io_api_get(*module, &api);
|
||||
bt_io_eam_api_set(&api);
|
||||
}
|
||||
|
||||
static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
{
|
||||
struct cconfig *config;
|
||||
@@ -108,12 +135,10 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
/* Start up sdvxio.DLL */
|
||||
if (!config_io.disable_bio2_emu) {
|
||||
log_info("Starting sdvx IO backend");
|
||||
core_log_impl_assign(sdvx_io_set_loggers);
|
||||
|
||||
if (!sdvx_io_init(
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get())) {
|
||||
_sdvxhook2_io_sdvx_init(&_sdvxhook2_module_io_sdvx);
|
||||
|
||||
if (!bt_io_sdvx_init()) {
|
||||
log_fatal("Initializing sdvx IO backend failed");
|
||||
}
|
||||
}
|
||||
@@ -121,12 +146,10 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
/* Start up EAMIO.DLL */
|
||||
if (!config_io.disable_card_reader_emu) {
|
||||
log_misc("Initializing card reader backend");
|
||||
core_log_impl_assign(eam_io_set_loggers);
|
||||
|
||||
if (!eam_io_init(
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get())) {
|
||||
_sdvxhook2_io_eam_init(&_sdvxhook2_module_io_eam);
|
||||
|
||||
if (!bt_io_eam_init()) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
}
|
||||
@@ -188,12 +211,20 @@ static bool my_dll_entry_main(void)
|
||||
|
||||
if (!config_io.disable_card_reader_emu) {
|
||||
log_misc("Shutting down card reader backend");
|
||||
eam_io_fini();
|
||||
|
||||
bt_io_eam_fini();
|
||||
|
||||
bt_io_eam_api_clear();
|
||||
module_io_free(&_sdvxhook2_module_io_eam);
|
||||
}
|
||||
|
||||
if (!config_io.disable_bio2_emu) {
|
||||
log_misc("Shutting down sdvx IO backend");
|
||||
sdvx_io_fini();
|
||||
|
||||
bt_io_sdvx_fini();
|
||||
|
||||
bt_io_sdvx_api_clear();
|
||||
module_io_free(&_sdvxhook2_module_io_sdvx);
|
||||
}
|
||||
|
||||
if (!config_io.disable_file_hooks) {
|
||||
@@ -213,8 +244,8 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
}
|
||||
|
||||
// Use AVS APIs
|
||||
avs_util_core_interop_thread_avs_impl_set();
|
||||
avs_util_core_interop_log_avs_impl_set();
|
||||
avs_ext_log_core_api_set();
|
||||
avs_ext_thread_core_api_set();
|
||||
|
||||
app_hook_init(my_dll_entry_init, my_dll_entry_main);
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "sdvxhook2/nvapi.h"
|
||||
|
||||
static void *my_GetProcAddress(HMODULE dll, const char *name);
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "sdvxhook2/power.h"
|
||||
|
||||
static DWORD
|
||||
|
||||
Reference in New Issue
Block a user