From 2e6189bc568b4e95cf5b04cf84375b3e918675f1 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 1 May 2012 01:13:15 +0300 Subject: [PATCH] frontend: minor tweaks --- configure | 3 +++ frontend/common/input.c | 15 +++++++++++--- frontend/common/input.h | 1 + frontend/menu.c | 7 +++++-- frontend/plat_omap.c | 3 --- frontend/plat_pandora.c | 7 ++++++- frontend/plat_sdl.c | 44 ++++++++++++++++++++++++++--------------- plugins/gpulib/test.c | 4 ++-- 8 files changed, 57 insertions(+), 27 deletions(-) diff --git a/configure b/configure index 4aed26ae..4cbcc803 100755 --- a/configure +++ b/configure @@ -313,4 +313,7 @@ if [ "$drc_cache_base" = "yes" ]; then echo "DRC_CACHE_BASE = 1" >> $config_mak fi +# use pandora's skin (for now) +test -e skin || ln -s frontend/pandora/skin skin + # vim:shiftwidth=2:expandtab diff --git a/frontend/common/input.c b/frontend/common/input.c index 2f8a8673..a6834646 100644 --- a/frontend/common/input.c +++ b/frontend/common/input.c @@ -548,8 +548,10 @@ static int in_set_blocking(int is_blocking) int in_set_config(int dev_id, int what, const void *val, int size) { + const char * const *names; const int *ival = val; in_dev_t *dev; + int count; if (what == IN_CFG_BLOCKING) return in_set_blocking(*ival); @@ -558,9 +560,10 @@ int in_set_config(int dev_id, int what, const void *val, int size) if (dev == NULL) return -1; - if (what == IN_CFG_KEY_NAMES) { - const char * const *names = val; - int count = size / sizeof(names[0]); + switch (what) { + case IN_CFG_KEY_NAMES: + names = val; + count = size / sizeof(names[0]); if (count < dev->key_count) { lprintf("input: set_key_names: not enough keys\n"); @@ -569,6 +572,12 @@ int in_set_config(int dev_id, int what, const void *val, int size) dev->key_names = names; return 0; + case IN_CFG_DEFAULT_DEV: + /* just set last used dev, for now */ + menu_last_used_dev = dev_id; + return 0; + default: + break; } if (dev->probed) diff --git a/frontend/common/input.h b/frontend/common/input.h index 1f904250..da6349bf 100644 --- a/frontend/common/input.h +++ b/frontend/common/input.h @@ -61,6 +61,7 @@ enum { IN_CFG_KEY_NAMES, IN_CFG_ABS_DEAD_ZONE, /* dead zone for analog-digital mapping */ IN_CFG_ABS_AXIS_COUNT, /* number of abs axes (ro) */ + IN_CFG_DEFAULT_DEV, }; enum { diff --git a/frontend/menu.c b/frontend/menu.c index 57156d57..65f7b98a 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -1698,11 +1698,14 @@ static void menu_bios_warn(void) "The file is usually named SCPH1001.BIN,\n" "but other not compressed files can be\n" "used too.\n\n" - "Press (B) or (X) to continue"; + "Press %s or %s to continue"; + char tmp_msg[sizeof(msg) + 64]; + snprintf(tmp_msg, sizeof(tmp_msg), msg, + in_get_key_name(-1, -PBTN_MOK), in_get_key_name(-1, -PBTN_MBACK)); while (1) { - draw_menu_message(msg, NULL); + draw_menu_message(tmp_msg, NULL); inp = in_menu_wait(PBTN_MOK|PBTN_MBACK, 70); if (inp & (PBTN_MBACK|PBTN_MOK)) diff --git a/frontend/plat_omap.c b/frontend/plat_omap.c index 1a725ff5..d3ba5c98 100644 --- a/frontend/plat_omap.c +++ b/frontend/plat_omap.c @@ -221,12 +221,9 @@ void plat_init(void) return; -fail1: - vout_fbdev_finish(layer_fb); fail0: vout_fbdev_finish(main_fb); exit(1); - } void plat_finish(void) diff --git a/frontend/plat_pandora.c b/frontend/plat_pandora.c index 2522b0b0..20abd68a 100644 --- a/frontend/plat_pandora.c +++ b/frontend/plat_pandora.c @@ -17,6 +17,7 @@ #include #include "common/input.h" +#include "linux/in_evdev.h" #include "plugin_lib.h" #include "plat.h" #include "main.h" @@ -66,10 +67,14 @@ static const struct in_default_bind in_evdev_defbinds[] = { int plat_pandora_init(void) { + int gpiokeys_id; + in_evdev_init(in_evdev_defbinds); in_probe(); - in_set_config(in_name_to_id("evdev:gpio-keys"), IN_CFG_KEY_NAMES, + gpiokeys_id = in_name_to_id("evdev:gpio-keys"); + in_set_config(gpiokeys_id, IN_CFG_KEY_NAMES, pandora_gpio_keys, sizeof(pandora_gpio_keys)); + in_set_config(gpiokeys_id, IN_CFG_DEFAULT_DEV, NULL, 0); in_adev[0] = in_name_to_id("evdev:nub0"); in_adev[1] = in_name_to_id("evdev:nub1"); diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c index b9a27c37..9be12a5e 100644 --- a/frontend/plat_sdl.c +++ b/frontend/plat_sdl.c @@ -19,25 +19,26 @@ #include "revision.h" static const struct in_default_bind in_sdl_defbinds[] = { - { SDLK_UP, IN_BINDTYPE_PLAYER12, DKEY_UP }, - { SDLK_DOWN, IN_BINDTYPE_PLAYER12, DKEY_DOWN }, - { SDLK_LEFT, IN_BINDTYPE_PLAYER12, DKEY_LEFT }, - { SDLK_RIGHT, IN_BINDTYPE_PLAYER12, DKEY_RIGHT }, - { SDLK_d, IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE }, - { SDLK_z, IN_BINDTYPE_PLAYER12, DKEY_CROSS }, - { SDLK_x, IN_BINDTYPE_PLAYER12, DKEY_CIRCLE }, - { SDLK_s, IN_BINDTYPE_PLAYER12, DKEY_SQUARE }, - { SDLK_v, IN_BINDTYPE_PLAYER12, DKEY_START }, - { SDLK_c, IN_BINDTYPE_PLAYER12, DKEY_SELECT }, - { SDLK_w, IN_BINDTYPE_PLAYER12, DKEY_L1 }, - { SDLK_r, IN_BINDTYPE_PLAYER12, DKEY_R1 }, - { SDLK_e, IN_BINDTYPE_PLAYER12, DKEY_L2 }, - { SDLK_t, IN_BINDTYPE_PLAYER12, DKEY_R2 }, - { SDLK_ESCAPE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU }, - { 0, 0, 0 } + { SDLK_UP, IN_BINDTYPE_PLAYER12, DKEY_UP }, + { SDLK_DOWN, IN_BINDTYPE_PLAYER12, DKEY_DOWN }, + { SDLK_LEFT, IN_BINDTYPE_PLAYER12, DKEY_LEFT }, + { SDLK_RIGHT, IN_BINDTYPE_PLAYER12, DKEY_RIGHT }, + { SDLK_d, IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE }, + { SDLK_z, IN_BINDTYPE_PLAYER12, DKEY_CROSS }, + { SDLK_x, IN_BINDTYPE_PLAYER12, DKEY_CIRCLE }, + { SDLK_s, IN_BINDTYPE_PLAYER12, DKEY_SQUARE }, + { SDLK_v, IN_BINDTYPE_PLAYER12, DKEY_START }, + { SDLK_c, IN_BINDTYPE_PLAYER12, DKEY_SELECT }, + { SDLK_w, IN_BINDTYPE_PLAYER12, DKEY_L1 }, + { SDLK_r, IN_BINDTYPE_PLAYER12, DKEY_R1 }, + { SDLK_e, IN_BINDTYPE_PLAYER12, DKEY_L2 }, + { SDLK_t, IN_BINDTYPE_PLAYER12, DKEY_R2 }, + { SDLK_ESCAPE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU }, + { 0, 0, 0 } }; static SDL_Surface *screen; +static void *menubg_img; static int change_video_mode(int w, int h) { @@ -78,6 +79,10 @@ void plat_init(void) } SDL_WM_SetCaption("PCSX-ReARMed " REV, NULL); + menubg_img = malloc(640 * 512 * 2); + if (menubg_img == NULL) + goto fail; + in_sdl_init(in_sdl_defbinds); in_probe(); pl_rearmed_cbs.only_16bpp = 1; @@ -90,6 +95,8 @@ fail: void plat_finish(void) { + free(menubg_img); + menubg_img = NULL; SDL_Quit(); } @@ -103,6 +110,7 @@ void *plat_gvideo_set_mode(int *w, int *h, int *bpp) return screen->pixels; } +/* XXX: missing SDL_LockSurface() */ void *plat_gvideo_flip(void) { SDL_Flip(screen); @@ -115,6 +123,10 @@ void plat_gvideo_close(void) void plat_video_menu_enter(int is_rom_loaded) { + /* surface will be lost, must adjust pl_vout_buf for menu bg */ + memcpy(menubg_img, screen->pixels, screen->w * screen->h * 2); + pl_vout_buf = menubg_img; + change_video_mode(g_menuscreen_w, g_menuscreen_h); } diff --git a/plugins/gpulib/test.c b/plugins/gpulib/test.c index e523e209..80d0e9ef 100644 --- a/plugins/gpulib/test.c +++ b/plugins/gpulib/test.c @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) { unsigned int start_cycles; uint32_t *list; - int size; + int size, dummy; FILE *state_file; FILE *list_file; FILE *out_file; @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) start_cycles = pcnt_get(); - do_cmd_list(list, size / 4); + do_cmd_list(list, size / 4, &dummy); renderer_flush_queues(); printf("%u\n", pcnt_get() - start_cycles); -- 2.39.5