diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2023-10-22 09:12:15 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2023-10-22 09:12:15 +0530 |
commit | bac4e3b955875d6ba9e798eb003ea1a979dc49ab (patch) | |
tree | 98ba7f0fd830ec0061797a98e3cb41d065653bb8 | |
parent | 9b6b14d2502abdd825975052c5619c4dbfaa9141 (diff) |
move chip8 initialization above platform
-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; |