mirror of https://github.com/bsnes-emu/bsnes.git
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
struct System {
|
|
enum class Region : uint { NTSC, PAL };
|
|
|
|
inline auto loaded() const -> bool { return information.loaded; }
|
|
inline auto region() const -> Region { return information.region; }
|
|
inline auto cpuFrequency() const -> double { return information.cpuFrequency; }
|
|
inline auto apuFrequency() const -> double { return information.apuFrequency; }
|
|
|
|
auto run() -> void;
|
|
auto runToSave() -> void;
|
|
|
|
auto init() -> void;
|
|
auto term() -> void;
|
|
auto load(Emulator::Interface*) -> bool;
|
|
auto save() -> void;
|
|
auto unload() -> void;
|
|
auto power() -> void;
|
|
|
|
//video.cpp
|
|
auto configureVideoPalette() -> void;
|
|
auto configureVideoEffects() -> void;
|
|
|
|
//serialization.cpp
|
|
auto serialize() -> serializer;
|
|
auto unserialize(serializer&) -> bool;
|
|
|
|
private:
|
|
Emulator::Interface* interface = nullptr;
|
|
|
|
struct Information {
|
|
string manifest;
|
|
bool loaded = false;
|
|
Region region = Region::NTSC;
|
|
double cpuFrequency = Emulator::Constants::Colorburst::NTSC * 6.0;
|
|
double apuFrequency = 32040.0 * 768.0;
|
|
} information;
|
|
|
|
uint serializeSize = 0;
|
|
|
|
auto serialize(serializer&) -> void;
|
|
auto serializeAll(serializer&) -> void;
|
|
auto serializeInit() -> void;
|
|
|
|
friend class Cartridge;
|
|
};
|
|
|
|
struct Random {
|
|
auto seed(uint seed) -> void;
|
|
auto operator()(uint result) -> uint;
|
|
auto serialize(serializer& s) -> void;
|
|
|
|
private:
|
|
uint iter = 0;
|
|
};
|
|
|
|
extern System system;
|
|
extern Random random;
|
|
|
|
auto Region::NTSC() -> bool { return system.region() == System::Region::NTSC; }
|
|
auto Region::PAL() -> bool { return system.region() == System::Region::PAL; }
|