mirror of
https://github.com/pumpitupdev/pumptools.git
synced 2026-10-01 11:17:55 +03:00
Appl new code style on whole code base
Use a similar code style to bemanitools though reduce indentation to 2 spaces. Also some other tweaks to be more similar to google style.
This commit is contained in:
+154
-148
@@ -11,9 +11,9 @@
|
||||
#include "hook/core/piu-utils.h"
|
||||
|
||||
#include "hook/patch/hook-mon.h"
|
||||
#include "hook/patch/piuio.h"
|
||||
#include "hook/patch/piuio-exit.h"
|
||||
#include "hook/patch/piuio-khack.h"
|
||||
#include "hook/patch/piuio.h"
|
||||
#include "hook/patch/redir.h"
|
||||
#include "hook/patch/usb-emu.h"
|
||||
#include "hook/patch/usb-init-fix.h"
|
||||
@@ -31,201 +31,207 @@
|
||||
|
||||
#include "options.h"
|
||||
|
||||
static void prohook_bootstrapping(int argc, char** argv, struct prohook_options* options)
|
||||
static void
|
||||
prohook_bootstrapping(int argc, char **argv, struct prohook_options *options)
|
||||
{
|
||||
log_assert(argc >= 0);
|
||||
log_assert(argv);
|
||||
log_assert(options);
|
||||
log_assert(argc >= 0);
|
||||
log_assert(argv);
|
||||
log_assert(options);
|
||||
|
||||
if (hook_core_piu_block_non_piu_process_recursion(argc, argv)) {
|
||||
return;
|
||||
}
|
||||
if (hook_core_piu_block_non_piu_process_recursion(argc, argv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
hook_core_piu_log_init(argc, argv);
|
||||
hook_core_piu_log_init(argc, argv);
|
||||
|
||||
if (!prohook_options_init(argc, argv, options)) {
|
||||
exit(0);
|
||||
}
|
||||
if (!prohook_options_init(argc, argv, options)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
hook_core_piu_log_info(argc, argv);
|
||||
hook_core_piu_log_info(argc, argv);
|
||||
|
||||
hook_core_piu_utils_verify_root_user();
|
||||
hook_core_piu_utils_verify_root_user();
|
||||
|
||||
log_info("Initializing");
|
||||
log_info("Initializing");
|
||||
}
|
||||
|
||||
static void prohook_patch_fs_init(struct prohook_options* options)
|
||||
static void prohook_patch_fs_init(struct prohook_options *options)
|
||||
{
|
||||
log_assert(options);
|
||||
log_assert(options);
|
||||
|
||||
patch_hook_mon_init(
|
||||
options->patch.hook_mon.io,
|
||||
options->patch.hook_mon.file,
|
||||
options->patch.hook_mon.fs,
|
||||
options->patch.hook_mon.usb,
|
||||
options->patch.hook_mon.open);
|
||||
patch_hook_mon_init(
|
||||
options->patch.hook_mon.io,
|
||||
options->patch.hook_mon.file,
|
||||
options->patch.hook_mon.fs,
|
||||
options->patch.hook_mon.usb,
|
||||
options->patch.hook_mon.open);
|
||||
|
||||
patch_redir_init();
|
||||
patch_redir_init();
|
||||
}
|
||||
|
||||
static void prohook_fs_redir_settings(struct prohook_options* options)
|
||||
static void prohook_fs_redir_settings(struct prohook_options *options)
|
||||
{
|
||||
if (options->game.settings) {
|
||||
if (!util_fs_path_exists(options->game.settings)) {
|
||||
log_info("Settings path %s does not exist, creating", options->game.settings);
|
||||
if (options->game.settings) {
|
||||
if (!util_fs_path_exists(options->game.settings)) {
|
||||
log_info(
|
||||
"Settings path %s does not exist, creating", options->game.settings);
|
||||
|
||||
if (!util_fs_mkdir(options->game.settings)) {
|
||||
log_error("Creating directory %s failed", options->game.settings);
|
||||
}
|
||||
}
|
||||
|
||||
char* abs_path = util_fs_get_abs_path(options->game.settings);
|
||||
|
||||
cnh_redir_add("/data", abs_path);
|
||||
free(abs_path);
|
||||
} else {
|
||||
log_warn("No settings (data) path specified");
|
||||
}
|
||||
}
|
||||
|
||||
static void prohook_fs_redir_data(struct prohook_options* options)
|
||||
{
|
||||
if (options->game.data) {
|
||||
char* abs_path = util_fs_get_abs_path(options->game.data);
|
||||
|
||||
cnh_redir_add("/game", abs_path);
|
||||
free(abs_path);
|
||||
} else {
|
||||
log_warn("No data (game) path specified");
|
||||
}
|
||||
}
|
||||
|
||||
static void prohook_fs_redirs_init(struct prohook_options* options)
|
||||
{
|
||||
log_assert(options);
|
||||
|
||||
prohook_fs_redir_settings(options);
|
||||
prohook_fs_redir_data(options);
|
||||
}
|
||||
|
||||
static void prohook_patch_sigsegv_init(struct prohook_options* options)
|
||||
{
|
||||
log_assert(options);
|
||||
|
||||
/* seems like pump pro doesn't like it when injecting our own signal
|
||||
handler. game crashes instantly when adding it. */
|
||||
/*
|
||||
patch_sigsegv_init();
|
||||
*/
|
||||
}
|
||||
|
||||
static void prohook_patch_x11_event_loop_init(struct prohook_options* options)
|
||||
{
|
||||
patch_x11_event_loop_init();
|
||||
|
||||
// Register up to two X11 input handlers for piuio and piubtn
|
||||
|
||||
if (options->patch.x11_event_loop.api_lib) {
|
||||
char* abs_path_lib = util_fs_get_abs_path(options->patch.x11_event_loop.api_lib);
|
||||
|
||||
patch_x11_event_loop_add_input_handler(abs_path_lib);
|
||||
free(abs_path_lib);
|
||||
if (!util_fs_mkdir(options->game.settings)) {
|
||||
log_error("Creating directory %s failed", options->game.settings);
|
||||
}
|
||||
}
|
||||
|
||||
if (options->patch.x11_event_loop.api_lib2) {
|
||||
char* abs_path_lib = util_fs_get_abs_path(options->patch.x11_event_loop.api_lib2);
|
||||
char *abs_path = util_fs_get_abs_path(options->game.settings);
|
||||
|
||||
patch_x11_event_loop_add_input_handler(abs_path_lib);
|
||||
free(abs_path_lib);
|
||||
}
|
||||
cnh_redir_add("/data", abs_path);
|
||||
free(abs_path);
|
||||
} else {
|
||||
log_warn("No settings (data) path specified");
|
||||
}
|
||||
}
|
||||
|
||||
static void prohook_patch_usbprofiles(struct prohook_options* options)
|
||||
static void prohook_fs_redir_data(struct prohook_options *options)
|
||||
{
|
||||
propatch_usb_fix_init(
|
||||
options->patch.usb_profile.device_nodes,
|
||||
options->patch.usb_profile.p1_bus_port,
|
||||
options->patch.usb_profile.p2_bus_port);
|
||||
if (options->game.data) {
|
||||
char *abs_path = util_fs_get_abs_path(options->game.data);
|
||||
|
||||
cnh_redir_add("/game", abs_path);
|
||||
free(abs_path);
|
||||
} else {
|
||||
log_warn("No data (game) path specified");
|
||||
}
|
||||
}
|
||||
|
||||
static void prohook_patch_piuio_init(struct prohook_options* options)
|
||||
static void prohook_fs_redirs_init(struct prohook_options *options)
|
||||
{
|
||||
log_assert(options);
|
||||
log_assert(options);
|
||||
|
||||
// The order of layering the hooks is important here because of deps
|
||||
// 1. Fix low level libusb thing with init
|
||||
// 2. Turn the ITG 2 piuio kernel hack calls into normal piuio ctrl transfer calls
|
||||
// 3. Introduce an abstraction layer to allow, to abstract libusb0.1 and allow adding fakedevs
|
||||
// required for further software emulation
|
||||
// 4. Exit module to allow exiting the game with test + service
|
||||
// 5. Software emulation layer for piuio
|
||||
//
|
||||
// For example, the kernel hack layer takes care of removing that, so software
|
||||
// emulation code doesn't have to bother with that edge case. Furthermore, it allows you
|
||||
// to use the game with real hardware without any additional software emulation layers
|
||||
// that have to detour to real hardware again
|
||||
|
||||
patch_usb_init_fix_init();
|
||||
patch_piuio_khack_init();
|
||||
patch_usb_emu_init();
|
||||
|
||||
/* Hook before PIUIO emulation */
|
||||
if (options->patch.piuio.exit_test_serv) {
|
||||
patch_piuio_exit_init();
|
||||
}
|
||||
|
||||
if (options->patch.piuio.api_lib) {
|
||||
char* abs_path_iolib = util_fs_get_abs_path(options->patch.piuio.api_lib);
|
||||
|
||||
patch_piuio_init(abs_path_iolib);
|
||||
free(abs_path_iolib);
|
||||
}
|
||||
prohook_fs_redir_settings(options);
|
||||
prohook_fs_redir_data(options);
|
||||
}
|
||||
|
||||
static void prohook_patch_piubtn_init(struct prohook_options* options)
|
||||
static void prohook_patch_sigsegv_init(struct prohook_options *options)
|
||||
{
|
||||
if (options->patch.piubtn.api_lib) {
|
||||
char* abs_path_btnlib = util_fs_get_abs_path(options->patch.piubtn.api_lib);
|
||||
log_assert(options);
|
||||
|
||||
patch_piubtn_init(abs_path_btnlib);
|
||||
free(abs_path_btnlib);
|
||||
}
|
||||
/* seems like pump pro doesn't like it when injecting our own signal
|
||||
handler. game crashes instantly when adding it. */
|
||||
/*
|
||||
patch_sigsegv_init();
|
||||
*/
|
||||
}
|
||||
|
||||
static void prohook_patch_x11_event_loop_init(struct prohook_options *options)
|
||||
{
|
||||
patch_x11_event_loop_init();
|
||||
|
||||
// Register up to two X11 input handlers for piuio and piubtn
|
||||
|
||||
if (options->patch.x11_event_loop.api_lib) {
|
||||
char *abs_path_lib =
|
||||
util_fs_get_abs_path(options->patch.x11_event_loop.api_lib);
|
||||
|
||||
patch_x11_event_loop_add_input_handler(abs_path_lib);
|
||||
free(abs_path_lib);
|
||||
}
|
||||
|
||||
if (options->patch.x11_event_loop.api_lib2) {
|
||||
char *abs_path_lib =
|
||||
util_fs_get_abs_path(options->patch.x11_event_loop.api_lib2);
|
||||
|
||||
patch_x11_event_loop_add_input_handler(abs_path_lib);
|
||||
free(abs_path_lib);
|
||||
}
|
||||
}
|
||||
|
||||
static void prohook_patch_usbprofiles(struct prohook_options *options)
|
||||
{
|
||||
propatch_usb_fix_init(
|
||||
options->patch.usb_profile.device_nodes,
|
||||
options->patch.usb_profile.p1_bus_port,
|
||||
options->patch.usb_profile.p2_bus_port);
|
||||
}
|
||||
|
||||
static void prohook_patch_piuio_init(struct prohook_options *options)
|
||||
{
|
||||
log_assert(options);
|
||||
|
||||
// The order of layering the hooks is important here because of deps
|
||||
// 1. Fix low level libusb thing with init
|
||||
// 2. Turn the ITG 2 piuio kernel hack calls into normal piuio ctrl transfer
|
||||
// calls
|
||||
// 3. Introduce an abstraction layer to allow, to abstract libusb0.1 and allow
|
||||
// adding fakedevs
|
||||
// required for further software emulation
|
||||
// 4. Exit module to allow exiting the game with test + service
|
||||
// 5. Software emulation layer for piuio
|
||||
//
|
||||
// For example, the kernel hack layer takes care of removing that, so software
|
||||
// emulation code doesn't have to bother with that edge case. Furthermore, it
|
||||
// allows you to use the game with real hardware without any additional
|
||||
// software emulation layers that have to detour to real hardware again
|
||||
|
||||
patch_usb_init_fix_init();
|
||||
patch_piuio_khack_init();
|
||||
patch_usb_emu_init();
|
||||
|
||||
/* Hook before PIUIO emulation */
|
||||
if (options->patch.piuio.exit_test_serv) {
|
||||
patch_piuio_exit_init();
|
||||
}
|
||||
|
||||
if (options->patch.piuio.api_lib) {
|
||||
char *abs_path_iolib = util_fs_get_abs_path(options->patch.piuio.api_lib);
|
||||
|
||||
patch_piuio_init(abs_path_iolib);
|
||||
free(abs_path_iolib);
|
||||
}
|
||||
}
|
||||
|
||||
static void prohook_patch_piubtn_init(struct prohook_options *options)
|
||||
{
|
||||
if (options->patch.piubtn.api_lib) {
|
||||
char *abs_path_btnlib = util_fs_get_abs_path(options->patch.piubtn.api_lib);
|
||||
|
||||
patch_piubtn_init(abs_path_btnlib);
|
||||
free(abs_path_btnlib);
|
||||
}
|
||||
}
|
||||
|
||||
void prohook_constructor(void)
|
||||
{
|
||||
/* Nothing here */
|
||||
/* Nothing here */
|
||||
}
|
||||
|
||||
void prohook_destructor(void)
|
||||
{
|
||||
/* Nothing here */
|
||||
/* Nothing here */
|
||||
}
|
||||
|
||||
void prohook_trap_before_main(int argc, char** argv)
|
||||
void prohook_trap_before_main(int argc, char **argv)
|
||||
{
|
||||
log_assert(argc >= 0);
|
||||
log_assert(argv);
|
||||
log_assert(argc >= 0);
|
||||
log_assert(argv);
|
||||
|
||||
struct prohook_options options;
|
||||
struct prohook_options options;
|
||||
|
||||
prohook_bootstrapping(argc, argv, &options);
|
||||
prohook_patch_fs_init(&options);
|
||||
prohook_fs_redirs_init(&options);
|
||||
prohook_patch_sigsegv_init(&options);
|
||||
prohook_patch_x11_event_loop_init(&options);
|
||||
prohook_patch_usbprofiles(&options);
|
||||
prohook_patch_piuio_init(&options);
|
||||
prohook_patch_piubtn_init(&options);
|
||||
prohook_bootstrapping(argc, argv, &options);
|
||||
prohook_patch_fs_init(&options);
|
||||
prohook_fs_redirs_init(&options);
|
||||
prohook_patch_sigsegv_init(&options);
|
||||
prohook_patch_x11_event_loop_init(&options);
|
||||
prohook_patch_usbprofiles(&options);
|
||||
prohook_patch_piuio_init(&options);
|
||||
prohook_patch_piubtn_init(&options);
|
||||
|
||||
log_info("Hooking finished");
|
||||
log_info("Hooking finished");
|
||||
}
|
||||
|
||||
void prohook_trap_after_main(void)
|
||||
{
|
||||
propatch_usb_fix_shutdown();
|
||||
patch_piubtn_shutdown();
|
||||
patch_piuio_shutdown();
|
||||
propatch_usb_fix_shutdown();
|
||||
patch_piubtn_shutdown();
|
||||
patch_piuio_shutdown();
|
||||
}
|
||||
|
||||
LIB_MAIN_CONSTRUCTOR(prohook_constructor);
|
||||
|
||||
+72
-48
@@ -11,12 +11,18 @@
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_USB "patch.hook_mon.usb"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_PIUBTN_EMU_LIB "patch.piubtn.emu_lib"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB "patch.piuio.emu_lib"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_PIUIO_EXIT_TEST_SERV "patch.piuio_exit.test_serv"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P1_BUS_PORT "patch.usb_profile.p1.bus_port"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P2_BUS_PORT "patch.usb_profile.p2.bus_port"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_DEV_NODES "patch.usb_profile.dev_nodes"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER "patch_x11_event_loop.input_handler_lib"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER2 "patch_x11_event_loop.input_handler_lib2"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_PIUIO_EXIT_TEST_SERV \
|
||||
"patch.piuio_exit.test_serv"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P1_BUS_PORT \
|
||||
"patch.usb_profile.p1.bus_port"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P2_BUS_PORT \
|
||||
"patch.usb_profile.p2.bus_port"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_DEV_NODES \
|
||||
"patch.usb_profile.dev_nodes"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER \
|
||||
"patch_x11_event_loop.input_handler_lib"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER2 \
|
||||
"patch_x11_event_loop.input_handler_lib2"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_UTIL_LOG_FILE "util.log.file"
|
||||
#define PROHOOK_OPTIONS_STR_PATCH_UTIL_LOG_LEVEL "util.log.level"
|
||||
|
||||
@@ -72,14 +78,16 @@ static const struct util_options_def prohook_options_def[] = {
|
||||
},
|
||||
{
|
||||
.name = PROHOOK_OPTIONS_STR_PATCH_PIUBTN_EMU_LIB,
|
||||
.description = "Path to library implementing the piubtn api for piubtn emulation",
|
||||
.description =
|
||||
"Path to library implementing the piubtn api for piubtn emulation",
|
||||
.param = 'b',
|
||||
.type = UTIL_OPTIONS_TYPE_STR,
|
||||
.default_value.str = NULL,
|
||||
},
|
||||
{
|
||||
.name = PROHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB,
|
||||
.description = "Path to library implementing the piuio api for piuio emulation",
|
||||
.description =
|
||||
"Path to library implementing the piuio api for piuio emulation",
|
||||
.param = 'p',
|
||||
.type = UTIL_OPTIONS_TYPE_STR,
|
||||
.default_value.str = NULL,
|
||||
@@ -93,7 +101,8 @@ static const struct util_options_def prohook_options_def[] = {
|
||||
},
|
||||
{
|
||||
.name = PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P1_BUS_PORT,
|
||||
.description = "Bus and port (format: X-X, e.g. 1-2) of the USB slot to assign to Player 1 when a USB thumb "
|
||||
.description = "Bus and port (format: X-X, e.g. 1-2) of the USB slot "
|
||||
"to assign to Player 1 when a USB thumb "
|
||||
"drive is plugged in",
|
||||
.param = 'a',
|
||||
.type = UTIL_OPTIONS_TYPE_STR,
|
||||
@@ -101,7 +110,8 @@ static const struct util_options_def prohook_options_def[] = {
|
||||
},
|
||||
{
|
||||
.name = PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P2_BUS_PORT,
|
||||
.description = "Bus and port (format: X-X, e.g. 1-2) of the USB slot to assign to Player 2 when a USB thumb "
|
||||
.description = "Bus and port (format: X-X, e.g. 1-2) of the USB slot "
|
||||
"to assign to Player 2 when a USB thumb "
|
||||
"drive is plugged in",
|
||||
.param = 'k',
|
||||
.type = UTIL_OPTIONS_TYPE_STR,
|
||||
@@ -109,7 +119,8 @@ static const struct util_options_def prohook_options_def[] = {
|
||||
},
|
||||
{
|
||||
.name = PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_DEV_NODES,
|
||||
.description = "Device nodes of plugged in USB thumb drives to consider for mounting for usb profiles, format: "
|
||||
.description = "Device nodes of plugged in USB thumb drives to "
|
||||
"consider for mounting for usb profiles, format: "
|
||||
"sdX,sdY e.g. sde,sdf",
|
||||
.param = 't',
|
||||
.type = UTIL_OPTIONS_TYPE_STR,
|
||||
@@ -117,14 +128,16 @@ static const struct util_options_def prohook_options_def[] = {
|
||||
},
|
||||
{
|
||||
.name = PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER,
|
||||
.description = "Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs",
|
||||
.description = "Path to a library implementing the x11-input-handler "
|
||||
"api to capture X11 keyboard inputs",
|
||||
.param = 'q',
|
||||
.type = UTIL_OPTIONS_TYPE_STR,
|
||||
.default_value.str = NULL,
|
||||
},
|
||||
{
|
||||
{
|
||||
.name = PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER2,
|
||||
.description = "Path to a second library implementing the x11-input-handler api to capture X11 keyboard inputs",
|
||||
.description = "Path to a second library implementing the "
|
||||
"x11-input-handler api to capture X11 keyboard inputs",
|
||||
.param = 'r',
|
||||
.type = UTIL_OPTIONS_TYPE_STR,
|
||||
.default_value.str = NULL,
|
||||
@@ -154,44 +167,55 @@ static const struct util_options_defs prohook_options_defs = {
|
||||
.ndefs = lengthof(prohook_options_def)
|
||||
};
|
||||
|
||||
bool prohook_options_init(int argc, char** argv, struct prohook_options* options)
|
||||
bool prohook_options_init(
|
||||
int argc, char **argv, struct prohook_options *options)
|
||||
{
|
||||
log_assert(argv);
|
||||
log_assert(options);
|
||||
log_assert(argv);
|
||||
log_assert(options);
|
||||
|
||||
struct util_options_opts* options_opt;
|
||||
struct util_options_opts *options_opt;
|
||||
|
||||
util_options_init(argc, argv);
|
||||
options_opt = util_options_get(&prohook_options_defs);
|
||||
util_options_init(argc, argv);
|
||||
options_opt = util_options_get(&prohook_options_defs);
|
||||
|
||||
if (!options_opt) {
|
||||
return false;
|
||||
}
|
||||
if (!options_opt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
options->game.data = util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_GAME_DATA);
|
||||
options->game.settings = util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_GAME_SETTINGS);
|
||||
options->patch.hook_mon.file = util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_FILE);
|
||||
options->patch.hook_mon.fs = util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_FS);
|
||||
options->patch.hook_mon.io = util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_IO);
|
||||
options->patch.hook_mon.open = util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_OPEN);
|
||||
options->patch.hook_mon.usb = util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_USB);
|
||||
options->patch.piubtn.api_lib = util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_PIUBTN_EMU_LIB);
|
||||
options->patch.piuio.api_lib = util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB);
|
||||
options->patch.piuio.exit_test_serv =
|
||||
util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_PIUIO_EXIT_TEST_SERV);
|
||||
options->patch.usb_profile.device_nodes =
|
||||
util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_DEV_NODES);
|
||||
options->patch.usb_profile.p1_bus_port =
|
||||
util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P1_BUS_PORT);
|
||||
options->patch.usb_profile.p2_bus_port =
|
||||
util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P2_BUS_PORT);
|
||||
options->patch.x11_event_loop.api_lib =
|
||||
util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER);
|
||||
options->patch.x11_event_loop.api_lib2 =
|
||||
util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER2);
|
||||
options->log.file = util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_PATCH_UTIL_LOG_FILE);
|
||||
options->log.level =
|
||||
(enum util_log_level) util_options_get_int(options_opt, PROHOOK_OPTIONS_STR_PATCH_UTIL_LOG_LEVEL);
|
||||
options->game.data =
|
||||
util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_GAME_DATA);
|
||||
options->game.settings =
|
||||
util_options_get_str(options_opt, PROHOOK_OPTIONS_STR_GAME_SETTINGS);
|
||||
options->patch.hook_mon.file = util_options_get_bool(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_FILE);
|
||||
options->patch.hook_mon.fs =
|
||||
util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_FS);
|
||||
options->patch.hook_mon.io =
|
||||
util_options_get_bool(options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_IO);
|
||||
options->patch.hook_mon.open = util_options_get_bool(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_OPEN);
|
||||
options->patch.hook_mon.usb = util_options_get_bool(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_HOOK_MON_USB);
|
||||
options->patch.piubtn.api_lib = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_PIUBTN_EMU_LIB);
|
||||
options->patch.piuio.api_lib = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB);
|
||||
options->patch.piuio.exit_test_serv = util_options_get_bool(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_PIUIO_EXIT_TEST_SERV);
|
||||
options->patch.usb_profile.device_nodes = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_DEV_NODES);
|
||||
options->patch.usb_profile.p1_bus_port = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P1_BUS_PORT);
|
||||
options->patch.usb_profile.p2_bus_port = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_USB_PROFILE_P2_BUS_PORT);
|
||||
options->patch.x11_event_loop.api_lib = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER);
|
||||
options->patch.x11_event_loop.api_lib2 = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_X11_EVENT_LOOP_INPUT_HANDLER2);
|
||||
options->log.file = util_options_get_str(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_UTIL_LOG_FILE);
|
||||
options->log.level = (enum util_log_level) util_options_get_int(
|
||||
options_opt, PROHOOK_OPTIONS_STR_PATCH_UTIL_LOG_LEVEL);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
+35
-34
@@ -7,47 +7,48 @@
|
||||
#include "util/log.h"
|
||||
|
||||
struct prohook_options {
|
||||
struct game {
|
||||
const char* data;
|
||||
const char* settings;
|
||||
} game;
|
||||
struct game {
|
||||
const char *data;
|
||||
const char *settings;
|
||||
} game;
|
||||
|
||||
struct patch {
|
||||
struct hook_mon {
|
||||
bool file;
|
||||
bool fs;
|
||||
bool io;
|
||||
bool open;
|
||||
bool usb;
|
||||
} hook_mon;
|
||||
struct patch {
|
||||
struct hook_mon {
|
||||
bool file;
|
||||
bool fs;
|
||||
bool io;
|
||||
bool open;
|
||||
bool usb;
|
||||
} hook_mon;
|
||||
|
||||
struct piubtn {
|
||||
const char* api_lib;
|
||||
} piubtn;
|
||||
struct piubtn {
|
||||
const char *api_lib;
|
||||
} piubtn;
|
||||
|
||||
struct piuio {
|
||||
const char* api_lib;
|
||||
bool exit_test_serv;
|
||||
} piuio;
|
||||
struct piuio {
|
||||
const char *api_lib;
|
||||
bool exit_test_serv;
|
||||
} piuio;
|
||||
|
||||
struct usb_profile {
|
||||
const char* device_nodes;
|
||||
const char* p1_bus_port;
|
||||
const char* p2_bus_port;
|
||||
} usb_profile;
|
||||
struct usb_profile {
|
||||
const char *device_nodes;
|
||||
const char *p1_bus_port;
|
||||
const char *p2_bus_port;
|
||||
} usb_profile;
|
||||
|
||||
struct x11_event_loop {
|
||||
const char* api_lib;
|
||||
const char* api_lib2;
|
||||
} x11_event_loop;
|
||||
} patch;
|
||||
struct x11_event_loop {
|
||||
const char *api_lib;
|
||||
const char *api_lib2;
|
||||
} x11_event_loop;
|
||||
} patch;
|
||||
|
||||
struct log {
|
||||
const char* file;
|
||||
enum util_log_level level;
|
||||
} log;
|
||||
struct log {
|
||||
const char *file;
|
||||
enum util_log_level level;
|
||||
} log;
|
||||
};
|
||||
|
||||
bool prohook_options_init(int argc, char** argv, struct prohook_options* options);
|
||||
bool prohook_options_init(
|
||||
int argc, char **argv, struct prohook_options *options);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user