mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-10 13:29:56 +00:00
Process priority:
. Normal when in 'full speed' mode (so OS still has time to run) . Above Normal otherwise (for BUG #015394 - audio under-run)
This commit is contained in:
parent
41b90361fd
commit
c6971fadae
@ -100,6 +100,36 @@ ULONGLONG g_nPerfFreq = 0;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static bool g_bPriorityNormal = true;
|
||||
|
||||
// Make APPLEWIN process higher priority
|
||||
void SetPriorityAboveNormal()
|
||||
{
|
||||
if (!g_bPriorityNormal)
|
||||
return;
|
||||
|
||||
if ( SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS) )
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
||||
g_bPriorityNormal = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Make APPLEWIN process normal priority
|
||||
void SetPriorityNormal()
|
||||
{
|
||||
if (g_bPriorityNormal)
|
||||
return;
|
||||
|
||||
if ( SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS) )
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
|
||||
g_bPriorityNormal = true;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ContinueExecution()
|
||||
{
|
||||
static BOOL pageflipping = 0; //?
|
||||
@ -131,12 +161,19 @@ void ContinueExecution()
|
||||
SysClk_StopTimer();
|
||||
|
||||
g_nCpuCyclesFeedback = 0; // For the case when this is a big -ve number
|
||||
|
||||
// Switch to normal priority so that APPLEWIN process doesn't hog machine!
|
||||
//. EG: No disk in Drive-1, and boot Apple: Windows will start to crawl!
|
||||
SetPriorityNormal();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't call Spkr_Demute()
|
||||
MB_Demute();
|
||||
SysClk_StartTimerUsec(nExecutionPeriodUsec);
|
||||
|
||||
// Switch to higher priority, eg. for audio (BUG #015394)
|
||||
SetPriorityAboveNormal();
|
||||
}
|
||||
|
||||
//
|
||||
@ -873,16 +910,6 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
|
||||
//
|
||||
|
||||
// Make APPLEWIN process higher priority
|
||||
// . BUG: No disk in Drive-1, and boot Apple: Windows will start to crawl!
|
||||
if ( SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS) )
|
||||
{
|
||||
// Make main thread (for audio) higher priority
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
do
|
||||
{
|
||||
// DO INITIALIZATION THAT MUST BE REPEATED FOR A RESTART
|
||||
|
@ -42,7 +42,7 @@ bool g_bShiftKey = false;
|
||||
bool g_bCtrlKey = false;
|
||||
bool g_bAltKey = false;
|
||||
|
||||
bool g_bCapsLock = true; //Caps lock key for Apple2 and Lat/Cyr lock for Pravets8
|
||||
static bool g_bCapsLock = true; //Caps lock key for Apple2 and Lat/Cyr lock for Pravets8
|
||||
static bool g_bP8CapsLock = true; //Caps lock key of Pravets 8A/C
|
||||
static int lastvirtkey = 0; // Current PC keycode
|
||||
static BYTE keycode = 0; // Current Apple keycode
|
||||
|
Loading…
x
Reference in New Issue
Block a user