diff --git a/src/loader.cpp b/src/loader.cpp index 7c8a823..6dfd322 100644 --- a/src/loader.cpp +++ b/src/loader.cpp @@ -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) { diff --git a/src/loader.h b/src/loader.h index 45213d0..842337b 100644 --- a/src/loader.h +++ b/src/loader.h @@ -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; }; diff --git a/src/main.cpp b/src/main.cpp index 3b5939f..6d26077 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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;