Go to the documentation of this file.
89 static size_t getRomSize(
const std::string &romPath);
105 static constexpr std::string_view
_magicSPC =
"SNES-SPC700 Sound File Data v0.30";
111 explicit Cartridge(
const std::string &romPath);
139 [[nodiscard]] std::filesystem::path
getRomPath()
const;
147 void loadRom(
const std::string& path);
static constexpr std::string_view _magicSPC
Magic Header string of a SPC Rom.
Definition: Cartridge.hpp:105
CartridgeType
Definition: Cartridge.hpp:17
CartridgeType _type
Current type of the cartridge.
Definition: Cartridge.hpp:103
CartridgeType getType()
Return current type of the cartridge.
Definition: Cartridge.cpp:211
@ LoRom
Definition: Cartridge.hpp:25
MappingMode & operator|=(MappingMode &self, const MappingMode &other)
Definition: Cartridge.cpp:226
uint8_t read(uint24_t addr) override
Read from the rom.
Definition: Cartridge.cpp:48
bool _isSPCFile()
Check if the cartridge is not a game but a SPC audio dump.
Definition: Cartridge.cpp:173
unsigned uint24_t
Definition: Ints.hpp:10
Definition: Cartridge.cpp:12
std::filesystem::path getRomPath() const
The path of the rom file.
Definition: Cartridge.cpp:58
uint32_t _getHeaderAddress()
Get the address of the header.
Definition: Cartridge.cpp:111
MappingMode
Definition: Cartridge.hpp:23
uint24_t getSize() const override
Get the size of the rom in bytes (without the smc header).
Definition: Cartridge.cpp:216
@ FastRom
Definition: Cartridge.hpp:28
uint16_t _romStart
Sometime the rom's data has an offset for a SMC header. This value indicate the start of the real rom...
Definition: Cartridge.hpp:84
@ SlowRom
Definition: Cartridge.hpp:27
std::string _romPath
The path of the currently loaded rom.
Definition: Cartridge.hpp:82
Cartridge()
A default constructor that doesn't load anything.
Definition: Cartridge.cpp:16
Definition: InterruptVectors.hpp:11
Contains the rom's memory/instructions.
Definition: Cartridge.hpp:78
void loadRom(const std::string &path)
Load the rom at the given path.
Definition: Cartridge.cpp:27
@ ExRom
Definition: Cartridge.hpp:29
static size_t getRomSize(const std::string &romPath)
Get the size of a rom from it's path.
Definition: Cartridge.cpp:39
Header header
The header of the cartridge.
Definition: Cartridge.hpp:120
@ Game
Definition: Cartridge.hpp:19
@ Audio
Definition: Cartridge.hpp:20
MappingMode operator|(const MappingMode &self, const MappingMode &other)
Definition: Cartridge.cpp:221
bool _loadHeader()
Set the public variable header by parsing the header in the ROM.
Definition: Cartridge.cpp:190
void write(uint24_t addr, uint8_t data) override
Write data to the rom.
Definition: Cartridge.cpp:53
@ HiRom
Definition: Cartridge.hpp:26
~Cartridge() override=default
Destructor that free the cartridge data.
Header _mapHeader(uint32_t headerAddress)
Parse the memory to get a readable header.
Definition: Cartridge.cpp:63
Cartridge & operator=(const Cartridge &)=delete
The cartridge can't be assigned.