diff options
-rw-r--r-- | src/chip8.cpp | 3 | ||||
-rw-r--r-- | src/main.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/chip8.cpp b/src/chip8.cpp index 1d46c49..e813a61 100644 --- a/src/chip8.cpp +++ b/src/chip8.cpp @@ -169,6 +169,9 @@ void Chip8::LoadROM(const char* filename) { // Free the buffer delete[] buffer; + } else { + std::cerr << "Error: Unable to open " << filename << std::endl; + std::exit(1); } } diff --git a/src/main.cpp b/src/main.cpp index b3e9dc0..9d6e277 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,9 @@ int main(int argc, char** argv) { int cycleDelay = std::stoi(argv[2]); char const* filename = argv[3]; + Chip8 chip8; + chip8.LoadROM(filename); + Platform platform( WINDOW_TITLE, VIDEO_WIDTH * videoScale, @@ -24,9 +27,6 @@ int main(int argc, char** argv) { VIDEO_WIDTH, VIDEO_HEIGHT ); - Chip8 chip8; - chip8.LoadROM(filename); - std::thread timerThread(&Chip8::TimerUpdateThread, &chip8, &platform); bool quit = false; |