X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fplugin_lib.c;h=0ca45ce602deb9e7bd78509d1e8a5d3228a6f9d0;hp=26d5218e4dfa5dfc9d2cc59ed5ae812685de9edd;hb=bbd837c6d8a14e76c19028c84ef62a3b8cf0c1f0;hpb=722285599b1ce45ca435f484b0f34a5e568487a1;ds=sidebyside diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 26d5218e..0ca45ce6 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -20,6 +20,7 @@ #include "common/fonts.h" #include "common/input.h" #include "omap.h" +#include "menu.h" #include "pcnt.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" @@ -61,12 +62,6 @@ static void print_cpu_usage(void) pl_text_out16(pl_fbdev_w - 28, pl_fbdev_h - 10, "%3d", tick_per_sec); } -int pl_fbdev_init(void) -{ - pl_fbdev_buf = vout_fbdev_flip(layer_fb); - return 0; -} - int pl_fbdev_set_mode(int w, int h, int bpp) { void *ret; @@ -85,30 +80,43 @@ int pl_fbdev_set_mode(int w, int h, int bpp) else pl_fbdev_buf = ret; + menu_notify_mode_change(w, h, bpp); + return (ret != NULL) ? 0 : -1; } void pl_fbdev_flip(void) { - /* doing input here because the pad is polled - * thousands of times for some reason */ - int actions[IN_BINDTYPE_COUNT] = { 0, }; - - in_update(actions); - if (actions[IN_BINDTYPE_EMU] & PEV_MENU) - stop = 1; - keystate = actions[IN_BINDTYPE_PLAYER12]; - flip_cnt++; - print_fps(); - print_cpu_usage(); + if (g_opts & OPT_SHOWFPS) + print_fps(); + if (g_opts & OPT_SHOWCPU) + print_cpu_usage(); // let's flip now pl_fbdev_buf = vout_fbdev_flip(layer_fb); } -void pl_fbdev_finish(void) +int pl_fbdev_open(void) +{ + pl_fbdev_buf = vout_fbdev_flip(layer_fb); + omap_enable_layer(1); + return 0; +} + +void pl_fbdev_close(void) { + omap_enable_layer(0); +} + +static void update_input(void) +{ + int actions[IN_BINDTYPE_COUNT] = { 0, }; + + in_update(actions); + if (actions[IN_BINDTYPE_EMU] & PEV_MENU) + stop = 1; + keystate = actions[IN_BINDTYPE_PLAYER12]; } /* called on every vsync */ @@ -118,14 +126,19 @@ void pl_frame_limit(void) static int oldsec; struct timeval tv; + /* doing input here because the pad is polled + * thousands of times per frame for some reason */ + update_input(); + pcnt_end(PCNT_ALL); gettimeofday(&tv, 0); if (tv.tv_sec != oldsec) { flips_per_sec = flip_cnt; flip_cnt = 0; - tick_per_sec = get_cpu_ticks(); oldsec = tv.tv_sec; + if (g_opts & OPT_SHOWCPU) + tick_per_sec = get_cpu_ticks(); } #ifdef PCNT static int ya_vsync_count;