From 3e8486d4de44718e5ec5c43a14254b713e190420 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 6 Sep 2021 20:24:52 -0230 Subject: [PATCH 1/2] libretro: Re-enable rewind support (fixes #820). --- src/emucore/Serializer.cxx | 10 ++++++---- src/gui/PlusRomsSetupDialog.cxx | 2 +- src/libretro/StellaLIBRETRO.cxx | 12 ++---------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx index 57657712a..2a66be122 100644 --- a/src/emucore/Serializer.cxx +++ b/src/emucore/Serializer.cxx @@ -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; } diff --git a/src/gui/PlusRomsSetupDialog.cxx b/src/gui/PlusRomsSetupDialog.cxx index 72355a04f..5da2e55df 100644 --- a/src/gui/PlusRomsSetupDialog.cxx +++ b/src/gui/PlusRomsSetupDialog.cxx @@ -76,4 +76,4 @@ void PlusRomsSetupDialog::handleCommand(CommandSender* sender, int cmd, InputTextDialog::handleCommand(sender, cmd, data, id); break; } -} \ No newline at end of file +} diff --git a/src/libretro/StellaLIBRETRO.cxx b/src/libretro/StellaLIBRETRO.cxx index 7514458c5..9faa674e8 100644 --- a/src/libretro/StellaLIBRETRO.cxx +++ b/src/libretro/StellaLIBRETRO.cxx @@ -187,25 +187,20 @@ void StellaLIBRETRO::updateAudio() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool StellaLIBRETRO::loadState(const void* data, size_t size) { -#if 0 Serializer state; - state.putByteArray(reinterpret_cast(data), static_cast(size)); + state.putByteArray(reinterpret_cast(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(data), static_cast(state.size())); + state.getByteArray(reinterpret_cast(data), state.size()); return true; -#else - return false; -#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From d4d34faf53e7419fb881d95356c0335e08bea5c9 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Tue, 7 Sep 2021 08:46:59 +0200 Subject: [PATCH 2/2] fixed wording --- src/common/jsonDefinitions.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/jsonDefinitions.hxx b/src/common/jsonDefinitions.hxx index 954ed6093..522bcd2ed 100644 --- a/src/common/jsonDefinitions.hxx +++ b/src/common/jsonDefinitions.hxx @@ -35,7 +35,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(JoyDir, { {JoyDir::NONE, nullptr}, {JoyDir::ANALOG, "analog"}, {JoyDir::NEG, "negative"}, - {JoyDir::POS, "position"} + {JoyDir::POS, "positive"} }) NLOHMANN_JSON_SERIALIZE_ENUM(JoyHatDir, {