diff --git a/src/config.c b/src/config.c index 12b2691..55f0aa4 100644 --- a/src/config.c +++ b/src/config.c @@ -23,7 +23,7 @@ Config config = { .fn_state = "state", }; -void parse_args( int argc, char* argv[] ) +void config_init( int argc, char* argv[] ) { int option_index; int c = '?'; diff --git a/src/config.h b/src/config.h index 958fe3a..27ffcf2 100644 --- a/src/config.h +++ b/src/config.h @@ -23,6 +23,6 @@ typedef struct { extern Config config; -void parse_args( int argc, char* argv[] ); +void config_init( int argc, char* argv[] ); #endif diff --git a/src/gui.c b/src/gui.c index bbea184..ab7c0d9 100644 --- a/src/gui.c +++ b/src/gui.c @@ -958,7 +958,7 @@ static inline void _button_mouse_up( int mouse_x, int mouse_y, int mouse_button /********************/ /* PUBLIC FUNCTIONS */ /********************/ -void gui_refresh() +void gui_update() { SDL_SetRenderDrawColor( renderer, gui_colors.faceplate.r, gui_colors.faceplate.g, gui_colors.faceplate.b, gui_colors.faceplate.a ); SDL_RenderClear( renderer ); diff --git a/src/gui.h b/src/gui.h index 496981b..2207e6f 100644 --- a/src/gui.h +++ b/src/gui.h @@ -3,7 +3,7 @@ #include -extern void gui_refresh( void ); +extern void gui_update( void ); extern bool gui_events(); extern bool gui_init( void ); diff --git a/src/main.c b/src/main.c index 19fe3fb..dc2e4ac 100644 --- a/src/main.c +++ b/src/main.c @@ -8,48 +8,50 @@ #include "gui.h" #include "display.h" -unsigned int currentTime; +Uint64 currentTime; // display_update -unsigned int lastTime_timer1 = 0; +Uint64 lastTime_timer1 = 0; unsigned int delay_timer1 = 16384; // display show -unsigned int lastTime_timer5 = 0; +Uint64 lastTime_timer5 = 0; unsigned int delay_timer5 = 64; // fps int main( int argc, char* argv[] ) { - parse_args( argc, argv ); + config_init( argc, argv ); if ( !gui_init() ) exit( EXIT_FAILURE ); - emulator_init( "rom", "ram", "port1", "port2", "bus", "cpu" ); + emulator_init(); while ( !please_exit ) { if ( please_exit ) break; - currentTime = SDL_GetTicks(); + currentTime = SDL_GetTicks64(); emulator_run(); if ( currentTime > lastTime_timer1 + delay_timer1 ) { lastTime_timer1 = currentTime; + display_update(); } if ( currentTime > lastTime_timer5 + delay_timer5 ) { lastTime_timer5 = currentTime; - gui_refresh(); + + gui_update(); } if ( !gui_events() ) break; } - emulator_exit( "rom", "ram", "port1", "port2", "bus", "cpu" ); + emulator_exit(); gui_exit(); return 0;