2002-05-13 19:14:17 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
2016-12-30 00:00:30 +00:00
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
2002-05-13 19:14:17 +00:00
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2017-12-29 20:40:37 +00:00
|
|
|
// Copyright (c) 1995-2018 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2002-05-13 19:14:17 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2002-05-13 19:14:17 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//============================================================================
|
|
|
|
|
2010-04-09 20:13:12 +00:00
|
|
|
#include "FSNode.hxx"
|
2002-05-13 19:14:17 +00:00
|
|
|
#include "Serializer.hxx"
|
|
|
|
|
2016-05-24 16:55:45 +00:00
|
|
|
using std::ios;
|
|
|
|
using std::ios_base;
|
|
|
|
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-09 20:13:12 +00:00
|
|
|
Serializer::Serializer(const string& filename, bool readonly)
|
2015-04-26 19:02:42 +00:00
|
|
|
: myStream(nullptr)
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
{
|
2010-04-09 20:13:12 +00:00
|
|
|
if(readonly)
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
{
|
2010-04-09 20:13:12 +00:00
|
|
|
FilesystemNode node(filename);
|
2012-05-16 20:52:33 +00:00
|
|
|
if(node.isFile() && node.isReadable())
|
2010-04-09 20:13:12 +00:00
|
|
|
{
|
2017-07-21 23:40:13 +00:00
|
|
|
unique_ptr<fstream> str = make_unique<fstream>(filename, ios::in | ios::binary);
|
2010-04-09 20:13:12 +00:00
|
|
|
if(str && str->is_open())
|
|
|
|
{
|
2015-01-01 03:23:06 +00:00
|
|
|
myStream = std::move(str);
|
2012-05-20 14:23:48 +00:00
|
|
|
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
|
2017-12-06 15:14:40 +00:00
|
|
|
rewind();
|
2010-04-09 20:13:12 +00:00
|
|
|
}
|
|
|
|
}
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
}
|
|
|
|
else
|
2010-04-09 20:13:12 +00:00
|
|
|
{
|
|
|
|
// When using fstreams, we need to manually create the file first
|
|
|
|
// if we want to use it in read/write mode, since it won't be created
|
|
|
|
// if it doesn't already exist
|
|
|
|
// However, if it *does* exist, we don't want to overwrite it
|
|
|
|
// So we open in write and append mode - the write creates the file
|
|
|
|
// when necessary, and the append doesn't delete any data if it
|
|
|
|
// already exists
|
2015-06-12 17:37:58 +00:00
|
|
|
fstream temp(filename, ios::out | ios::app);
|
2010-04-09 20:13:12 +00:00
|
|
|
temp.close();
|
|
|
|
|
2017-07-21 23:40:13 +00:00
|
|
|
unique_ptr<fstream> str = make_unique<fstream>(filename, ios::in | ios::out | ios::binary);
|
2010-04-09 20:13:12 +00:00
|
|
|
if(str && str->is_open())
|
|
|
|
{
|
2015-01-01 03:23:06 +00:00
|
|
|
myStream = std::move(str);
|
2012-05-20 14:23:48 +00:00
|
|
|
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
|
2017-12-06 15:14:40 +00:00
|
|
|
rewind();
|
2010-04-09 20:13:12 +00:00
|
|
|
}
|
|
|
|
}
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
}
|
|
|
|
|
2002-05-13 19:14:17 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-09-29 20:39:28 +00:00
|
|
|
Serializer::Serializer()
|
2015-04-26 19:02:42 +00:00
|
|
|
: myStream(nullptr)
|
2002-05-13 19:14:17 +00:00
|
|
|
{
|
2017-07-21 23:40:13 +00:00
|
|
|
myStream = make_unique<stringstream>(ios::in | ios::out | ios::binary);
|
2016-12-30 00:00:30 +00:00
|
|
|
|
2009-08-24 23:42:01 +00:00
|
|
|
// For some reason, Windows and possibly OSX needs to store something in
|
|
|
|
// the stream before it is used for the first time
|
|
|
|
if(myStream)
|
|
|
|
{
|
2012-05-20 14:23:48 +00:00
|
|
|
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
|
2009-08-24 23:42:01 +00:00
|
|
|
putBool(true);
|
2017-12-06 15:14:40 +00:00
|
|
|
rewind();
|
2009-08-24 23:42:01 +00:00
|
|
|
}
|
2002-05-13 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2017-12-06 15:14:40 +00:00
|
|
|
void Serializer::rewind()
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
{
|
2012-05-20 14:23:48 +00:00
|
|
|
myStream->clear();
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
myStream->seekg(ios_base::beg);
|
|
|
|
myStream->seekp(ios_base::beg);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
uInt8 Serializer::getByte() const
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
{
|
|
|
|
char buf;
|
|
|
|
myStream->read(&buf, 1);
|
|
|
|
|
|
|
|
return buf;
|
2002-05-13 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
void Serializer::getByteArray(uInt8* array, uInt32 size) const
|
2002-05-13 19:14:17 +00:00
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->read(reinterpret_cast<char*>(array), size);
|
2012-05-20 14:23:48 +00:00
|
|
|
}
|
2002-05-13 19:14:17 +00:00
|
|
|
|
2012-05-20 14:23:48 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
uInt16 Serializer::getShort() const
|
2012-05-20 14:23:48 +00:00
|
|
|
{
|
|
|
|
uInt16 val = 0;
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->read(reinterpret_cast<char*>(&val), sizeof(uInt16));
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
|
|
|
|
return val;
|
2002-05-13 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2012-05-20 14:23:48 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
void Serializer::getShortArray(uInt16* array, uInt32 size) const
|
2012-05-20 14:23:48 +00:00
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->read(reinterpret_cast<char*>(array), sizeof(uInt16)*size);
|
2012-05-20 14:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
uInt32 Serializer::getInt() const
|
2012-05-20 14:23:48 +00:00
|
|
|
{
|
|
|
|
uInt32 val = 0;
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->read(reinterpret_cast<char*>(&val), sizeof(uInt32));
|
2012-05-20 14:23:48 +00:00
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
void Serializer::getIntArray(uInt32* array, uInt32 size) const
|
2012-05-20 14:23:48 +00:00
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->read(reinterpret_cast<char*>(array), sizeof(uInt32)*size);
|
2012-05-20 14:23:48 +00:00
|
|
|
}
|
|
|
|
|
2017-09-08 13:59:30 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
uInt64 Serializer::getLong() const
|
|
|
|
{
|
|
|
|
uInt64 val = 0;
|
|
|
|
myStream->read(reinterpret_cast<char*>(&val), sizeof(uInt64));
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2017-03-25 20:28:58 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
double Serializer::getDouble() const
|
|
|
|
{
|
|
|
|
double val = 0.0;
|
|
|
|
myStream->read(reinterpret_cast<char*>(&val), sizeof(double));
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2002-05-13 19:14:17 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
string Serializer::getString() const
|
2002-05-13 19:14:17 +00:00
|
|
|
{
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
int len = getInt();
|
|
|
|
string str;
|
2012-05-21 21:33:39 +00:00
|
|
|
str.resize(len);
|
|
|
|
myStream->read(&str[0], len);
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
|
|
|
|
return str;
|
2002-05-13 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2005-12-09 19:09:49 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-10-21 23:02:20 +00:00
|
|
|
bool Serializer::getBool() const
|
2005-12-09 19:09:49 +00:00
|
|
|
{
|
2012-05-21 21:33:39 +00:00
|
|
|
return getByte() == TruePattern;
|
2012-05-20 14:23:48 +00:00
|
|
|
}
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
|
2012-05-20 14:23:48 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Serializer::putByte(uInt8 value)
|
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->write(reinterpret_cast<char*>(&value), 1);
|
2005-12-09 19:09:49 +00:00
|
|
|
}
|
|
|
|
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2012-05-20 14:23:48 +00:00
|
|
|
void Serializer::putByteArray(const uInt8* array, uInt32 size)
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->write(reinterpret_cast<const char*>(array), size);
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
}
|
|
|
|
|
2002-05-13 19:14:17 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2012-05-20 14:23:48 +00:00
|
|
|
void Serializer::putShort(uInt16 value)
|
2002-05-13 19:14:17 +00:00
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->write(reinterpret_cast<char*>(&value), sizeof(uInt16));
|
2012-05-20 14:23:48 +00:00
|
|
|
}
|
2005-12-17 01:23:07 +00:00
|
|
|
|
2012-05-20 14:23:48 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Serializer::putShortArray(const uInt16* array, uInt32 size)
|
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->write(reinterpret_cast<const char*>(array), sizeof(uInt16)*size);
|
2012-05-20 14:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Serializer::putInt(uInt32 value)
|
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->write(reinterpret_cast<char*>(&value), sizeof(uInt32));
|
2012-05-20 14:23:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Serializer::putIntArray(const uInt32* array, uInt32 size)
|
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
myStream->write(reinterpret_cast<const char*>(array), sizeof(uInt32)*size);
|
2002-05-13 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
2017-09-08 13:59:30 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Serializer::putLong(uInt64 value)
|
|
|
|
{
|
|
|
|
myStream->write(reinterpret_cast<char*>(&value), sizeof(uInt64));
|
|
|
|
}
|
|
|
|
|
2017-03-25 20:28:58 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Serializer::putDouble(double value)
|
|
|
|
{
|
|
|
|
myStream->write(reinterpret_cast<char*>(&value), sizeof(double));
|
|
|
|
}
|
|
|
|
|
2002-05-13 19:14:17 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
- Major changes across the board with respect to sound. The sound code
has basically been reverted to 1.2 functionality. The good news is that
the video and audio are always in sync, even in Windows. The bad news
is that we've lost advanced sound in Pitfall2. I know what's required to
fix it, but I'm seriously considering doing a new release and waiting
until the release after that to fix it. Right now (with release 1.3),
most games have laggy sound, even under Linux, but the background music
in Pitfall2 is there. I'd rather do a new release with Pitfall2 not
completely working, but having everything else working great, than wait
another month or two. I'm sure most people will agree ...
- The Windows port has some slight popping every now and then. Damn, I
really hate Windows sound programming. It just can't handle low-latency
sound generation as well as Linux (shameless plug).
- Added options '-fragsize' and '-bufsize', which set the sound fragment
and buffer sizes, respectively. They're currently set to 512 and 1536,
and this seems to work best.
- Fixed an error in calling 'putenv' in mainSDL. Now the Windows port
actually starts with the game window centered.
- Finally, IMHO (baring Pitfall2) Stella now works better wrt A/V sync
on Linux than z26 does on Windows (a bit of friendly competition :)
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@232 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2004-04-04 02:03:15 +00:00
|
|
|
void Serializer::putString(const string& str)
|
2002-05-13 19:14:17 +00:00
|
|
|
{
|
2015-09-14 18:14:00 +00:00
|
|
|
int len = int(str.length());
|
2005-12-17 01:23:07 +00:00
|
|
|
putInt(len);
|
2012-05-21 21:33:39 +00:00
|
|
|
myStream->write(str.data(), len);
|
2002-05-13 19:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void Serializer::putBool(bool b)
|
|
|
|
{
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
putByte(b ? TruePattern: FalsePattern);
|
2002-05-13 19:14:17 +00:00
|
|
|
}
|