1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2025-01-18 23:14:02 +01:00

feat(iidx/config): Expose ezusb specific configuration params

Useful (debugging) and required (io board type) for different
game versions
This commit is contained in:
icex2 2023-04-03 01:11:34 +02:00 committed by icex2
parent aaab9bfbfc
commit 3a71a5047a
3 changed files with 88 additions and 0 deletions

View File

@ -8,6 +8,7 @@ src_iidxhook-util := \
chart-patch.c \
clock.c \
config-eamuse.c \
config-ezusb.c \
config-gfx.c \
config-io.c \
config-misc.c \

View File

@ -0,0 +1,69 @@
#include <stdio.h>
#include <string.h>
#include "cconfig/cconfig-util.h"
#include "iidxhook-util/config-ezusb.h"
#include "util/log.h"
#include "util/mem.h"
#define IIDXHOOK_UTIL_CONFIG_EZUSB_API_CALL_MONITORING_KEY "ezusb.api_call_monitoring"
#define IIDXHOOK_UTIL_CONFIG_EZUSB_IO_BOARD_TYPE_KEY "ezusb.io_board_type"
#define IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_API_CALL_MONITORING_VALUE false
#define IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_IO_BOARD_TYPE_VALUE 0
void iidxhook_util_config_ezusb_init(struct cconfig *config)
{
cconfig_util_set_bool(
config,
IIDXHOOK_UTIL_CONFIG_EZUSB_API_CALL_MONITORING_KEY,
IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_API_CALL_MONITORING_VALUE,
"Enable monitoring of ezusb.dll calls by logging call traces. "
"Only works on 9th and 10th style!");
cconfig_util_set_int(
config,
IIDXHOOK_UTIL_CONFIG_EZUSB_IO_BOARD_TYPE_KEY,
IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_IO_BOARD_TYPE_VALUE,
"Set the type of ezusb IO board. 0 = C02, 1 = D01. "
"Note: Impacts security settings!");
}
void iidxhook_util_config_ezusb_get(
struct iidxhook_util_config_ezusb *config_ezusb, struct cconfig *config)
{
if (!cconfig_util_get_bool(
config,
IIDXHOOK_UTIL_CONFIG_EZUSB_API_CALL_MONITORING_KEY,
&config_ezusb->api_call_monitoring,
IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_API_CALL_MONITORING_VALUE)) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
IIDXHOOK_UTIL_CONFIG_EZUSB_API_CALL_MONITORING_KEY,
IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_API_CALL_MONITORING_VALUE);
}
if (!cconfig_util_get_int(
config,
IIDXHOOK_UTIL_CONFIG_EZUSB_IO_BOARD_TYPE_KEY,
&config_ezusb->io_board_type,
IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_IO_BOARD_TYPE_VALUE)) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
IIDXHOOK_UTIL_CONFIG_EZUSB_IO_BOARD_TYPE_KEY,
IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_IO_BOARD_TYPE_VALUE);
}
if (config_ezusb->io_board_type != 0 && config_ezusb->io_board_type != 1) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
IIDXHOOK_UTIL_CONFIG_EZUSB_IO_BOARD_TYPE_KEY,
IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_IO_BOARD_TYPE_VALUE);
config_ezusb->io_board_type = 0;
}
}

View File

@ -0,0 +1,18 @@
#ifndef IIDXHOOK_UTIL_CONFIG_EZUSB_H
#define IIDXHOOK_UTIL_CONFIG_EZUSB_H
#include "cconfig/cconfig.h"
#include "security/mcode.h"
struct iidxhook_util_config_ezusb {
bool api_call_monitoring;
int32_t io_board_type;
};
void iidxhook_util_config_ezusb_init(struct cconfig *config);
void iidxhook_util_config_ezusb_get(
struct iidxhook_util_config_ezusb *config_ezusb, struct cconfig *config);
#endif