Merge branch 'master' of github-lodefmode:lodefmode/stella

This commit is contained in:
Lo Def 2021-09-12 14:59:14 -04:00
commit 7abe402ba9
4 changed files with 10 additions and 16 deletions

View File

@ -35,7 +35,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(JoyDir, {
{JoyDir::NONE, nullptr}, {JoyDir::NONE, nullptr},
{JoyDir::ANALOG, "analog"}, {JoyDir::ANALOG, "analog"},
{JoyDir::NEG, "negative"}, {JoyDir::NEG, "negative"},
{JoyDir::POS, "position"} {JoyDir::POS, "positive"}
}) })
NLOHMANN_JSON_SERIALIZE_ENUM(JoyHatDir, { NLOHMANN_JSON_SERIALIZE_ENUM(JoyHatDir, {

View File

@ -33,8 +33,9 @@ Serializer::Serializer(const string& filename, Mode m)
if(str && str->is_open()) if(str && str->is_open())
{ {
myStream = std::move(str); myStream = std::move(str);
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
rewind(); rewind();
myStream->exceptions( ios_base::failbit | ios_base::badbit |
ios_base::eofbit );
} }
} }
} }
@ -57,8 +58,9 @@ Serializer::Serializer(const string& filename, Mode m)
if(str && str->is_open()) if(str && str->is_open())
{ {
myStream = std::move(str); myStream = std::move(str);
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
rewind(); rewind();
myStream->exceptions( ios_base::failbit | ios_base::badbit |
ios_base::eofbit );
} }
} }
} }
@ -71,9 +73,9 @@ Serializer::Serializer()
// the stream before it is used for the first time // the stream before it is used for the first time
if(myStream) if(myStream)
{ {
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
putBool(true); putBool(true);
rewind(); rewind();
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
} }
} }
@ -100,7 +102,7 @@ size_t Serializer::size()
myStream->seekp(0, std::ios::end); myStream->seekp(0, std::ios::end);
size_t s = myStream->tellp(); size_t s = myStream->tellp();
setPosition(oldPos); myStream->seekp(oldPos);
return s; return s;
} }

View File

@ -187,25 +187,20 @@ void StellaLIBRETRO::updateAudio()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::loadState(const void* data, size_t size) bool StellaLIBRETRO::loadState(const void* data, size_t size)
{ {
#if 0
Serializer state; Serializer state;
state.putByteArray(reinterpret_cast<const uInt8*>(data), static_cast<uInt32>(size)); state.putByteArray(reinterpret_cast<const uInt8*>(data), size);
if(!myOSystem->state().loadState(state)) if(!myOSystem->state().loadState(state))
return false; return false;
memcpy(system_ram, myOSystem->console().system().m6532().getRAM(), 128); memcpy(system_ram, myOSystem->console().system().m6532().getRAM(), 128);
return true; return true;
#else
return false;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::saveState(void* data, size_t size) const bool StellaLIBRETRO::saveState(void* data, size_t size) const
{ {
#if 0
Serializer state; Serializer state;
if (!myOSystem->state().saveState(state)) if (!myOSystem->state().saveState(state))
@ -214,11 +209,8 @@ bool StellaLIBRETRO::saveState(void* data, size_t size) const
if (state.size() > size) if (state.size() > size)
return false; return false;
state.getByteArray(reinterpret_cast<uInt8*>(data), static_cast<uInt32>(state.size())); state.getByteArray(reinterpret_cast<uInt8*>(data), state.size());
return true; return true;
#else
return false;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -