refactor: Entire code base, thread and log usage
Boils down to: - Include headers - Reduce boiler plate with helpers - Swap out explicit usages with core API layer and ensure the right API is configured beforehand
This commit is contained in:
@@ -10,6 +10,8 @@ ldflags_jbhook2 := \
|
||||
-lopengl32 \
|
||||
|
||||
libs_jbhook2 := \
|
||||
avs-util \
|
||||
core \
|
||||
acioemu \
|
||||
eamio \
|
||||
jbio \
|
||||
|
||||
+18
-12
@@ -5,9 +5,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "avs-util/core-interop.h"
|
||||
|
||||
#include "bemanitools/eamio.h"
|
||||
#include "bemanitools/jbio.h"
|
||||
|
||||
#include "core/log.h"
|
||||
#include "core/thread.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
@@ -36,8 +41,6 @@
|
||||
#include "security/mcode.h"
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
#include "util/thread.h"
|
||||
|
||||
static struct options options;
|
||||
|
||||
@@ -80,11 +83,12 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
|
||||
log_info("Starting up jubeat IO backend");
|
||||
|
||||
jb_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
core_log_impl_assign(jb_io_set_loggers);
|
||||
|
||||
jb_io_ok =
|
||||
jb_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
jb_io_ok = jb_io_init(
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get());
|
||||
|
||||
if (!jb_io_ok) {
|
||||
goto fail;
|
||||
@@ -99,11 +103,12 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
|
||||
log_info("Starting up card reader backend");
|
||||
|
||||
eam_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
core_log_impl_assign(eam_io_set_loggers);
|
||||
|
||||
eam_io_ok =
|
||||
eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
eam_io_ok = eam_io_init(
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get());
|
||||
|
||||
if (!eam_io_ok) {
|
||||
goto fail;
|
||||
@@ -224,8 +229,9 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
log_to_external(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
// Use AVS APIs
|
||||
avs_util_core_interop_thread_avs_impl_set();
|
||||
avs_util_core_interop_log_avs_impl_set();
|
||||
|
||||
options_init_from_cmdline(&options);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "util/cmdline.h"
|
||||
#include "util/defs.h"
|
||||
#include "util/hex.h"
|
||||
#include "util/log.h"
|
||||
|
||||
#include "util/str.h"
|
||||
|
||||
void options_init_from_cmdline(struct options *options)
|
||||
|
||||
Reference in New Issue
Block a user