#include #include #include #include "chip8.hpp" #include "platform.hpp" #define WINDOW_TITLE "chip8emu" int main(int argc, char** argv) { if (argc != 4) { std::cerr << "Usage: " << argv[0] << " \n"; std::exit(EXIT_FAILURE); } int videoScale = std::stoi(argv[1]); int cycleDelay = std::stoi(argv[2]); char const* filename = argv[3]; Platform platform( WINDOW_TITLE, VIDEO_WIDTH * videoScale, VIDEO_HEIGHT * videoScale, VIDEO_WIDTH, VIDEO_HEIGHT ); Chip8 chip8; chip8.LoadROM(filename); std::thread timerThread(&Chip8::TimerUpdateThread, &chip8, &platform); bool quit = false; while (!quit) { quit = platform.ProcessInput(&chip8.keypad); usleep(cycleDelay * 1000); chip8.Cycle(); platform.Update(chip8.video, videoScale); } return 0; }