mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-24 16:30:01 +00:00
Remove redundant 'BOOL behind' which was always zero.
- allowed some simplification to VideoSetMode() Tidy up ContinueExecution(), removing unused 'BOOL pageflipping'. Refactor VideoCheckPage() to make it more readable.
This commit is contained in:
parent
b036b03062
commit
ae233fe1fc
@ -44,7 +44,6 @@ TCHAR *g_pAppTitle = TITLE_APPLE_2E_ENHANCED;
|
||||
|
||||
eApple2Type g_Apple2Type = A2TYPE_APPLE2EENHANCED;
|
||||
|
||||
BOOL behind = 0; // Redundant
|
||||
DWORD cumulativecycles = 0; // Wraps after ~1hr 9mins
|
||||
DWORD cyclenum = 0; // Used by SpkrToggle() for non-wave sound
|
||||
DWORD emulmsec = 0;
|
||||
@ -163,8 +162,6 @@ void SetPriorityNormal(void)
|
||||
|
||||
void ContinueExecution(void)
|
||||
{
|
||||
static BOOL pageflipping = 0; //?
|
||||
|
||||
const double fUsecPerSec = 1.e6;
|
||||
#if 1
|
||||
const UINT nExecutionPeriodUsec = 1000; // 1.0ms
|
||||
@ -241,22 +238,16 @@ void ContinueExecution(void)
|
||||
emulmsec_frac %= CLKS_PER_MS;
|
||||
}
|
||||
|
||||
//
|
||||
// DETERMINE WHETHER THE SCREEN WAS UPDATED, THE DISK WAS SPINNING,
|
||||
// OR THE KEYBOARD I/O PORTS WERE BEING EXCESSIVELY QUERIED THIS CLOCKTICK
|
||||
VideoCheckPage(0);
|
||||
BOOL screenupdated = VideoHasRefreshed();
|
||||
BOOL systemidle = 0; //(KeybGetNumQueries() > (clockgran << 2)); // && (!ranfinegrain); // TO DO
|
||||
|
||||
if (screenupdated)
|
||||
pageflipping = 3;
|
||||
|
||||
//
|
||||
|
||||
if (g_dwCyclesThisFrame >= dwClksPerFrame)
|
||||
{
|
||||
g_dwCyclesThisFrame -= dwClksPerFrame;
|
||||
|
||||
// DETERMINE WHETHER THE SCREEN WAS UPDATED THIS CLOCKTICK
|
||||
VideoCheckPage(0); // force=0
|
||||
const BOOL screenupdated = VideoHasRefreshed(); // Only called from here. Clears & returns 'hasrefreshed' flag.
|
||||
|
||||
if (g_nAppMode != MODE_LOGO)
|
||||
{
|
||||
VideoUpdateFlash();
|
||||
@ -276,20 +267,16 @@ void ContinueExecution(void)
|
||||
static DWORD lasttime = 0;
|
||||
DWORD currtime = GetTickCount();
|
||||
if ((!g_bFullSpeed) ||
|
||||
(currtime-lasttime >= (DWORD)((g_bGraphicsMode || !systemidle) ? 100 : 25)))
|
||||
(currtime-lasttime >= (DWORD)(g_bGraphicsMode ? 100 : 25)))
|
||||
{
|
||||
VideoRefreshScreen();
|
||||
lasttime = currtime;
|
||||
}
|
||||
screenupdated = 1;
|
||||
}
|
||||
|
||||
lastupdates[1] = lastupdates[0];
|
||||
lastupdates[0] = anyupdates;
|
||||
anyupdates = 0;
|
||||
|
||||
if (pageflipping)
|
||||
pageflipping--;
|
||||
}
|
||||
|
||||
MB_EndOfVideoFrame();
|
||||
|
@ -10,7 +10,6 @@ extern TCHAR *g_pAppTitle;
|
||||
|
||||
extern eApple2Type g_Apple2Type;
|
||||
|
||||
extern BOOL behind;
|
||||
extern DWORD cumulativecycles;
|
||||
extern DWORD cyclenum;
|
||||
extern DWORD emulmsec;
|
||||
|
@ -3117,9 +3117,17 @@ BYTE VideoCheckMode (WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void VideoCheckPage (BOOL force) {
|
||||
if ((g_bVideoDisplayPage2 != (SW_PAGE2 != 0)) &&
|
||||
(force || (emulmsec-lastpageflip > 500))) {
|
||||
|
||||
// Check if we should call VideoRefreshScreen() based on unexpected page
|
||||
// - Only called from a single place in main ContinueExecution() loop
|
||||
void VideoCheckPage(BOOL force)
|
||||
{
|
||||
const bool bUnexpectedPage = (g_bVideoDisplayPage2 != (SW_PAGE2 != 0));
|
||||
//_ASSERT(!bUnexpectedPage); // [TC] Q: When does this happen? A: EG. When page-flipping && Scroll-Lock is pressed
|
||||
|
||||
if (bUnexpectedPage && // Unexpected page &&
|
||||
(force || (emulmsec-lastpageflip > 500))) // force || >500ms since last flip
|
||||
{
|
||||
g_bVideoDisplayPage2 = (SW_PAGE2 != 0);
|
||||
VideoRefreshScreen();
|
||||
hasrefreshed = 1;
|
||||
@ -3701,24 +3709,22 @@ BYTE VideoSetMode (WORD, WORD address, BYTE write, BYTE, ULONG uExecutedCycles)
|
||||
else
|
||||
oldpage2 = SW_PAGE2;
|
||||
}
|
||||
if (oldpage2 != SW_PAGE2) {
|
||||
static DWORD lastrefresh = 0;
|
||||
if ((g_bVideoDisplayPage2 && !SW_PAGE2) || (!behind)) {
|
||||
|
||||
if (oldpage2 != SW_PAGE2)
|
||||
{
|
||||
g_bVideoDisplayPage2 = (SW_PAGE2 != 0);
|
||||
if (!g_VideoForceFullRedraw) {
|
||||
if (!g_VideoForceFullRedraw)
|
||||
{
|
||||
#if 1
|
||||
VideoRefreshScreen();
|
||||
hasrefreshed = 1;
|
||||
lastrefresh = emulmsec;
|
||||
}
|
||||
}
|
||||
else if ((!SW_PAGE2) && (!g_VideoForceFullRedraw) && (emulmsec-lastrefresh >= 20)) {
|
||||
g_bVideoDisplayPage2 = 0;
|
||||
VideoRefreshScreen();
|
||||
hasrefreshed = 1;
|
||||
lastrefresh = emulmsec;
|
||||
#else
|
||||
g_VideoForceFullRedraw = 1; // GH#129,GH204: Defer the redraw until the main ContinueExecution() loop (TODO: What effect does this have on other games?)
|
||||
#endif
|
||||
}
|
||||
lastpageflip = emulmsec;
|
||||
}
|
||||
|
||||
return MemReadFloatingBus(uExecutedCycles);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user