X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fplugin_lib.c;h=a458f0e7213cd981de1a7ba487f06aecbf06b038;hp=7110b35405e2e7dd3ceb0ef79567b88bbb12c860;hb=297b3d633ad25797a4f355c57964b7ce3aee6936;hpb=3c70c47bb2fa50066c4c3b23813253e03b8751fe diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 7110b354..a458f0e7 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -62,13 +62,7 @@ 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 *pl_fbdev_set_mode(int w, int h, int bpp) { void *ret; @@ -86,32 +80,47 @@ int pl_fbdev_set_mode(int w, int h, int bpp) else pl_fbdev_buf = ret; - menu_notify_mode_change(w, h); + menu_notify_mode_change(w, h, bpp); - return (ret != NULL) ? 0 : -1; + return pl_fbdev_buf; } -void pl_fbdev_flip(void) +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 (pl_fbdev_buf != NULL) { + 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); + return pl_fbdev_buf; +} + +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); } -void pl_fbdev_finish(void) +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 */ @@ -121,14 +130,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; @@ -179,3 +193,22 @@ void pl_text_out16(int x, int y, const char *texto, ...) pl_text_out16_(x, y, buffer); } +static void pl_get_layer_pos(int *x, int *y, int *w, int *h) +{ + *x = g_layer_x; + *y = g_layer_y; + *w = g_layer_w; + *h = g_layer_h; +} + +extern int UseFrameSkip; // hmh + +const struct rearmed_cbs pl_rearmed_cbs = { + pl_get_layer_pos, + pl_fbdev_open, + pl_fbdev_set_mode, + pl_fbdev_flip, + pl_fbdev_close, + &UseFrameSkip, +}; +