Updated TIA code to emulate the 'widening' part of the Cosmic Ark

starfield effect.  More research is required in this area.

Large update to exception handling throughout the codebase.  It seems
that in many cases, the correct 'catch' block was never being called.
I never see exceptions thrown very much, so that area doesn't get much
testing.  But I guess it's good that Stella doesn't generate many
exceptions :)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1862 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-08-27 22:59:14 +00:00
parent a13fad2d0f
commit 67fec652b0
36 changed files with 147 additions and 430 deletions

View File

@ -144,7 +144,7 @@ string Snapshot::saveBufferToPNG(ofstream& out, uInt8* buffer,
return "Snapshot saved";
}
catch(const char *msg)
catch(const char* msg)
{
if(buffer) delete[] buffer;
if(compmem) delete[] compmem;

View File

@ -457,14 +457,9 @@ bool SoundSDL::save(Serializer& out) const
out.putInt(myLastRegisterSetCycle);
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << device << endl;
cerr << "ERROR: SoundSDL::save" << endl << " " << msg << endl;
return false;
}
@ -506,14 +501,9 @@ bool SoundSDL::load(Serializer& in)
if(!myIsMuted) SDL_PauseAudio(0);
}
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << device << endl;
cerr << "ERROR: SoundSDL::load" << endl << " " << msg << endl;
return false;
}

View File

@ -200,14 +200,9 @@ bool Cartridge0840::save(Serializer& out) const
out.putString(cart);
out.putInt(myCurrentBank);
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: Cartridge0840::save" << endl << " " << msg << endl;
return false;
}
@ -226,14 +221,9 @@ bool Cartridge0840::load(Serializer& in)
myCurrentBank = (uInt16)in.getInt();
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: Cartridge0840::load" << endl << " " << msg << endl;
return false;
}

View File

@ -139,12 +139,7 @@ bool Cartridge2K::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: Cartridge2K::save" << endl << " " << msg << endl;
return false;
}
@ -163,12 +158,7 @@ bool Cartridge2K::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: Cartridge2K::load" << endl << " " << msg << endl;
return false;
}

View File

@ -257,12 +257,7 @@ bool Cartridge3E::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: Cartridge3E::save" << endl << " " << msg << endl;
return false;
}
@ -288,12 +283,7 @@ bool Cartridge3E::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: Cartridge3E::load" << endl << " " << msg << endl;
return false;
}

View File

@ -193,12 +193,7 @@ bool Cartridge3F::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: Cartridge3F::save" << endl << " " << msg << endl;
return false;
}
@ -219,12 +214,7 @@ bool Cartridge3F::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: Cartridge3F::load" << endl << " " << msg << endl;
return false;
}

View File

@ -347,12 +347,7 @@ bool Cartridge4A50::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: Cartridge4A40::save" << endl << " " << msg << endl;
return false;
}
@ -389,12 +384,7 @@ bool Cartridge4A50::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: Cartridge4A50::load" << endl << " " << msg << endl;
return false;
}

View File

@ -117,12 +117,7 @@ bool Cartridge4K::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: Cartridge4K::save" << endl << " " << msg << endl;
return false;
}
@ -141,12 +136,7 @@ bool Cartridge4K::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: Cartridge4K::load" << endl << " " << msg << endl;
return false;
}

View File

@ -477,12 +477,7 @@ bool CartridgeAR::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeAR::save" << endl << " " << msg << endl;
return false;
}
@ -545,12 +540,7 @@ bool CartridgeAR::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeAR::load" << endl << " " << msg << endl;
return false;
}

View File

@ -181,12 +181,7 @@ bool CartridgeCV::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeCV::save" << endl << " " << msg << endl;
return false;
}
@ -210,12 +205,7 @@ bool CartridgeCV::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeCV::load" << endl << " " << msg << endl;
return false;
}

View File

@ -518,12 +518,7 @@ bool CartridgeDPC::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeDPC::save" << endl << " " << msg << endl;
return false;
}
@ -579,12 +574,7 @@ bool CartridgeDPC::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeDPC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -241,12 +241,7 @@ bool CartridgeE0::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeE0::save" << endl << " " << msg << endl;
return false;
}
@ -269,12 +264,7 @@ bool CartridgeE0::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeE0::load" << endl << " " << msg << endl;
return false;
}

View File

@ -261,12 +261,7 @@ bool CartridgeE7::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeE7::save" << endl << " " << msg << endl;
return false;
}
@ -298,12 +293,7 @@ bool CartridgeE7::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeE7::load" << endl << " " << msg << endl;
return false;
}

View File

@ -151,12 +151,7 @@ bool CartridgeEF::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeEF::save" << endl << " " << msg << endl;
return false;
}
@ -177,12 +172,7 @@ bool CartridgeEF::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeEF::load" << endl << " " << msg << endl;
return false;
}

View File

@ -191,12 +191,7 @@ bool CartridgeEFSC::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeEFSC::save" << endl << " " << msg << endl;
return false;
}
@ -217,12 +212,7 @@ bool CartridgeEFSC::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeEFSC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -155,12 +155,7 @@ bool CartridgeF4::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeF4::save" << endl << " " << msg << endl;
return false;
}
@ -183,12 +178,7 @@ bool CartridgeF4::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeF4::load" << endl << " " << msg << endl;
return false;
}

View File

@ -202,12 +202,7 @@ bool CartridgeF4SC::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeF4SC::save" << endl << " " << msg << endl;
return false;
}
@ -232,12 +227,7 @@ bool CartridgeF4SC::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeF4SC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -197,12 +197,7 @@ bool CartridgeF6::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeF6::save" << endl << " " << msg << endl;
return false;
}
@ -223,12 +218,7 @@ bool CartridgeF6::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeF6::load" << endl << " " << msg << endl;
return false;
}

View File

@ -243,12 +243,7 @@ bool CartridgeF6SC::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeF6SC::save" << endl << " " << msg << endl;
return false;
}
@ -274,12 +269,7 @@ bool CartridgeF6SC::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeF6SC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -181,12 +181,7 @@ bool CartridgeF8::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeF8::save" << endl << " " << msg << endl;
return false;
}
@ -207,12 +202,7 @@ bool CartridgeF8::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeF8SC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -222,12 +222,7 @@ bool CartridgeF8SC::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeF8SC::save" << endl << " " << msg << endl;
return false;
}
@ -252,12 +247,7 @@ bool CartridgeF8SC::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeF8SC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -234,12 +234,7 @@ bool CartridgeFASC::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeFASC::save" << endl << " " << msg << endl;
return false;
}
@ -264,12 +259,7 @@ bool CartridgeFASC::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeFASC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -120,12 +120,7 @@ bool CartridgeFE::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeFE::save" << endl << " " << msg << endl;
return false;
}
@ -144,12 +139,7 @@ bool CartridgeFE::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeF8SC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -163,12 +163,7 @@ bool CartridgeMB::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeMB::save" << endl << " " << msg << endl;
return false;
}
@ -189,12 +184,7 @@ bool CartridgeMB::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeMB::load" << endl << " " << msg << endl;
return false;
}

View File

@ -249,12 +249,7 @@ bool CartridgeMC::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeMC::save" << endl << " " << msg << endl;
return false;
}
@ -286,12 +281,7 @@ bool CartridgeMC::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeMC::load" << endl << " " << msg << endl;
return false;
}

View File

@ -179,14 +179,9 @@ bool CartridgeSB::save(Serializer& out) const
out.putString(cart);
out.putInt(myCurrentBank);
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeSB::save" << endl << " " << msg << endl;
return false;
}
@ -205,14 +200,9 @@ bool CartridgeSB::load(Serializer& in)
myCurrentBank = (uInt16)in.getInt();
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeSB::load" << endl << " " << msg << endl;
return false;
}

View File

@ -189,12 +189,7 @@ bool CartridgeUA::save(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeUA::save" << endl << " " << msg << endl;
return false;
}
@ -215,12 +210,7 @@ bool CartridgeUA::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeUA::load" << endl << " " << msg << endl;
return false;
}

View File

@ -172,14 +172,9 @@ bool CartridgeX07::save(Serializer& out) const
out.putString(cart);
out.putInt(myCurrentBank);
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << cart << endl;
cerr << "ERROR: CartridgeX07::save" << endl << " " << msg << endl;
return false;
}
@ -198,14 +193,9 @@ bool CartridgeX07::load(Serializer& in)
myCurrentBank = (uInt16)in.getInt();
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << cart << endl;
cerr << "ERROR: CartridgeX07::load" << endl << " " << msg << endl;
return false;
}

View File

@ -206,14 +206,9 @@ bool Console::save(Serializer& out) const
if(!mySwitches->save(out))
return false;
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for \'Console\'" << endl;
cerr << "ERROR: Console::save" << endl << " " << msg << endl;
return false;
}
@ -233,14 +228,9 @@ bool Console::load(Serializer& in)
if(!mySwitches->load(in))
return false;
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for \'Console\'" << endl;
cerr << "ERROR: Console::load" << endl << " " << msg << endl;
return false;
}

View File

@ -134,7 +134,7 @@ bool Controller::save(Serializer& out) const
out.putInt(myAnalogPinValue[Five]);
out.putInt(myAnalogPinValue[Nine]);
}
catch(...)
catch(...) // FIXME
{
cerr << "ERROR: Controller::save() exception\n";
return false;
@ -158,7 +158,7 @@ bool Controller::load(Serializer& in)
myAnalogPinValue[Five] = (Int32) in.getInt();
myAnalogPinValue[Nine] = (Int32) in.getInt();
}
catch(...)
catch(...) // FIXME
{
cerr << "ERROR: Controller::load() exception\n";
return false;

View File

@ -321,14 +321,9 @@ bool M6532::save(Serializer& out) const
out.putByte((char)myOutTimer[2]);
out.putByte((char)myOutTimer[3]);
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << device << endl;
cerr << "ERROR: M6532::save" << endl << " " << msg << endl;
return false;
}
@ -364,14 +359,9 @@ bool M6532::load(Serializer& in)
myOutTimer[2] = (uInt8) in.getByte();
myOutTimer[3] = (uInt8) in.getByte();
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << device << endl;
cerr << "ERROR: M6532::load" << endl << " " << msg << endl;
return false;
}

View File

@ -310,7 +310,7 @@ bool StateManager::saveState(Serializer& out)
}
catch(const char* msg)
{
cerr << "ERROR: StateManager::saveState(Serializer&)" << endl << msg << endl;
cerr << "ERROR: StateManager::saveState(Serializer&)" << endl << " " << msg << endl;
}
return false;
}

View File

@ -114,7 +114,7 @@ bool Switches::save(Serializer& out) const
{
out.putByte((char)mySwitches);
}
catch(...)
catch(...) // FIXME
{
cerr << "ERROR: Switches::save() exception\n";
return false;
@ -129,7 +129,7 @@ bool Switches::load(Serializer& in)
{
mySwitches = (uInt8) in.getByte();
}
catch(...)
catch(...) // FIXME
{
cerr << "ERROR: Switches::load() exception\n";
return false;

View File

@ -315,6 +315,9 @@ bool TIA::save(Serializer& out) const
out.putInt(myColor[_P1]);
out.putInt(myColor[_PF]);
out.putInt(myColor[_BK]);
out.putInt(myColor[_M0]);
out.putInt(myColor[_M1]);
out.putInt(myColor[_BL]);
out.putByte((char)myCTRLPF);
out.putByte((char)myPlayfieldPriorityAndScore);
@ -381,14 +384,9 @@ bool TIA::save(Serializer& out) const
// Save the sound sample stuff ...
mySound.save(out);
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << device << endl;
cerr << "ERROR: TIA::save" << endl << " " << msg << endl;
return false;
}
@ -425,6 +423,9 @@ bool TIA::load(Serializer& in)
myColor[_P1] = (uInt32) in.getInt();
myColor[_PF] = (uInt32) in.getInt();
myColor[_BK] = (uInt32) in.getInt();
myColor[_M0] = (uInt32) in.getInt();
myColor[_M1] = (uInt32) in.getInt();
myColor[_BL] = (uInt32) in.getInt();
myCTRLPF = (uInt8) in.getByte();
myPlayfieldPriorityAndScore = (uInt8) in.getByte();
@ -498,12 +499,7 @@ bool TIA::load(Serializer& in)
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << device << endl;
cerr << "ERROR: TIA::load" << endl << " " << msg << endl;
return false;
}
@ -523,12 +519,7 @@ bool TIA::saveDisplay(Serializer& out) const
}
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for TIA display" << endl;
cerr << "ERROR: TIA::saveDisplay" << endl << " " << msg << endl;
return false;
}
@ -557,14 +548,9 @@ bool TIA::loadDisplay(Serializer& in)
myFrameGreyed = true;
}
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for TIA display" << endl;
cerr << "ERROR: TIA::loadDisplay" << endl << " " << msg << endl;
return false;
}
@ -827,17 +813,13 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
// Handle all other possible combinations
else
{
// Update masks
// Update masks (M0 and M1 are done in updateFrame)
myCurrentBLMask = &TIATables::BLMask[myPOSBL & 0x03]
[(myCTRLPF & 0x30) >> 4][160 - (myPOSBL & 0xFC)];
myCurrentP0Mask = &TIATables::PxMask[myPOSP0 & 0x03]
[mySuppressP0][myNUSIZ0 & 0x07][160 - (myPOSP0 & 0xFC)];
myCurrentP1Mask = &TIATables::PxMask[myPOSP1 & 0x03]
[mySuppressP1][myNUSIZ1 & 0x07][160 - (myPOSP1 & 0xFC)];
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
[myNUSIZ1 & 0x07][(myNUSIZ1 & 0x30) >> 4][160 - (myPOSM1 & 0xFC)];
switch(myEnabledObjects | myPlayfieldPriorityAndScore)
{
@ -1463,9 +1445,54 @@ void TIA::updateFrame(Int32 clock)
// Apply extra clocks for 'more motion required/mmr'
if(myHMP0mmr) { myPOSP0 -= 17; posChanged = true; }
if(myHMP1mmr) { myPOSP1 -= 17; posChanged = true; }
if(myHMM0mmr) { myPOSM0 -= 17; posChanged = true; }
if(myHMM1mmr) { myPOSM1 -= 17; posChanged = true; }
if(myHMBLmmr) { myPOSBL -= 17; posChanged = true; }
// TODO - 08-27-2009: Simulate the weird effects of Cosmic Ark and
// Stay Frosty. The movement itself is well understood, but there
// also seems to be some widening and blanking occurring as well.
// This doesn't properly emulate the effect, but it does give a
// fair approximation. More testing is required to figure out
// what's really going on here.
if(myHMM0mmr)
{
myPOSM0 -= 17; if(myPOSM0 < 0) { myPOSM0 += 160; } myPOSM0 %= 160;
if(myPOSM0 % 4 == 3)
{
// Stretch this missle so it's at least 2 pixels wide
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
[myNUSIZ0 & 0x07][((myNUSIZ0 & 0x30) >> 4) | 0x01]
[160 - (myPOSM0 & 0xFC)];
}
else
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
}
else
{
if(myPOSM0 < 0) { myPOSM0 += 160; } myPOSM0 %= 160;
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
}
if(myHMM1mmr)
{
myPOSM1 -= 17; if(myPOSM1 < 0) { myPOSM1 += 160; } myPOSM1 %= 160;
if(myPOSM1 % 4 == 3)
{
// Stretch this missle so it's at least 2 pixels wide
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
[myNUSIZ1 & 0x07][((myNUSIZ1 & 0x30) >> 4) | 0x01]
[160 - (myPOSM1 & 0xFC)];
}
else
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
[myNUSIZ1 & 0x07][(myNUSIZ1 & 0x30) >> 4][160 - (myPOSM1 & 0xFC)];
}
else
{
if(myPOSM1 < 0) { myPOSM1 += 160; } myPOSM1 %= 160;
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
[myNUSIZ1 & 0x07][(myNUSIZ1 & 0x30) >> 4][160 - (myPOSM1 & 0xFC)];
}
#endif
// Make sure positions are in range
if(posChanged)
@ -1548,9 +1575,9 @@ void TIA::updateFrame(Int32 clock)
// Yes, so set PF mask based on current CTRLPF reflection state
myCurrentPFMask = TIATables::PFMask[myCTRLPF & 0x01];
// TODO: These should be reset right after the first copy of the player
// has passed. However, for now we'll just reset at the end of the
// scanline since the other way would be to slow (01/21/99).
// TODO - 01-21-99: These should be reset right after the first copy
// of the player has passed. However, for now we'll just reset at the
// end of the scanline since the other way would be to slow.
mySuppressP0 = mySuppressP1 = 0;
}
}

View File

@ -362,14 +362,9 @@ bool M6502::save(Serializer& out) const
out.putInt(myLastAddress);
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << CPU << endl;
cerr << "ERROR: M6502::save" << endl << " " << msg << endl;
return false;
}
@ -408,14 +403,9 @@ bool M6502::load(Serializer& in)
// Indicates the last address which was accessed
myLastAddress = (uInt16) in.getInt();
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << CPU << endl;
cerr << "ERROR: M6502::laod" << endl << " " << msg << endl;
return false;
}

View File

@ -259,14 +259,9 @@ bool System::save(Serializer& out) const
if(!myDevices[i]->save(out))
return false;
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in save state for " << device << endl;
cerr << "ERROR: System::save" << endl << " " << msg << endl;
return false;
}
@ -293,14 +288,9 @@ bool System::load(Serializer& in)
if(!myDevices[i]->load(in))
return false;
}
catch(char *msg)
catch(const char* msg)
{
cerr << msg << endl;
return false;
}
catch(...)
{
cerr << "Unknown error in load state for " << device << endl;
cerr << "ERROR: System::load" << endl << " " << msg << endl;
return false;
}