Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ZDoom/gzdoom into gzdoom_…
Browse files Browse the repository at this point in the history
…unstable
  • Loading branch information
nashmuhandes committed Jan 31, 2025
2 parents 9c79016 + f21b68c commit 0e04a4c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
16 changes: 10 additions & 6 deletions src/common/platform/win32/i_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ EXTERN_CVAR(Bool, i_pauseinbackground);


CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, i_allowprioritychange, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)

static void I_CheckGUICapture ()
{
Expand Down Expand Up @@ -485,13 +486,16 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)

case WM_ACTIVATEAPP:
AppActive = (wParam == TRUE);
if (wParam || !i_pauseinbackground)
if (!i_pauseinbackground && i_allowprioritychange)
{
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
}
else if (!noidle && !(sysCallbacks.NetGame && sysCallbacks.NetGame()))
{
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
if (wParam)
{
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
}
else if (!noidle && !(sysCallbacks.NetGame && sysCallbacks.NetGame()))
{
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
}
}
S_SetSoundPaused (wParam);
break;
Expand Down
5 changes: 4 additions & 1 deletion src/common/platform/win32/i_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ void CalculateCPUSpeed()
// probably never use the performance statistics.
min_diff = freq.LowPart * 11 / 200;

// just in case we were launched with a custom priority class, keep it
DWORD OldPriorityClass = GetPriorityClass(GetCurrentProcess());

// Minimize the chance of task switching during the testing by going very
// high priority. This is another reason to avoid timing for too long.
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
Expand All @@ -257,7 +260,7 @@ void CalculateCPUSpeed()
do { QueryPerformanceCounter(&count1); } while ((count1.QuadPart - count2.QuadPart) < min_diff);
ClockCalibration.Unclock();

SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
SetPriorityClass(GetCurrentProcess(), OldPriorityClass);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);

PerfToSec = double(count1.QuadPart - count2.QuadPart) / (double(ClockCalibration.GetRawCounter()) * freq.QuadPart);
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/actor.zs
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ class Actor : Thinker native
native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false);
native void A_SprayDecal(String name, double dist = 172, vector3 offset = (0, 0, 0), vector3 direction = (0, 0, 0), bool useBloodColor = false, color decalColor = 0, TranslationID translation = 0);
native void A_SetMugshotState(String name);
native void CopyBloodColor(Actor other);
native void CopyBloodColor(readonly<Actor> other);

native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
native void A_TransferPointer(int ptr_source, int ptr_recipient, int sourcefield, int recipientfield=AAPTR_DEFAULT, int flags=0);
Expand Down

0 comments on commit 0e04a4c

Please sign in to comment.