From 71c56e678143b17672f3b3e7a59a68eeb8cfeaae Mon Sep 17 00:00:00 2001 From: Maximilian Wittfeld Date: Wed, 26 Feb 2025 23:28:42 +0100 Subject: [PATCH] feat(loading-screens-five): option to hide busy spinner in loading screen --- .../loading-screens-five/include/LoadingScreens.h | 3 +++ .../loading-screens-five/src/HookLoadingScreens.cpp | 3 ++- .../loading-screens-five/src/LoadingScreens.cpp | 13 +++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 code/components/loading-screens-five/include/LoadingScreens.h diff --git a/code/components/loading-screens-five/include/LoadingScreens.h b/code/components/loading-screens-five/include/LoadingScreens.h new file mode 100644 index 0000000000..5b99e8f8c2 --- /dev/null +++ b/code/components/loading-screens-five/include/LoadingScreens.h @@ -0,0 +1,3 @@ +#pragma once + +extern bool showBusySpinner; diff --git a/code/components/loading-screens-five/src/HookLoadingScreens.cpp b/code/components/loading-screens-five/src/HookLoadingScreens.cpp index 766e186858..be9970502a 100644 --- a/code/components/loading-screens-five/src/HookLoadingScreens.cpp +++ b/code/components/loading-screens-five/src/HookLoadingScreens.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "LoadingScreens.h" #include @@ -479,7 +480,7 @@ static InitFunction initFunction([] () { OnLookAliveFrame.Connect([]() { - if (nui::HasFrame("loadingScreen")) + if (nui::HasFrame("loadingScreen") && showBusySpinner) { if (*g_scaleformMgr) { diff --git a/code/components/loading-screens-five/src/LoadingScreens.cpp b/code/components/loading-screens-five/src/LoadingScreens.cpp index 8ac063a36b..fd0c502337 100644 --- a/code/components/loading-screens-five/src/LoadingScreens.cpp +++ b/code/components/loading-screens-five/src/LoadingScreens.cpp @@ -28,10 +28,7 @@ #include #include - -#include - -#include +#include "LoadingScreens.h" static std::shared_ptr> g_loadProfileConvar; static std::map g_loadTiming; @@ -117,6 +114,7 @@ class LoadsThread : public GtaThread static LoadsThread loadsThread; static bool autoShutdownNui = true; +bool showBusySpinner = true; static fx::TNativeHandler g_origShutdown; #include @@ -195,6 +193,7 @@ static HookFunction hookFunction([]() { endedLoadingScreens = false; autoShutdownNui = true; + showBusySpinner = true; }); { @@ -557,6 +556,12 @@ static InitFunction initFunction([] () autoShutdownNui = false; } + entriesTwo = mdComponent->GetEntries("loadscreen_hide_busyspinner"); + if (entriesTwo.begin() != entriesTwo.end()) + { + showBusySpinner = false; + } + static ConVar uiLoadingCursor("ui_loadingCursor", ConVar_None, false); auto useCursor = mdComponent->GetEntries("loadscreen_cursor"); if (useCursor.begin() != useCursor.end())