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:
@@ -4,6 +4,8 @@ deplibs_bsthook := \
|
||||
avs \
|
||||
|
||||
libs_bsthook := \
|
||||
avs-util \
|
||||
core \
|
||||
acioemu \
|
||||
bstio \
|
||||
hook \
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
#include "bsthook/acio.h"
|
||||
#include "bsthook/kfca.h"
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
|
||||
#include "imports/avs.h"
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/iobuf.h"
|
||||
#include "util/log.h"
|
||||
#include "util/str.h"
|
||||
|
||||
static struct ac_io_emu ac_io_emu;
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "avs-util/core-interop.h"
|
||||
|
||||
#include "bemanitools/bstio.h"
|
||||
#include "bemanitools/eamio.h"
|
||||
|
||||
#include "core/log.h"
|
||||
#include "core/thread.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
|
||||
#include "hooklib/app.h"
|
||||
@@ -18,7 +23,6 @@
|
||||
|
||||
#include "util/cmdline.h"
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
|
||||
static bool my_dll_entry_init(char *sidcode, struct property_node *config);
|
||||
static bool my_dll_entry_main(void);
|
||||
@@ -33,19 +37,23 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *config)
|
||||
|
||||
log_info("Starting up BeatStream IO backend");
|
||||
|
||||
bst_io_set_loggers(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
core_log_impl_assign(bst_io_set_loggers);
|
||||
|
||||
ok = bst_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
ok = bst_io_init(
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get());
|
||||
|
||||
if (!ok) {
|
||||
goto bst_io_fail;
|
||||
}
|
||||
|
||||
eam_io_set_loggers(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
core_log_impl_assign(eam_io_set_loggers);
|
||||
|
||||
ok = eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
ok = eam_io_init(
|
||||
core_thread_create_impl_get(),
|
||||
core_thread_join_impl_get(),
|
||||
core_thread_destroy_impl_get());
|
||||
|
||||
if (!ok) {
|
||||
goto eam_io_fail;
|
||||
@@ -91,8 +99,9 @@ BOOL WINAPI DllMain(HMODULE self, 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();
|
||||
|
||||
args_recover(&argc, &argv);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/com-proxy.h"
|
||||
#include "hook/pe.h"
|
||||
#include "hook/table.h"
|
||||
@@ -10,7 +12,6 @@
|
||||
#include "sdvxhook/gfx.h"
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
|
||||
static HRESULT STDCALL my_CreateDevice(
|
||||
IDirect3D9 *self,
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "util/defs.h"
|
||||
#include "util/log.h"
|
||||
#include "util/str.h"
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user