From 10dd0fe66ad609126e9ecde0588ffd4c4e2c34d6 Mon Sep 17 00:00:00 2001 From: Shaun Inman Date: Thu, 19 Jan 2023 20:41:38 -0500 Subject: [PATCH] fixed SDL_GetTicks var types --- src/clock/main.c | 4 ++-- src/common/api.c | 18 +++++++++--------- src/minarch/main.c | 17 ++++++----------- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/clock/main.c b/src/clock/main.c index d3fbf8e..720d8a4 100644 --- a/src/clock/main.c +++ b/src/clock/main.c @@ -136,7 +136,7 @@ int main(int argc , char* argv[]) { int dirty = 1; int show_setting = 0; while(!quit) { - unsigned long frame_start = SDL_GetTicks(); + uint32_t frame_start = SDL_GetTicks(); PAD_poll(); @@ -293,7 +293,7 @@ int main(int argc , char* argv[]) { } else { // slow down to 60fps - unsigned long frame_duration = SDL_GetTicks() - frame_start; + uint32_t frame_duration = SDL_GetTicks() - frame_start; #define kTargetFrameDuration 17 if (frame_duration=pad.repeat_at[i])) { @@ -865,15 +865,15 @@ void POW_update(int* _dirty, int* _show_setting, POW_callback_t before_sleep, PO int dirty = _dirty ? *_dirty : 0; int show_setting = _show_setting ? *_show_setting : 0; - static unsigned long cancel_start = 0; - static unsigned long power_start = 0; + static uint32_t cancel_start = 0; + static uint32_t power_start = 0; - static unsigned long setting_start = 0; - static unsigned long charge_start = 0; + static uint32_t setting_start = 0; + static uint32_t charge_start = 0; static int was_charging = -1; if (was_charging==-1) was_charging = POW_isCharging(); - unsigned long now = SDL_GetTicks(); + uint32_t now = SDL_GetTicks(); if (cancel_start==0) cancel_start = now; if (charge_start==0) charge_start = now; @@ -976,7 +976,7 @@ static void POW_exitSleep(void) { static void POW_waitForWake(void) { SDL_Event event; int wake = 0; - unsigned long sleep_ticks = SDL_GetTicks(); + uint32_t sleep_ticks = SDL_GetTicks(); while (!wake) { while (SDL_PollEvent(&event)) { if (event.type==SDL_KEYUP) { diff --git a/src/minarch/main.c b/src/minarch/main.c index 0e4b142..46fa5a0 100644 --- a/src/minarch/main.c +++ b/src/minarch/main.c @@ -590,7 +590,7 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico static int cpu_ticks = 0; static int fps_ticks = 0; -static int sec_start = 0; +static uint32_t sec_start = 0; // TODO: flesh out static scale_neon_t scaler; @@ -1098,10 +1098,10 @@ static void video_refresh_callback(const void *data, unsigned width, unsigned he return; // TODO: tmp // measure framerate - static int start = -1; static int ticks = 0; + static uint32_t start = -1; ticks += 1; - int now = SDL_GetTicks(); + uint32_t now = SDL_GetTicks(); if (start==-1) start = now; if (now-start>=1000) { start = now; @@ -1444,11 +1444,6 @@ void Menu_loop(void) { sprintf(slot_path, "%s/%s.txt", minui_dir, game.name); getDisplayName(game.name, rom_name); - puts("slot_path"); - puts(slot_path); - fflush(stdout); - - // int selected = 0; // resets every launch if (exists(slot_path)) menu.slot = getInt(slot_path); if (menu.slot==8) menu.slot = 0; @@ -1464,7 +1459,7 @@ void Menu_loop(void) { int dirty = 1; while (show_menu) { GFX_startFrame(); - int frame_start = SDL_GetTicks(); + uint32_t frame_start = SDL_GetTicks(); PAD_poll(); @@ -1732,7 +1727,7 @@ void Menu_loop(void) { } else { // slow down to 60fps - unsigned long frame_duration = SDL_GetTicks() - frame_start; + uint32_t frame_duration = SDL_GetTicks() - frame_start; #define kTargetFrameDuration 17 if (frame_duration=1000) { printf("fps: %i (%i)\n", cpu_ticks, fps_ticks); sec_start = now;