Emulator: Add cli argument to specify bootrom path
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ void Loader::init()
|
||||
Emu::the().addMemorySpace("IE", 0xffff, 0xffff); // 1B, Interrupt Enable register
|
||||
|
||||
// Load bootrom
|
||||
auto bootrom = ruc::File("gbc_bios.bin").data();
|
||||
auto bootrom = ruc::File(m_bootrom_path).data();
|
||||
for (size_t i = 0; i < bootrom.length(); ++i) {
|
||||
// Skip cartridge header memory range
|
||||
if (i >= 0x0100 && i <= 0x01ff) {
|
||||
|
||||
@@ -17,6 +17,8 @@ public:
|
||||
|
||||
void loadRom(std::string_view rom_path);
|
||||
|
||||
void setBootromPath(std::string_view bootrom_path) { m_bootrom_path = bootrom_path; }
|
||||
|
||||
private:
|
||||
void init();
|
||||
void update();
|
||||
@@ -24,5 +26,6 @@ private:
|
||||
|
||||
void loadCartridgeHeader();
|
||||
|
||||
std::string_view m_bootrom_path;
|
||||
std::string m_rom_data;
|
||||
};
|
||||
|
||||
@@ -13,12 +13,15 @@
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
std::string_view bootrom_path = "gbc_bios.bin";
|
||||
std::string_view rom_path;
|
||||
|
||||
ruc::ArgParser argParser;
|
||||
argParser.addOption(bootrom_path, 'b', "bootrom", nullptr, nullptr, "", ruc::ArgParser::Required::Yes);
|
||||
argParser.addOption(rom_path, 'r', "rom", nullptr, nullptr, "", ruc::ArgParser::Required::Yes);
|
||||
argParser.parse(argc, argv);
|
||||
|
||||
Loader::the().setBootromPath(bootrom_path);
|
||||
Loader::the().loadRom(rom_path);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user