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:
@@ -12,6 +12,8 @@ deplibs_sdvxhook2 := \
|
||||
avs \
|
||||
|
||||
libs_sdvxhook2 := \
|
||||
avs-util \
|
||||
core \
|
||||
acioemu \
|
||||
bio2emu \
|
||||
camhook \
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "acioemu/emu.h"
|
||||
#include "acioemu/icca.h"
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
#include "hooklib/rs232.h"
|
||||
|
||||
@@ -24,7 +26,6 @@
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/iobuf.h"
|
||||
#include "util/log.h"
|
||||
#include "util/str.h"
|
||||
|
||||
static struct ac_io_emu ac_io_emu;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "cconfig/cconfig-util.h"
|
||||
|
||||
#include "sdvxhook2/config-io.h"
|
||||
#include "core/log.h"
|
||||
|
||||
#include "util/log.h"
|
||||
#include "sdvxhook2/config-io.h"
|
||||
|
||||
#define SDVXHOOK2_CONFIG_IO_DISABLE_CARD_READER_EMU_KEY \
|
||||
"io.disable_card_reader_emu"
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "avs-util/core-interop.h"
|
||||
|
||||
#include "bemanitools/eamio.h"
|
||||
#include "bemanitools/sdvxio.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"
|
||||
@@ -33,9 +38,7 @@
|
||||
|
||||
#include "imports/avs.h"
|
||||
|
||||
#include "util/log.h"
|
||||
#include "util/str.h"
|
||||
#include "util/thread.h"
|
||||
|
||||
#define SDVXHOOK2_INFO_HEADER \
|
||||
"sdvxhook for VW" \
|
||||
@@ -105,11 +108,12 @@ 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");
|
||||
sdvx_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
core_log_impl_assign(sdvx_io_set_loggers);
|
||||
|
||||
if (!sdvx_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 sdvx IO backend failed");
|
||||
}
|
||||
}
|
||||
@@ -117,11 +121,12 @@ 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");
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -207,8 +212,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);
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "sdvxhook2/nvapi.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
static void *my_GetProcAddress(HMODULE dll, const char *name);
|
||||
|
||||
static void *(*real_GetProcAddress)(HMODULE dll, const char *name);
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "sdvxhook2/power.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
static DWORD
|
||||
my_PowerSetActiveScheme(HKEY UserRootPowerKey, const GUID *SchemeGuid);
|
||||
static DWORD my_PowerWriteACValueIndex(
|
||||
|
||||
Reference in New Issue
Block a user