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-08-14 17:53:51 +02:00
parent 82d1a2df52
commit 93e0a090bc
338 changed files with 1307 additions and 641 deletions
+3
View File
@@ -3,6 +3,7 @@ testexes += cconfig-test
srcdir_cconfig-test := src/test/cconfig
libs_cconfig-test := \
core \
cconfig \
test \
util \
@@ -17,6 +18,7 @@ testexes += cconfig-util-test
srcdir_cconfig-util-test := src/test/cconfig
libs_cconfig-util-test := \
core \
cconfig \
test \
util \
@@ -31,6 +33,7 @@ testexes += cconfig-cmd-test
srcdir_cconfig-cmd-test := src/test/cconfig
libs_cconfig-cmd-test := \
core \
cconfig \
test \
util \
+2
View File
@@ -5,6 +5,7 @@ srcdir_d3d9hook := src/test/d3d9hook
ldflags_d3d9hook := \
libs_d3d9hook := \
core \
hook \
test \
util \
@@ -25,6 +26,7 @@ libs_d3d9hook-test := \
hook \
test \
util \
core \
src_d3d9hook-test := \
main.c \
+7 -3
View File
@@ -2,12 +2,14 @@
#include <stdlib.h>
#include <windows.h>
#include "core/log-bt-ext.h"
#include "core/log-bt.h"
#include "core/log.h"
#include "hook/d3d9.h"
#include "test/check.h"
#include "util/log.h"
#define debug_print(...) fprintf(stderr, __VA_ARGS__)
static HRESULT my_d3d9_handler(struct hook_d3d9_irp *irp);
@@ -298,7 +300,9 @@ static HRESULT my_d3d9_handler(struct hook_d3d9_irp *irp)
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
{
if (reason == DLL_PROCESS_ATTACH) {
log_to_writer(log_writer_stderr, NULL);
core_log_bt_ext_init_with_debug();
core_log_bt_ext_init_with_stderr();
debug_print("Initializing d3d9 hook module...\n");
hook_d3d9_init(d3d9_handlers, lengthof(d3d9_handlers));
+4
View File
@@ -6,6 +6,7 @@ ldflags_iidxhook-util-config-eamuse-test := \
-lws2_32 \
libs_iidxhook-util-config-eamuse-test := \
core \
security \
iidxhook-util \
cconfig \
@@ -22,6 +23,7 @@ testexes += iidxhook-util-config-gfx-test
srcdir_iidxhook-util-config-gfx-test := src/test/iidxhook-util
libs_iidxhook-util-config-gfx-test := \
core \
security \
iidxhook-util \
cconfig \
@@ -38,6 +40,7 @@ testexes += iidxhook-util-config-misc-test
srcdir_iidxhook-util-config-misc-test := src/test/iidxhook-util
libs_iidxhook-util-config-misc-test := \
core \
security \
iidxhook-util \
cconfig \
@@ -54,6 +57,7 @@ testexes += iidxhook-util-config-sec-test
srcdir_iidxhook-util-config-sec-test := src/test/iidxhook-util
libs_iidxhook-util-config-sec-test := \
core \
security \
iidxhook-util \
cconfig \
+2
View File
@@ -3,6 +3,7 @@ testexes += iidxhook-config-iidxhook1-test
srcdir_iidxhook-config-iidxhook1-test := src/test/iidxhook
libs_iidxhook-config-iidxhook1-test := \
core \
cconfig \
iidxhook1 \
test \
@@ -18,6 +19,7 @@ testexes += iidxhook-config-iidxhook2-test
srcdir_iidxhook-config-iidxhook2-test := src/test/iidxhook
libs_iidxhook-config-iidxhook2-test := \
core \
iidxhook2 \
cconfig \
test \
+2
View File
@@ -3,6 +3,7 @@ testexes += iidxhook8-config-cam-test
srcdir_iidxhook8-config-cam-test := src/test/iidxhook8
libs_iidxhook8-config-cam-test := \
core \
camhook \
cconfig \
test \
@@ -18,6 +19,7 @@ testexes += iidxhook8-config-io-test
srcdir_iidxhook8-config-io-test := src/test/iidxhook8
libs_iidxhook8-config-io-test := \
core \
cconfig \
test \
util \
+6
View File
@@ -3,6 +3,7 @@ testexes += security-id-test
srcdir_security-id-test := src/test/security
libs_security-id-test := \
core \
security \
test \
util \
@@ -17,6 +18,7 @@ testexes += security-mcode-test
srcdir_security-mcode-test := src/test/security
libs_security-mcode-test := \
core \
security \
test \
util \
@@ -31,6 +33,7 @@ testexes += security-util-test
srcdir_security-util-test := src/test/security
libs_security-util-test := \
core \
security \
test \
util \
@@ -45,6 +48,7 @@ testexes += security-rp-test
srcdir_security-rp-test := src/test/security
libs_security-rp-test := \
core \
security \
test \
util \
@@ -59,6 +63,7 @@ testexes += security-rp2-test
srcdir_security-rp2-test := src/test/security
libs_security-rp2-test := \
core \
security \
test \
util \
@@ -73,6 +78,7 @@ testexes += security-rp3-test
srcdir_security-rp3-test := src/test/security
libs_security-rp3-test := \
core \
security \
test \
util \
+10 -5
View File
@@ -3,12 +3,15 @@
#include <stdio.h>
#include "util/log.h"
#include "core/log-bt-ext.h"
#include "core/log-bt.h"
#include "core/log.h"
#define TEST_MODULE_BEGIN(name) \
int main(int argc, char **argv) \
{ \
log_to_writer(log_writer_stderr, NULL); \
#define TEST_MODULE_BEGIN(name) \
int main(int argc, char **argv) \
{ \
core_log_bt_ext_impl_set(); \
core_log_bt_ext_init_with_stderr(); \
fprintf(stderr, "Executing test module '%s'...\n", #name);
#define TEST_MODULE_TEST(func) \
@@ -19,6 +22,8 @@
#define TEST_MODULE_END() \
fprintf(stderr, "Finished execution of test module\n"); \
core_log_bt_fini(); \
\
return 0; \
}
+1
View File
@@ -7,6 +7,7 @@ ldflags_util-net-test := \
-liphlpapi \
libs_util-net-test := \
core \
test \
util \