X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fplat_pollux.c;h=33e94178eda709f56bfcdd8dbf3d5963d881e088;hp=252feba7d61ce9fa28927b210c5e726190c60552;hb=215ff9e69c0b845f24e7a3aa9faeef06d9276145;hpb=c82f907a99f7d0d3071471489d247f4b4394a8b7 diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c index 252feba7..33e94178 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 @@ -674,10 +704,15 @@ static int haptic_init(void) return 0; } -void plat_trigger_vibrate(int is_strong) +void plat_trigger_vibrate(int pad, int low, int high) { + int is_strong; int ret; + if (low == 0 && high == 0) + return; + is_strong = (high >= 0xf0); + if (hapticdev == -2) return; // it's broken if (hapticdev < 0) {