bsnes/sfc/system/system.hpp
Tim Allen 6d9f43a37b Update to v095r05 release.
byuu says:

Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection

GBA test scores: 1552/1552, 37/38, 1020/1260

(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)

Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.

Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 21:15:03 +11:00

86 lines
1.7 KiB
C++

struct Interface;
#include "video.hpp"
#include "audio.hpp"
#include "device.hpp"
struct System : property<System> {
enum class Region : uint { NTSC = 0, PAL = 1, Autodetect = 2 };
System();
auto run() -> void;
auto runToSave() -> void;
auto init() -> void;
auto term() -> void;
auto load() -> void;
auto unload() -> void;
auto power() -> void;
auto reset() -> void;
auto frame() -> void;
auto scanline() -> void;
//return *active* system information (settings are cached upon power-on)
readonly<Region> region;
readonly<Device::ID> expansionPort;
readonly<uint> cpuFrequency;
readonly<uint> apuFrequency;
readonly<uint> serializeSize;
auto serialize() -> serializer;
auto unserialize(serializer&) -> bool;
struct Information {
string manifest;
} information;
private:
auto runThreadToSave() -> void;
auto serialize(serializer&) -> void;
auto serializeAll(serializer&) -> void;
auto serializeInit() -> void;
friend class Cartridge;
friend class Video;
friend class Audio;
friend class Device;
};
extern System system;
#include <sfc/scheduler/scheduler.hpp>
struct Configuration {
Device::ID controllerPort1 = Device::ID::None;
Device::ID controllerPort2 = Device::ID::None;
Device::ID expansionPort = Device::ID::None;
System::Region region = System::Region::Autodetect;
bool random = true;
};
extern Configuration configuration;
struct Random {
auto seed(uint seed) -> void {
iter = seed;
}
auto operator()(uint result) -> uint {
if(configuration.random == false) return result;
return iter = (iter >> 1) ^ (((iter & 1) - 1) & 0xedb88320);
}
auto serialize(serializer& s) -> void {
s.integer(iter);
}
private:
uint iter = 0;
};
extern Random random;