From 40f333129b463b8c729040c2efbdc3b7f3cd0e2e Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 6 Jan 2007 16:21:31 +0000 Subject: [PATCH] Changing XStart/YStart/Width/Height values of the Console/TIA are now done without resetting the whole system. This means that a game can continue running while these values are being changed. Eventually, I'd like all such options to be configurable in-game, and not have to reload a ROM for them to take effect. Updated yet more ROM properties, which were found with the help of the above feature. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1269 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/Console.cxx | 20 ++++----- stella/src/emucore/DefProps.hxx | 10 ++--- stella/src/emucore/OSystem.cxx | 6 ++- stella/src/emucore/TIA.cxx | 78 ++++++++++++++++++--------------- stella/src/emucore/TIA.hxx | 9 +++- stella/src/emucore/stella.pro | 19 +++++--- 6 files changed, 82 insertions(+), 60 deletions(-) diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index 01a2a7cb5..e9beee7c5 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Console.cxx,v 1.119 2007-01-01 18:04:47 stephena Exp $ +// $Id: Console.cxx,v 1.120 2007-01-06 16:21:29 stephena Exp $ //============================================================================ #include @@ -483,8 +483,8 @@ void Console::changeXStart(int direction) strval << xstart; myProperties.set(Display_XStart, strval.str()); - mySystem->reset(); - initializeVideo(); + ((TIA*)myMediaSource)->recalc(); + myOSystem->frameBuffer().refresh(); message = "XStart "; message += strval.str(); @@ -521,8 +521,8 @@ void Console::changeYStart(int direction) strval << ystart; myProperties.set(Display_YStart, strval.str()); - mySystem->reset(); - initializeVideo(); + ((TIA*)myMediaSource)->recalc(); + myOSystem->frameBuffer().refresh(); message = "YStart "; message += strval.str(); @@ -554,7 +554,7 @@ void Console::changeWidth(int direction) else if(direction == -1) // decrease Width { width -= 4; - if(width < 80) + if(width < 140) { myOSystem->frameBuffer().showMessage("Width at minimum"); return; @@ -565,8 +565,8 @@ void Console::changeWidth(int direction) strval << width; myProperties.set(Display_Width, strval.str()); - mySystem->reset(); - initializeVideo(); + ((TIA*)myMediaSource)->recalc(); + initializeVideo(); // takes care of refreshing the screen message = "Width "; message += strval.str(); @@ -603,8 +603,8 @@ void Console::changeHeight(int direction) strval << height; myProperties.set(Display_Height, strval.str()); - mySystem->reset(); - initializeVideo(); + ((TIA*)myMediaSource)->recalc(); + initializeVideo(); // takes care of refreshing the screen message = "Height "; message += strval.str(); diff --git a/stella/src/emucore/DefProps.hxx b/stella/src/emucore/DefProps.hxx index 3604d30c0..53c044008 100644 --- a/stella/src/emucore/DefProps.hxx +++ b/stella/src/emucore/DefProps.hxx @@ -160,7 +160,7 @@ static const char* DefProps[][23] = { { "2bc26619e31710a9884c110d8430c1da", "Atari", "CX2652", "Casino (1978) (Atari) (PAL) [!]", "Uses the Paddle Controllers", "Uncommon", "", "", "", "", "", "", "Paddles", "", "", "", "", "", "", "", "", "", "" }, { "2d1cf85fbc732856bf76470cd4060f4a", "", "", "Daredevil (V1) (Stunt_Cycle_Rules!) (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "2ef36341d1bf42e02c7ea2f71e024982", "", "", "Space Invaders (Explosion Hack)", "Hack of Space Invaders (Atari)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, - { "3105967f7222cc36a5ac6e5f6e89a0b4", "Sega", "011-02", "Spy Hunter (1983) (Sega) [!]", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, + { "3105967f7222cc36a5ac6e5f6e89a0b4", "Sega", "011-02", "Spy Hunter (1983) (Sega) [!]", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "31", "", "", "", "" }, { "324cb4a749bcac4f3db9da842b85d2f7", "", "", "Climber 5 (01-05-2003) (Dennis Debro)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "NO" }, { "345769d085113d57937198262af52298", "", "", "Space Raid (Rainbow Vision) (PAL) [!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "368d88a6c071caba60b4f778615aae94", "Atari", "CX26159", "Double Dunk (1989) (Atari)", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, @@ -252,7 +252,7 @@ static const char* DefProps[][23] = { { "e784a9d26707cfcd170a4c1c60422a72", "Starsoft", "", "Gefecht im All (Starsoft) (PAL) [!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "e9c71f8cdba6037521c9a3c70819d171", "20th Century Fox", "11012", "Bank Heist (1983) (20th Century Fox) (w-Skull Island Label) (PAL) [!]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "ec407a206b718a0a9f69b03e920a0185", "Starsoft", "", "Landung in der Normandie (Starsoft) (PAL) [p1][!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, - { "ee6665683ebdb539e89ba620981cb0f6", "Coleco", "2658", "Berenstain Bears (1982) (Coleco)", "", "Unbelievably Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, + { "ee6665683ebdb539e89ba620981cb0f6", "Coleco", "2658", "Berenstain Bears (1982) (Coleco)", "", "Unbelievably Rare", "", "", "", "", "", "", "", "", "", "", "", "", "25", "", "", "", "" }, { "f0536303f49006806bac3aec15738336", "Starpath", "AR-4200", "Escape from the Mindmaster (4 of 4) (1982) (Starpath)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "No" }, { "f1beca5a198cf08190487e5c27b8e540", "", "", "Fu Kung! (V0.16) (2003) (AD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "f4204fc92d17ed4cb567c40361ad58f1", "Inky", "", "Beanie Baby Bash by Inky (Beany Bopper Hack)", "Hack of Beany Bopper (1982) (20th Century Fox)", "New Release (Hack)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, @@ -932,7 +932,7 @@ static const char* DefProps[][23] = { { "d2c4f8a4a98a905a9deef3ba7380ed64", "Mythicon", "MA-1001", "Sorcerer (1983) (Mythicon) [!]", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "d3171407c3a8bb401a3a62eb578f48fb", "", "", "Fire Spinner (Emag) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Yes", "", "" }, { "d3456b4cf1bd1a7b8fb907af1a80ee15", "Avalon Hill", "50030", "Wall Ball (1983) (Avalon Hill)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Yes", "", "" }, - { "d3bb42228a6cd452c111c1932503cc03", "UA Limited", "", "Funky Fish (UA Limited)", "", "Prototype", "", "UA", "", "", "", "", "", "", "", "", "", "", "", "", "Yes", "", "" }, + { "d3bb42228a6cd452c111c1932503cc03", "UA Limited", "", "Funky Fish (UA Limited)", "", "Prototype", "", "UA", "", "", "", "", "", "", "", "", "", "", "38", "", "YES", "", "" }, { "d4942f4b55313ff269488527d84ce35c", "", "", "Ms. Pac-Man (1982) (Atari) (PAL) [a1][!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "d536a84d4e1f170305e17f7078296a50", "Starpath", "AR-4400", "Dragonstomper (1982) (Starpath) [a2]", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "d5aa7472e7f2cc17e893a1a36f8dadf0", "", "", "Overhead Adventure Demo 5 (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, @@ -1393,7 +1393,7 @@ static const char* DefProps[][23] = { { "59f596285d174233c84597dee6f34f1f", "CCE", "", "River Raid (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "5a5390f91437af9951a5f8455b61cd43", "Retroactive", "", "Qb (0.11) (Retroactive) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Yes", "", "" }, { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, - { "5a8afe5422abbfb0a342fb15afd7415f", "Atari", "CX26155", "Sprint Master (1988) (Atari)", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, + { "5a8afe5422abbfb0a342fb15afd7415f", "Atari", "CX26155", "Sprint Master (1988) (Atari)", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "26", "", "", "", "" }, { "5acf9865a72c0ce944979f76ff9610f0", "", "", "Dodge Demo 2 (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "5aea9974b975a6a844e6df10d2b861c4", "Atari", "CX2656", "SwordQuest - Earthworld (1982) (Atari) [!]", "", "Common", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "5af9cd346266a1f2515e1fbc86f5186a", "Sega", "002-01", "Sub Scan (1983) (Sega) [!]", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, @@ -4034,7 +4034,7 @@ static const char* DefProps[][23] = { { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, - { "fa2be8125c3c60ab83e1c0fe56922fcb", "DSD-Camelot", "", "Tooth Protectors (DSD-Camelot)", "", "Unbelievably Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Yes", "", "" }, + { "fa2be8125c3c60ab83e1c0fe56922fcb", "DSD-Camelot", "", "Tooth Protectors (DSD-Camelot)", "", "Unbelievably Rare", "", "", "", "", "", "", "", "", "", "", "", "", "26", "", "YES", "", "" }, { "fa3de71841c0841db6a741884a6b6b2f", "", "", "Warring Worms (17-02-2002) (Billy Eno)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "fa447e4e2f0d5e67cbf0b060fac5944c", "Activision", "AG-019", "Sky Jinks (1982) (Activision) [b1]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "fa6fe97a10efb9e74c0b5a816e6e1958", "Zimag", "707-111", "Tanks But No Tanks (Zimag)", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index bb5378c9c..c9e345342 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.cxx,v 1.90 2007-01-01 18:04:49 stephena Exp $ +// $Id: OSystem.cxx,v 1.91 2007-01-06 16:21:31 stephena Exp $ //============================================================================ #include @@ -323,6 +323,10 @@ void OSystem::createSound() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool OSystem::createConsole(const string& romfile) { + // Do a little error checking; it shouldn't be necessary + setFramerate(60); // make sure we can see messages + if(myConsole) deleteConsole(); + bool retval = false, showmessage = false; // If a blank ROM has been given, we reload the current one (assuming one exists) diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx index 357b97477..da406a400 100644 --- a/stella/src/emucore/TIA.cxx +++ b/stella/src/emucore/TIA.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: TIA.cxx,v 1.76 2007-01-01 18:04:50 stephena Exp $ +// $Id: TIA.cxx,v 1.77 2007-01-06 16:21:31 stephena Exp $ //============================================================================ #include @@ -131,6 +131,37 @@ void TIA::reset() // Reset the sound device mySound->reset(); + // Recalculate the size of the display + recalc(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::systemCyclesReset() +{ + // Get the current system cycle + uInt32 cycles = mySystem->cycles(); + + // Adjust the sound cycle indicator + mySound->adjustCycleCounter(-1 * cycles); + + // Adjust the dump cycle + myDumpDisabledCycle -= cycles; + + // Get the current color clock the system is using + uInt32 clocks = cycles * 3; + + // Adjust the clocks by this amount since we're reseting the clock to zero + myClockWhenFrameStarted -= clocks; + myClockStartDisplay -= clocks; + myClockStopDisplay -= clocks; + myClockAtLastUpdate -= clocks; + myVSYNCFinishClock -= clocks; + myLastHMOVEClock -= clocks; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::recalc() +{ // Clear frame buffers clearBuffers(); @@ -211,8 +242,7 @@ void TIA::reset() myM0CosmicArkMotionEnabled = false; myM0CosmicArkCounter = 0; - for(uInt32 i = 0; i < 6; ++i) - myBitEnabled[i] = true; + enableBits(true); myDumpEnabled = false; myDumpDisabledCycle = 0; @@ -225,17 +255,21 @@ void TIA::reset() myFrameYStart = atoi(myConsole.properties().get(Display_YStart).c_str()); myFrameHeight = atoi(myConsole.properties().get(Display_Height).c_str()); - // Make sure frameHeight is no less than 190 pixels - // This is a hack for the onscreen menus - myFrameHeight = MAX((int)myFrameHeight, 190); - - // Make sure the starting x and width values are reasonable - if((myFrameXStart + myFrameWidth) > 160) + // Make sure the starting x and width/height values are reasonable + // This is partly due to restrictions on the internal buffer size, + // but also because we need a certain minimum amount of space for + // the onscreen GUI + if((myFrameXStart + myFrameWidth) > 160 || myFrameWidth < 140) { // Values are illegal so reset to default values myFrameXStart = 0; myFrameWidth = 160; } + if(myFrameHeight < 200) + { + // Values are illegal so reset to default values + myFrameHeight = 200; + } if(myConsole.getFormat().compare(0, 3, "PAL") == 0) { @@ -247,34 +281,8 @@ void TIA::reset() myColorLossEnabled = false; myMaximumNumberOfScanlines = 290; } - - enableBits(true); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIA::systemCyclesReset() -{ - // Get the current system cycle - uInt32 cycles = mySystem->cycles(); - - // Adjust the sound cycle indicator - mySound->adjustCycleCounter(-1 * cycles); - - // Adjust the dump cycle - myDumpDisabledCycle -= cycles; - - // Get the current color clock the system is using - uInt32 clocks = cycles * 3; - - // Adjust the clocks by this amount since we're reseting the clock to zero - myClockWhenFrameStarted -= clocks; - myClockStartDisplay -= clocks; - myClockStopDisplay -= clocks; - myClockAtLastUpdate -= clocks; - myVSYNCFinishClock -= clocks; - myLastHMOVEClock -= clocks; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::install(System& system) { diff --git a/stella/src/emucore/TIA.hxx b/stella/src/emucore/TIA.hxx index cbb172707..ff4e4528d 100644 --- a/stella/src/emucore/TIA.hxx +++ b/stella/src/emucore/TIA.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: TIA.hxx,v 1.39 2007-01-01 18:04:50 stephena Exp $ +// $Id: TIA.hxx,v 1.40 2007-01-06 16:21:31 stephena Exp $ //============================================================================ #ifndef TIA_HXX @@ -42,7 +42,7 @@ class Settings; be displayed on screen. @author Bradford W. Mott - @version $Id: TIA.hxx,v 1.39 2007-01-01 18:04:50 stephena Exp $ + @version $Id: TIA.hxx,v 1.40 2007-01-06 16:21:31 stephena Exp $ */ class TIA : public Device , public MediaSource { @@ -82,6 +82,11 @@ class TIA : public Device , public MediaSource */ virtual void systemCyclesReset(); + /** + Recalculate set XStart/YStart/Width/Height properties + */ + virtual void recalc(); + /** Install TIA in the specified system. Invoked by the system when the TIA is attached to it. diff --git a/stella/src/emucore/stella.pro b/stella/src/emucore/stella.pro index 0002dfb98..3faa538a6 100644 --- a/stella/src/emucore/stella.pro +++ b/stella/src/emucore/stella.pro @@ -3097,10 +3097,11 @@ "" "Cartridge.MD5" "3105967f7222cc36a5ac6e5f6e89a0b4" -"Cartridge.Name" "Spy Hunter (1983) (Sega) [!]" "Cartridge.Manufacturer" "Sega" "Cartridge.ModelNo" "011-02" +"Cartridge.Name" "Spy Hunter (1983) (Sega) [!]" "Cartridge.Rarity" "Extremely Rare" +"Display.YStart" "31" "" "Cartridge.MD5" "30f0b49661cfcfd4ec63395fab837dc3" @@ -5514,10 +5515,11 @@ "" "Cartridge.MD5" "5a8afe5422abbfb0a342fb15afd7415f" -"Cartridge.Name" "Sprint Master (1988) (Atari)" "Cartridge.Manufacturer" "Atari" "Cartridge.ModelNo" "CX26155" +"Cartridge.Name" "Sprint Master (1988) (Atari)" "Cartridge.Rarity" "Rare" +"Display.YStart" "26" "" "Cartridge.MD5" "5a9d188245aff829efde816fcade0b16" @@ -12747,11 +12749,12 @@ "" "Cartridge.MD5" "d3bb42228a6cd452c111c1932503cc03" -"Cartridge.Name" "Funky Fish (UA Limited)" "Cartridge.Manufacturer" "UA Limited" +"Cartridge.Name" "Funky Fish (UA Limited)" "Cartridge.Rarity" "Prototype" "Cartridge.Type" "UA" -"Display.Phosphor" "Yes" +"Display.YStart" "38" +"Display.Phosphor" "YES" "" "Cartridge.MD5" "d36308387241e98f813646f346e7f9f7" @@ -14194,10 +14197,11 @@ "" "Cartridge.MD5" "ee6665683ebdb539e89ba620981cb0f6" -"Cartridge.Name" "Berenstain Bears (1982) (Coleco)" "Cartridge.Manufacturer" "Coleco" "Cartridge.ModelNo" "2658" +"Cartridge.Name" "Berenstain Bears (1982) (Coleco)" "Cartridge.Rarity" "Unbelievably Rare" +"Display.YStart" "25" "" "Cartridge.MD5" "ee456542b93fa8d7e6a8c689b5a0413c" @@ -15234,10 +15238,11 @@ "" "Cartridge.MD5" "fa2be8125c3c60ab83e1c0fe56922fcb" -"Cartridge.Name" "Tooth Protectors (DSD-Camelot)" "Cartridge.Manufacturer" "DSD-Camelot" +"Cartridge.Name" "Tooth Protectors (DSD-Camelot)" "Cartridge.Rarity" "Unbelievably Rare" -"Display.Phosphor" "Yes" +"Display.YStart" "26" +"Display.Phosphor" "YES" "" "Cartridge.MD5" "fa3de71841c0841db6a741884a6b6b2f"