From 31d3233dc05bb07d5894f71562b8bf20b8ec1c19 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 21 Apr 2010 15:45:44 +0000 Subject: [PATCH] Fixed timing bug reported on AtariAge, also noticed on several versions of OSX. It was partially caused by 'negative time', or successive calls to SDL_GetTicks() returning smaller values than previous calls. This obviously totally confused the timing logic, which was never designed for time to go backwards. Related to this, setting the framerate to 0 from the VideoDialog UI (indicating that auto-frame should be used) ended up setting the time-per-frame to approx. 71 minutes, resulting in a delay of 71 minutes to the next frame (which is what caused the 'lockup'). Changed all references to the Intel OSX build to also mention OSX Snow Leopard (10.6), since the build won't run on 10.4 or 10.5. Bumped version number to 3.1 (again). Hopefully this is good to go. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2016 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Announce.txt | 2 +- Changes.txt | 15 ++++++++------ Readme.txt | 2 +- docs/index.html | 2 +- src/common/Version.hxx | 2 +- src/emucore/OSystem.cxx | 20 ++++++++++++++++--- .../stella_intel.xcodeproj/project.pbxproj | 4 +++- src/unix/stella.spec | 2 +- 8 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Announce.txt b/Announce.txt index a374363f2..877ecaba8 100644 --- a/Announce.txt +++ b/Announce.txt @@ -33,7 +33,7 @@ distributions currently available are: * Binary distribution for MacOSX 32-bit & 64-bit : Stella-3.1-macosx.dmg (32-bit Universal Binary) - Stella-3.1_intel-macosx.dmg (32/64-bit Intel-only) + Stella-3.1_intel_10.6-macosx.dmg (32/64-bit Intel/Snow-Leopard only) * Binary distribution in 32-bit & 64-bit Ubuntu DEB format : stella_3.1-1_i386.deb diff --git a/Changes.txt b/Changes.txt index 338a0d41d..eec775256 100644 --- a/Changes.txt +++ b/Changes.txt @@ -12,12 +12,16 @@ Release History =========================================================================== -3.0 to 3.1: (April 16, 2010) +3.0 to 3.1: (April 22, 2010) * Fixed a major bug with text drawing in software rendering mode. Switching between windowed and fullscreen mode while text was being shown could result in garbled text or even a program crash. + * Fixed issues when using 'sleep' timing, whereby a lockup could occur + when changing video modes, and/or Stella would consume more CPU time + than was necessary. + * Integrated Distella disassembler, completely replacing the previous disassembler. The entire infrastructure has not been completely ported yet. As a result, labels defined by the user or from a @@ -45,8 +49,8 @@ actions are tied to the same keys as the enable ones, except the 'Shift' key is also used. - * Added 'DPC+' bankswitching scheme, thanks to Darrell Spice Jr and - Fred Quimby. + * Added preliminary support for 'DPC+' bankswitching scheme, thanks to + Darrell Spice Jr and Fred Quimby. * Added '16in1' bankswitching scheme, which works with various ROMs labeled '128-in-1 ...' (the database has been updated for @@ -104,9 +108,8 @@ Two versions are available: the first is a 32-bit Universal Binary for OSX 10.4 - 10.6, and the second is 32/64-bit Intel-only for - OSX 10.4 - 10.6 (64-bit requires 10.6). The Intel version is - compiled with the very latest compiler (Clang), resulting in - better performance. + OSX 10.6 (aka Snow Leopard). The Intel version is compiled with the + very latest compiler (LLVM/Clang), resulting in better performance. The keyboard handling is changed to match other systems in terms of where the keys actually are on the keyboard (ie, the OSX Command key diff --git a/Readme.txt b/Readme.txt index 1afa9baeb..fed824aaa 100644 --- a/Readme.txt +++ b/Readme.txt @@ -9,4 +9,4 @@ the Stella Website at: Enjoy, The Stella Team -April 16, 2010 +April 23, 2010 diff --git a/docs/index.html b/docs/index.html index ca3c65315..c05fede2b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -438,7 +438,7 @@    OR
  • Copy the Stella.app package to your 'Applications' folder.
  • -
  • For compiling the Intel version only, open the stella-release/src/macosx/stella_intel.xcodeproj file instead, and continue from +
  • For compiling the Intel/Snow Leopard version, open the stella-release/src/macosx/stella_intel.xcodeproj file instead, and continue from step 2 above.
  • diff --git a/src/common/Version.hxx b/src/common/Version.hxx index ccb52bb67..be4914ba8 100644 --- a/src/common/Version.hxx +++ b/src/common/Version.hxx @@ -22,7 +22,7 @@ #include -#define STELLA_VERSION "3.1_test6" +#define STELLA_VERSION "3.1" #define STELLA_BUILD atoi("$Rev$"+6) diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index bde6736d2..1e96267a8 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -366,8 +366,11 @@ void OSystem::setConfigFile(const string& file) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void OSystem::setFramerate(float framerate) { - myDisplayFrameRate = framerate; - myTimePerFrame = (uInt32)(1000000.0 / myDisplayFrameRate); + if(framerate > 0.0) + { + myDisplayFrameRate = framerate; + myTimePerFrame = (uInt32)(1000000.0 / myDisplayFrameRate); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -819,8 +822,10 @@ string OSystem::getROMInfo(const Console* console) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void OSystem::resetLoopTiming() { - memset(&myTimingInfo, 0, sizeof(TimingInfo)); myTimingInfo.start = myTimingInfo.virt = getTicks(); + myTimingInfo.current = 0; + myTimingInfo.totalTime = 0; + myTimingInfo.totalFrames = 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -913,6 +918,15 @@ void OSystem::mainLoop() myTimingInfo.current = getTicks(); myTimingInfo.virt += myTimePerFrame; + // Timestamps may periodically go out of sync, particularly on systems + // that can have 'negative time' (ie, when the time seems to go backwards) + // This normally results in having a very large delay time, so we check + // for that and reset the timers when appropriate + if((myTimingInfo.virt - myTimingInfo.current) > (myTimePerFrame << 1)) + { + myTimingInfo.start = myTimingInfo.current = myTimingInfo.virt = getTicks(); + } + if(myTimingInfo.current < myTimingInfo.virt) SDL_Delay((myTimingInfo.virt - myTimingInfo.current) / 1000); diff --git a/src/macosx/stella_intel.xcodeproj/project.pbxproj b/src/macosx/stella_intel.xcodeproj/project.pbxproj index 300f229b0..86bd6dbfb 100644 --- a/src/macosx/stella_intel.xcodeproj/project.pbxproj +++ b/src/macosx/stella_intel.xcodeproj/project.pbxproj @@ -1813,6 +1813,7 @@ ); GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + SDKROOT = ""; VALID_ARCHS = "i386 x86_64"; }; name = Development; @@ -1829,6 +1830,7 @@ GCC_OPTIMIZATION_LEVEL = 3; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; MACOSX_DEPLOYMENT_TARGET = ""; + SDKROOT = ""; VALID_ARCHS = "i386 x86_64"; }; name = Deployment; @@ -1839,7 +1841,7 @@ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; MACOSX_DEPLOYMENT_TARGET = 10.4; - SDKROOT = macosx10.4; + SDKROOT = ""; VALID_ARCHS = "i386 x86_64"; }; name = Default; diff --git a/src/unix/stella.spec b/src/unix/stella.spec index 9e1dd92ee..f270d71d7 100644 --- a/src/unix/stella.spec +++ b/src/unix/stella.spec @@ -107,7 +107,7 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version} %_datadir/icons/large/%{name}.png %changelog -* Fri Apr 16 2010 Stephen Anthony 3.1-1 +* Fri Apr 23 2010 Stephen Anthony 3.1-1 - Version 3.1 release * Fri Sep 11 2009 Stephen Anthony 3.0-1