mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-31 02:00:27 +02:00
v111.8
Added fully working deterministic save state support (non-portable.) Rewind is now 100% deterministic, disk save states are still portable. Added run-ahead support.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <nall/queue.hpp>
|
||||
#include <nall/serializer.hpp>
|
||||
#include <nall/dsp/dsp.hpp>
|
||||
|
||||
namespace nall::DSP::Resampler {
|
||||
@@ -11,6 +12,7 @@ struct Cubic {
|
||||
inline auto pending() const -> uint;
|
||||
inline auto read() -> double;
|
||||
inline auto write(double sample) -> void;
|
||||
inline auto serialize(serializer&) -> void;
|
||||
|
||||
private:
|
||||
double inputFrequency;
|
||||
@@ -67,4 +69,13 @@ auto Cubic::write(double sample) -> void {
|
||||
mu -= 1.0;
|
||||
}
|
||||
|
||||
auto Cubic::serialize(serializer& s) -> void {
|
||||
s.real(inputFrequency);
|
||||
s.real(outputFrequency);
|
||||
s.real(ratio);
|
||||
s.real(fraction);
|
||||
s.array(history);
|
||||
samples.serialize(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -51,6 +51,15 @@ struct serializer {
|
||||
return _capacity;
|
||||
}
|
||||
|
||||
auto setMode(Mode mode) -> bool {
|
||||
if(_mode == Mode::Save && mode == Mode::Load) {
|
||||
_mode = mode;
|
||||
_size = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T> auto real(T& value) -> serializer& {
|
||||
enum : uint { size = sizeof(T) };
|
||||
//this is rather dangerous, and not cross-platform safe;
|
||||
|
Reference in New Issue
Block a user