Skip to content

Commit 42f16e9

Browse files
committed
dont use so much cpu while paused and whatnot
1 parent a4cf363 commit 42f16e9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

BizHawk.MultiClient/MainForm.cs

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ void SyncThrottle()
334334

335335
throttle.SetCoreFps(Global.Emulator.CoreOutputComm.VsyncRate);
336336

337+
throttle.signal_paused = EmulatorPaused || Global.Emulator is NullEmulator;
337338
throttle.signal_unthrottle = unthrottled;
338339
if (fastforward)
339340
throttle.SetSpeedPercent(Global.Config.SpeedPercentAlternate);

BizHawk.MultiClient/Throttle.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class Throttle
1414
int framesskipped;
1515
public bool skipnextframe;
1616

17+
//if the emulator is paused then we dont need to behave as if unthrottled
18+
public bool signal_paused;
1719
public bool signal_frameAdvance;
1820
public bool signal_unthrottle;
1921
public bool signal_continuousframeAdvancing; //continuousframeAdvancing
@@ -64,9 +66,9 @@ public void Step(bool allowSleep, int forceFrameSkip)
6466
if (framestoskip < 1)
6567
framestoskip += ffSkipRate;
6668
}
67-
else if ((/*autoframeskipenab && frameskiprate ||*/ cfg_frameLimit) && allowSleep)
69+
else if ((signal_paused || /*autoframeskipenab && frameskiprate ||*/ cfg_frameLimit) && allowSleep)
6870
{
69-
SpeedThrottle();
71+
SpeedThrottle(signal_paused);
7072
}
7173

7274
if (cfg_autoframeskipenab && cfg_frameskiprate!=0)
@@ -303,7 +305,7 @@ int AutoFrameSkip_GetSkipAmount(int min, int max)
303305
}
304306

305307

306-
void SpeedThrottle()
308+
void SpeedThrottle(bool paused)
307309
{
308310
AutoFrameSkip_BeforeThrottle();
309311

@@ -322,7 +324,7 @@ void SpeedThrottle()
322324
sleepy /= afsfreq;
323325
else
324326
sleepy = 0;
325-
if (sleepy >= 10)
327+
if (sleepy >= 10 || paused)
326328
{
327329
Thread.Sleep((int) (sleepy/2));
328330
// reduce it further beacuse Sleep usually sleeps for more than the amount we tell it to

0 commit comments

Comments
 (0)