diff --git a/.gitignore b/.gitignore index 7ab9fb3..8c5f46a 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,7 @@ $RECYCLE.BIN/ *.lnk .idea/ cmake-build-debug/ -dependencies/ +/dependencies/ assets_wip/ Backup_*.cdr .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e62e2d..d820abb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,8 +130,8 @@ add_executable( src/packages/game/data/IZ_list.h src/packages/net/svc/IZ_wsclient.c src/packages/net/svc/IZ_wsclient.h - src/packages/log/IZ_intercept.c - src/packages/log/IZ_intercept.h + src/packages/log/IZ_intercept.c + src/packages/log/IZ_intercept.h src/packages/midi/IZ_midi.c src/packages/midi/IZ_midi.h src/packages/net/core/IZ_websocket.h @@ -149,11 +149,18 @@ add_executable( src/packages/game/IZ_app_config.h src/packages/game/asset/IZ_asset.c src/packages/game/asset/IZ_asset.h - src/packages/stdinc/IZ_string.c - src/packages/stdinc/IZ_string.h + src/packages/stdinc/IZ_string.c + src/packages/stdinc/IZ_string.h src/packages/io/IZ_io.c src/packages/io/IZ_io.h - src/packages/log/IZ_log.c src/packages/log/IZ_log.h src/packages/timer/IZ_timer.c src/packages/timer/IZ_timer.h src/packages/compat/IZ_windows.h src/packages/stdinc/IZ_stdlib.c src/packages/stdinc/IZ_stdlib.h) + src/packages/log/IZ_log.c + src/packages/log/IZ_log.h + src/packages/timer/IZ_timer.c + src/packages/timer/IZ_timer.h + src/packages/compat/IZ_windows.h + src/packages/stdinc/IZ_stdlib.c + src/packages/stdinc/IZ_stdlib.h +) if (WIN32) target_link_libraries( @@ -200,12 +207,12 @@ add_executable( src/packages/test/IZ_mock.h src/packages/test/IZ_test.h - __mocks__/minIni.mock.h - __mocks__/SDL_keyboard.mock.h - __mocks__/SDL_events.mock.h - __mocks__/SDL_joystick.mock.h - __mocks__/SDL_stdinc.mock.h - __mocks__/portmidi.mock.h + __mocks__/dependencies/minIni/minIni.mock.h + __mocks__/dependencies/SDL2/SDL_keyboard.mock.h + __mocks__/dependencies/SDL2/SDL_events.mock.h + __mocks__/dependencies/SDL2/SDL_joystick.mock.h + __mocks__/dependencies/SDL2/SDL_stdinc.mock.h + __mocks__/dependencies/portmidi/portmidi.mock.h src/packages/config/IZ_config.h @@ -229,9 +236,9 @@ add_executable( dependencies/bdd-for-c/bdd-for-c.h src/packages/test/IZ_mock.h src/packages/test/IZ_test.h - __mocks__/minIni.mock.h - __mocks__/SDL_stdinc.mock.h - __mocks__/SDL_render.mock.h + __mocks__/dependencies/minIni/minIni.mock.h + __mocks__/dependencies/SDL2/SDL_stdinc.mock.h + __mocks__/dependencies/SDL2/SDL_render.mock.h src/packages/config/IZ_config.h src/packages/game/output/video/IZ_video.h src/packages/game/output/video/IZ_video.c @@ -243,6 +250,14 @@ add_executable( dependencies/bdd-for-c/bdd-for-c.h src/packages/test/IZ_mock.h src/packages/test/IZ_test.h + src/packages/timer/IZ_timer.h + src/packages/timer/IZ_timer.c + src/packages/stdinc/IZ_stdlib.h + __mocks__/src/packages/stdinc/IZ_stdlib.mock.h + src/packages/stdinc/IZ_string.h + __mocks__/src/packages/stdinc/IZ_string.mock.h + src/packages/log/IZ_log.h + __mocks__/src/packages/log/IZ_log.mock.h src/packages/game/memory/IZ_pool.h src/packages/game/memory/IZ_pool.c src/packages/game/memory/memory.test.c @@ -250,6 +265,12 @@ add_executable( src/packages/game/data/IZ_list.h ) +target_link_libraries( + game-test-memory + SDL2main + SDL2 +) + add_executable( game-test-data dependencies/bdd-for-c/bdd-for-c.h @@ -284,8 +305,8 @@ add_executable( src/packages/server/db/IZ_repo.c src/packages/server/db/IZ_repo.h src/packages/server/IZ_subsystem.h - src/packages/stdinc/IZ_string.c - src/packages/stdinc/IZ_string.h + src/packages/stdinc/IZ_string.c + src/packages/stdinc/IZ_string.h src/packages/io/IZ_io.c src/packages/io/IZ_io.h src/packages/log/IZ_log.c diff --git a/TODO.md b/TODO.md index 50d3f17..1c0be71 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ - [X] Improve logging (remove SDL/lws dependency) - [X] Unify memset/memcpy/free/malloc functions (remove SDL/lws dependency) +- [ ] Implement memory pool - [ ] Fix gamepad mapping - [ ] Provide default mapping - [ ] Allow customization of button mappings diff --git a/__mocks__/SDL_events.mock.h b/__mocks__/dependencies/SDL2/SDL_events.mock.h similarity index 100% rename from __mocks__/SDL_events.mock.h rename to __mocks__/dependencies/SDL2/SDL_events.mock.h diff --git a/__mocks__/SDL_joystick.mock.h b/__mocks__/dependencies/SDL2/SDL_joystick.mock.h similarity index 86% rename from __mocks__/SDL_joystick.mock.h rename to __mocks__/dependencies/SDL2/SDL_joystick.mock.h index 1f4d885..52f96d3 100644 --- a/__mocks__/SDL_joystick.mock.h +++ b/__mocks__/dependencies/SDL2/SDL_joystick.mock.h @@ -1,8 +1,8 @@ #ifndef SDL_JOYSTICK_MOCK_H #define SDL_JOYSTICK_MOCK_H -#include "../src/packages/common/IZ_common.h" -#include "../src/packages/test/IZ_test.h" +#include "../../../src/packages/common/IZ_common.h" +#include "../../../src/packages/test/IZ_test.h" typedef struct _SDL_Joystick {} SDL_Joystick; diff --git a/__mocks__/SDL_keyboard.mock.h b/__mocks__/dependencies/SDL2/SDL_keyboard.mock.h similarity index 72% rename from __mocks__/SDL_keyboard.mock.h rename to __mocks__/dependencies/SDL2/SDL_keyboard.mock.h index 5959966..05dc405 100644 --- a/__mocks__/SDL_keyboard.mock.h +++ b/__mocks__/dependencies/SDL2/SDL_keyboard.mock.h @@ -1,8 +1,8 @@ #ifndef SDL_KEYBOARD_MOCK_H #define SDL_KEYBOARD_MOCK_H -#include "../src/packages/common/IZ_common.h" -#include "../src/packages/test/IZ_test.h" +#include "../../../src/packages/common/IZ_common.h" +#include "../../../src/packages/test/IZ_test.h" mock(SDL_GetKeyName) const char* SDL_GetKeyName(i32 key) { mock_return(SDL_GetKeyName) ""; diff --git a/__mocks__/SDL_render.mock.h b/__mocks__/dependencies/SDL2/SDL_render.mock.h similarity index 92% rename from __mocks__/SDL_render.mock.h rename to __mocks__/dependencies/SDL2/SDL_render.mock.h index db6e98b..e977187 100644 --- a/__mocks__/SDL_render.mock.h +++ b/__mocks__/dependencies/SDL2/SDL_render.mock.h @@ -1,8 +1,8 @@ #ifndef SDL_RENDER_MOCK_H #define SDL_RENDER_MOCK_H -#include "../src/packages/common/IZ_common.h" -#include "../src/packages/test/IZ_test.h" +#include "../../../src/packages/common/IZ_common.h" +#include "../../../src/packages/test/IZ_test.h" typedef struct SDL_Renderer SDL_Renderer; diff --git a/__mocks__/SDL_stdinc.mock.h b/__mocks__/dependencies/SDL2/SDL_stdinc.mock.h similarity index 69% rename from __mocks__/SDL_stdinc.mock.h rename to __mocks__/dependencies/SDL2/SDL_stdinc.mock.h index 1fbbff1..0a0cbd5 100644 --- a/__mocks__/SDL_stdinc.mock.h +++ b/__mocks__/dependencies/SDL2/SDL_stdinc.mock.h @@ -2,8 +2,8 @@ #define SDL_STDINC_MOCK_H #include -#include "../src/packages/common/IZ_common.h" -#include "../src/packages/test/IZ_test.h" +#include "../../../src/packages/common/IZ_common.h" +#include "../../../src/packages/test/IZ_test.h" mock(SDL_memcpy) void* SDL_memcpy(void* dst, const void* src, size_t len) { mock_return(SDL_memcpy) memcpy(dst, src, len); @@ -21,4 +21,8 @@ mock(SDL_free) void SDL_free(void* mem) { mock_return(SDL_free); } +mock(SDL_calloc) void* SDL_calloc(size_t num, size_t size) { + mock_return(SDL_calloc) calloc(num, size); +} + #endif diff --git a/__mocks__/minIni.mock.h b/__mocks__/dependencies/minIni/minIni.mock.h similarity index 86% rename from __mocks__/minIni.mock.h rename to __mocks__/dependencies/minIni/minIni.mock.h index d63cc64..c90171d 100644 --- a/__mocks__/minIni.mock.h +++ b/__mocks__/dependencies/minIni/minIni.mock.h @@ -1,8 +1,8 @@ #ifndef MININI_MOCK_H #define MININI_MOCK_H -#include "../src/packages/common/IZ_common.h" -#include "../src/packages/test/IZ_test.h" +#include "../../../src/packages/common/IZ_common.h" +#include "../../../src/packages/test/IZ_test.h" mock(ini_getl) long ini_getl(const char *Section, const char *Key, long DefValue, const char *Filename) { mock_return(ini_getl) DefValue; diff --git a/__mocks__/portmidi.mock.h b/__mocks__/dependencies/portmidi/portmidi.mock.h similarity index 97% rename from __mocks__/portmidi.mock.h rename to __mocks__/dependencies/portmidi/portmidi.mock.h index e313636..2f090be 100644 --- a/__mocks__/portmidi.mock.h +++ b/__mocks__/dependencies/portmidi/portmidi.mock.h @@ -3,7 +3,7 @@ #define PORTMIDI_INCLUDED -#include "../src/packages/common/IZ_common.h" +#include "../../../src/packages/common/IZ_common.h" typedef i32 PmDeviceID; typedef void PortMidiStream; diff --git a/__mocks__/src/packages/log/IZ_log.mock.h b/__mocks__/src/packages/log/IZ_log.mock.h new file mode 100644 index 0000000..f6b3d60 --- /dev/null +++ b/__mocks__/src/packages/log/IZ_log.mock.h @@ -0,0 +1,11 @@ +#ifndef IZ_LOG_MOCK_H +#define IZ_LOG_MOCK_H + +#include "../../../src/packages/log/IZ_log.h" +#include "../../../src/packages/test/IZ_mock.h" + +mock(IZ_LogInfo) void IZ_LogInfo(IZ_LogCategory category, const char* format, ...) { + mock_return(IZ_LogInfo); +} + +#endif diff --git a/__mocks__/src/packages/stdinc/IZ_stdlib.mock.h b/__mocks__/src/packages/stdinc/IZ_stdlib.mock.h new file mode 100644 index 0000000..5d5824a --- /dev/null +++ b/__mocks__/src/packages/stdinc/IZ_stdlib.mock.h @@ -0,0 +1,19 @@ +#ifndef IZ_STDLIB_MOCK_C +#define IZ_STDLIB_MOCK_C + +#include +#include "../../../../src/packages/test/IZ_mock.h" + +mock(IZ_malloc) void* IZ_malloc(size_t size) { + mock_return(IZ_malloc) SDL_malloc(size); +} + +mock(IZ_free) void IZ_free(void* mem) { + mock_return(IZ_free) SDL_free(mem); +} + +mock(IZ_calloc) void* IZ_calloc(unsigned int num, size_t size) { + mock_return(IZ_calloc) SDL_calloc(num, size); +} + +#endif diff --git a/__mocks__/src/packages/stdinc/IZ_string.mock.h b/__mocks__/src/packages/stdinc/IZ_string.mock.h new file mode 100644 index 0000000..bb75207 --- /dev/null +++ b/__mocks__/src/packages/stdinc/IZ_string.mock.h @@ -0,0 +1,10 @@ +#ifndef IZ_STRING_MOCK_C +#define IZ_STRING_MOCK_C + +#include "../../../../src/packages/test/IZ_mock.h" + +mock(IZ_memset) void* IZ_memset(void* dst, int c, size_t len) { + mock_return(IZ_memset) 0; +} + +#endif diff --git a/src/packages/config/IZ_config.c b/src/packages/config/IZ_config.c index 7cd66f9..cfdb06d 100644 --- a/src/packages/config/IZ_config.c +++ b/src/packages/config/IZ_config.c @@ -346,14 +346,14 @@ IZ_ConfigInitializeResult IZ_ConfigInitialize(IZ_ConfigItem item[], const char* IZ_ConfigLoad(item, config_path); IZ_ConfigSaveResult save_result = IZ_ConfigSave(item, config_path); if (save_result < 0) { - IZ_LogError("Config sync failed! Result: %u", save_result); + IZ_LogError("app/config Sync failed! Result: %u", save_result); return IZ_CONFIG_INITIALIZE_RESULT_ERROR; } IZ_ConfigOverride(item, argc, argv); if (save_result > 0) { - IZ_LogWarn(false, "Config sync encountered issues. Result: %u", save_result); + IZ_LogWarn(false, "app/config Sync encountered issues. Result: %u", save_result); return IZ_CONFIG_INITIALIZE_RESULT_WARNING; } - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Config sync successful."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/config Sync successful."); return IZ_CONFIG_INITIALIZE_RESULT_OK; } diff --git a/src/packages/game/IZ_app.c b/src/packages/game/IZ_app.c index fbba02e..732eab8 100644 --- a/src/packages/game/IZ_app.c +++ b/src/packages/game/IZ_app.c @@ -28,7 +28,7 @@ typedef enum { IZ_AppInitializeResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char* argv[]) { IZ_LogInterceptWSMessages(LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE); - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Starting %s...", IZ_APP_NAME); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/global Starting %s...", IZ_APP_NAME); IZ_memset(app, 0, sizeof(struct IZ_App)); const char* cmdline_buffer; @@ -47,7 +47,7 @@ IZ_AppInitializeResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char* ); if (SDL_Init(flags) < 0) { - IZ_LogError("Framework initialization failed! Reason: %s", SDL_GetError()); + IZ_LogError("app/global Framework initialization failed! Reason: %s", SDL_GetError()); return IZ_APP_INITIALIZE_RESULT_SDL_ERROR; } @@ -70,12 +70,12 @@ IZ_AppInitializeResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char* } void IZ_AppTeardown(struct IZ_App* app) { - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down networking..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/net Shutting down..."); IZ_NetClientDisconnect(&app->net_state); IZ_PoolTeardown(&app->pool); IZ_InputTeardown(&app->input_state); IZ_VideoTeardown(&app->video_state); - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Stopping %s...", IZ_APP_NAME); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/global Stopping %s...", IZ_APP_NAME); SDL_Quit(); } diff --git a/src/packages/game/data/data.test.c b/src/packages/game/data/data.test.c index b774a75..4ecd469 100644 --- a/src/packages/game/data/data.test.c +++ b/src/packages/game/data/data.test.c @@ -1,6 +1,6 @@ #include "../../test/IZ_test.h" #include "../../common/IZ_common.h" -#include "../../../__mocks__/SDL_stdinc.mock.h" +#include "../../../../__mocks__/dependencies/SDL2/SDL_stdinc.mock.h" #include "IZ_list.h" bool NodeExists(IZ_ListNode** node, u64 _index, IZ_List* list) { diff --git a/src/packages/game/input/IZ_input.c b/src/packages/game/input/IZ_input.c index 3a4589a..2fb9d77 100644 --- a/src/packages/game/input/IZ_input.c +++ b/src/packages/game/input/IZ_input.c @@ -10,7 +10,7 @@ void IZ_InputHandlePortMIDIEvents(IZ_InputState* state, PmEvent e) { } IZ_ProcedureResult IZ_InputInitialize(IZ_InputState* state, const char* config_path, u8 argc, const char* argv[]) { - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Setting up input..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/input Setting up..."); *state = (IZ_InputState) { .action = {}, @@ -40,13 +40,13 @@ IZ_ProcedureResult IZ_InputInitialize(IZ_InputState* state, const char* config_p IZ_ProcedureResult final_result = -result; - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Input setup complete. Result: %d", final_result); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/input Setup complete. Result: %d", final_result); return final_result; } void IZ_InputTeardown(IZ_InputState* state) { - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down input..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/input Shutting down..."); IZ_JoystickTeardown(&state->joystick_state); IZ_MIDIInputTeardown(&state->midi_input_state); } diff --git a/src/packages/game/input/input.test.c b/src/packages/game/input/input.test.c index 73f37a0..88bd013 100644 --- a/src/packages/game/input/input.test.c +++ b/src/packages/game/input/input.test.c @@ -1,8 +1,8 @@ -#include "../../../__mocks__/SDL_keyboard.mock.h" -#include "../../../__mocks__/SDL_joystick.mock.h" -#include "../../../__mocks__/SDL_stdinc.mock.h" -#include "../../../__mocks__/minIni.mock.h" -#include "../../../__mocks__/portmidi.mock.h" +#include "../../../../__mocks__/dependencies/SDL2/SDL_keyboard.mock.h" +#include "../../../../__mocks__/dependencies/SDL2/SDL_joystick.mock.h" +#include "../../../../__mocks__/dependencies/SDL2/SDL_stdinc.mock.h" +#include "../../../../__mocks__/dependencies/minIni/minIni.mock.h" +#include "../../../../__mocks__/dependencies/portmidi/portmidi.mock.h" //#include "../../stdinc/IZ_string.h" #include "IZ_keyboard.h" #include "IZ_joystick.h" diff --git a/src/packages/game/memory/IZ_pool.c b/src/packages/game/memory/IZ_pool.c index 8246793..dff6de3 100644 --- a/src/packages/game/memory/IZ_pool.c +++ b/src/packages/game/memory/IZ_pool.c @@ -1,7 +1,7 @@ #include "IZ_pool.h" void IZ_PoolInitialize(IZ_Pool* pool, size_t size) { - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Setting up memory pools..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/memory Setting up pool..."); IZ_ListInitialize(&pool->items); pool->memory = IZ_malloc(size); IZ_memset(pool->memory, 0, size); @@ -47,7 +47,7 @@ void IZ_PoolDeallocate(IZ_PoolItem* item) { } void IZ_PoolTeardown(IZ_Pool* pool) { - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down memory pools..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/memory Shutting down pool..."); IZ_free(pool->memory); pool->memory = NULL; } diff --git a/src/packages/game/memory/memory.test.c b/src/packages/game/memory/memory.test.c index c2f191a..5355b28 100644 --- a/src/packages/game/memory/memory.test.c +++ b/src/packages/game/memory/memory.test.c @@ -1,5 +1,7 @@ -#include "../../test/IZ_test.h" -#include "../../../__mocks__/SDL_stdinc.mock.h" +#include +#include "../../../../__mocks__/src/packages/log/IZ_log.mock.h" +#include "../../../../__mocks__/src/packages/stdinc/IZ_stdlib.mock.h" +#include "../../../../__mocks__/src/packages/stdinc/IZ_string.mock.h" #include "IZ_pool.h" struct DummyInnerStruct { @@ -21,11 +23,11 @@ spec("memory") { static IZ_Pool pool; after_each() { - mock_reset(SDL_memset); + mock_reset(IZ_memset); } after_each() { - mock_reset(SDL_malloc); + mock_reset(IZ_malloc); } after_each() { @@ -33,12 +35,12 @@ spec("memory") { } it("initializes the pool values") { - mock_set_expected_calls(SDL_memset, 1); + mock_set_expected_calls(IZ_memset, 1); IZ_PoolInitialize(&pool, POOL_MAX_SIZE); check( - mock_get_expected_calls(SDL_memset) == mock_get_actual_calls(SDL_memset), + mock_get_expected_calls(IZ_memset) == mock_get_actual_calls(IZ_memset), "Call count mismatch." ); } @@ -47,7 +49,7 @@ spec("memory") { IZ_PoolInitialize(&pool, POOL_MAX_SIZE); check( - mock_is_called(SDL_malloc), + mock_is_called(IZ_malloc), "Memory not allocated." ); } @@ -172,14 +174,14 @@ spec("memory") { } after_each() { - mock_reset(SDL_free); + mock_reset(IZ_free); } it("frees memory") { IZ_PoolTeardown(&pool); check( - mock_is_called(SDL_free), + mock_is_called(IZ_free), "Memory not freed." ); } diff --git a/src/packages/game/output/output.test.c b/src/packages/game/output/output.test.c index 12e29f1..fe3eb85 100644 --- a/src/packages/game/output/output.test.c +++ b/src/packages/game/output/output.test.c @@ -1,6 +1,6 @@ -#include "../../../__mocks__/minIni.mock.h" -#include "../../../__mocks__/SDL_stdinc.mock.h" -#include "../../../__mocks__/SDL_render.mock.h" +#include "../../../../__mocks__/dependencies/minIni/minIni.mock.h" +#include "../../../../__mocks__/dependencies/SDL2/SDL_stdinc.mock.h" +#include "../../../../__mocks__/dependencies/SDL2/SDL_render.mock.h" #include "video/IZ_video.h" const char* IZ_ConfigGetCommandlineOption(u8 argc, const char* argv[], const char* val) { diff --git a/src/packages/game/output/video/IZ_video.c b/src/packages/game/output/video/IZ_video.c index 4fe6870..185a24c 100644 --- a/src/packages/game/output/video/IZ_video.c +++ b/src/packages/game/output/video/IZ_video.c @@ -65,7 +65,7 @@ IZ_ProcedureResult IZ_VideoInitializeConfig(IZ_VideoState* state, const char* c } IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, const char* config_path, u8 argc, const char* argv[]) { - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Setting up video..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/video Setting up..."); IZ_memcpy(state, sizeof(IZ_VideoState), &IZ_VIDEO_DEFAULT_STATE, sizeof(IZ_VideoState)); IZ_memset(state->active_sprites, 0, sizeof(IZ_SpriteSlot) * IZ_MAX_ACTIVE_SPRITES); if (IZ_VideoInitializeConfig(state, config_path, argc, argv) < 0) { @@ -84,7 +84,7 @@ IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, con SDL_WINDOW_SHOWN ); if (window == NULL) { - IZ_LogError("Window could not be created! Reason: %s", SDL_GetError()); + IZ_LogError("app/video Window could not be created! Reason: %s", SDL_GetError()); return -3; } state->window = window; @@ -93,7 +93,7 @@ IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, con } void IZ_VideoTeardown(IZ_VideoState* state) { - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Shutting down video..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/video Shutting down..."); for (u16 i = 0; i < IZ_MAX_ACTIVE_SPRITES; i += 1) { if (state->active_sprites[i].sprite.texture) { SDL_DestroyTexture(state->active_sprites[i].sprite.texture); diff --git a/src/packages/log/IZ_intercept.c b/src/packages/log/IZ_intercept.c index 9b824dd..4e90f6f 100644 --- a/src/packages/log/IZ_intercept.c +++ b/src/packages/log/IZ_intercept.c @@ -56,20 +56,20 @@ void IZ_LogInterceptHandleFromWS(i32 level, const char* line) { switch (level) { // TODO level is a bit field...check if each level is OR'd. case LLL_ERR: - IZ_LogError("ws %s", buffer); + IZ_LogError("app/net/ws %s", buffer); return; case LLL_WARN: - IZ_LogWarn(false, "ws %s", buffer); + IZ_LogWarn(false, "app/net/ws %s", buffer); return; case LLL_NOTICE: - IZ_LogInfo(IZ_LOG_CATEGORY_GENERIC, "ws %s", buffer); + IZ_LogInfo(IZ_LOG_CATEGORY_GENERIC, "app/net/ws %s", buffer); return; case LLL_USER: default: break; } - IZ_Log("ws %s", buffer); + IZ_Log("app/net/ws %s", buffer); } void IZ_LogInterceptWSMessages(i32 level) { diff --git a/src/packages/net/IZ_net_client.c b/src/packages/net/IZ_net_client.c index e01786a..5e931ca 100644 --- a/src/packages/net/IZ_net_client.c +++ b/src/packages/net/IZ_net_client.c @@ -106,7 +106,7 @@ IZ_ProcedureResult IZ_NetClientInitialize( if (!user_data) { return -1; } - IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "Setting up networking..."); + IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "app/net Setting up..."); IZ_memcpy(state, sizeof(IZ_NetClientState), &IZ_NET_CLIENT_DEFAULT_STATE, sizeof(IZ_NetClientState)); if (IZ_NetClientInitializeConfig(state, config_path, argc, argv) < 0) { return -2;