HRESULT CRetroArchControls::OnInit(XUIMessageInit * pInitData, BOOL& bHandled) { unsigned i; int controlno; char buttons[RARCH_FIRST_META_KEY][128]; GetChildById(L"XuiControlsList", &m_controlslist); GetChildById(L"XuiBackButton", &m_back); GetChildById(L"XuiControlNoSlider", &m_controlnoslider); m_controlnoslider.SetValue(g_settings.input.currently_selected_controller_no); m_controlnoslider.GetValue(&controlno); for(i = 0; i < RARCH_FIRST_META_KEY; i++) { snprintf(buttons[i], sizeof(buttons[i]), "%s #%d: %s", rarch_input_get_default_keybind_name(i), controlno, rarch_input_find_platform_key_label(g_settings.input.binds[controlno][i].joykey)); convert_char_to_wchar(strw_buffer, buttons[i], sizeof(strw_buffer)); 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]]); 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"); return 0; }
HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled) { struct retro_system_info info; retro_get_system_info(&info); const char *id = info.library_name ? info.library_name : "Unknown"; GetChildById(L"XuiLogo", &m_logoimage); GetChildById(L"XuiBtnRomBrowser", &m_filebrowser); GetChildById(L"XuiBtnSettings", &m_settings); GetChildById(L"XuiBtnQuickMenu", &m_quick_menu); GetChildById(L"XuiBtnControls", &m_controls); GetChildById(L"XuiBtnQuit", &m_quit); GetChildById(L"XuiTxtTitle", &m_title); GetChildById(L"XuiTxtCoreText", &m_core); GetChildById(L"XuiBtnLibretroCore", &m_change_libretro_core); char core_text[256]; snprintf(core_text, sizeof(core_text), "%s %s", id, info.library_version); convert_char_to_wchar(strw_buffer, core_text, sizeof(strw_buffer)); m_core.SetText(strw_buffer); rarch_settings_create_menu_item_label_w(strw_buffer, S_LBL_RARCH_VERSION, sizeof(strw_buffer)); m_title.SetText(strw_buffer); g_extern.console.rmenu.input_loop = INPUT_LOOP_NONE; return 0; }
void rarch_settings_create_menu_item_label_w(wchar_t *strwbuf, unsigned setting, size_t size) { char str[PATH_MAX]; rarch_settings_create_menu_item_label(str, setting, sizeof(str)); convert_char_to_wchar(strwbuf, str, size); }
static void filebrowser_fetch_directory_entries(filebrowser_t * browser, uint64_t action, CXuiList * romlist, CXuiTextElement * rompath_title) { browser_update(browser, action, browser->extensions); convert_char_to_wchar(strw_buffer, filebrowser_get_current_dir(browser), sizeof(strw_buffer)); rompath_title->SetText(strw_buffer); romlist->DeleteItems(0, romlist->GetItemCount()); romlist->InsertItems(0, browser->current_dir.list->size); for(unsigned i = 0; i < browser->current_dir.list->size; i++) { char fname_tmp[256]; fill_pathname_base(fname_tmp, browser->current_dir.list->elems[i].data, sizeof(fname_tmp)); convert_char_to_wchar(strw_buffer, fname_tmp, sizeof(strw_buffer)); romlist->SetText(i, strw_buffer); } }
HRESULT CRetroArchControls::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled ) { int current_index, i, controlno; char buttons[RARCH_FIRST_META_KEY][128]; m_controlnoslider.GetValue(&controlno); if ( hObjPressed == m_controlslist) { current_index = m_controlslist.GetCurSel(); switch(current_index) { case SETTING_CONTROLS_DPAD_EMULATION: break; case SETTING_CONTROLS_DEFAULT_ALL: rarch_input_set_default_keybinds(0); for(i = 0; i < RARCH_FIRST_META_KEY; i++) { snprintf(buttons[i], sizeof(buttons[i]), "%s #%d: %s", rarch_input_get_default_keybind_name(i), controlno, rarch_input_find_platform_key_label( g_settings.input.binds[controlno][i].joykey)); convert_char_to_wchar(strw_buffer, buttons[i], sizeof(strw_buffer)); m_controlslist.SetText(i, strw_buffer); } break; default: rarch_input_set_keybind(controlno, KEYBIND_DEFAULT, current_index); snprintf(buttons[current_index], sizeof(buttons[current_index]), "%s #%d: %s", rarch_input_get_default_keybind_name(current_index), controlno, rarch_input_find_platform_key_label(g_settings.input.binds[controlno][current_index].joykey)); convert_char_to_wchar(strw_buffer, buttons[current_index], sizeof(strw_buffer)); m_controlslist.SetText(current_index, strw_buffer); break; } } snprintf(buttons[current_index], sizeof(buttons[current_index]), "D-Pad Emulation: %s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[controlno]]); 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"); bHandled = TRUE; return 0; }
HRESULT CRetroArchControls::OnControlNavigate( XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) { char button[128]; char buttons[RARCH_FIRST_META_KEY][128]; int controlno, i, current_index; current_index = m_controlslist.GetCurSel(); m_controlnoslider.GetValue(&controlno); for(i = 0; i < RARCH_FIRST_META_KEY; i++) { snprintf(buttons[i], sizeof(buttons[i]), "%s #%d: %s", rarch_input_get_default_keybind_name(i), controlno, rarch_input_find_platform_key_label(g_settings.input.binds[controlno][i].joykey)); convert_char_to_wchar(strw_buffer, buttons[i], sizeof(strw_buffer)); m_controlslist.SetText(i, strw_buffer); } switch(pControlNavigateData->nControlNavigate) { case XUI_CONTROL_NAVIGATE_LEFT: switch(current_index) { case SETTING_CONTROLS_DPAD_EMULATION: switch(g_settings.input.dpad_emulation[controlno]) { case DPAD_EMULATION_NONE: break; case DPAD_EMULATION_LSTICK: input_xinput.set_analog_dpad_mapping(0, DPAD_EMULATION_NONE, controlno); break; case DPAD_EMULATION_RSTICK: input_xinput.set_analog_dpad_mapping(0, DPAD_EMULATION_LSTICK, controlno); break; } break; case SETTING_CONTROLS_DEFAULT_ALL: break; default: rarch_input_set_keybind(controlno, KEYBIND_DECREMENT, current_index); snprintf(button, sizeof(button), "%s #%d: %s", rarch_input_get_default_keybind_name(current_index), controlno, rarch_input_find_platform_key_label(g_settings.input.binds[controlno][current_index].joykey)); convert_char_to_wchar(strw_buffer, button, sizeof(strw_buffer)); m_controlslist.SetText(current_index, strw_buffer); break; } break; case XUI_CONTROL_NAVIGATE_RIGHT: switch(current_index) { case SETTING_CONTROLS_DPAD_EMULATION: switch(g_settings.input.dpad_emulation[controlno]) { case DPAD_EMULATION_NONE: input_xinput.set_analog_dpad_mapping(0, DPAD_EMULATION_LSTICK, controlno); break; case DPAD_EMULATION_LSTICK: input_xinput.set_analog_dpad_mapping(0, DPAD_EMULATION_RSTICK, controlno); break; case DPAD_EMULATION_RSTICK: break; } break; case SETTING_CONTROLS_DEFAULT_ALL: break; default: rarch_input_set_keybind(controlno, KEYBIND_INCREMENT, current_index); snprintf(button, sizeof(button), "%s #%d: %s", rarch_input_get_default_keybind_name(current_index), controlno, rarch_input_find_platform_key_label(g_settings.input.binds[controlno][current_index].joykey)); convert_char_to_wchar(strw_buffer, button, sizeof(strw_buffer)); m_controlslist.SetText(current_index, strw_buffer); break; } break; case XUI_CONTROL_NAVIGATE_UP: case XUI_CONTROL_NAVIGATE_DOWN: break; } snprintf(button, sizeof(button), "D-Pad Emulation: %s", rarch_dpad_emulation_name_lut[g_settings.input.dpad_emulation[controlno]]); 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"); return 0; }