(Input) Remove dpad_emulation_name_lut

This commit is contained in:
twinaphex 2013-03-13 01:07:27 +01:00
parent 31998880f6
commit 713aa0ecbe
6 changed files with 49 additions and 14 deletions

View File

@ -48,12 +48,6 @@ char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][32] = {
"RetroPad Button R3", /* RETRO_DEVICE_ID_JOYPAD_R3 */
};
char rarch_dpad_emulation_name_lut[KEYBIND_DEFAULT][32] = {
"None", /* DPAD_EMULATION_NONE */
"Left Stick", /* DPAD_EMULATION_LSTICK */
"Right Stick", /* DPAD_EMULATION_RSTICK */
};
extern const struct platform_bind platform_keys[];
extern const unsigned int platform_keys_size;

View File

@ -28,7 +28,6 @@ enum keybind_set_id
};
extern char rarch_default_libretro_keybind_name_lut[RARCH_FIRST_META_KEY][32];
extern char rarch_dpad_emulation_name_lut[KEYBIND_DEFAULT][32];
const char *rarch_input_find_platform_key_label(uint64_t joykey);
void rarch_input_set_default_keybinds(unsigned player);

View File

@ -299,6 +299,6 @@ void menu_settings_create_menu_item_label(char * str, unsigned setting, size_t s
break;
case S_LBL_REWIND_GRANULARITY:
snprintf(str, size, "Rewind granularity: %d", g_settings.rewind_granularity);
break;
break;
}
}

View File

@ -514,7 +514,18 @@ static void render_text(rgui_handle_t *rgui)
#endif
#ifdef RARCH_CONSOLE
case RGUI_SETTINGS_BIND_DPAD_EMULATION:
snprintf(type_str, sizeof(type_str), "%s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[port]]);
switch(g_settings.input.dpad_emulation[port])
{
case DPAD_EMULATION_NONE:
snprintf(type_str, sizeof(type_str), "None");
break;
case DPAD_EMULATION_LSTICK:
snprintf(type_str, sizeof(type_str), "Left Stick");
break;
case DPAD_EMULATION_RSTICK:
snprintf(type_str, sizeof(type_str), "Right Stick");
break;
}
break;
case RGUI_SETTINGS_BIND_UP:
case RGUI_SETTINGS_BIND_DOWN:

View File

@ -569,8 +569,21 @@ static void populate_setting_item(void *data, unsigned input)
break;
case SETTING_DPAD_EMULATION:
snprintf(current_item->text, sizeof(current_item->text), "D-Pad Emulation");
snprintf(current_item->comment, sizeof(current_item->comment), "[%s] from Controller %d is mapped to D-pad.", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[currently_selected_controller_menu]], currently_selected_controller_menu+1);
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[currently_selected_controller_menu]]);
switch(g_settings.input.dpad_emulation[currently_selected_controller_menu])
{
case DPAD_EMULATION_NONE:
snprintf(current_item->comment, sizeof(current_item->comment), "[%s] from Controller %d is mapped to D-pad.", "None", currently_selected_controller_menu+1);
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "None");
break;
case DPAD_EMULATION_LSTICK:
snprintf(current_item->comment, sizeof(current_item->comment), "[%s] from Controller %d is mapped to D-pad.", "Left Stick", currently_selected_controller_menu+1);
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Left Stick");
break;
case DPAD_EMULATION_RSTICK:
snprintf(current_item->comment, sizeof(current_item->comment), "[%s] from Controller %d is mapped to D-pad.", "Right Stick", currently_selected_controller_menu+1);
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "Right Stick");
break;
}
break;
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_B:
case SETTING_CONTROLS_RETRO_DEVICE_ID_JOYPAD_Y:

View File

@ -381,6 +381,22 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
return 0;
}
static void set_dpad_emulation_label(unsigned port, char *str, size_t sizeof_str)
{
switch(g_settings.input.dpad_emulation[port])
{
case DPAD_EMULATION_NONE:
snprintf(str, sizeof_str, "D-Pad Emulation: None");
break;
case DPAD_EMULATION_LSTICK:
snprintf(str, sizeof_str, "D-Pad Emulation: Left Stick");
break;
case DPAD_EMULATION_RSTICK:
snprintf(str, sizeof_str, "D-Pad Emulation: Right Stick");
break;
}
}
HRESULT CRetroArchControls::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
unsigned i;
@ -403,7 +419,7 @@ HRESULT CRetroArchControls::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
m_controlslist.SetText(i, strw_buffer);
}
snprintf(buttons[0], sizeof(buttons[0]), "D-Pad Emulation: %s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[controlno]]);
set_dpad_emulation_label(controlno, buttons[0], sizeof(buttons[0]));
convert_char_to_wchar(strw_buffer, buttons[0], sizeof(strw_buffer));
m_controlslist.SetText(SETTING_CONTROLS_DPAD_EMULATION, strw_buffer);
m_controlslist.SetText(SETTING_CONTROLS_DEFAULT_ALL, L"Reset all buttons to default");
@ -489,7 +505,8 @@ HRESULT CRetroArchControls::OnControlNavigate(
break;
}
snprintf(button, sizeof(button), "D-Pad Emulation: %s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[controlno]]);
set_dpad_emulation_label(controlno, button, sizeof(button));
convert_char_to_wchar(strw_buffer, button, sizeof(strw_buffer));
m_controlslist.SetText(SETTING_CONTROLS_DPAD_EMULATION, strw_buffer);
m_controlslist.SetText(SETTING_CONTROLS_DEFAULT_ALL, L"Reset all buttons to default");
@ -534,7 +551,8 @@ HRESULT CRetroArchControls::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
}
}
snprintf(buttons[current_index], sizeof(buttons[current_index]), "D-Pad Emulation: %s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[controlno]]);
set_dpad_emulation_label(controlno, buttons[current_index], sizeof(buttons[curent_index]));
convert_char_to_wchar(strw_buffer, buttons[current_index], sizeof(strw_buffer));
m_controlslist.SetText(SETTING_CONTROLS_DPAD_EMULATION, strw_buffer);
m_controlslist.SetText(SETTING_CONTROLS_DEFAULT_ALL, L"Reset all buttons to default");