tidy
trying (and failing) to figure out double buffered flickering...
This commit is contained in:
parent
01358f3b33
commit
ab7da437c6
3 changed files with 10 additions and 30 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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<TARGET_FRAME_DURATION) SDL_Delay(TARGET_FRAME_DURATION-frame_duration);
|
||||
}
|
||||
else GFX_sync();
|
||||
}
|
||||
|
||||
if (version) SDL_FreeSurface(version);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue