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:
@@ -7,6 +7,8 @@ deplibs_iidxhook6 := \
|
||||
avs \
|
||||
|
||||
libs_iidxhook6 := \
|
||||
avs-util \
|
||||
core \
|
||||
iidxhook-d3d9 \
|
||||
iidxhook-util \
|
||||
ezusb-emu \
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "avs-util/core-interop.h"
|
||||
|
||||
#include "bemanitools/eamio.h"
|
||||
#include "bemanitools/iidxio.h"
|
||||
|
||||
#include "cconfig/cconfig-hook.h"
|
||||
|
||||
#include "core/log.h"
|
||||
#include "core/thread.h"
|
||||
|
||||
#include "ezusb-iidx-emu/nodes.h"
|
||||
|
||||
#include "ezusb2-emu/desc.h"
|
||||
@@ -35,9 +40,7 @@
|
||||
|
||||
#include "imports/avs.h"
|
||||
|
||||
#include "util/log.h"
|
||||
#include "util/str.h"
|
||||
#include "util/thread.h"
|
||||
|
||||
#define IIDXHOOK6_INFO_HEADER \
|
||||
"iidxhook for Tricoro" \
|
||||
@@ -121,11 +124,12 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
if (!config_io.disable_io_emu) {
|
||||
log_info("Starting IIDX IO backend");
|
||||
|
||||
iidx_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
core_log_impl_assign(iidx_io_set_loggers);
|
||||
|
||||
if (!iidx_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get())) {
|
||||
log_fatal("Initializing IIDX IO backend failed");
|
||||
}
|
||||
} else {
|
||||
@@ -135,11 +139,12 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
if (!config_io.disable_card_reader_emu) {
|
||||
log_misc("Initializing 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);
|
||||
|
||||
if (!eam_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get())) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
} else {
|
||||
@@ -203,8 +208,9 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
goto end;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
app_hook_init(my_dll_entry_init, my_dll_entry_main);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user