Skip to content

Commit

Permalink
xrEngine: moved CheckPrivilegySlowdown to device.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Dec 16, 2023
1 parent c76dddd commit 71eb6b2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
28 changes: 27 additions & 1 deletion src/xrEngine/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,33 @@ bool CRenderDevice::RenderBegin()
}

void CRenderDevice::Clear() { GEnv.Render->Clear(); }
extern void CheckPrivilegySlowdown();

namespace
{
void CheckPrivilegySlowdown()
{
#ifndef MASTER_GOLD
const auto slowdownthread = +[](void*)
{
for (;;)
{
if (Device.GetStats().fFPS < 30)
Sleep(1);
if (Device.mt_bMustExit || !pSettings || !Console || !pInput)
return;
}
};

if (strstr(Core.Params, "-slowdown"))
Threading::SpawnThread(slowdownthread, "slowdown", 0, nullptr);
if (strstr(Core.Params, "-slowdown2x"))
{
Threading::SpawnThread(slowdownthread, "slowdown", 0, nullptr);
Threading::SpawnThread(slowdownthread, "slowdown", 0, nullptr);
}
#endif
}
}

void CRenderDevice::RenderEnd(void)
{
Expand Down
23 changes: 0 additions & 23 deletions src/xrEngine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,29 +195,6 @@ void execUserScript()
Console->ExecuteScript(Console->ConfigFile);
}

void slowdownthread(void*)
{
for (;;)
{
if (Device.GetStats().fFPS < 30)
Sleep(1);
if (Device.mt_bMustExit || !pSettings || !Console || !pInput)
return;
}
}
void CheckPrivilegySlowdown()
{
#ifdef DEBUG
if (strstr(Core.Params, "-slowdown"))
Threading::SpawnThread(slowdownthread, "slowdown", 0, 0);
if (strstr(Core.Params, "-slowdown2x"))
{
Threading::SpawnThread(slowdownthread, "slowdown", 0, 0);
Threading::SpawnThread(slowdownthread, "slowdown", 0, 0);
}
#endif
}

ENGINE_API void Startup()
{
InitSoundDeviceList();
Expand Down

0 comments on commit 71eb6b2

Please sign in to comment.