2121
2222#include < CoreConsole.h>
2323
24+ #include < Rect.h>
25+ #include < DrawCommands.h>
26+
2427#include < Error.h>
2528
2629static std::shared_ptr<ConVar<bool >> g_loadProfileConvar;
@@ -35,6 +38,7 @@ static std::set<uint64_t> g_visitedTimings;
3538
3639using fx::Resource;
3740
41+ static bool g_doDrawBelowLoadingScreens;
3842static bool frameOn = false ;
3943static bool primedMapLoad = false ;
4044
@@ -60,6 +64,8 @@ static void DestroyFrame()
6064{
6165 if (frameOn)
6266 {
67+ g_doDrawBelowLoadingScreens = false ;
68+
6369 nui::DestroyFrame (" loadingScreen" );
6470
6571 frameOn = false ;
@@ -251,6 +257,8 @@ static InitFunction initFunction([] ()
251257 }
252258 });
253259
260+ g_doDrawBelowLoadingScreens = true ;
261+
254262 nui::CreateFrame (" loadingScreen" , loadingScreens.back ());
255263 nui::OverrideFocus (true );
256264
@@ -523,4 +531,45 @@ static InitFunction initFunction([] ()
523531 InvokeNUIScript (" onDataFileEntry" , doc);
524532 }
525533 });
534+
535+ OnPostFrontendRender.Connect ([]()
536+ {
537+ if (!g_doDrawBelowLoadingScreens)
538+ {
539+ return ;
540+ }
541+
542+ SetTextureGtaIm (rage::grcTextureFactory::GetNoneTexture ());
543+
544+ auto oldRasterizerState = GetRasterizerState ();
545+ SetRasterizerState (GetStockStateIdentifier (RasterizerStateNoCulling));
546+
547+ auto oldBlendState = GetBlendState ();
548+ SetBlendState (GetStockStateIdentifier (BlendStateNoBlend));
549+
550+ auto oldDepthStencilState = GetDepthStencilState ();
551+ SetDepthStencilState (GetStockStateIdentifier (DepthStencilStateNoDepth));
552+
553+ PushDrawBlitImShader ();
554+
555+ BeginImVertices (4 , 4 );
556+
557+ CRect rect (0 .0f , 0 .0f , 6144 .0f , 6144 .0f );
558+ uint32_t color = 0x00000000 ;
559+
560+ AddImVertex (rect.fX1 , rect.fY1 , 0 .0f , 0 .0f , 0 .0f , -1 .0f , color, 0 .0f , 0 .0f );
561+ AddImVertex (rect.fX2 , rect.fY1 , 0 .0f , 0 .0f , 0 .0f , -1 .0f , color, 0 .0f , 0 .0f );
562+ AddImVertex (rect.fX1 , rect.fY2 , 0 .0f , 0 .0f , 0 .0f , -1 .0f , color, 0 .0f , 0 .0f );
563+ AddImVertex (rect.fX2 , rect.fY2 , 0 .0f , 0 .0f , 0 .0f , -1 .0f , color, 0 .0f , 0 .0f );
564+
565+ DrawImVertices ();
566+
567+ PopDrawBlitImShader ();
568+
569+ SetRasterizerState (oldRasterizerState);
570+
571+ SetBlendState (oldBlendState);
572+
573+ SetDepthStencilState (oldDepthStencilState);
574+ }, INT32_MIN);
526575});
0 commit comments