diff --git a/src/app/engine/assembly/foldhaus_assembly.cpp b/src/app/engine/assembly/foldhaus_assembly.cpp index 840fddc..6e69f4b 100644 --- a/src/app/engine/assembly/foldhaus_assembly.cpp +++ b/src/app/engine/assembly/foldhaus_assembly.cpp @@ -226,7 +226,7 @@ LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, gs_memory_arena ErrorAt != 0; ErrorAt = ErrorAt->Next) { - OutputDebugString(ErrorAt->Message.Str); + Log_Error(GlobalLogBuffer, ErrorAt->Message.Str); } } diff --git a/src/app/foldhaus_app.h b/src/app/foldhaus_app.h index 3a7f70c..28227b7 100644 --- a/src/app/foldhaus_app.h +++ b/src/app/foldhaus_app.h @@ -11,7 +11,6 @@ #include "engine/foldhaus_serializer.h" #include "../gs_libs/gs_font.h" -#include "engine/foldhaus_log.h" #include "editor/interface.h" @@ -48,8 +47,6 @@ typedef struct panel panel; #include "ss_blumen_lumen/phrase_hue_map.h" #include "ss_blumen_lumen/blumen_lumen.h" -global log_buffer* GlobalLogBuffer; - struct app_state { gs_memory_arena Permanent; diff --git a/src/app/foldhaus_platform.h b/src/app/foldhaus_platform.h index 9e63d61..adbc19a 100644 --- a/src/app/foldhaus_platform.h +++ b/src/app/foldhaus_platform.h @@ -29,6 +29,9 @@ Handle_IsValid(handle Handle) #include "..\gs_libs\gs_string.h" #include "..\gs_libs\gs_csv.h" +#include "engine/foldhaus_log.h" +global log_buffer* GlobalLogBuffer; + #include "foldhaus_debug.h" global debug_services* GlobalDebugServices; diff --git a/src/app/platform_win32/win32_foldhaus.cpp b/src/app/platform_win32/win32_foldhaus.cpp index 19653ac..1e25934 100644 --- a/src/app/platform_win32/win32_foldhaus.cpp +++ b/src/app/platform_win32/win32_foldhaus.cpp @@ -397,7 +397,8 @@ Win32_SendAddressedDataBuffer(gs_thread_context Context, addressed_data_buffer* else { #if 0 - OutputDebugStringA("Skipping data buffer because its COM Port isn't set"); + Log_Message(GlobalLogBuffer, + "Skipping data buffer because its COM Port isn't set"); #endif } }break; @@ -422,11 +423,11 @@ ReloadAndLinkDLL(win32_dll_refresh* DLL, context* Context, gs_work_queue* WorkQu SetApplicationLinks(Context, *DLL, WorkQueue); Context->ReloadStaticData(*Context, GlobalDebugServices, AppReady); Success = true; - OutputDebugStringA("Reloaded DLL\n"); + Log_Message(GlobalLogBuffer, "Reloaded DLL\n"); } else if(ShouldError) { - OutputDebugStringA("Unable to load application DLL at startup.\nAborting\n"); + Log_Error(GlobalLogBuffer, "Unable to load application DLL at startup.\nAborting\n"); } return Success; } @@ -490,9 +491,9 @@ SetWorkingDirectory(HINSTANCE HInstance, gs_thread_context ThreadContext) if (WorkingDirectory.Length > 0) { - OutputDebugStringA("Setting Working Directory\n"); - OutputDebugStringA(WorkingDirectory.Str); - OutputDebugStringA("\n"); + Log_Message(GlobalLogBuffer, + "Setting Working Directory \n%S \n", + WorkingDirectory.ConstString); Result = SetCurrentDirectory(WorkingDirectory.Str); if (!Result) { @@ -502,7 +503,7 @@ SetWorkingDirectory(HINSTANCE HInstance, gs_thread_context ThreadContext) } else { - OutputDebugStringA("Error, no data folder found\n"); + Log_Error(GlobalLogBuffer, "Error, no data folder found\n"); } return Result; @@ -601,7 +602,7 @@ WinMain ( gs_const_string Args = ConstString((char*)CmdLineArgs); if (StringsEqual(Args, ConstString("-headless"))) { - OutputDebugStringA("Running Headless\n"); + Log_Message(GlobalLogBuffer, "Running Headless\n"); Context.Headless = true; } @@ -707,9 +708,10 @@ WinMain ( u64 NanosElapsed = Context.SystemTime_Current.NanosSinceEpoch - StartTime.NanosSinceEpoch; r64 SecondsElapsed = (r64)NanosElapsed * NanosToSeconds; - PrintF(&T, "%lld %f Seconds\n", NanosElapsed, SecondsElapsed); - NullTerminate(&T); - OutputDebugStringA(T.Str); + Log_Message(GlobalLogBuffer, + "%lld %f Seconds \n", + NanosElapsed, + SecondsElapsed); #endif } diff --git a/src/app/platform_win32/win32_foldhaus_serial.h b/src/app/platform_win32/win32_foldhaus_serial.h index 23d8cdf..1609013 100644 --- a/src/app/platform_win32/win32_foldhaus_serial.h +++ b/src/app/platform_win32/win32_foldhaus_serial.h @@ -212,7 +212,7 @@ Win32SerialPort_Write(HANDLE PortHandle, gs_data Buffer) } else { - OutputDebugStringA("Error: Unable to write to port\n"); + Log_Error(GlobalLogBuffer, "Error: Unable to write to port\n"); s32 Error = GetLastError(); switch (Error) { diff --git a/src/app/ss_blumen_lumen/blumen_lumen.cpp b/src/app/ss_blumen_lumen/blumen_lumen.cpp index 294e9b8..84a1c89 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.cpp +++ b/src/app/ss_blumen_lumen/blumen_lumen.cpp @@ -444,10 +444,7 @@ BlumenLumen_ApplyNextHotHue(blumen_lumen_state* BLState, context Context, gs_str // if we are in standard color mode, shift all flowers to the new color // otherwise, only shift the next flower in the sequence to the new color phrase_hue NewHue = BLState->NextHotHue; - - PrintF(DebugStr, "Switching To: %S\n", NewHue.Phrase); - NullTerminate(DebugStr); - OutputDebugString(DebugStr->Str); + Log_Message(GlobalLogBuffer, "Switching To: %S\n", NewHue.Phrase); if (BLState->PatternMode == BlumenPattern_Standard || @@ -499,9 +496,7 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context) bool IsntInPhraseReceptionMode = !BLState->InPhraseReceptionMode; if (IsLonger || IsntInPhraseReceptionMode) { - PrintF(&DebugStr, "Queuing: %S\n", NewHue.Phrase); - NullTerminate(&DebugStr); - OutputDebugString(DebugStr.Str); + Log_Message(GlobalLogBuffer, "Queueing: %S\n", NewHue.Phrase); BLState->NextHotHue = NewHue; if (SecondsElapsed(BLState->TimePhraseReceptionBegan, diff --git a/src/app/ss_blumen_lumen/phrase_hue_map.h b/src/app/ss_blumen_lumen/phrase_hue_map.h index 89ec6e0..3b2af84 100644 --- a/src/app/ss_blumen_lumen/phrase_hue_map.h +++ b/src/app/ss_blumen_lumen/phrase_hue_map.h @@ -127,7 +127,7 @@ CreateHueFromString(gs_const_string Str) parse_float_result Parsed = ValidateAndParseFloat(Str); if (!Parsed.Success) { - OutputDebugString("Failed to Parse CSV Float\n"); + Log_Error(GlobalLogBuffer, "Failed to Parse CSV Float\n"); Parsed.Value = 0.0; } Result.HSV = v4{ (r32)Parsed.Value, 1, 1, 1 };