mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-22 14:12:35 +01:00
byuu says: It took several hours, but I've rebuilt much of the SNES' bus memory mapping architecture. The new design unifies the cartridge string-based mapping ("00-3f,80-bf:8000-ffff") and internal bus.map calls. The map() function now has an accompanying unmap() function, and instead of a fixed 256 callbacks, it'll scan to find the first available slot. unmap() will free slots up when zero addresses reference a given slot. The controllers and expansion port are now both entirely dynamic. Instead of load/unload/power/reset, they only have the constructor (power/reset/load) and destructor (unload). What this means is you can now dynamically change even expansion port devices after the system is loaded. Note that this is incredibly dangerous and stupid, but ... oh well. The whole point of this was for 21fx. There's no way to change the expansion port device prior to loading a game, but if the 21fx isn't active, then the reset vector hijack won't work. Now you can load a 21fx game, change the expansion port device, and simply reset the system to active the device. The unification of design between controller port devices and expansion port devices is nice, and overall this results in a reduction of code (all of the Mapping stuff in Cartridge is gone, replaced with direct bus mapping.) And there's always the potential to expand this system more in the future now. The big missing feature right now is the ability to push/pop mappings. So if you look at how the 21fx does the reset vector, you might vomit a little bit. But ... it works. Also changed exit(0) to _exit(0) in the POSIX version of nall::execute. [The _exit(0) thing is an attempt to make higan not crash when it tries to launch icarus and it's not on $PATH. The theory is that higan forks, then the child tries to exec icarus and fails, so it exits, all the unique_ptrs clean up their resources and tell the X server to free things the parent process is still using. Calling _exit() prevents destructors from running, and seems to prevent the problem. -Ed.]
101 lines
2.8 KiB
C++
101 lines
2.8 KiB
C++
struct Cartridge : property<Cartridge> {
|
|
enum class Region : unsigned { NTSC, PAL };
|
|
|
|
auto sha256() const -> string { return _sha256; }
|
|
auto region() const -> Region { return _region; }
|
|
|
|
readonly<bool> hasICD2;
|
|
readonly<bool> hasMCC;
|
|
readonly<bool> hasNSSDIP;
|
|
readonly<bool> hasEvent;
|
|
readonly<bool> hasSA1;
|
|
readonly<bool> hasSuperFX;
|
|
readonly<bool> hasARMDSP;
|
|
readonly<bool> hasHitachiDSP;
|
|
readonly<bool> hasNECDSP;
|
|
readonly<bool> hasEpsonRTC;
|
|
readonly<bool> hasSharpRTC;
|
|
readonly<bool> hasSPC7110;
|
|
readonly<bool> hasSDD1;
|
|
readonly<bool> hasOBC1;
|
|
readonly<bool> hasMSU1;
|
|
|
|
readonly<bool> hasGameBoySlot;
|
|
readonly<bool> hasBSMemorySlot;
|
|
readonly<bool> hasSufamiTurboSlots;
|
|
|
|
auto manifest() -> string;
|
|
auto title() -> string;
|
|
|
|
auto load() -> void;
|
|
auto unload() -> void;
|
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
MappedRAM rom;
|
|
MappedRAM ram;
|
|
|
|
struct Memory {
|
|
unsigned id;
|
|
string name;
|
|
};
|
|
vector<Memory> memory;
|
|
|
|
struct Information {
|
|
struct Markup {
|
|
string cartridge;
|
|
string gameBoy;
|
|
string bsMemory;
|
|
string sufamiTurboA;
|
|
string sufamiTurboB;
|
|
} markup;
|
|
|
|
struct Title {
|
|
string cartridge;
|
|
string gameBoy;
|
|
string bsMemory;
|
|
string sufamiTurboA;
|
|
string sufamiTurboB;
|
|
} title;
|
|
} information;
|
|
|
|
private:
|
|
auto loadGameBoy() -> void;
|
|
auto loadBSMemory() -> void;
|
|
auto loadSufamiTurboA() -> void;
|
|
auto loadSufamiTurboB() -> void;
|
|
friend class Interface;
|
|
friend class ICD2;
|
|
|
|
//markup.cpp
|
|
auto parseMarkup(const string&) -> void;
|
|
auto parseMarkupMap(Markup::Node, SuperFamicom::Memory&) -> void;
|
|
auto parseMarkupMap(Markup::Node, const function<uint8 (uint24, uint8)>&, const function<void (uint24, uint8)>&) -> void;
|
|
auto parseMarkupMemory(MappedRAM&, Markup::Node, uint id, bool writable) -> void;
|
|
|
|
auto parseMarkupROM(Markup::Node) -> void;
|
|
auto parseMarkupRAM(Markup::Node) -> void;
|
|
auto parseMarkupICD2(Markup::Node) -> void;
|
|
auto parseMarkupMCC(Markup::Node) -> void;
|
|
auto parseMarkupBSMemory(Markup::Node) -> void;
|
|
auto parseMarkupSufamiTurbo(Markup::Node, bool slot) -> void;
|
|
auto parseMarkupNSS(Markup::Node) -> void;
|
|
auto parseMarkupEvent(Markup::Node) -> void;
|
|
auto parseMarkupSA1(Markup::Node) -> void;
|
|
auto parseMarkupSuperFX(Markup::Node) -> void;
|
|
auto parseMarkupARMDSP(Markup::Node) -> void;
|
|
auto parseMarkupHitachiDSP(Markup::Node, unsigned roms) -> void;
|
|
auto parseMarkupNECDSP(Markup::Node) -> void;
|
|
auto parseMarkupEpsonRTC(Markup::Node) -> void;
|
|
auto parseMarkupSharpRTC(Markup::Node) -> void;
|
|
auto parseMarkupSPC7110(Markup::Node) -> void;
|
|
auto parseMarkupSDD1(Markup::Node) -> void;
|
|
auto parseMarkupOBC1(Markup::Node) -> void;
|
|
auto parseMarkupMSU1(Markup::Node) -> void;
|
|
|
|
string _sha256;
|
|
Region _region = Region::NTSC;
|
|
};
|
|
|
|
extern Cartridge cartridge;
|