From 2551b5d8f5d71ccdde207e2df839ade3c417b446 Mon Sep 17 00:00:00 2001 From: HeliumAnt Date: Fri, 11 Jul 2025 00:44:22 +0200 Subject: [PATCH 1/6] remove unnecessary checks for old sdl versions --- Source/Main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/Main.cpp b/Source/Main.cpp index 1fb6ad711..0e3398680 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -411,12 +411,9 @@ int main(int argc, char** argv) { SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD ); -#if SDL_MINOR_VERSION > 22 SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "0"); -#endif - - SDL_HideCursor(); SDL_SetHint("SDL_ALLOW_TOPMOST", "0"); + SDL_HideCursor(); if (std::filesystem::exists("Base.rte/gamecontrollerdb.txt")) { SDL_AddGamepadMappingsFromFile("Base.rte/gamecontrollerdb.txt"); From 8517c1de3e4ea060b848e1325b77950a845c8e0b Mon Sep 17 00:00:00 2001 From: HeliumAnt Date: Fri, 11 Jul 2025 00:44:59 +0200 Subject: [PATCH 2/6] add null check for bitmapinfo delete sometimes gets called before bitmap is initialized... --- Source/Managers/GLResourceMan.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Managers/GLResourceMan.cpp b/Source/Managers/GLResourceMan.cpp index 7c7353675..459f3f0de 100644 --- a/Source/Managers/GLResourceMan.cpp +++ b/Source/Managers/GLResourceMan.cpp @@ -154,5 +154,7 @@ GLuint GLResourceMan::UpdateDynamicBitmap(BITMAP* bitmap, bool updated, const st void GLResourceMan::DestroyBitmapInfo(BITMAP* bitmap) { GLBitmapInfo* info = GetBitmapInfo(bitmap); - rlUnloadTexture(info->m_Texture); -} \ No newline at end of file + if (info) { + rlUnloadTexture(info->m_Texture); + } +} From e1b5f5501a8a62026c3716803523e7e73ef3e151 Mon Sep 17 00:00:00 2001 From: HeliumAnt Date: Fri, 11 Jul 2025 00:45:46 +0200 Subject: [PATCH 3/6] fix mouse cursor (oops forgot to set imgui config flag to deny it control over the cursor visibility) --- Source/Managers/WindowMan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Managers/WindowMan.cpp b/Source/Managers/WindowMan.cpp index 3f20b0671..49fe98d19 100644 --- a/Source/Managers/WindowMan.cpp +++ b/Source/Managers/WindowMan.cpp @@ -133,7 +133,7 @@ void WindowMan::Initialize() { ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; - io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; + io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange; ImGui::StyleColorsDark(); ImGui_ImplSDL3_InitForOpenGL(m_PrimaryWindow.get(), m_GLContext.get()); From 6fd43eec3860d759fde1bffb59e0e651ee6402f6 Mon Sep 17 00:00:00 2001 From: HeliumAnt Date: Fri, 11 Jul 2025 00:46:53 +0200 Subject: [PATCH 4/6] fix loading screen not being scaled --- Source/Menus/LoadingScreen.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Source/Menus/LoadingScreen.cpp b/Source/Menus/LoadingScreen.cpp index 0056fc89a..3a89154d9 100644 --- a/Source/Menus/LoadingScreen.cpp +++ b/Source/Menus/LoadingScreen.cpp @@ -76,19 +76,11 @@ void LoadingScreen::CreateLoadingSplash(int xOffset) { m_LoadingBackground->Create(ContentFile("Base.rte/GUIs/Title/LoadingSplash.png").GetAsBitmap(COLORCONV_NONE, false), false, Vector(), true, false, Vector(1.0F, 0)); m_LoadingBackground->SetOffset(Vector(static_cast(((m_LoadingBackground->GetBitmap()->w - g_WindowMan.GetResX()) / 2) + xOffset), 0)); - Box loadingSplashTargetBox(Vector(0, static_cast((g_WindowMan.GetResY() - m_LoadingBackground->GetBitmap()->h) / 2)), static_cast(g_WindowMan.GetResX()), static_cast(m_LoadingBackground->GetBitmap()->h)); - RenderTarget defaultTarget{ - FloatRect(0, 0, g_WindowMan.GetResX(), g_WindowMan.GetResY()), - FloatRect(0, 0, g_WindowMan.GetResX(), g_WindowMan.GetResY()), - 0, - Texture2D(), - true - }; - defaultTarget.Begin(); - g_WindowMan.ClearBackbuffer(); + Box loadingSplashTargetBox(Vector(0, static_cast((g_WindowMan.GetResY() - g_LoadingScreen.m_LoadingBackground->GetBitmap()->h) / 2)), static_cast(g_WindowMan.GetResX()), static_cast(g_LoadingScreen.m_LoadingBackground->GetBitmap()->h)); + g_WindowMan.ClearBackbuffer(false); + g_WindowMan.GetScreenBuffer()->Begin(); m_LoadingBackground->Draw(loadingSplashTargetBox, loadingSplashTargetBox); - rlDrawRenderBatchActive(); - g_WindowMan.Present(); + g_WindowMan.UploadFrame(); } void LoadingScreen::CreateProgressReportListbox(GUIControlManager* parentControlManager) { @@ -152,6 +144,7 @@ void LoadingScreen::LoadingSplashProgressReport(const std::string& reportString, blit(g_LoadingScreen.m_ProgressListboxBitmap, g_FrameMan.GetBackBuffer32(), 0, 0, g_LoadingScreen.m_ProgressListboxPosX, g_LoadingScreen.m_ProgressListboxPosY, g_LoadingScreen.m_ProgressListboxBitmap->w, g_LoadingScreen.m_ProgressListboxBitmap->h); Box loadingSplashTargetBox(Vector(0, static_cast((g_WindowMan.GetResY() - g_LoadingScreen.m_LoadingBackground->GetBitmap()->h) / 2)), static_cast(g_WindowMan.GetResX()), static_cast(g_LoadingScreen.m_LoadingBackground->GetBitmap()->h)); + g_WindowMan.ClearBackbuffer(false); g_WindowMan.GetScreenBuffer()->Begin(); g_LoadingScreen.m_LoadingBackground->Draw(loadingSplashTargetBox, loadingSplashTargetBox); From 3d5c02e77327e3a6c42e64d184bfaad1a6bb4338 Mon Sep 17 00:00:00 2001 From: HeliumAnt Date: Fri, 11 Jul 2025 00:47:24 +0200 Subject: [PATCH 5/6] lower raylib loglevel default to error --- Source/Renderer/raylib/rlutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Renderer/raylib/rlutils.c b/Source/Renderer/raylib/rlutils.c index ca2b85165..646d9c019 100644 --- a/Source/Renderer/raylib/rlutils.c +++ b/Source/Renderer/raylib/rlutils.c @@ -59,7 +59,7 @@ //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -static int logTypeLevel = LOG_INFO; // Minimum log type level +static int logTypeLevel = LOG_ERROR; // Minimum log type level static TraceLogCallback traceLog = NULL; // TraceLog callback function pointer static LoadFileDataCallback loadFileData = NULL; // LoadFileData callback function pointer @@ -509,4 +509,4 @@ static int android_close(void *cookie) } #endif // PLATFORM_ANDROID -#endif \ No newline at end of file +#endif From b89c056d597a775dbc3466b625cecd8783edce36 Mon Sep 17 00:00:00 2001 From: HeliumAnt Date: Fri, 11 Jul 2025 00:47:40 +0200 Subject: [PATCH 6/6] make DefaultPaletteToSDL always use the default Instead of using the current palette, grab the default from FrameMan (assumes that frameman is always init before a palette is requested which seems to be the case) --- Source/System/ContentFile.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Source/System/ContentFile.cpp b/Source/System/ContentFile.cpp index b33300e3c..62f3e9a60 100644 --- a/Source/System/ContentFile.cpp +++ b/Source/System/ContentFile.cpp @@ -258,19 +258,18 @@ void ContentFile::GetAsAnimation(std::vector& vectorToFill, int frameCo } } SDL_Palette* ContentFile::DefaultPaletteToSDL() { - SDL_Palette* palette = SDL_CreatePalette(256); - std::array paletteColor; - PALETTE currentPalette; - get_palette(currentPalette); - paletteColor[0] = {.r = 0, .g = 0, .b = 0, .a = 0}; - for (size_t i = 1; i < paletteColor.size(); ++i) { - paletteColor[i].r = currentPalette[i].r; - paletteColor[i].g = currentPalette[i].g; - paletteColor[i].b = currentPalette[i].b; - paletteColor[i].a = 255; - } - SDL_SetPaletteColors(palette, paletteColor.data(), 0, 256); - return palette; + SDL_Palette* palette = SDL_CreatePalette(256); + std::array paletteColor; + const PALETTE& defaultPalette = g_FrameMan.GetDefaultPalette(); + paletteColor[0] = {.r = 0, .g = 0, .b = 0, .a = 0}; + for (size_t i = 1; i < paletteColor.size(); ++i) { + paletteColor[i].r = defaultPalette[i].r; + paletteColor[i].g = defaultPalette[i].g; + paletteColor[i].b = defaultPalette[i].b; + paletteColor[i].a = 255; + } + SDL_SetPaletteColors(palette, paletteColor.data(), 0, 256); + return palette; } SDL_Surface* ContentFile::LoadImageAsSurface(int conversionMode, const std::string& dataPathToLoad) { @@ -286,7 +285,6 @@ SDL_Surface* ContentFile::LoadImageAsSurface(int conversionMode, const std::stri image = newImage; bitDepth = 8; } else if (bitDepth != 8 || convert8To32) { - SDL_Palette* palette = DefaultPaletteToSDL(); if (SDL_GetPixelFormatDetails(image->format)->bits_per_pixel == 8) { SDL_SetSurfacePalette(image, palette); @@ -312,7 +310,7 @@ BITMAP* ContentFile::LoadAndReleaseBitmap(int conversionMode, const std::string& int bitDepth = SDL_GetPixelFormatDetails(image->format)->bits_per_pixel; BITMAP* returnBitmap = create_bitmap_ex(bitDepth, image->w, image->h); - + // allegro doesn't (always) align lines to 4byte, so copy line by line. SDL_Surface.pitch is the size in bytes per line + alignment padding. for (int y = 0; y < image->h; ++y) { memcpy(returnBitmap->line[y], static_cast(image->pixels) + image->pitch * y, image->w * SDL_GetPixelFormatDetails(image->format)->bytes_per_pixel);