nesemu/main.c

63 lines
1.1 KiB
C

/*
* =====================================================================================
*
* Filename: main.c
*
* Description: Emulator main loop
*
* Version: 1.0
* Created: 2023-09-21 09:50:34 PM
* Revision: none
* Compiler: gcc
*
* Author: William Nolin,
* Organization:
*
* =====================================================================================
*/
#include <stdlib.h>
#include "log.h"
#include "include/rom.h"
#include "include/system.h"
#include "gui.h"
int main() {
char *rom_path = "./test_roms/dk_jp.nes";
log_set_level(LOG_INFO);
if (!gui_init()) {
return EXIT_FAILURE;
}
system_init();
if (!rom_load(rom_path)) {
system_uninit();
gui_uninit();
return EXIT_FAILURE;
}
gui_post_sysinit();
system_start();
bool stop = false;
while (!stop) {
if (gui_input() < 0) {
stop = true;
}
system_next_frame();
gui_render();
gui_present();
gui_delay();
}
system_uninit();
rom_unload();
gui_uninit();
return EXIT_SUCCESS;
}