From 9351ac9fd956dd0d1f97566d85d75b4c33c068d2 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 7 May 2012 22:25:56 +0200 Subject: [PATCH] (PS3) Added extra buttons for PS3 port --- console/console_ext.c | 4 ++++ ps3/main.c | 4 ++++ ps3/menu-entries.h | 52 +++++++++++++++++++++++++++++++++++++++++++ ps3/menu.c | 13 +++++++++++ ps3/menu.h | 4 ++++ 5 files changed, 77 insertions(+) diff --git a/console/console_ext.c b/console/console_ext.c index faca0cbdc2..618e4b8259 100644 --- a/console/console_ext.c +++ b/console/console_ext.c @@ -228,6 +228,10 @@ char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][256] = { "X Button", /* RETRO_DEVICE_ID_JOYPAD_X */ "L Button", /* RETRO_DEVICE_ID_JOYPAD_L */ "R Button", /* RETRO_DEVICE_ID_JOYPAD_R */ + "L2 Button", /* RETRO_DEVICE_ID_JOYPAD_L2 */ + "R2 Button", /* RETRO_DEVICE_ID_JOYPAD_R2 */ + "L3 Button", /* RETRO_DEVICE_ID_JOYPAD_L3 */ + "R3 Button", /* RETRO_DEVICE_ID_JOYPAD_R3 */ }; #if defined(__CELLOS_LV2__) diff --git a/ps3/main.c b/ps3/main.c index e6c29b31b5..7a2cd078e5 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -111,6 +111,10 @@ static void set_default_settings(void) rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_X] = platform_keys[PS3_DEVICE_ID_JOYPAD_TRIANGLE].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L] = platform_keys[PS3_DEVICE_ID_JOYPAD_L1].joykey; rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R] = platform_keys[PS3_DEVICE_ID_JOYPAD_R1].joykey; + rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R2] = platform_keys[PS3_DEVICE_ID_JOYPAD_R2].joykey; + rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_R3] = platform_keys[PS3_DEVICE_ID_JOYPAD_R3].joykey; + rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L2] = platform_keys[PS3_DEVICE_ID_JOYPAD_L2].joykey; + rarch_default_keybind_lut[RETRO_DEVICE_ID_JOYPAD_L3] = platform_keys[PS3_DEVICE_ID_JOYPAD_L3].joykey; for(uint32_t x = 0; x < MAX_PLAYERS; x++) rarch_input_set_default_keybinds(x); diff --git a/ps3/menu-entries.h b/ps3/menu-entries.h index 6226619092..4c9b59c1e7 100644 --- a/ps3/menu-entries.h +++ b/ps3/menu-entries.h @@ -711,6 +711,58 @@ static item items_generalsettings[MAX_NO_OF_CONTROLS_SETTINGS] = 0.09f, 0.83f, }, + { + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2, + "L2 Button", + "", + 0.0f, + 0.0f, + YELLOW, + "", + WHITE, + 0.91f, + 0.09f, + 0.83f, + }, + { + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2, + "R2 Button", + "", + 0.0f, + 0.0f, + YELLOW, + "", + WHITE, + 0.91f, + 0.09f, + 0.83f, + }, + { + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3, + "L3 Button", + "", + 0.0f, + 0.0f, + YELLOW, + "", + WHITE, + 0.91f, + 0.09f, + 0.83f, + }, + { + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3, + "R3 Button", + "", + 0.0f, + 0.0f, + YELLOW, + "", + WHITE, + 0.91f, + 0.09f, + 0.83f, + }, { SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS, "SAVE CUSTOM CONTROLS", diff --git a/ps3/menu.c b/ps3/menu.c index 8fcbfedf45..a098061cce 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -730,6 +730,10 @@ static void set_setting_label(menu * menu_obj, uint64_t currentsetting) case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_X: case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L: case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R: + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2: + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2: + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3: + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3: { if(g_settings.input.binds[currently_selected_controller_menu][currentsetting-(FIRST_CONTROL_BIND)].joykey == rarch_default_keybind_lut[currentsetting-FIRST_CONTROL_BIND]) menu_obj->items[currentsetting].text_color = GREEN; @@ -1775,6 +1779,15 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R: set_keybind_digital(state, RETRO_DEVICE_ID_JOYPAD_R); break; + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2: + set_keybind_digital(state, RETRO_DEVICE_ID_JOYPAD_L2); + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2: + set_keybind_digital(state, RETRO_DEVICE_ID_JOYPAD_R2); + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3: + set_keybind_digital(state, RETRO_DEVICE_ID_JOYPAD_L3); + case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3: + set_keybind_digital(state, RETRO_DEVICE_ID_JOYPAD_R3); + break; case SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS: if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state) || CTRL_START(state)) { diff --git a/ps3/menu.h b/ps3/menu.h index 2c8dbd3df6..0a1ebbc96f 100644 --- a/ps3/menu.h +++ b/ps3/menu.h @@ -129,6 +129,10 @@ enum SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_X, SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L, SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R, + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L2, + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R2, + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_L3, + SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_R3, SETTING_CONTROLS_SAVE_CUSTOM_CONTROLS, SETTING_CONTROLS_DEFAULT_ALL };