diff --git a/src/common/api.c b/src/common/api.c index 2e89a66..cb79a43 100644 --- a/src/common/api.c +++ b/src/common/api.c @@ -177,11 +177,9 @@ SDL_Surface* GFX_init(int mode) { gfx.vinfo.yres_virtual = SCREEN_HEIGHT * GFX_BUFFER_COUNT; gfx.vinfo.xoffset = 0; gfx.vinfo.yoffset = 0; - gfx.vinfo.activate = FB_ACTIVATE_VBL; + // gfx.vinfo.activate = FB_ACTIVATE_VBL; - if (ioctl(gfx.fb, FBIOPUT_VSCREENINFO, &gfx.vinfo)) { - printf("FBIOPUT_VSCREENINFO failed: %s (%i)\n", strerror(errno), errno); - } + ioctl(gfx.fb, FBIOPUT_VSCREENINFO, &gfx.vinfo); // get fixed screen info ioctl(gfx.fb, FBIOGET_FSCREENINFO, &gfx.finfo); @@ -191,12 +189,10 @@ SDL_Surface* GFX_init(int mode) { struct owlfb_sync_info sinfo; sinfo.enabled = 1; - if (ioctl(gfx.fb, OWLFB_VSYNC_EVENT_EN, &sinfo)) { - printf("OWLFB_VSYNC_EVENT_EN failed: %s (%i)\n", strerror(errno), errno); - } + ioctl(gfx.fb, OWLFB_VSYNC_EVENT_EN, &sinfo); // buffer tracking - gfx.buffer = 1; + gfx.buffer = 1; // start on back buffer gfx.buffer_size = SCREEN_PITCH * SCREEN_HEIGHT; // return screen @@ -285,6 +281,7 @@ void GFX_flip(SDL_Surface* screen) { if (gfx.buffer>=GFX_BUFFER_COUNT) gfx.buffer -= GFX_BUFFER_COUNT; screen->pixels = gfx.map + (gfx.buffer * gfx.buffer_size); + // TODO: this doesn't make sense here but it's the only way to reduce flickering when changing volume/brightness... if (gfx.vsync!=VSYNC_OFF) { // this limiting condition helps SuperFX chip games #define FRAME_BUDGET 17 // 60fps diff --git a/src/minarch/main.c b/src/minarch/main.c index 48d4fa8..e0488c8 100644 --- a/src/minarch/main.c +++ b/src/minarch/main.c @@ -3208,8 +3208,8 @@ static int Menu_options(MenuList* list) { return 0; } static void Menu_loop(void) { - GFX_setVsync(VSYNC_STRICT); POW_setCPUSpeed(CPU_SPEED_MENU); // set Hz directly + GFX_setVsync(VSYNC_STRICT); fast_forward = 0; POW_enableAutosleep(); diff --git a/src/minui/main.c b/src/minui/main.c index dd939a1..c5af37b 100644 --- a/src/minui/main.c +++ b/src/minui/main.c @@ -16,10 +16,6 @@ /////////////////////////////////////// -#define dump(msg) puts((msg));fflush(stdout); - -/////////////////////////////////////// - typedef struct Array { int count; int capacity; @@ -1168,7 +1164,7 @@ static void Menu_quit(void) { int main (int argc, char *argv[]) { if (autoResume()) return 0; // nothing to do - dump("MinUI"); + LOG_info("MinUI\n"); SDL_Surface* screen = GFX_init(MODE_MAIN); InitSettings(); @@ -1180,6 +1176,7 @@ int main (int argc, char *argv[]) { // now that (most of) the heavy lifting is done, take a load off POW_setCPUSpeed(CPU_SPEED_MENU); + GFX_setVsync(VSYNC_STRICT); PAD_reset(); int dirty = 1; @@ -1386,25 +1383,11 @@ int main (int argc, char *argv[]) { GFX_blitButtonGroup((char*[]){ "A","OPEN", NULL }, screen, 1); } } - } - - // scroll long names - if (total>0) { - int selected_row = top->selected - top->start; - Entry* entry = top->entries->items[top->selected]; - // if (GFX_scrollMenu(screen, entry->name, entry->path, entry->unique, selected_row, top->selected, was_dirty, dirty)) dirty = 1; - } - - if (dirty) { + GFX_flip(screen); dirty = 0; } - else { - // slow down to 60fps - unsigned long frame_duration = SDL_GetTicks() - frame_start; - #define TARGET_FRAME_DURATION 17 - if (frame_duration