X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=blobdiff_plain;f=loader%2Femu.c;h=571c3b0032abd75f7598d76204ef73502ed4dba9;hp=3ab4b346e504c8462456551ce05ae929c55be247;hb=adb798406512d2bf868330e74deb2637e0575c2f;hpb=4d0451847a77d420284c7fb0f50b1f167c1118ee diff --git a/loader/emu.c b/loader/emu.c index 3ab4b34..571c3b0 100644 --- a/loader/emu.c +++ b/loader/emu.c @@ -269,21 +269,26 @@ bad_blit: // FIXME: pass real dimensions to blitters static void mlc_flip(void *src, int bpp) { - u32 *srcp = NULL; + static int old_bpp; // only pass pal to host if it's dirty if (bpp <= 8 && mmsp2.dirty_pal) { - srcp = mmsp2.mlc_stl_pallt_d32; + host_video_update_pal(mmsp2.mlc_stl_pallt_d32); mmsp2.dirty_pal = 0; } + if (bpp != old_bpp) { + host_video_change_bpp(bpp); + old_bpp = bpp; + } + switch (bpp) { case 4: - host_video_blit4(src, 320, 240, srcp); + host_video_blit4(src, 320, 240); break; case 8: - host_video_blit8(src, 320, 240, srcp); + host_video_blit8(src, 320, 240); break; case 16: @@ -304,6 +309,8 @@ static void mlc_flip(void *src, int bpp) } \ } +static int fb_sync_thread_paused; + static void *fb_sync_thread(void *arg) { int invalid_fb_addr = 1; @@ -340,6 +347,10 @@ static void *fb_sync_thread(void *arg) sleep(1); continue; } + if (fb_sync_thread_paused) { + ts_add_nsec(ts, 100000000); + continue; + } if (wait_ret != ETIMEDOUT) { clock_gettime(CLOCK_REALTIME, &ts); @@ -370,6 +381,19 @@ static void *fb_sync_thread(void *arg) } } +static void fb_thread_pause(void) +{ + fb_sync_thread_paused = 1; + // wait until it finishes last refresh + // that it might be doing now + usleep(10000); +} + +static void fb_thread_resume(void) +{ + fb_sync_thread_paused = 0; +} + static u32 xread8(u32 a) { iolog("r8 ", a, 0, 8); @@ -1044,6 +1068,7 @@ int emu_do_system(const char *command) static char tmp_path[512]; const char *p2; char *p; + int ret; if (command == NULL) return -1; @@ -1058,11 +1083,16 @@ int emu_do_system(const char *command) p = tmp_path + strlen(tmp_path); p2 = wrap_path(command); - snprintf(p, sizeof(tmp_path) - (p - tmp_path), " %s", p2); + snprintf(p, sizeof(tmp_path) - (p - tmp_path), " --nomenu %s", p2); if (p2 != command) free((void *)p2); dbg("system: \"%s\"\n", tmp_path); - return system(tmp_path); + + // the app might want the screen too.. + fb_thread_pause(); + ret = system(tmp_path); + fb_thread_resume(); + return ret; }