libretro: Re-enable rewind support (fixes #820).

This commit is contained in:
Stephen Anthony 2021-09-06 20:24:52 -02:30
parent 44c9b74345
commit 3e8486d4de
3 changed files with 9 additions and 15 deletions

View File

@ -33,8 +33,9 @@ Serializer::Serializer(const string& filename, Mode m)
if(str && str->is_open())
{
myStream = std::move(str);
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
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())
{
myStream = std::move(str);
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
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
if(myStream)
{
myStream->exceptions( ios_base::failbit | ios_base::badbit | ios_base::eofbit );
putBool(true);
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);
size_t s = myStream->tellp();
setPosition(oldPos);
myStream->seekp(oldPos);
return s;
}

View File

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