#include #include #include #include #include "nese.h" #include "port.h" #define DEBUG "Port" #include "log.h" void* nese_map_file(FILE* file, int size) { void* addr = mmap(NULL, size, PROT_READ, MAP_SHARED, fileno(file), 0); if (MAP_FAILED == addr || NULL == addr) { fprintf(stderr, "mmap failed: %d\n", (int)errno); addr = NULL; } return addr; } int nese_unmap_file(void* addr, int size) { return munmap(addr, size); } int nese_frame_ready() { /* static int frame = 0; static int ignore = 1; static struct timespec t_last = {0}; struct timespec t_now = {0}; ++frame; clock_gettime(CLOCK_MONOTONIC, &t_now); if (t_now.tv_sec > t_last.tv_sec) { if (!ignore) printf("%d\n", frame); frame = 0; ignore = 0; } t_last = t_now; */ // TODO: Render frame // TODO: Time sync // TODO: Handle quit signal // TODO: Perform menu actions return 0; } int nese_update_input(nes_Input* input) { // TODO: Populate the gamepad states return 0; } static nes sys = {0}; int main(int argc, char* argv[]) { int status = 0; if (argc <= 1) { LOGE("No ROM file provided."); status = -1; } else { status = nese_start(&sys, argv[1]); } return status; }