From bcfc48e326fd502e77654330ce4b902e7db8c2dc Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 9 Dec 2014 23:06:47 +0200 Subject: frontend: update libpicofe --- frontend/in_tsbutton.c | 6 +++--- frontend/libpicofe | 2 +- frontend/main.c | 6 +++++- frontend/plat_pandora.c | 32 +++++++++++++++++++++++++++++++- frontend/plat_pollux.c | 32 +++++++++++++++++++++++++++++++- frontend/plat_sdl.c | 37 ++++++++++++++++++++++++++++++++++++- 6 files changed, 107 insertions(+), 8 deletions(-) (limited to 'frontend') diff --git a/frontend/in_tsbutton.c b/frontend/in_tsbutton.c index aee6852..b3e4158 100644 --- a/frontend/in_tsbutton.c +++ b/frontend/in_tsbutton.c @@ -30,7 +30,7 @@ static const char * const in_tsbutton_keys[IN_TSBUTTON_COUNT] = { "TS1", "TS2", "TS3", "TS4", }; -static void in_tsbutton_probe(void) +static void in_tsbutton_probe(const in_drv_t *drv) { struct tsdev *dev = tsdev; if (dev == NULL) { @@ -43,7 +43,7 @@ static void in_tsbutton_probe(void) } static const char * const * -in_tsbutton_get_key_names(int *count) +in_tsbutton_get_key_names(const in_drv_t *drv, int *count) { *count = IN_TSBUTTON_COUNT; return in_tsbutton_keys; @@ -133,6 +133,6 @@ static const in_drv_t in_tsbutton_drv = { void in_tsbutton_init(void) { tsbutton_down_id = last_tsbutton_id = -1; - in_register_driver(&in_tsbutton_drv, NULL); + in_register_driver(&in_tsbutton_drv, NULL, NULL); } diff --git a/frontend/libpicofe b/frontend/libpicofe index da0cc55..d1453cf 160000 --- a/frontend/libpicofe +++ b/frontend/libpicofe @@ -1 +1 @@ -Subproject commit da0cc55643353ab15725194be64a3d8460fe48b1 +Subproject commit d1453cf7e6d5d6758cc5d72c6d3af7d37156bf72 diff --git a/frontend/main.c b/frontend/main.c index 2ef5f52..1caec4b 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -251,7 +251,11 @@ do_state_slot: } case SACTION_VOLUME_UP: case SACTION_VOLUME_DOWN: - plat_target_step_volume(emu_action == SACTION_VOLUME_UP); + { + static int volume; + plat_target_step_volume(&volume, + emu_action == SACTION_VOLUME_UP ? 1 : -1); + } return; case SACTION_MINIMIZE: if (GPU_close != NULL) diff --git a/frontend/plat_pandora.c b/frontend/plat_pandora.c index d44513c..3202c1d 100644 --- a/frontend/plat_pandora.c +++ b/frontend/plat_pandora.c @@ -45,12 +45,42 @@ static const struct in_default_bind in_evdev_defbinds[] = { { 0, 0, 0 } }; +static const struct menu_keymap key_pbtn_map[] = +{ + { KEY_UP, PBTN_UP }, + { KEY_DOWN, PBTN_DOWN }, + { KEY_LEFT, PBTN_LEFT }, + { KEY_RIGHT, PBTN_RIGHT }, + /* Pandora */ + { KEY_END, PBTN_MOK }, + { KEY_PAGEDOWN, PBTN_MBACK }, + { KEY_HOME, PBTN_MA2 }, + { KEY_PAGEUP, PBTN_MA3 }, + { KEY_LEFTCTRL, PBTN_MENU }, + { KEY_RIGHTSHIFT, PBTN_L }, + { KEY_RIGHTCTRL, PBTN_R }, + /* "normal" keyboards */ + { KEY_ENTER, PBTN_MOK }, + { KEY_ESC, PBTN_MBACK }, + { KEY_SEMICOLON, PBTN_MA2 }, + { KEY_APOSTROPHE, PBTN_MA3 }, + { KEY_BACKSLASH, PBTN_MENU }, + { KEY_LEFTBRACE, PBTN_L }, + { KEY_RIGHTBRACE, PBTN_R }, +}; + +static const struct in_pdata pandora_evdev_pdata = { + .defbinds = in_evdev_defbinds, + .key_map = key_pbtn_map, + .kmap_size = sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]), +}; + int plat_init(void) { plat_omap_init(); plat_target_init(); - in_evdev_init(in_evdev_defbinds); + in_evdev_init(&pandora_evdev_pdata); in_probe(); plat_target_setup_input(); diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c index 252feba..cb7afef 100644 --- a/frontend/plat_pollux.c +++ b/frontend/plat_pollux.c @@ -84,6 +84,36 @@ static const struct in_default_bind in_evdev_defbinds[] = { { 0, 0, 0 }, }; +static const struct menu_keymap key_pbtn_map[] = +{ + { KEY_UP, PBTN_UP }, + { KEY_DOWN, PBTN_DOWN }, + { KEY_LEFT, PBTN_LEFT }, + { KEY_RIGHT, PBTN_RIGHT }, + /* Caanoo */ + { BTN_THUMB2, PBTN_MOK }, + { BTN_THUMB, PBTN_MBACK }, + { BTN_TRIGGER, PBTN_MA2 }, + { BTN_TOP, PBTN_MA3 }, + { BTN_BASE, PBTN_MENU }, + { BTN_TOP2, PBTN_L }, + { BTN_PINKIE, PBTN_R }, + /* "normal" keyboards */ + { KEY_ENTER, PBTN_MOK }, + { KEY_ESC, PBTN_MBACK }, + { KEY_SEMICOLON, PBTN_MA2 }, + { KEY_APOSTROPHE, PBTN_MA3 }, + { KEY_BACKSLASH, PBTN_MENU }, + { KEY_LEFTBRACE, PBTN_L }, + { KEY_RIGHTBRACE, PBTN_R }, +}; + +static const struct in_pdata gp2x_evdev_pdata = { + .defbinds = in_evdev_defbinds, + .key_map = key_pbtn_map, + .kmap_size = sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]), +}; + static void *fb_flip(void) { memregl[0x406C>>2] = memregl[0x446C>>2] = fb_paddrs[fb_work_buf]; @@ -533,7 +563,7 @@ void plat_init(void) DMA_REG(0x0c) = 0x20000; // pending IRQ clear in_tsbutton_init(); - in_evdev_init(in_evdev_defbinds); + in_evdev_init(&gp2x_evdev_pdata); if (gp2x_dev_id == GP2X_DEV_CAANOO) caanoo_init(); else diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c index 247437e..4e77dc3 100644 --- a/frontend/plat_sdl.c +++ b/frontend/plat_sdl.c @@ -53,6 +53,41 @@ static const struct in_default_bind in_sdl_defbinds[] = { { 0, 0, 0 } }; +const struct menu_keymap in_sdl_key_map[] = +{ + { SDLK_UP, PBTN_UP }, + { SDLK_DOWN, PBTN_DOWN }, + { SDLK_LEFT, PBTN_LEFT }, + { SDLK_RIGHT, PBTN_RIGHT }, + { SDLK_RETURN, PBTN_MOK }, + { SDLK_ESCAPE, PBTN_MBACK }, + { SDLK_SEMICOLON, PBTN_MA2 }, + { SDLK_QUOTE, PBTN_MA3 }, + { SDLK_LEFTBRACKET, PBTN_L }, + { SDLK_RIGHTBRACKET, PBTN_R }, +}; + +const struct menu_keymap in_sdl_joy_map[] = +{ + { SDLK_UP, PBTN_UP }, + { SDLK_DOWN, PBTN_DOWN }, + { SDLK_LEFT, PBTN_LEFT }, + { SDLK_RIGHT, PBTN_RIGHT }, + /* joystick */ + { SDLK_WORLD_0, PBTN_MOK }, + { SDLK_WORLD_1, PBTN_MBACK }, + { SDLK_WORLD_2, PBTN_MA2 }, + { SDLK_WORLD_3, PBTN_MA3 }, +}; + +static const struct in_pdata in_sdl_platform_data = { + .defbinds = in_sdl_defbinds, + .key_map = in_sdl_key_map, + .kmap_size = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]), + .joy_map = in_sdl_joy_map, + .jmap_size = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]), +}; + static int psx_w, psx_h; static void *shadow_fb, *menubg_img; static int in_menu; @@ -122,7 +157,7 @@ void plat_init(void) exit(1); } - in_sdl_init(in_sdl_defbinds, plat_sdl_event_handler); + in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler); in_probe(); pl_rearmed_cbs.only_16bpp = 1; pl_rearmed_cbs.pl_get_layer_pos = get_layer_pos; -- cgit v1.2.3