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:
icex2
2024-02-25 09:07:54 +01:00
parent 0afca1da49
commit e8221631f9
338 changed files with 1307 additions and 640 deletions
+18 -9
View File
@@ -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);