Commit Graph

16 Commits

Author SHA1 Message Date
tomcw
a2260510f3 Better support for GH issues #129 and #204 (x86 CPU core is no longer max'ed out). 2014-09-21 21:42:19 +01:00
tomcw
8098b84a0e Fix GH issue #188 (GDI object leak). Also refactored V_CreateLookup_Text() and V_CreateLookup_MonoText() to use common code. 2014-09-21 16:12:05 +01:00
tomcw
efd2e4405a Fix: 80-column video mode wasn't being detected as needing an update, when FLASH chars only existed in AUX text pages. 2014-09-15 22:47:50 +01:00
tomcw
8c019bcd35 More main-loop reduction & removal of redundant globals.
Fixed JoyUpdateButtonLatch() to debounce in 5mecs instead of 5secs!

SpkrToggle() was using redundant global ('cyclenum') when using the PC speaker.
. I reworked the code (as it looked out-of-date),
    but probably better to just remove all the PC speaker support.
2014-09-14 21:23:54 +01:00
tomcw
0db62489f9 Refactor: g_bVideoMode -> g_uVideoMode 2014-09-14 16:15:14 +01:00
tomcw
1f892a27d4 Simplified main-loop a bit more, and removed more globals from AppleWin.cpp 2014-09-14 16:12:55 +01:00
tomcw
bc45812f4e Simplified and moved main-loop video update logic into Video.cpp.
Removed complex case below for:
. VideoHasRefreshed(), 'anyupdates'
. VideoCheckPage()

Detailed notes below.

---

Video updates in ContinueExecution() loop:

'anyupdates' gets set if there were any page-flip(s) in last ~17030 cycles:
	anyupdates |= VideoHasRefreshed();
ie. VideoRefreshScreen() was called outside of this loop.

If there's been a call to VideoRefreshScreen() outside of this loop,
  and then the video framebuffer gets written to, ie. VideoApparentlyDirty() returns TRUE,
then don't call VideoRefreshScreen() from this loop for 3 frames.
(If a VideoRefreshScreen() is called outside of this loop then restart the 3 frame count.)

So..
 if the game is flipping, the VideoApparentlyDirty() will return FALSE (since game writes to other framebuffer).
 if the game is not flipping, then VideoHasRefreshed() will return FALSE (since no flips occur).

Therefore this complex case above probably only arises at a boundary eg. when the game is transitioning between these 2 modes,
and so if the emulator does the very occasional screen update in this main loop, it is of no consequence.

(I guess this extra logic was to throttle video updates on very old slow machines)

---

VideoCheckPage(BOOL bForce) was called twice in main-loop:

UnexpectedPage if g_bVideoDisplayPage2 != SW_PAGE2

Once each time through the loop (ie. every 1ms), with bForce=0
	if UnexpectedPage && >500ms since last flip then VideoRefreshScreen()

Once each video frame (ie. ~17030 cycles) when not flipping, with bForce=1
	if UnexpectedPage then VideoRefreshScreen()

Basically this was all about supporting FullSpeed mode, and limiting the calls to VideoRefreshScreen().
2014-09-13 22:22:27 +01:00
tomcw
99bed3ed36 GH#212: Eliminate flicker when in fullscreen & 50% mode 2014-08-21 22:54:03 +01:00
tomcw
ea23def601 More header refactoring 2014-08-14 18:03:12 +01:00
tomcw
6a26a95487 PCH refactor: remove non-system headers from stdafx.h 2014-08-13 21:30:35 +01:00
tomcw
a75555d21c Simplified ContinueExecution(): video refresh part. 2014-07-20 10:24:50 +01:00
tomcw
8637dfa7af Removed the _DEBUG-only experimental video modes (eg. Emboss, Psychedelic, etc) 2014-07-10 22:52:26 +01:00
tomcw
ae233fe1fc 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.
2014-07-08 20:58:48 +01:00
tomcw
b036b03062 Tweaks to fullscreen 32-bit mode 2014-06-27 22:43:25 +01:00
tomcw
c509349469 Fullscreen defaults to 32-bit. Use -fs8bit for 8-bit mode 2014-06-26 22:44:02 +01:00
tomcw
d591dd006b Remove the top-level AppleWin folder 2014-05-23 22:59:02 +01:00