From 3c546b7f301201cd80d7a430c830feceaf29718a Mon Sep 17 00:00:00 2001 From: RDW Date: Thu, 19 Mar 2026 06:48:13 +0100 Subject: [PATCH] Cleanup: Remove the obsolete TODO placeholder define It was one of the first things added, but is now obsolete. There's better ways to encode this, anyway. --- Core/Platforms/Win32.cpp | 31 +++++++------------------------ Core/Platforms/Win32/GamePad.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/Core/Platforms/Win32.cpp b/Core/Platforms/Win32.cpp index 99eb3db1..8b310f7e 100644 --- a/Core/Platforms/Win32.cpp +++ b/Core/Platforms/Win32.cpp @@ -1,7 +1,5 @@ #include "Win32.hpp" -#define TODO(msg) OutputDebugStringA(msg); - constexpr size_t MAX_ERROR_MSG_SIZE = 512; GLOBAL TCHAR SYSTEM_ERROR_MESSAGE[MAX_ERROR_MSG_SIZE]; @@ -99,10 +97,9 @@ INTERNAL void SurfacePresentFrameBuffer(gdi_surface_t& surface, gdi_offscreen_bu int srcH = backBuffer.bitmap.height; int destW = surface.width; int destH = surface.height; - if(!StretchBlt(surface.displayDeviceContext, 0, 0, destW, destH, surface.offscreenDeviceContext, - 0, 0, srcW, srcH, SRCCOPY)) { - TODO("StretchBlt failed\n"); - } + BOOL success = StretchBlt(surface.displayDeviceContext, 0, 0, destW, destH, surface.offscreenDeviceContext, + 0, 0, srcW, srcH, SRCCOPY); + ASSUME(success, "StretchBlt failed (multi-monitor setup with mismatching source/destination HDCs?)"); } INTERNAL void SurfaceDrawDebugUI(gdi_surface_t& doubleBufferedWindowSurface) { @@ -184,11 +181,6 @@ LRESULT CALLBACK MainWindowProcessIncomingMessage(HWND window, UINT message, WPA LRESULT result = 0; switch(message) { - case WM_CREATE: { - TODO("Received WM_CREATE\n"); - // TODO Initialize child windows here? - } break; - case WM_DISPLAYCHANGE: case WM_MOVE: case WM_MOVING: @@ -266,14 +258,9 @@ LRESULT CALLBACK MainWindowProcessIncomingMessage(HWND window, UINT message, WPA } break; case WM_CLOSE: { - TODO("Received WM_CLOSE\n"); APPLICATION_SHOULD_EXIT = true; } break; - case WM_ACTIVATEAPP: { - TODO("Received WM_ACTIVATEAPP\n"); - } break; - case WM_ERASEBKGND: { // NOTE: No need for the OS to clear since the entire window is always fully painted constexpr bool didEraseBackground = true; @@ -338,10 +325,8 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); - if(!RegisterClassEx(&windowClass)) { - TODO("Failed to register window class\n"); - return EXIT_FAILURE; - } + ATOM classGUID = RegisterClassEx(&windowClass); + ASSUME(classGUID != NULL, "Failed to register window class (...really?)"); // TODO: On modern Windows systems, MAX_PATH is insufficient and Unicode paths should ideally be supported (later?) TCHAR executableFileSystemPath[MAX_PATH]; @@ -358,10 +343,8 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, 0, windowClass.lpszClassName, windowTitle.buffer, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_MAXIMIZE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, instance, 0); - if(!mainWindow) { - TODO("Failed to CreateWindowExA - Exiting..."); - return EXIT_FAILURE; - } + ASSUME(mainWindow != NULL, "Failed to CreateWindowExA (...can this actually happen in practice?)"); + MainWindowCreateFrameBuffers(mainWindow, GDI_SURFACE, GDI_BACKBUFFER); CPU_PERFORMANCE_INFO.applicationLaunchTime = PerformanceMetricsGetTimeSince(applicationStartTime); diff --git a/Core/Platforms/Win32/GamePad.cpp b/Core/Platforms/Win32/GamePad.cpp index 676340e4..7def8281 100644 --- a/Core/Platforms/Win32/GamePad.cpp +++ b/Core/Platforms/Win32/GamePad.cpp @@ -8,10 +8,10 @@ INTERNAL void GamePadPollControllers(gamepad_state_t& controllerInputs) { constexpr DWORD MAX_SUPPORTED_GAMEPAD_COUNT = XUSER_MAX_COUNT; for(DWORD gamePadID = 0; gamePadID < MAX_SUPPORTED_GAMEPAD_COUNT; ++gamePadID) { - XINPUT_STATE gamePadButtonState; - if(XInputGetState(gamePadID, &gamePadButtonState) != ERROR_SUCCESS) { - TODO("XInput detected a GamePad but it wasn't usable?\n") - } + XINPUT_STATE gamePadButtonState = {}; + DWORD result = XInputGetState(gamePadID, &gamePadButtonState); + ASSUME(result != ERROR_DEVICE_NOT_CONNECTED, "GamePad detected, but not connected (...how does that work?)"); + ASSUME(result == ERROR_SUCCESS, "GamePad detected, but it wasn't usable - despite being connected (...why?)"); XINPUT_GAMEPAD* gamePad = &gamePadButtonState.Gamepad; controllerInputs.stickX = gamePad->sThumbLX;