supply rom as cmd line argument
This commit is contained in:
parent
1510bb94be
commit
9ce2fa6124
|
@ -14,14 +14,14 @@
|
|||
#include "Debugger.hpp"
|
||||
#include "gfx/Window.hpp"
|
||||
|
||||
void Application::Launch()
|
||||
void Application::Launch(const char* rom)
|
||||
{
|
||||
glfwInit();
|
||||
|
||||
Application* app = nullptr;
|
||||
try
|
||||
{
|
||||
app = new Application;
|
||||
app = new Application(rom);
|
||||
}
|
||||
catch (const std::runtime_error& err)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ void Application::Launch()
|
|||
glfwTerminate();
|
||||
}
|
||||
|
||||
Application::Application() :
|
||||
Application::Application(const char* rom) :
|
||||
bus(nullptr), window(nullptr)
|
||||
{
|
||||
LOG_CORE_INFO("Creating window");
|
||||
|
@ -93,7 +93,7 @@ Application::Application() :
|
|||
throw err;
|
||||
}
|
||||
|
||||
bus = new Bus(screen);
|
||||
bus = new Bus(rom, screen);
|
||||
debugger = new Debugger(bus);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ public:
|
|||
/**
|
||||
* @brief Create and launch a new application.
|
||||
*/
|
||||
static void Launch();
|
||||
static void Launch(const char* rom);
|
||||
|
||||
private:
|
||||
Application();
|
||||
Application(const char* rom);
|
||||
~Application();
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "controllers/StandardController.hpp"
|
||||
|
||||
Bus::Bus(Screen* screen) :
|
||||
Bus::Bus(const char* rom, Screen* screen) :
|
||||
cpu(this), ppu(this, screen), apu(this), cartridge(this)
|
||||
{
|
||||
LOG_CORE_INFO("Allocating RAM");
|
||||
|
@ -16,7 +16,7 @@ Bus::Bus(Screen* screen) :
|
|||
palettes = std::vector<Byte>(0x20, 0);
|
||||
|
||||
LOG_CORE_INFO("Inserting cartridge");
|
||||
cartridge.Load("roms/mario.nes");
|
||||
cartridge.Load(rom);
|
||||
|
||||
LOG_CORE_INFO("Powering up CPU");
|
||||
cpu.Powerup();
|
||||
|
|
|
@ -25,7 +25,7 @@ class Bus
|
|||
friend class Palettes;
|
||||
|
||||
public:
|
||||
Bus(Screen* screen);
|
||||
Bus(const char* rom, Screen* screen);
|
||||
|
||||
/**
|
||||
* @brief Reboot the NES.
|
||||
|
|
|
@ -61,7 +61,7 @@ bool Debugger::Frame()
|
|||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Debugger::Update()
|
||||
|
|
13
src/debugger/imgui.ini
Normal file
13
src/debugger/imgui.ini
Normal file
|
@ -0,0 +1,13 @@
|
|||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debugger]
|
||||
ViewportPos=1419,173
|
||||
ViewportId=0x289D2C3F
|
||||
Size=400,600
|
||||
Collapsed=0
|
||||
|
||||
[Docking][Data]
|
||||
|
10
src/main.cpp
10
src/main.cpp
|
@ -1,10 +1,16 @@
|
|||
#include "Application.hpp"
|
||||
#include "Log.hpp"
|
||||
|
||||
int main()
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Log::Init();
|
||||
Application::Launch();
|
||||
|
||||
if (argc != 2) {
|
||||
LOG_CORE_FATAL("Usage: {0} <rom>", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Application::Launch(argv[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue