diff --git a/3rdparty/include/IconsPromptFont.h b/3rdparty/include/IconsPromptFont.h new file mode 100644 index 0000000000..d627eee353 --- /dev/null +++ b/3rdparty/include/IconsPromptFont.h @@ -0,0 +1,328 @@ +#pragma once +#define ICON_PF_EXCHANGE "\xE2\x86\x94" +#define ICON_PF_REVERSE "\xE2\x86\x95" +#define ICON_PF_LEFT_TRIGGER_LT "\xE2\x86\x96" +#define ICON_PF_RIGHT_TRIGGER_RT "\xE2\x86\x97" +#define ICON_PF_LEFT_SHOULDER_LB "\xE2\x86\x98" +#define ICON_PF_RIGHT_SHOULDER_RB "\xE2\x86\x99" +#define ICON_PF_LEFT_TRIGGER_ZL "\xE2\x86\x9A" +#define ICON_PF_RIGHT_TRIGGER_ZR "\xE2\x86\x9B" +#define ICON_PF_LEFT_SHOULDER_L "\xE2\x86\x9C" +#define ICON_PF_RIGHT_SHOULDER_R "\xE2\x86\x9D" +#define ICON_PF_DPAD_LEFT "\xE2\x86\x9E" +#define ICON_PF_DPAD_UP "\xE2\x86\x9F" +#define ICON_PF_DPAD_RIGHT "\xE2\x86\xA0" +#define ICON_PF_DPAD_DOWN "\xE2\x86\xA1" +#define ICON_PF_DPAD_LEFT_RIGHT "\xE2\x86\xA2" +#define ICON_PF_DPAD_UP_DOWN "\xE2\x86\xA3" +#define ICON_PF_BUTTON_LEFT_X "\xE2\x86\xA4" +#define ICON_PF_BUTTON_UP_Y "\xE2\x86\xA5" +#define ICON_PF_BUTTON_RIGHT_B "\xE2\x86\xA6" +#define ICON_PF_BUTTON_DOWN_A "\xE2\x86\xA7" +#define ICON_PF_LEFT_ANALOG_CLOCKWISE "\xE2\x86\xA9" +#define ICON_PF_LEFT_ANALOG_COUNTER "\xE2\x86\xAA" +#define ICON_PF_RIGHT_ANALOG_CLOCKWISE "\xE2\x86\xAB" +#define ICON_PF_RIGHT_ANALOG_COUNTER "\xE2\x86\xAC" +#define ICON_PF_BOTH_ANALOG_CLOCKWISE "\xE2\x86\xAD" +#define ICON_PF_BOTH_ANALOG_COUNTER "\xE2\x86\xAE" +#define ICON_PF_LEFT_SHOULDER_L1 "\xE2\x86\xB0" +#define ICON_PF_RIGHT_SHOULDER_R1 "\xE2\x86\xB1" +#define ICON_PF_LEFT_TRIGGER_L2 "\xE2\x86\xB2" +#define ICON_PF_RIGHT_TRIGGER_R2 "\xE2\x86\xB3" +#define ICON_PF_DPAD_LEFT_DOWN "\xE2\x86\xB4" +#define ICON_PF_DPAD_UP_RIGHT "\xE2\x86\xB5" +#define ICON_PF_ANALOG_CLOCKWISE "\xE2\x86\xB6" +#define ICON_PF_ANALOG_COUNTER "\xE2\x86\xB7" +#define ICON_PF_BOTH_ANALOG_CLICK "\xE2\x86\xB9" +#define ICON_PF_LEFT_ANALOG_CLICK "\xE2\x86\xBA" +#define ICON_PF_RIGHT_ANALOG_CLICK "\xE2\x86\xBB" +#define ICON_PF_LEFT_ANALOG_LEFT "\xE2\x86\xBC" +#define ICON_PF_RIGHT_ANALOG_LEFT "\xE2\x86\xBD" +#define ICON_PF_LEFT_ANALOG_UP "\xE2\x86\xBE" +#define ICON_PF_RIGHT_ANALOG_UP "\xE2\x86\xBF" +#define ICON_PF_LEFT_ANALOG_RIGHT "\xE2\x87\x80" +#define ICON_PF_RIGHT_ANALOG_RIGHT "\xE2\x87\x81" +#define ICON_PF_LEFT_ANALOG_DOWN "\xE2\x87\x82" +#define ICON_PF_RIGHT_ANALOG_DOWN "\xE2\x87\x83" +#define ICON_PF_LEFT_ANALOG_LEFT_RIGHT "\xE2\x87\x84" +#define ICON_PF_LEFT_ANALOG_UP_DOWN "\xE2\x87\x85" +#define ICON_PF_RIGHT_ANALOG_LEFT_RIGHT "\xE2\x87\x86" +#define ICON_PF_ANALOG_LEFT "\xE2\x87\x87" +#define ICON_PF_ANALOG_UP "\xE2\x87\x88" +#define ICON_PF_ANALOG_RIGHT "\xE2\x87\x89" +#define ICON_PF_ANALOG_DOWN "\xE2\x87\x8A" +#define ICON_PF_LEFT_ANALOG "\xE2\x87\x8B" +#define ICON_PF_RIGHT_ANALOG "\xE2\x87\x8C" +#define ICON_PF_DPAD "\xE2\x87\x8E" +#define ICON_PF_BUTTON_X "\xE2\x87\x90" +#define ICON_PF_BUTTON_Y "\xE2\x87\x91" +#define ICON_PF_BUTTON_B "\xE2\x87\x92" +#define ICON_PF_BUTTON_A "\xE2\x87\x93" +#define ICON_PF_ANALOG_LEFT_RIGHT "\xE2\x87\x94" +#define ICON_PF_ANALOG_UP_DOWN "\xE2\x87\x95" +#define ICON_PF_ANALOG_UP_LEFT "\xE2\x87\x96" +#define ICON_PF_ANALOG_UP_RIGHT "\xE2\x87\x97" +#define ICON_PF_ANALOG_DOWN_RIGHT "\xE2\x87\x98" +#define ICON_PF_ANALOG_DOWN_LEFT "\xE2\x87\x99" +#define ICON_PF_LEFT_ANALOG_TOUCH "\xE2\x87\x9A" +#define ICON_PF_RIGHT_ANALOG_TOUCH "\xE2\x87\x9B" +#define ICON_PF_LEFT_TRIGGER_PULL "\xE2\x87\x9C" +#define ICON_PF_RIGHT_TRIGGER_PULL "\xE2\x87\x9D" +#define ICON_PF_DPAD_RIGHT_DOWN "\xE2\x87\x9E" +#define ICON_PF_DPAD_LEFT_UP "\xE2\x87\x9F" +#define ICON_PF_BUTTON_SQUARE "\xE2\x87\xA0" +#define ICON_PF_BUTTON_TRIANGLE "\xE2\x87\xA1" +#define ICON_PF_BUTTON_CIRCLE "\xE2\x87\xA2" +#define ICON_PF_BUTTON_CROSS "\xE2\x87\xA3" +#define ICON_PF_STEAM_MENU "\xE2\x87\xA4" +#define ICON_PF_OPTIONS_MENU "\xE2\x87\xA5" +#define ICON_PF_DUALSHOCK_SHARE "\xE2\x87\xA6" +#define ICON_PF_DUALSHOCK_TOUCHPAD "\xE2\x87\xA7" +#define ICON_PF_DUALSHOCK_OPTIONS "\xE2\x87\xA8" +#define ICON_PF_GAMECUBE_Z "\xE2\x87\xA9" +#define ICON_PF_BACK_TRIGGER_Z "\xE2\x87\xAA" +#define ICON_PF_BUTTON_C "\xE2\x87\xAB" +#define ICON_PF_BUTTON_Z "\xE2\x87\xAC" +#define ICON_PF_BUTTON_ALT_1 "\xE2\x87\xAD" +#define ICON_PF_BUTTON_ALT_2 "\xE2\x87\xAE" +#define ICON_PF_LEFT_ANALOG_ANY "\xE2\x87\xB1" +#define ICON_PF_RIGHT_ANALOG_ANY "\xE2\x87\xB2" +#define ICON_PF_ANALOG_ANY "\xE2\x87\xB3" +#define ICON_PF_RIGHT_ANALOG_UP_DOWN "\xE2\x87\xB5" +#define ICON_PF_SELECT_SHARE "\xE2\x87\xB7" +#define ICON_PF_START "\xE2\x87\xB8" +#define ICON_PF_HOME_MENU "\xE2\x87\xB9" +#define ICON_PF_SHARE_CAPTURE "\xE2\x87\xBA" +#define ICON_PF_BURGER_MENU "\xE2\x87\xBB" +#define ICON_PF_MINUS "\xE2\x87\xBD" +#define ICON_PF_PLUS "\xE2\x87\xBE" +#define ICON_PF_JOYCON_DPAD_LEFT "\xE2\x87\xBF" +#define ICON_PF_JOYCON_DPAD_UP "\xE2\x88\x80" +#define ICON_PF_JOYCON_DPAD_RIGHT "\xE2\x88\x81" +#define ICON_PF_JOYCON_DPAD_DOWN "\xE2\x88\x82" +#define ICON_PF_JOYCON_SL "\xE2\x88\x83" +#define ICON_PF_JOYCON_SR "\xE2\x88\x84" +#define ICON_PF_LENOVO_LEGION_QUICK_SETTINGS "\xE2\x88\x85" +#define ICON_PF_DUALSENSE_SHARE "\xE2\x88\x86" +#define ICON_PF_DUALSENSE_TOUCHPAD "\xE2\x88\x87" +#define ICON_PF_DUALSENSE_OPTIONS "\xE2\x88\x88" +#define ICON_PF_AYANEO_LC "\xE2\x88\x89" +#define ICON_PF_AYANEO_RC "\xE2\x88\x8A" +#define ICON_PF_AYANEO_WAVE "\xE2\x88\x8B" +#define ICON_PF_AYN_HOME "\xE2\x88\x8C" +#define ICON_PF_AYN_LCC "\xE2\x88\x8D" +#define ICON_PF_GPD_C1 "\xE2\x88\x8E" +#define ICON_PF_GPD_C2 "\xE2\x88\x8F" +#define ICON_PF_ONEXPLAYER_KEYBOARD "\xE2\x88\x90" +#define ICON_PF_ONEXPLAYER_TURBO "\xE2\x88\x91" +#define ICON_PF_ROG_ALLY_M1 "\xE2\x88\x92" +#define ICON_PF_ROG_ALLY_M2 "\xE2\x88\x93" +#define ICON_PF_LEFT_TRACKPAD_ANY "\xE2\x89\xA4" +#define ICON_PF_RIGHT_TRACKPAD_ANY "\xE2\x89\xA5" +#define ICON_PF_LEFT_TRACKPAD_CLICK "\xE2\x89\xA6" +#define ICON_PF_RIGHT_TRACKPAD_CLICK "\xE2\x89\xA7" +#define ICON_PF_LEFT_TRACKPAD_TOUCH "\xE2\x89\xA8" +#define ICON_PF_RIGHT_TRACKPAD_TOUCH "\xE2\x89\xA9" +#define ICON_PF_LEFT_TRACKPAD_LEFT "\xE2\x89\xAE" +#define ICON_PF_RIGHT_TRACKPAD_LEFT "\xE2\x89\xAF" +#define ICON_PF_LEFT_TRACKPAD_UP "\xE2\x89\xB0" +#define ICON_PF_RIGHT_TRACKPAD_UP "\xE2\x89\xB1" +#define ICON_PF_LEFT_TRACKPAD_RIGHT "\xE2\x89\xB2" +#define ICON_PF_RIGHT_TRACKPAD_RIGHT "\xE2\x89\xB3" +#define ICON_PF_LEFT_TRACKPAD_DOWN "\xE2\x89\xB4" +#define ICON_PF_RIGHT_TRACKPAD_DOWN "\xE2\x89\xB5" +#define ICON_PF_STEAMDECK_L4 "\xE2\x89\xB6" +#define ICON_PF_STEAMDECK_R4 "\xE2\x89\xB7" +#define ICON_PF_STEAMDECK_L5 "\xE2\x89\xB8" +#define ICON_PF_STEAMDECK_R5 "\xE2\x89\xB9" +#define ICON_PF_XBOX_DPAD_LEFT "\xE2\x89\xBA" +#define ICON_PF_XBOX_DPAD_UP "\xE2\x89\xBB" +#define ICON_PF_XBOX_DPAD_RIGHT "\xE2\x89\xBC" +#define ICON_PF_XBOX_DPAD_DOWN "\xE2\x89\xBD" +#define ICON_PF_XBOX_DPAD_LEFT_RIGHT "\xE2\x89\xBE" +#define ICON_PF_XBOX_DPAD_UP_DOWN "\xE2\x89\xBF" +#define ICON_PF_XBOX_DPAD_LEFT_UP "\xE2\x8A\x80" +#define ICON_PF_XBOX_DPAD_RIGHT_UP "\xE2\x8A\x81" +#define ICON_PF_XBOX_DPAD_LEFT_DOWN "\xE2\x8A\x82" +#define ICON_PF_XBOX_DPAD_RIGHT_DOWN "\xE2\x8A\x83" +#define ICON_PF_XBOX_DPAD "\xE2\x8A\x84" +#define ICON_PF_PIN "\xE2\x8C\x96" +#define ICON_PF_TABS "\xE2\x8F\x8D" +#define ICON_PF_BACK "\xE2\x8F\x8E" +#define ICON_PF_HOME_SCREEN "\xE2\x8F\x8F" +#define ICON_PF_HORIZONTAL_DOTS "\xE2\x8F\x90" +#define ICON_PF_VERTICAL_DOTS "\xE2\x8F\x91" +#define ICON_PF_HAMBURGER_MENU "\xE2\x8F\x92" +#define ICON_PF_ARROW_LEFT "\xE2\x8F\xB4" +#define ICON_PF_ARROW_UP "\xE2\x8F\xB5" +#define ICON_PF_ARROW_RIGHT "\xE2\x8F\xB6" +#define ICON_PF_ARROW_DOWN "\xE2\x8F\xB7" +#define ICON_PF_WASD "\xE2\x90\xA3" +#define ICON_PF_ARROW_KEYS "\xE2\x90\xA4" +#define ICON_PF_IJKL "\xE2\x90\xA5" +#define ICON_PF_FN "\xE2\x90\xA6" +#define ICON_PF_CTRL "\xE2\x90\xA7" +#define ICON_PF_ALT "\xE2\x90\xA8" +#define ICON_PF_SHIFT "\xE2\x90\xA9" +#define ICON_PF_SUPER "\xE2\x90\xAA" +#define ICON_PF_TAB "\xE2\x90\xAB" +#define ICON_PF_CAPS "\xE2\x90\xAC" +#define ICON_PF_BACKSPACE "\xE2\x90\xAD" +#define ICON_PF_ENTER "\xE2\x90\xAE" +#define ICON_PF_ESC "\xE2\x90\xAF" +#define ICON_PF_PRTSC "\xE2\x90\xB0" +#define ICON_PF_SCRLK "\xE2\x90\xB1" +#define ICON_PF_PAUSE "\xE2\x90\xB2" +#define ICON_PF_NUMLOCK "\xE2\x90\xB3" +#define ICON_PF_INSERT "\xE2\x90\xB4" +#define ICON_PF_HOME "\xE2\x90\xB5" +#define ICON_PF_PAGE_UP "\xE2\x90\xB6" +#define ICON_PF_DELETE "\xE2\x90\xB7" +#define ICON_PF_END "\xE2\x90\xB8" +#define ICON_PF_PAGE_DOWN "\xE2\x90\xB9" +#define ICON_PF_SPACE "\xE2\x90\xBA" +#define ICON_PF_GAMEPAD "\xE2\x90\xBC" +#define ICON_PF_KEYBOARD "\xE2\x90\xBD" +#define ICON_PF_MOUSE "\xE2\x90\xBE" +#define ICON_PF_MOUSE_AND_KEYBOARD "\xE2\x90\xBF" +#define ICON_PF_F1 "\xE2\x91\xA0" +#define ICON_PF_F2 "\xE2\x91\xA1" +#define ICON_PF_F3 "\xE2\x91\xA2" +#define ICON_PF_F4 "\xE2\x91\xA3" +#define ICON_PF_F5 "\xE2\x91\xA4" +#define ICON_PF_F6 "\xE2\x91\xA5" +#define ICON_PF_F7 "\xE2\x91\xA6" +#define ICON_PF_F8 "\xE2\x91\xA7" +#define ICON_PF_F9 "\xE2\x91\xA8" +#define ICON_PF_F10 "\xE2\x91\xA9" +#define ICON_PF_F11 "\xE2\x91\xAA" +#define ICON_PF_F12 "\xE2\x91\xAB" +#define ICON_PF_EMPTY_KEYCAP "\xE2\x92\x8F" +#define ICON_PF_1 "\xE2\x93\xB5" +#define ICON_PF_2 "\xE2\x93\xB6" +#define ICON_PF_3 "\xE2\x93\xB7" +#define ICON_PF_4 "\xE2\x93\xB8" +#define ICON_PF_5 "\xE2\x93\xB9" +#define ICON_PF_6 "\xE2\x93\xBA" +#define ICON_PF_7 "\xE2\x93\xBB" +#define ICON_PF_8 "\xE2\x93\xBC" +#define ICON_PF_9 "\xE2\x93\xBD" +#define ICON_PF_0 "\xE2\x93\xBF" +#define ICON_PF_STAR "\xE2\x98\x85" +#define ICON_PF_SKULL "\xE2\x98\xA0" +#define ICON_PF_FROWN "\xE2\x98\xB9" +#define ICON_PF_SMILE "\xE2\x98\xBA" +#define ICON_PF_EMPTY_HEART "\xE2\x99\xA1" +#define ICON_PF_HEART "\xE2\x99\xA5" +#define ICON_PF_D4 "\xE2\x99\xB3" +#define ICON_PF_D6 "\xE2\x99\xB4" +#define ICON_PF_D8 "\xE2\x99\xB5" +#define ICON_PF_D10 "\xE2\x99\xB6" +#define ICON_PF_D12 "\xE2\x99\xB7" +#define ICON_PF_D20 "\xE2\x99\xB8" +#define ICON_PF_D6_1 "\xE2\x9A\x80" +#define ICON_PF_D6_2 "\xE2\x9A\x81" +#define ICON_PF_D6_3 "\xE2\x9A\x82" +#define ICON_PF_D6_4 "\xE2\x9A\x83" +#define ICON_PF_D6_5 "\xE2\x9A\x84" +#define ICON_PF_D6_6 "\xE2\x9A\x85" +#define ICON_PF_FLAG "\xE2\x9A\x91" +#define ICON_PF_GEARS_OPTIONS_SETTINGS "\xE2\x9A\x99" +#define ICON_PF_CROSS "\xE2\x9C\x97" +#define ICON_PF_QUESTION "\xE2\x9D\x93" +#define ICON_PF_EXCLAMATION "\xE2\x9D\x97" +#define ICON_PF_MOUSE_BUTTON_1 "\xE2\x9E\x8A" +#define ICON_PF_MOUSE_BUTTON_2 "\xE2\x9E\x8B" +#define ICON_PF_MOUSE_BUTTON_3 "\xE2\x9E\x8C" +#define ICON_PF_MOUSE_BUTTON_4 "\xE2\x9E\x8D" +#define ICON_PF_MOUSE_BUTTON_5 "\xE2\x9E\x8E" +#define ICON_PF_MOUSE_BUTTON_6 "\xE2\x9E\x8F" +#define ICON_PF_MOUSE_BUTTON_7 "\xE2\x9E\x90" +#define ICON_PF_MOUSE_BUTTON_8 "\xE2\x9E\x91" +#define ICON_PF_SCROLL_UP "\xE2\x9F\xB0" +#define ICON_PF_SCROLL_DOWN "\xE2\x9F\xB1" +#define ICON_PF_LEFT_CLICK "\xE2\x9F\xB5" +#define ICON_PF_RIGHT_CLICK "\xE2\x9F\xB6" +#define ICON_PF_MIDDLE_CLICK "\xE2\x9F\xB7" +#define ICON_PF_MOUSE_LEFT_RIGHT "\xE2\x9F\xBA" +#define ICON_PF_MOUSE_UP_DOWN "\xE2\x9F\xBB" +#define ICON_PF_MOUSE_ANY "\xE2\x9F\xBC" +#define ICON_PF_BOX_CRATE "\xE2\xAC\x9B" +#define ICON_PF_PLAYSTATION "\xEE\x80\x80" +#define ICON_PF_XBOX "\xEE\x80\x81" +#define ICON_PF_NINTENDO_SWITCH "\xEE\x80\x82" +#define ICON_PF_AYANEO "\xEE\x80\x83" +#define ICON_PF_LENOVO_LEGION "\xEE\x80\x84" +#define ICON_PF_ROG_ALLY_ARMOURY "\xEE\x80\x85" +#define ICON_PF_ROG_ALLOY_COMMAND "\xEE\x80\x86" +#define ICON_PF_APPLE_MAC "\xEE\x80\x87" +#define ICON_PF_WINDOWS "\xEE\x80\x88" +#define ICON_PF_LINUX "\xEE\x80\x89" +#define ICON_PF_BSD "\xEE\x80\x8A" +#define ICON_PF_KEY_0 "\xEF\xBC\x90" +#define ICON_PF_KEY_1 "\xEF\xBC\x91" +#define ICON_PF_KEY_2 "\xEF\xBC\x92" +#define ICON_PF_KEY_3 "\xEF\xBC\x93" +#define ICON_PF_KEY_4 "\xEF\xBC\x94" +#define ICON_PF_KEY_5 "\xEF\xBC\x95" +#define ICON_PF_KEY_6 "\xEF\xBC\x96" +#define ICON_PF_KEY_7 "\xEF\xBC\x97" +#define ICON_PF_KEY_8 "\xEF\xBC\x98" +#define ICON_PF_KEY_9 "\xEF\xBC\x99" +#define ICON_PF_KEY_A "\xEF\xBC\xA1" +#define ICON_PF_KEY_B "\xEF\xBC\xA2" +#define ICON_PF_KEY_C "\xEF\xBC\xA3" +#define ICON_PF_KEY_D "\xEF\xBC\xA4" +#define ICON_PF_KEY_E "\xEF\xBC\xA5" +#define ICON_PF_KEY_F "\xEF\xBC\xA6" +#define ICON_PF_KEY_G "\xEF\xBC\xA7" +#define ICON_PF_KEY_H "\xEF\xBC\xA8" +#define ICON_PF_KEY_I "\xEF\xBC\xA9" +#define ICON_PF_KEY_J "\xEF\xBC\xAA" +#define ICON_PF_KEY_K "\xEF\xBC\xAB" +#define ICON_PF_KEY_L "\xEF\xBC\xAC" +#define ICON_PF_KEY_M "\xEF\xBC\xAD" +#define ICON_PF_KEY_N "\xEF\xBC\xAE" +#define ICON_PF_KEY_O "\xEF\xBC\xAF" +#define ICON_PF_KEY_P "\xEF\xBC\xB0" +#define ICON_PF_KEY_Q "\xEF\xBC\xB1" +#define ICON_PF_KEY_R "\xEF\xBC\xB2" +#define ICON_PF_KEY_S "\xEF\xBC\xB3" +#define ICON_PF_KEY_T "\xEF\xBC\xB4" +#define ICON_PF_KEY_U "\xEF\xBC\xB5" +#define ICON_PF_KEY_V "\xEF\xBC\xB6" +#define ICON_PF_KEY_W "\xEF\xBC\xB7" +#define ICON_PF_KEY_X "\xEF\xBC\xB8" +#define ICON_PF_KEY_Y "\xEF\xBC\xB9" +#define ICON_PF_KEY_Z "\xEF\xBC\xBA" +#define ICON_PF_HEADPHONES "\xF0\x9F\x8E\xA7" +#define ICON_PF_MUSIC "\xF0\x9F\x8E\xB6" +#define ICON_PF_FISH "\xF0\x9F\x90\x9F" +#define ICON_PF_DANCE_PAD "\xF0\x9F\x92\x83" +#define ICON_PF_LAPTOP "\xF0\x9F\x92\xBB" +#define ICON_PF_DISKETTE "\xF0\x9F\x92\xBE" +#define ICON_PF_WRITE "\xF0\x9F\x93\x9D" +#define ICON_PF_PHONE "\xF0\x9F\x93\xB1" +#define ICON_PF_CAMERA "\xF0\x9F\x93\xB7" +#define ICON_PF_SPEAKER "\xF0\x9F\x94\x88" +#define ICON_PF_LIGHT_GUN "\xF0\x9F\x94\xAB" +#define ICON_PF_SFX_SOUND_EFFECT_NOISE "\xF0\x9F\x95\xAC" +#define ICON_PF_STEERING_WHEEL "\xF0\x9F\x95\xB8" +#define ICON_PF_FIGHT_STICK_JOYSTICK "\xF0\x9F\x95\xB9" +#define ICON_PF_VR_HEADSET "\xF0\x9F\x95\xBB" +#define ICON_PF_VR_CONTROLLER "\xF0\x9F\x95\xBC" +#define ICON_PF_FLIGHT_STICK "\xF0\x9F\x95\xBD" +#define ICON_PF_CPU_PROCESSOR "\xF0\x9F\x96\xA5" +#define ICON_PF_WEB_INTERNET_LINK "\xF0\x9F\x96\xA7" +#define ICON_PF_GPU_GRAPHICS_CARD "\xF0\x9F\x96\xA8" +#define ICON_PF_RAM_MEMORY "\xF0\x9F\x96\xAA" +#define ICON_PF_USB_STICK "\xF0\x9F\x96\xAB" +#define ICON_PF_DATABASE "\xF0\x9F\x96\xAC" +#define ICON_PF_HARD_DISK_DRIVE "\xF0\x9F\x96\xB4" +#define ICON_PF_SCREEN_VIDEO "\xF0\x9F\x96\xB5" +#define ICON_PF_TEXT_ENTRY_EDIT "\xF0\x9F\x96\xB9" +#define ICON_PF_SPEAKING_VOICE "\xF0\x9F\x97\xA3" +#define ICON_PF_LANGUAGE "\xF0\x9F\x97\xA9" +#define ICON_PF_EXIT_QUIT_LEAVE "\xF0\x9F\x9A\xAA" +#define ICON_PF_INFORMATION "\xF0\x9F\x9B\x88" +#define ICON_PF_SHOPPING_CART "\xF0\x9F\x9B\x92" diff --git a/bin/resources/fonts/promptfont-license b/bin/resources/fonts/promptfont-license new file mode 100644 index 0000000000..ec29af783c --- /dev/null +++ b/bin/resources/fonts/promptfont-license @@ -0,0 +1,91 @@ +This Font Software is licensed under the SIL Open Font License, +Version 1.1. This license is copied below, and is also available +with a FAQ at + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/bin/resources/fonts/promptfont.otf b/bin/resources/fonts/promptfont.otf new file mode 100644 index 0000000000..9295e2e518 Binary files /dev/null and b/bin/resources/fonts/promptfont.otf differ diff --git a/pcsx2-gsrunner/Main.cpp b/pcsx2-gsrunner/Main.cpp index 222b7ac068..4f2a52c95c 100644 --- a/pcsx2-gsrunner/Main.cpp +++ b/pcsx2-gsrunner/Main.cpp @@ -393,6 +393,11 @@ std::optional InputManager::ConvertHostKeyboardCodeToString(u32 cod return std::nullopt; } +const char* InputManager::ConvertHostKeyboardCodeToIcon(u32 code) +{ + return nullptr; +} + BEGIN_HOTKEY_LIST(g_host_hotkeys) END_HOTKEY_LIST() diff --git a/pcsx2-qt/QtKeyCodes.cpp b/pcsx2-qt/QtKeyCodes.cpp index 324a026d0c..d10aa8a938 100644 --- a/pcsx2-qt/QtKeyCodes.cpp +++ b/pcsx2-qt/QtKeyCodes.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -21,457 +21,460 @@ #include "common/StringUtil.h" +#include "IconsPromptFont.h" + #include struct KeyCodeName { int code; const char* name; + const char* icon_name; }; -static constexpr KeyCodeName s_qt_key_names[] = { - {Qt::Key_Escape, "Escape"}, - {Qt::Key_Tab, "Tab"}, - {Qt::Key_Backtab, "Backtab"}, - {Qt::Key_Backspace, "Backspace"}, - {Qt::Key_Return, "Return"}, - {Qt::Key_Enter, "Enter"}, - {Qt::Key_Insert, "Insert"}, - {Qt::Key_Delete, "Delete"}, - {Qt::Key_Pause, "Pause"}, - {Qt::Key_Print, "Print"}, - {Qt::Key_SysReq, "SysReq"}, - {Qt::Key_Clear, "Clear"}, - {Qt::Key_Home, "Home"}, - {Qt::Key_End, "End"}, - {Qt::Key_Left, "Left"}, - {Qt::Key_Up, "Up"}, - {Qt::Key_Right, "Right"}, - {Qt::Key_Down, "Down"}, - {Qt::Key_PageUp, "PageUp"}, - {Qt::Key_PageDown, "PageDown"}, - {Qt::Key_Shift, "Shift"}, - {Qt::Key_Control, "Control"}, - {Qt::Key_Meta, "Meta"}, - {Qt::Key_Alt, "Alt"}, - {Qt::Key_CapsLock, "CapsLock"}, - {Qt::Key_NumLock, "NumLock"}, - {Qt::Key_ScrollLock, "ScrollLock"}, - {Qt::Key_F1, "F1"}, - {Qt::Key_F2, "F2"}, - {Qt::Key_F3, "F3"}, - {Qt::Key_F4, "F4"}, - {Qt::Key_F5, "F5"}, - {Qt::Key_F6, "F6"}, - {Qt::Key_F7, "F7"}, - {Qt::Key_F8, "F8"}, - {Qt::Key_F9, "F9"}, - {Qt::Key_F10, "F10"}, - {Qt::Key_F11, "F11"}, - {Qt::Key_F12, "F12"}, - {Qt::Key_F13, "F13"}, - {Qt::Key_F14, "F14"}, - {Qt::Key_F15, "F15"}, - {Qt::Key_F16, "F16"}, - {Qt::Key_F17, "F17"}, - {Qt::Key_F18, "F18"}, - {Qt::Key_F19, "F19"}, - {Qt::Key_F20, "F20"}, - {Qt::Key_F21, "F21"}, - {Qt::Key_F22, "F22"}, - {Qt::Key_F23, "F23"}, - {Qt::Key_F24, "F24"}, - {Qt::Key_F25, "F25"}, - {Qt::Key_F26, "F26"}, - {Qt::Key_F27, "F27"}, - {Qt::Key_F28, "F28"}, - {Qt::Key_F29, "F29"}, - {Qt::Key_F30, "F30"}, - {Qt::Key_F31, "F31"}, - {Qt::Key_F32, "F32"}, - {Qt::Key_F33, "F33"}, - {Qt::Key_F34, "F34"}, - {Qt::Key_F35, "F35"}, - {Qt::Key_Super_L, "Super_L"}, - {Qt::Key_Super_R, "Super_R"}, - {Qt::Key_Menu, "Menu"}, - {Qt::Key_Hyper_L, "Hyper_L"}, - {Qt::Key_Hyper_R, "Hyper_R"}, - {Qt::Key_Help, "Help"}, - {Qt::Key_Direction_L, "Direction_L"}, - {Qt::Key_Direction_R, "Direction_R"}, - {Qt::Key_Space, "Space"}, - {Qt::Key_Any, "Any"}, - {Qt::Key_Exclam, "Exclam"}, - {Qt::Key_QuoteDbl, "QuoteDbl"}, - {Qt::Key_NumberSign, "NumberSign"}, - {Qt::Key_Dollar, "Dollar"}, - {Qt::Key_Percent, "Percent"}, - {Qt::Key_Ampersand, "Ampersand"}, - {Qt::Key_Apostrophe, "Apostrophe"}, - {Qt::Key_ParenLeft, "ParenLeft"}, - {Qt::Key_ParenRight, "ParenRight"}, - {Qt::Key_Asterisk, "Asterisk"}, - {Qt::Key_Plus, "Plus"}, - {Qt::Key_Comma, "Comma"}, - {Qt::Key_Minus, "Minus"}, - {Qt::Key_Period, "Period"}, - {Qt::Key_Slash, "Slash"}, - {Qt::Key_0, "0"}, - {Qt::Key_1, "1"}, - {Qt::Key_2, "2"}, - {Qt::Key_3, "3"}, - {Qt::Key_4, "4"}, - {Qt::Key_5, "5"}, - {Qt::Key_6, "6"}, - {Qt::Key_7, "7"}, - {Qt::Key_8, "8"}, - {Qt::Key_9, "9"}, - {Qt::Key_Colon, "Colon"}, - {Qt::Key_Semicolon, "Semicolon"}, - {Qt::Key_Less, "Less"}, - {Qt::Key_Equal, "Equal"}, - {Qt::Key_Greater, "Greater"}, - {Qt::Key_Question, "Question"}, - {Qt::Key_At, "At"}, - {Qt::Key_A, "A"}, - {Qt::Key_B, "B"}, - {Qt::Key_C, "C"}, - {Qt::Key_D, "D"}, - {Qt::Key_E, "E"}, - {Qt::Key_F, "F"}, - {Qt::Key_G, "G"}, - {Qt::Key_H, "H"}, - {Qt::Key_I, "I"}, - {Qt::Key_J, "J"}, - {Qt::Key_K, "K"}, - {Qt::Key_L, "L"}, - {Qt::Key_M, "M"}, - {Qt::Key_N, "N"}, - {Qt::Key_O, "O"}, - {Qt::Key_P, "P"}, - {Qt::Key_Q, "Q"}, - {Qt::Key_R, "R"}, - {Qt::Key_S, "S"}, - {Qt::Key_T, "T"}, - {Qt::Key_U, "U"}, - {Qt::Key_V, "V"}, - {Qt::Key_W, "W"}, - {Qt::Key_X, "X"}, - {Qt::Key_Y, "Y"}, - {Qt::Key_Z, "Z"}, - {Qt::Key_BracketLeft, "BracketLeft"}, - {Qt::Key_Backslash, "Backslash"}, - {Qt::Key_BracketRight, "BracketRight"}, - {Qt::Key_AsciiCircum, "AsciiCircum"}, - {Qt::Key_Underscore, "Underscore"}, - {Qt::Key_QuoteLeft, "QuoteLeft"}, - {Qt::Key_BraceLeft, "BraceLeft"}, - {Qt::Key_Bar, "Bar"}, - {Qt::Key_BraceRight, "BraceRight"}, - {Qt::Key_AsciiTilde, "AsciiTilde"}, - {Qt::Key_nobreakspace, "nobreakspace"}, - {Qt::Key_exclamdown, "exclamdown"}, - {Qt::Key_cent, "cent"}, - {Qt::Key_sterling, "sterling"}, - {Qt::Key_currency, "currency"}, - {Qt::Key_yen, "yen"}, - {Qt::Key_brokenbar, "brokenbar"}, - {Qt::Key_section, "section"}, - {Qt::Key_diaeresis, "diaeresis"}, - {Qt::Key_copyright, "copyright"}, - {Qt::Key_ordfeminine, "ordfeminine"}, - {Qt::Key_guillemotleft, "guillemotleft"}, - {Qt::Key_notsign, "notsign"}, - {Qt::Key_hyphen, "hyphen"}, - {Qt::Key_registered, "registered"}, - {Qt::Key_macron, "macron"}, - {Qt::Key_degree, "degree"}, - {Qt::Key_plusminus, "plusminus"}, - {Qt::Key_twosuperior, "twosuperior"}, - {Qt::Key_threesuperior, "threesuperior"}, - {Qt::Key_acute, "acute"}, - {Qt::Key_mu, "mu"}, - {Qt::Key_paragraph, "paragraph"}, - {Qt::Key_periodcentered, "periodcentered"}, - {Qt::Key_cedilla, "cedilla"}, - {Qt::Key_onesuperior, "onesuperior"}, - {Qt::Key_masculine, "masculine"}, - {Qt::Key_guillemotright, "guillemotright"}, - {Qt::Key_onequarter, "onequarter"}, - {Qt::Key_onehalf, "onehalf"}, - {Qt::Key_threequarters, "threequarters"}, - {Qt::Key_questiondown, "questiondown"}, - {Qt::Key_Agrave, "Agrave"}, - {Qt::Key_Aacute, "Aacute"}, - {Qt::Key_Acircumflex, "Acircumflex"}, - {Qt::Key_Atilde, "Atilde"}, - {Qt::Key_Adiaeresis, "Adiaeresis"}, - {Qt::Key_Aring, "Aring"}, - {Qt::Key_AE, "AE"}, - {Qt::Key_Ccedilla, "Ccedilla"}, - {Qt::Key_Egrave, "Egrave"}, - {Qt::Key_Eacute, "Eacute"}, - {Qt::Key_Ecircumflex, "Ecircumflex"}, - {Qt::Key_Ediaeresis, "Ediaeresis"}, - {Qt::Key_Igrave, "Igrave"}, - {Qt::Key_Iacute, "Iacute"}, - {Qt::Key_Icircumflex, "Icircumflex"}, - {Qt::Key_Idiaeresis, "Idiaeresis"}, - {Qt::Key_ETH, "ETH"}, - {Qt::Key_Ntilde, "Ntilde"}, - {Qt::Key_Ograve, "Ograve"}, - {Qt::Key_Oacute, "Oacute"}, - {Qt::Key_Ocircumflex, "Ocircumflex"}, - {Qt::Key_Otilde, "Otilde"}, - {Qt::Key_Odiaeresis, "Odiaeresis"}, - {Qt::Key_multiply, "multiply"}, - {Qt::Key_Ooblique, "Ooblique"}, - {Qt::Key_Ugrave, "Ugrave"}, - {Qt::Key_Uacute, "Uacute"}, - {Qt::Key_Ucircumflex, "Ucircumflex"}, - {Qt::Key_Udiaeresis, "Udiaeresis"}, - {Qt::Key_Yacute, "Yacute"}, - {Qt::Key_THORN, "THORN"}, - {Qt::Key_ssharp, "ssharp"}, - {Qt::Key_division, "division"}, - {Qt::Key_ydiaeresis, "ydiaeresis"}, - {Qt::Key_AltGr, "AltGr"}, - {Qt::Key_Multi_key, "Multi_key"}, - {Qt::Key_Codeinput, "Codeinput"}, - {Qt::Key_SingleCandidate, "SingleCandidate"}, - {Qt::Key_MultipleCandidate, "MultipleCandidate"}, - {Qt::Key_PreviousCandidate, "PreviousCandidate"}, - {Qt::Key_Mode_switch, "Mode_switch"}, - {Qt::Key_Kanji, "Kanji"}, - {Qt::Key_Muhenkan, "Muhenkan"}, - {Qt::Key_Henkan, "Henkan"}, - {Qt::Key_Romaji, "Romaji"}, - {Qt::Key_Hiragana, "Hiragana"}, - {Qt::Key_Katakana, "Katakana"}, - {Qt::Key_Hiragana_Katakana, "Hiragana_Katakana"}, - {Qt::Key_Zenkaku, "Zenkaku"}, - {Qt::Key_Hankaku, "Hankaku"}, - {Qt::Key_Zenkaku_Hankaku, "Zenkaku_Hankaku"}, - {Qt::Key_Touroku, "Touroku"}, - {Qt::Key_Massyo, "Massyo"}, - {Qt::Key_Kana_Lock, "Kana_Lock"}, - {Qt::Key_Kana_Shift, "Kana_Shift"}, - {Qt::Key_Eisu_Shift, "Eisu_Shift"}, - {Qt::Key_Eisu_toggle, "Eisu_toggle"}, - {Qt::Key_Hangul, "Hangul"}, - {Qt::Key_Hangul_Start, "Hangul_Start"}, - {Qt::Key_Hangul_End, "Hangul_End"}, - {Qt::Key_Hangul_Hanja, "Hangul_Hanja"}, - {Qt::Key_Hangul_Jamo, "Hangul_Jamo"}, - {Qt::Key_Hangul_Romaja, "Hangul_Romaja"}, - {Qt::Key_Hangul_Jeonja, "Hangul_Jeonja"}, - {Qt::Key_Hangul_Banja, "Hangul_Banja"}, - {Qt::Key_Hangul_PreHanja, "Hangul_PreHanja"}, - {Qt::Key_Hangul_PostHanja, "Hangul_PostHanja"}, - {Qt::Key_Hangul_Special, "Hangul_Special"}, - {Qt::Key_Dead_Grave, "Dead_Grave"}, - {Qt::Key_Dead_Acute, "Dead_Acute"}, - {Qt::Key_Dead_Circumflex, "Dead_Circumflex"}, - {Qt::Key_Dead_Tilde, "Dead_Tilde"}, - {Qt::Key_Dead_Macron, "Dead_Macron"}, - {Qt::Key_Dead_Breve, "Dead_Breve"}, - {Qt::Key_Dead_Abovedot, "Dead_Abovedot"}, - {Qt::Key_Dead_Diaeresis, "Dead_Diaeresis"}, - {Qt::Key_Dead_Abovering, "Dead_Abovering"}, - {Qt::Key_Dead_Doubleacute, "Dead_Doubleacute"}, - {Qt::Key_Dead_Caron, "Dead_Caron"}, - {Qt::Key_Dead_Cedilla, "Dead_Cedilla"}, - {Qt::Key_Dead_Ogonek, "Dead_Ogonek"}, - {Qt::Key_Dead_Iota, "Dead_Iota"}, - {Qt::Key_Dead_Voiced_Sound, "Dead_Voiced_Sound"}, - {Qt::Key_Dead_Semivoiced_Sound, "Dead_Semivoiced_Sound"}, - {Qt::Key_Dead_Belowdot, "Dead_Belowdot"}, - {Qt::Key_Dead_Hook, "Dead_Hook"}, - {Qt::Key_Dead_Horn, "Dead_Horn"}, - {Qt::Key_Back, "Back"}, - {Qt::Key_Forward, "Forward"}, - {Qt::Key_Stop, "Stop"}, - {Qt::Key_Refresh, "Refresh"}, - {Qt::Key_VolumeDown, "VolumeDown"}, - {Qt::Key_VolumeMute, "VolumeMute"}, - {Qt::Key_VolumeUp, "VolumeUp"}, - {Qt::Key_BassBoost, "BassBoost"}, - {Qt::Key_BassUp, "BassUp"}, - {Qt::Key_BassDown, "BassDown"}, - {Qt::Key_TrebleUp, "TrebleUp"}, - {Qt::Key_TrebleDown, "TrebleDown"}, - {Qt::Key_MediaPlay, "MediaPlay"}, - {Qt::Key_MediaStop, "MediaStop"}, - {Qt::Key_MediaPrevious, "MediaPrevious"}, - {Qt::Key_MediaNext, "MediaNext"}, - {Qt::Key_MediaRecord, "MediaRecord"}, - {Qt::Key_MediaPause, "MediaPause"}, - {Qt::Key_MediaTogglePlayPause, "MediaTogglePlayPause"}, - {Qt::Key_HomePage, "HomePage"}, - {Qt::Key_Favorites, "Favorites"}, - {Qt::Key_Search, "Search"}, - {Qt::Key_Standby, "Standby"}, - {Qt::Key_OpenUrl, "OpenUrl"}, - {Qt::Key_LaunchMail, "LaunchMail"}, - {Qt::Key_LaunchMedia, "LaunchMedia"}, - {Qt::Key_Launch0, "Launch0"}, - {Qt::Key_Launch1, "Launch1"}, - {Qt::Key_Launch2, "Launch2"}, - {Qt::Key_Launch3, "Launch3"}, - {Qt::Key_Launch4, "Launch4"}, - {Qt::Key_Launch5, "Launch5"}, - {Qt::Key_Launch6, "Launch6"}, - {Qt::Key_Launch7, "Launch7"}, - {Qt::Key_Launch8, "Launch8"}, - {Qt::Key_Launch9, "Launch9"}, - {Qt::Key_LaunchA, "LaunchA"}, - {Qt::Key_LaunchB, "LaunchB"}, - {Qt::Key_LaunchC, "LaunchC"}, - {Qt::Key_LaunchD, "LaunchD"}, - {Qt::Key_LaunchE, "LaunchE"}, - {Qt::Key_LaunchF, "LaunchF"}, - {Qt::Key_MonBrightnessUp, "MonBrightnessUp"}, - {Qt::Key_MonBrightnessDown, "MonBrightnessDown"}, - {Qt::Key_KeyboardLightOnOff, "KeyboardLightOnOff"}, - {Qt::Key_KeyboardBrightnessUp, "KeyboardBrightnessUp"}, - {Qt::Key_KeyboardBrightnessDown, "KeyboardBrightnessDown"}, - {Qt::Key_PowerOff, "PowerOff"}, - {Qt::Key_WakeUp, "WakeUp"}, - {Qt::Key_Eject, "Eject"}, - {Qt::Key_ScreenSaver, "ScreenSaver"}, - {Qt::Key_WWW, "WWW"}, - {Qt::Key_Memo, "Memo"}, - {Qt::Key_LightBulb, "LightBulb"}, - {Qt::Key_Shop, "Shop"}, - {Qt::Key_History, "History"}, - {Qt::Key_AddFavorite, "AddFavorite"}, - {Qt::Key_HotLinks, "HotLinks"}, - {Qt::Key_BrightnessAdjust, "BrightnessAdjust"}, - {Qt::Key_Finance, "Finance"}, - {Qt::Key_Community, "Community"}, - {Qt::Key_AudioRewind, "AudioRewind"}, - {Qt::Key_BackForward, "BackForward"}, - {Qt::Key_ApplicationLeft, "ApplicationLeft"}, - {Qt::Key_ApplicationRight, "ApplicationRight"}, - {Qt::Key_Book, "Book"}, - {Qt::Key_CD, "CD"}, - {Qt::Key_Calculator, "Calculator"}, - {Qt::Key_ToDoList, "ToDoList"}, - {Qt::Key_ClearGrab, "ClearGrab"}, - {Qt::Key_Close, "Close"}, - {Qt::Key_Copy, "Copy"}, - {Qt::Key_Cut, "Cut"}, - {Qt::Key_Display, "Display"}, - {Qt::Key_DOS, "DOS"}, - {Qt::Key_Documents, "Documents"}, - {Qt::Key_Excel, "Excel"}, - {Qt::Key_Explorer, "Explorer"}, - {Qt::Key_Game, "Game"}, - {Qt::Key_Go, "Go"}, - {Qt::Key_iTouch, "iTouch"}, - {Qt::Key_LogOff, "LogOff"}, - {Qt::Key_Market, "Market"}, - {Qt::Key_Meeting, "Meeting"}, - {Qt::Key_MenuKB, "MenuKB"}, - {Qt::Key_MenuPB, "MenuPB"}, - {Qt::Key_MySites, "MySites"}, - {Qt::Key_News, "News"}, - {Qt::Key_OfficeHome, "OfficeHome"}, - {Qt::Key_Option, "Option"}, - {Qt::Key_Paste, "Paste"}, - {Qt::Key_Phone, "Phone"}, - {Qt::Key_Calendar, "Calendar"}, - {Qt::Key_Reply, "Reply"}, - {Qt::Key_Reload, "Reload"}, - {Qt::Key_RotateWindows, "RotateWindows"}, - {Qt::Key_RotationPB, "RotationPB"}, - {Qt::Key_RotationKB, "RotationKB"}, - {Qt::Key_Save, "Save"}, - {Qt::Key_Send, "Send"}, - {Qt::Key_Spell, "Spell"}, - {Qt::Key_SplitScreen, "SplitScreen"}, - {Qt::Key_Support, "Support"}, - {Qt::Key_TaskPane, "TaskPane"}, - {Qt::Key_Terminal, "Terminal"}, - {Qt::Key_Tools, "Tools"}, - {Qt::Key_Travel, "Travel"}, - {Qt::Key_Video, "Video"}, - {Qt::Key_Word, "Word"}, - {Qt::Key_Xfer, "Xfer"}, - {Qt::Key_ZoomIn, "ZoomIn"}, - {Qt::Key_ZoomOut, "ZoomOut"}, - {Qt::Key_Away, "Away"}, - {Qt::Key_Messenger, "Messenger"}, - {Qt::Key_WebCam, "WebCam"}, - {Qt::Key_MailForward, "MailForward"}, - {Qt::Key_Pictures, "Pictures"}, - {Qt::Key_Music, "Music"}, - {Qt::Key_Battery, "Battery"}, - {Qt::Key_Bluetooth, "Bluetooth"}, - {Qt::Key_WLAN, "WLAN"}, - {Qt::Key_UWB, "UWB"}, - {Qt::Key_AudioForward, "AudioForward"}, - {Qt::Key_AudioRepeat, "AudioRepeat"}, - {Qt::Key_AudioRandomPlay, "AudioRandomPlay"}, - {Qt::Key_Subtitle, "Subtitle"}, - {Qt::Key_AudioCycleTrack, "AudioCycleTrack"}, - {Qt::Key_Time, "Time"}, - {Qt::Key_Hibernate, "Hibernate"}, - {Qt::Key_View, "View"}, - {Qt::Key_TopMenu, "TopMenu"}, - {Qt::Key_PowerDown, "PowerDown"}, - {Qt::Key_Suspend, "Suspend"}, - {Qt::Key_ContrastAdjust, "ContrastAdjust"}, - {Qt::Key_LaunchG, "LaunchG"}, - {Qt::Key_LaunchH, "LaunchH"}, - {Qt::Key_TouchpadToggle, "TouchpadToggle"}, - {Qt::Key_TouchpadOn, "TouchpadOn"}, - {Qt::Key_TouchpadOff, "TouchpadOff"}, - {Qt::Key_MicMute, "MicMute"}, - {Qt::Key_Red, "Red"}, - {Qt::Key_Green, "Green"}, - {Qt::Key_Yellow, "Yellow"}, - {Qt::Key_Blue, "Blue"}, - {Qt::Key_ChannelUp, "ChannelUp"}, - {Qt::Key_ChannelDown, "ChannelDown"}, - {Qt::Key_Guide, "Guide"}, - {Qt::Key_Info, "Info"}, - {Qt::Key_Settings, "Settings"}, - {Qt::Key_MicVolumeUp, "MicVolumeUp"}, - {Qt::Key_MicVolumeDown, "MicVolumeDown"}, - {Qt::Key_New, "New"}, - {Qt::Key_Open, "Open"}, - {Qt::Key_Find, "Find"}, - {Qt::Key_Undo, "Undo"}, - {Qt::Key_Redo, "Redo"}, - {Qt::Key_MediaLast, "MediaLast"}, - {Qt::Key_Select, "Select"}, - {Qt::Key_Yes, "Yes"}, - {Qt::Key_No, "No"}, - {Qt::Key_Cancel, "Cancel"}, - {Qt::Key_Printer, "Printer"}, - {Qt::Key_Execute, "Execute"}, - {Qt::Key_Sleep, "Sleep"}, - {Qt::Key_Play, "Play"}, - {Qt::Key_Zoom, "Zoom"}, - {Qt::Key_Exit, "Exit"}, - {Qt::Key_Context1, "Context1"}, - {Qt::Key_Context2, "Context2"}, - {Qt::Key_Context3, "Context3"}, - {Qt::Key_Context4, "Context4"}, - {Qt::Key_Call, "Call"}, - {Qt::Key_Hangup, "Hangup"}, - {Qt::Key_Flip, "Flip"}, - {Qt::Key_ToggleCallHangup, "ToggleCallHangup"}, - {Qt::Key_VoiceDial, "VoiceDial"}, - {Qt::Key_LastNumberRedial, "LastNumberRedial"}, - {Qt::Key_Camera, "Camera"}, - {Qt::Key_CameraFocus, "CameraFocus"}}; +static constexpr const KeyCodeName s_qt_key_names[] = { + {Qt::Key_Escape, "Escape", ICON_PF_ESC}, + {Qt::Key_Tab, "Tab", ICON_PF_TAB}, + {Qt::Key_Backtab, "Backtab", nullptr}, + {Qt::Key_Backspace, "Backspace", ICON_PF_BACKSPACE}, + {Qt::Key_Return, "Return", ICON_PF_ENTER}, + {Qt::Key_Enter, "Enter", ICON_PF_ENTER}, + {Qt::Key_Insert, "Insert", ICON_PF_INSERT}, + {Qt::Key_Delete, "Delete", ICON_PF_DELETE}, + {Qt::Key_Pause, "Pause", ICON_PF_PAUSE}, + {Qt::Key_Print, "Print", ICON_PF_PRTSC}, + {Qt::Key_SysReq, "SysReq", ICON_PF_PAUSE}, + {Qt::Key_Clear, "Clear", nullptr}, + {Qt::Key_Home, "Home", ICON_PF_HOME}, + {Qt::Key_End, "End", ICON_PF_END}, + {Qt::Key_Left, "Left", ICON_PF_ARROW_LEFT}, + {Qt::Key_Up, "Up", ICON_PF_ARROW_UP}, + {Qt::Key_Right, "Right", ICON_PF_ARROW_RIGHT}, + {Qt::Key_Down, "Down", ICON_PF_ARROW_DOWN}, + {Qt::Key_PageUp, "PageUp", ICON_PF_PAGE_UP}, + {Qt::Key_PageDown, "PageDown", ICON_PF_PAGE_DOWN}, + {Qt::Key_Shift, "Shift", ICON_PF_SHIFT}, + {Qt::Key_Control, "Control", ICON_PF_CTRL}, + {Qt::Key_Meta, "Meta", ICON_PF_SUPER}, + {Qt::Key_Alt, "Alt", ICON_PF_ALT}, + {Qt::Key_CapsLock, "CapsLock", ICON_PF_CAPS}, + {Qt::Key_NumLock, "NumLock", ICON_PF_NUMLOCK}, + {Qt::Key_ScrollLock, "ScrollLock", ICON_PF_SCRLK}, + {Qt::Key_F1, "F1", ICON_PF_F1}, + {Qt::Key_F2, "F2", ICON_PF_F2}, + {Qt::Key_F3, "F3", ICON_PF_F3}, + {Qt::Key_F4, "F4", ICON_PF_F4}, + {Qt::Key_F5, "F5", ICON_PF_F5}, + {Qt::Key_F6, "F6", ICON_PF_F6}, + {Qt::Key_F7, "F7", ICON_PF_F7}, + {Qt::Key_F8, "F8", ICON_PF_F8}, + {Qt::Key_F9, "F9", ICON_PF_F9}, + {Qt::Key_F10, "F10", ICON_PF_F10}, + {Qt::Key_F11, "F11", ICON_PF_F11}, + {Qt::Key_F12, "F12", ICON_PF_F12}, + {Qt::Key_F13, "F13", nullptr}, + {Qt::Key_F14, "F14", nullptr}, + {Qt::Key_F15, "F15", nullptr}, + {Qt::Key_F16, "F16", nullptr}, + {Qt::Key_F17, "F17", nullptr}, + {Qt::Key_F18, "F18", nullptr}, + {Qt::Key_F19, "F19", nullptr}, + {Qt::Key_F20, "F20", nullptr}, + {Qt::Key_F21, "F21", nullptr}, + {Qt::Key_F22, "F22", nullptr}, + {Qt::Key_F23, "F23", nullptr}, + {Qt::Key_F24, "F24", nullptr}, + {Qt::Key_F25, "F25", nullptr}, + {Qt::Key_F26, "F26", nullptr}, + {Qt::Key_F27, "F27", nullptr}, + {Qt::Key_F28, "F28", nullptr}, + {Qt::Key_F29, "F29", nullptr}, + {Qt::Key_F30, "F30", nullptr}, + {Qt::Key_F31, "F31", nullptr}, + {Qt::Key_F32, "F32", nullptr}, + {Qt::Key_F33, "F33", nullptr}, + {Qt::Key_F34, "F34", nullptr}, + {Qt::Key_F35, "F35", nullptr}, + {Qt::Key_Super_L, "Super_L", nullptr}, + {Qt::Key_Super_R, "Super_R", nullptr}, + {Qt::Key_Menu, "Menu", nullptr}, + {Qt::Key_Hyper_L, "Hyper_L", nullptr}, + {Qt::Key_Hyper_R, "Hyper_R", nullptr}, + {Qt::Key_Help, "Help", nullptr}, + {Qt::Key_Direction_L, "Direction_L", nullptr}, + {Qt::Key_Direction_R, "Direction_R", nullptr}, + {Qt::Key_Space, "Space", ICON_PF_SPACE}, + {Qt::Key_Any, "Any", nullptr}, + {Qt::Key_Exclam, "Exclam", nullptr}, + {Qt::Key_QuoteDbl, "QuoteDbl", nullptr}, + {Qt::Key_NumberSign, "NumberSign", nullptr}, + {Qt::Key_Dollar, "Dollar", nullptr}, + {Qt::Key_Percent, "Percent", nullptr}, + {Qt::Key_Ampersand, "Ampersand", nullptr}, + {Qt::Key_Apostrophe, "Apostrophe", nullptr}, + {Qt::Key_ParenLeft, "ParenLeft", nullptr}, + {Qt::Key_ParenRight, "ParenRight", nullptr}, + {Qt::Key_Asterisk, "Asterisk", nullptr}, + {Qt::Key_Plus, "Plus", nullptr}, + {Qt::Key_Comma, "Comma", nullptr}, + {Qt::Key_Minus, "Minus", nullptr}, + {Qt::Key_Period, "Period", nullptr}, + {Qt::Key_Slash, "Slash", nullptr}, + {Qt::Key_0, "0", ICON_PF_0}, + {Qt::Key_1, "1", ICON_PF_1}, + {Qt::Key_2, "2", ICON_PF_2}, + {Qt::Key_3, "3", ICON_PF_3}, + {Qt::Key_4, "4", ICON_PF_4}, + {Qt::Key_5, "5", ICON_PF_5}, + {Qt::Key_6, "6", ICON_PF_6}, + {Qt::Key_7, "7", ICON_PF_7}, + {Qt::Key_8, "8", ICON_PF_8}, + {Qt::Key_9, "9", ICON_PF_9}, + {Qt::Key_Colon, "Colon", nullptr}, + {Qt::Key_Semicolon, "Semicolon", nullptr}, + {Qt::Key_Less, "Less", nullptr}, + {Qt::Key_Equal, "Equal", nullptr}, + {Qt::Key_Greater, "Greater", nullptr}, + {Qt::Key_Question, "Question", nullptr}, + {Qt::Key_At, "At", nullptr}, + {Qt::Key_A, "A", ICON_PF_KEY_A}, + {Qt::Key_B, "B", ICON_PF_KEY_B}, + {Qt::Key_C, "C", ICON_PF_KEY_C}, + {Qt::Key_D, "D", ICON_PF_KEY_D}, + {Qt::Key_E, "E", ICON_PF_KEY_E}, + {Qt::Key_F, "F", ICON_PF_KEY_F}, + {Qt::Key_G, "G", ICON_PF_KEY_G}, + {Qt::Key_H, "H", ICON_PF_KEY_H}, + {Qt::Key_I, "I", ICON_PF_KEY_I}, + {Qt::Key_J, "J", ICON_PF_KEY_J}, + {Qt::Key_K, "K", ICON_PF_KEY_K}, + {Qt::Key_L, "L", ICON_PF_KEY_L}, + {Qt::Key_M, "M", ICON_PF_KEY_M}, + {Qt::Key_N, "N", ICON_PF_KEY_N}, + {Qt::Key_O, "O", ICON_PF_KEY_O}, + {Qt::Key_P, "P", ICON_PF_KEY_P}, + {Qt::Key_Q, "Q", ICON_PF_KEY_Q}, + {Qt::Key_R, "R", ICON_PF_KEY_R}, + {Qt::Key_S, "S", ICON_PF_KEY_S}, + {Qt::Key_T, "T", ICON_PF_KEY_T}, + {Qt::Key_U, "U", ICON_PF_KEY_U}, + {Qt::Key_V, "V", ICON_PF_KEY_V}, + {Qt::Key_W, "W", ICON_PF_KEY_W}, + {Qt::Key_X, "X", ICON_PF_KEY_X}, + {Qt::Key_Y, "Y", ICON_PF_KEY_Y}, + {Qt::Key_Z, "Z", ICON_PF_KEY_Z}, + {Qt::Key_BracketLeft, "BracketLeft", nullptr}, + {Qt::Key_Backslash, "Backslash", nullptr}, + {Qt::Key_BracketRight, "BracketRight", nullptr}, + {Qt::Key_AsciiCircum, "AsciiCircum", nullptr}, + {Qt::Key_Underscore, "Underscore", nullptr}, + {Qt::Key_QuoteLeft, "QuoteLeft", nullptr}, + {Qt::Key_BraceLeft, "BraceLeft", nullptr}, + {Qt::Key_Bar, "Bar", nullptr}, + {Qt::Key_BraceRight, "BraceRight", nullptr}, + {Qt::Key_AsciiTilde, "AsciiTilde", nullptr}, + {Qt::Key_nobreakspace, "nobreakspace", nullptr}, + {Qt::Key_exclamdown, "exclamdown", nullptr}, + {Qt::Key_cent, "cent", nullptr}, + {Qt::Key_sterling, "sterling", nullptr}, + {Qt::Key_currency, "currency", nullptr}, + {Qt::Key_yen, "yen", nullptr}, + {Qt::Key_brokenbar, "brokenbar", nullptr}, + {Qt::Key_section, "section", nullptr}, + {Qt::Key_diaeresis, "diaeresis", nullptr}, + {Qt::Key_copyright, "copyright", nullptr}, + {Qt::Key_ordfeminine, "ordfeminine", nullptr}, + {Qt::Key_guillemotleft, "guillemotleft", nullptr}, + {Qt::Key_notsign, "notsign", nullptr}, + {Qt::Key_hyphen, "hyphen", nullptr}, + {Qt::Key_registered, "registered", nullptr}, + {Qt::Key_macron, "macron", nullptr}, + {Qt::Key_degree, "degree", nullptr}, + {Qt::Key_plusminus, "plusminus", nullptr}, + {Qt::Key_twosuperior, "twosuperior", nullptr}, + {Qt::Key_threesuperior, "threesuperior", nullptr}, + {Qt::Key_acute, "acute", nullptr}, + {Qt::Key_mu, "mu", nullptr}, + {Qt::Key_paragraph, "paragraph", nullptr}, + {Qt::Key_periodcentered, "periodcentered", nullptr}, + {Qt::Key_cedilla, "cedilla", nullptr}, + {Qt::Key_onesuperior, "onesuperior", nullptr}, + {Qt::Key_masculine, "masculine", nullptr}, + {Qt::Key_guillemotright, "guillemotright", nullptr}, + {Qt::Key_onequarter, "onequarter", nullptr}, + {Qt::Key_onehalf, "onehalf", nullptr}, + {Qt::Key_threequarters, "threequarters", nullptr}, + {Qt::Key_questiondown, "questiondown", nullptr}, + {Qt::Key_Agrave, "Agrave", nullptr}, + {Qt::Key_Aacute, "Aacute", nullptr}, + {Qt::Key_Acircumflex, "Acircumflex", nullptr}, + {Qt::Key_Atilde, "Atilde", nullptr}, + {Qt::Key_Adiaeresis, "Adiaeresis", nullptr}, + {Qt::Key_Aring, "Aring", nullptr}, + {Qt::Key_AE, "AE", nullptr}, + {Qt::Key_Ccedilla, "Ccedilla", nullptr}, + {Qt::Key_Egrave, "Egrave", nullptr}, + {Qt::Key_Eacute, "Eacute", nullptr}, + {Qt::Key_Ecircumflex, "Ecircumflex", nullptr}, + {Qt::Key_Ediaeresis, "Ediaeresis", nullptr}, + {Qt::Key_Igrave, "Igrave", nullptr}, + {Qt::Key_Iacute, "Iacute", nullptr}, + {Qt::Key_Icircumflex, "Icircumflex", nullptr}, + {Qt::Key_Idiaeresis, "Idiaeresis", nullptr}, + {Qt::Key_ETH, "ETH", nullptr}, + {Qt::Key_Ntilde, "Ntilde", nullptr}, + {Qt::Key_Ograve, "Ograve", nullptr}, + {Qt::Key_Oacute, "Oacute", nullptr}, + {Qt::Key_Ocircumflex, "Ocircumflex", nullptr}, + {Qt::Key_Otilde, "Otilde", nullptr}, + {Qt::Key_Odiaeresis, "Odiaeresis", nullptr}, + {Qt::Key_multiply, "multiply", nullptr}, + {Qt::Key_Ooblique, "Ooblique", nullptr}, + {Qt::Key_Ugrave, "Ugrave", nullptr}, + {Qt::Key_Uacute, "Uacute", nullptr}, + {Qt::Key_Ucircumflex, "Ucircumflex", nullptr}, + {Qt::Key_Udiaeresis, "Udiaeresis", nullptr}, + {Qt::Key_Yacute, "Yacute", nullptr}, + {Qt::Key_THORN, "THORN", nullptr}, + {Qt::Key_ssharp, "ssharp", nullptr}, + {Qt::Key_division, "division", nullptr}, + {Qt::Key_ydiaeresis, "ydiaeresis", nullptr}, + {Qt::Key_AltGr, "AltGr", nullptr}, + {Qt::Key_Multi_key, "Multi_key", nullptr}, + {Qt::Key_Codeinput, "Codeinput", nullptr}, + {Qt::Key_SingleCandidate, "SingleCandidate", nullptr}, + {Qt::Key_MultipleCandidate, "MultipleCandidate", nullptr}, + {Qt::Key_PreviousCandidate, "PreviousCandidate", nullptr}, + {Qt::Key_Mode_switch, "Mode_switch", nullptr}, + {Qt::Key_Kanji, "Kanji", nullptr}, + {Qt::Key_Muhenkan, "Muhenkan", nullptr}, + {Qt::Key_Henkan, "Henkan", nullptr}, + {Qt::Key_Romaji, "Romaji", nullptr}, + {Qt::Key_Hiragana, "Hiragana", nullptr}, + {Qt::Key_Katakana, "Katakana", nullptr}, + {Qt::Key_Hiragana_Katakana, "Hiragana_Katakana", nullptr}, + {Qt::Key_Zenkaku, "Zenkaku", nullptr}, + {Qt::Key_Hankaku, "Hankaku", nullptr}, + {Qt::Key_Zenkaku_Hankaku, "Zenkaku_Hankaku", nullptr}, + {Qt::Key_Touroku, "Touroku", nullptr}, + {Qt::Key_Massyo, "Massyo", nullptr}, + {Qt::Key_Kana_Lock, "Kana_Lock", nullptr}, + {Qt::Key_Kana_Shift, "Kana_Shift", nullptr}, + {Qt::Key_Eisu_Shift, "Eisu_Shift", nullptr}, + {Qt::Key_Eisu_toggle, "Eisu_toggle", nullptr}, + {Qt::Key_Hangul, "Hangul", nullptr}, + {Qt::Key_Hangul_Start, "Hangul_Start", nullptr}, + {Qt::Key_Hangul_End, "Hangul_End", nullptr}, + {Qt::Key_Hangul_Hanja, "Hangul_Hanja", nullptr}, + {Qt::Key_Hangul_Jamo, "Hangul_Jamo", nullptr}, + {Qt::Key_Hangul_Romaja, "Hangul_Romaja", nullptr}, + {Qt::Key_Hangul_Jeonja, "Hangul_Jeonja", nullptr}, + {Qt::Key_Hangul_Banja, "Hangul_Banja", nullptr}, + {Qt::Key_Hangul_PreHanja, "Hangul_PreHanja", nullptr}, + {Qt::Key_Hangul_PostHanja, "Hangul_PostHanja", nullptr}, + {Qt::Key_Hangul_Special, "Hangul_Special", nullptr}, + {Qt::Key_Dead_Grave, "Dead_Grave", nullptr}, + {Qt::Key_Dead_Acute, "Dead_Acute", nullptr}, + {Qt::Key_Dead_Circumflex, "Dead_Circumflex", nullptr}, + {Qt::Key_Dead_Tilde, "Dead_Tilde", nullptr}, + {Qt::Key_Dead_Macron, "Dead_Macron", nullptr}, + {Qt::Key_Dead_Breve, "Dead_Breve", nullptr}, + {Qt::Key_Dead_Abovedot, "Dead_Abovedot", nullptr}, + {Qt::Key_Dead_Diaeresis, "Dead_Diaeresis", nullptr}, + {Qt::Key_Dead_Abovering, "Dead_Abovering", nullptr}, + {Qt::Key_Dead_Doubleacute, "Dead_Doubleacute", nullptr}, + {Qt::Key_Dead_Caron, "Dead_Caron", nullptr}, + {Qt::Key_Dead_Cedilla, "Dead_Cedilla", nullptr}, + {Qt::Key_Dead_Ogonek, "Dead_Ogonek", nullptr}, + {Qt::Key_Dead_Iota, "Dead_Iota", nullptr}, + {Qt::Key_Dead_Voiced_Sound, "Dead_Voiced_Sound", nullptr}, + {Qt::Key_Dead_Semivoiced_Sound, "Dead_Semivoiced_Sound", nullptr}, + {Qt::Key_Dead_Belowdot, "Dead_Belowdot", nullptr}, + {Qt::Key_Dead_Hook, "Dead_Hook", nullptr}, + {Qt::Key_Dead_Horn, "Dead_Horn", nullptr}, + {Qt::Key_Back, "Back", nullptr}, + {Qt::Key_Forward, "Forward", nullptr}, + {Qt::Key_Stop, "Stop", nullptr}, + {Qt::Key_Refresh, "Refresh", nullptr}, + {Qt::Key_VolumeDown, "VolumeDown", nullptr}, + {Qt::Key_VolumeMute, "VolumeMute", nullptr}, + {Qt::Key_VolumeUp, "VolumeUp", nullptr}, + {Qt::Key_BassBoost, "BassBoost", nullptr}, + {Qt::Key_BassUp, "BassUp", nullptr}, + {Qt::Key_BassDown, "BassDown", nullptr}, + {Qt::Key_TrebleUp, "TrebleUp", nullptr}, + {Qt::Key_TrebleDown, "TrebleDown", nullptr}, + {Qt::Key_MediaPlay, "MediaPlay", nullptr}, + {Qt::Key_MediaStop, "MediaStop", nullptr}, + {Qt::Key_MediaPrevious, "MediaPrevious", nullptr}, + {Qt::Key_MediaNext, "MediaNext", nullptr}, + {Qt::Key_MediaRecord, "MediaRecord", nullptr}, + {Qt::Key_MediaPause, "MediaPause", nullptr}, + {Qt::Key_MediaTogglePlayPause, "MediaTogglePlayPause", nullptr}, + {Qt::Key_HomePage, "HomePage", nullptr}, + {Qt::Key_Favorites, "Favorites", nullptr}, + {Qt::Key_Search, "Search", nullptr}, + {Qt::Key_Standby, "Standby", nullptr}, + {Qt::Key_OpenUrl, "OpenUrl", nullptr}, + {Qt::Key_LaunchMail, "LaunchMail", nullptr}, + {Qt::Key_LaunchMedia, "LaunchMedia", nullptr}, + {Qt::Key_Launch0, "Launch0", nullptr}, + {Qt::Key_Launch1, "Launch1", nullptr}, + {Qt::Key_Launch2, "Launch2", nullptr}, + {Qt::Key_Launch3, "Launch3", nullptr}, + {Qt::Key_Launch4, "Launch4", nullptr}, + {Qt::Key_Launch5, "Launch5", nullptr}, + {Qt::Key_Launch6, "Launch6", nullptr}, + {Qt::Key_Launch7, "Launch7", nullptr}, + {Qt::Key_Launch8, "Launch8", nullptr}, + {Qt::Key_Launch9, "Launch9", nullptr}, + {Qt::Key_LaunchA, "LaunchA", nullptr}, + {Qt::Key_LaunchB, "LaunchB", nullptr}, + {Qt::Key_LaunchC, "LaunchC", nullptr}, + {Qt::Key_LaunchD, "LaunchD", nullptr}, + {Qt::Key_LaunchE, "LaunchE", nullptr}, + {Qt::Key_LaunchF, "LaunchF", nullptr}, + {Qt::Key_MonBrightnessUp, "MonBrightnessUp", nullptr}, + {Qt::Key_MonBrightnessDown, "MonBrightnessDown", nullptr}, + {Qt::Key_KeyboardLightOnOff, "KeyboardLightOnOff", nullptr}, + {Qt::Key_KeyboardBrightnessUp, "KeyboardBrightnessUp", nullptr}, + {Qt::Key_KeyboardBrightnessDown, "KeyboardBrightnessDown", nullptr}, + {Qt::Key_PowerOff, "PowerOff", nullptr}, + {Qt::Key_WakeUp, "WakeUp", nullptr}, + {Qt::Key_Eject, "Eject", nullptr}, + {Qt::Key_ScreenSaver, "ScreenSaver", nullptr}, + {Qt::Key_WWW, "WWW", nullptr}, + {Qt::Key_Memo, "Memo", nullptr}, + {Qt::Key_LightBulb, "LightBulb", nullptr}, + {Qt::Key_Shop, "Shop", nullptr}, + {Qt::Key_History, "History", nullptr}, + {Qt::Key_AddFavorite, "AddFavorite", nullptr}, + {Qt::Key_HotLinks, "HotLinks", nullptr}, + {Qt::Key_BrightnessAdjust, "BrightnessAdjust", nullptr}, + {Qt::Key_Finance, "Finance", nullptr}, + {Qt::Key_Community, "Community", nullptr}, + {Qt::Key_AudioRewind, "AudioRewind", nullptr}, + {Qt::Key_BackForward, "BackForward", nullptr}, + {Qt::Key_ApplicationLeft, "ApplicationLeft", nullptr}, + {Qt::Key_ApplicationRight, "ApplicationRight", nullptr}, + {Qt::Key_Book, "Book", nullptr}, + {Qt::Key_CD, "CD", nullptr}, + {Qt::Key_Calculator, "Calculator", nullptr}, + {Qt::Key_ToDoList, "ToDoList", nullptr}, + {Qt::Key_ClearGrab, "ClearGrab", nullptr}, + {Qt::Key_Close, "Close", nullptr}, + {Qt::Key_Copy, "Copy", nullptr}, + {Qt::Key_Cut, "Cut", nullptr}, + {Qt::Key_Display, "Display", nullptr}, + {Qt::Key_DOS, "DOS", nullptr}, + {Qt::Key_Documents, "Documents", nullptr}, + {Qt::Key_Excel, "Excel", nullptr}, + {Qt::Key_Explorer, "Explorer", nullptr}, + {Qt::Key_Game, "Game", nullptr}, + {Qt::Key_Go, "Go", nullptr}, + {Qt::Key_iTouch, "iTouch", nullptr}, + {Qt::Key_LogOff, "LogOff", nullptr}, + {Qt::Key_Market, "Market", nullptr}, + {Qt::Key_Meeting, "Meeting", nullptr}, + {Qt::Key_MenuKB, "MenuKB", nullptr}, + {Qt::Key_MenuPB, "MenuPB", nullptr}, + {Qt::Key_MySites, "MySites", nullptr}, + {Qt::Key_News, "News", nullptr}, + {Qt::Key_OfficeHome, "OfficeHome", nullptr}, + {Qt::Key_Option, "Option", nullptr}, + {Qt::Key_Paste, "Paste", nullptr}, + {Qt::Key_Phone, "Phone", nullptr}, + {Qt::Key_Calendar, "Calendar", nullptr}, + {Qt::Key_Reply, "Reply", nullptr}, + {Qt::Key_Reload, "Reload", nullptr}, + {Qt::Key_RotateWindows, "RotateWindows", nullptr}, + {Qt::Key_RotationPB, "RotationPB", nullptr}, + {Qt::Key_RotationKB, "RotationKB", nullptr}, + {Qt::Key_Save, "Save", nullptr}, + {Qt::Key_Send, "Send", nullptr}, + {Qt::Key_Spell, "Spell", nullptr}, + {Qt::Key_SplitScreen, "SplitScreen", nullptr}, + {Qt::Key_Support, "Support", nullptr}, + {Qt::Key_TaskPane, "TaskPane", nullptr}, + {Qt::Key_Terminal, "Terminal", nullptr}, + {Qt::Key_Tools, "Tools", nullptr}, + {Qt::Key_Travel, "Travel", nullptr}, + {Qt::Key_Video, "Video", nullptr}, + {Qt::Key_Word, "Word", nullptr}, + {Qt::Key_Xfer, "Xfer", nullptr}, + {Qt::Key_ZoomIn, "ZoomIn", nullptr}, + {Qt::Key_ZoomOut, "ZoomOut", nullptr}, + {Qt::Key_Away, "Away", nullptr}, + {Qt::Key_Messenger, "Messenger", nullptr}, + {Qt::Key_WebCam, "WebCam", nullptr}, + {Qt::Key_MailForward, "MailForward", nullptr}, + {Qt::Key_Pictures, "Pictures", nullptr}, + {Qt::Key_Music, "Music", nullptr}, + {Qt::Key_Battery, "Battery", nullptr}, + {Qt::Key_Bluetooth, "Bluetooth", nullptr}, + {Qt::Key_WLAN, "WLAN", nullptr}, + {Qt::Key_UWB, "UWB", nullptr}, + {Qt::Key_AudioForward, "AudioForward", nullptr}, + {Qt::Key_AudioRepeat, "AudioRepeat", nullptr}, + {Qt::Key_AudioRandomPlay, "AudioRandomPlay", nullptr}, + {Qt::Key_Subtitle, "Subtitle", nullptr}, + {Qt::Key_AudioCycleTrack, "AudioCycleTrack", nullptr}, + {Qt::Key_Time, "Time", nullptr}, + {Qt::Key_Hibernate, "Hibernate", nullptr}, + {Qt::Key_View, "View", nullptr}, + {Qt::Key_TopMenu, "TopMenu", nullptr}, + {Qt::Key_PowerDown, "PowerDown", nullptr}, + {Qt::Key_Suspend, "Suspend", nullptr}, + {Qt::Key_ContrastAdjust, "ContrastAdjust", nullptr}, + {Qt::Key_LaunchG, "LaunchG", nullptr}, + {Qt::Key_LaunchH, "LaunchH", nullptr}, + {Qt::Key_TouchpadToggle, "TouchpadToggle", nullptr}, + {Qt::Key_TouchpadOn, "TouchpadOn", nullptr}, + {Qt::Key_TouchpadOff, "TouchpadOff", nullptr}, + {Qt::Key_MicMute, "MicMute", nullptr}, + {Qt::Key_Red, "Red", nullptr}, + {Qt::Key_Green, "Green", nullptr}, + {Qt::Key_Yellow, "Yellow", nullptr}, + {Qt::Key_Blue, "Blue", nullptr}, + {Qt::Key_ChannelUp, "ChannelUp", nullptr}, + {Qt::Key_ChannelDown, "ChannelDown", nullptr}, + {Qt::Key_Guide, "Guide", nullptr}, + {Qt::Key_Info, "Info", nullptr}, + {Qt::Key_Settings, "Settings", nullptr}, + {Qt::Key_MicVolumeUp, "MicVolumeUp", nullptr}, + {Qt::Key_MicVolumeDown, "MicVolumeDown", nullptr}, + {Qt::Key_New, "New", nullptr}, + {Qt::Key_Open, "Open", nullptr}, + {Qt::Key_Find, "Find", nullptr}, + {Qt::Key_Undo, "Undo", nullptr}, + {Qt::Key_Redo, "Redo", nullptr}, + {Qt::Key_MediaLast, "MediaLast", nullptr}, + {Qt::Key_Select, "Select", nullptr}, + {Qt::Key_Yes, "Yes", nullptr}, + {Qt::Key_No, "No", nullptr}, + {Qt::Key_Cancel, "Cancel", nullptr}, + {Qt::Key_Printer, "Printer", nullptr}, + {Qt::Key_Execute, "Execute", nullptr}, + {Qt::Key_Sleep, "Sleep", nullptr}, + {Qt::Key_Play, "Play", nullptr}, + {Qt::Key_Zoom, "Zoom", nullptr}, + {Qt::Key_Exit, "Exit", nullptr}, + {Qt::Key_Context1, "Context1", nullptr}, + {Qt::Key_Context2, "Context2", nullptr}, + {Qt::Key_Context3, "Context3", nullptr}, + {Qt::Key_Context4, "Context4", nullptr}, + {Qt::Key_Call, "Call", nullptr}, + {Qt::Key_Hangup, "Hangup", nullptr}, + {Qt::Key_Flip, "Flip", nullptr}, + {Qt::Key_ToggleCallHangup, "ToggleCallHangup", nullptr}, + {Qt::Key_VoiceDial, "VoiceDial", nullptr}, + {Qt::Key_LastNumberRedial, "LastNumberRedial", nullptr}, + {Qt::Key_Camera, "Camera", nullptr}, + {Qt::Key_CameraFocus, "CameraFocus", nullptr}}; std::optional InputManager::ConvertHostKeyboardStringToCode(const std::string_view& str) { - std::string compare_name(str); + std::string_view compare_name = str; u32 modifier_bits = 0; if (StringUtil::StartsWith(compare_name, "Numpad")) { @@ -511,6 +514,21 @@ std::optional InputManager::ConvertHostKeyboardCodeToString(u32 cod return ret; } +const char* InputManager::ConvertHostKeyboardCodeToIcon(u32 code) +{ + if (code & Qt::KeyboardModifierMask) + return nullptr; + + const u32 masked_code = (code & ~Qt::KeyboardModifierMask); + for (const KeyCodeName& name : s_qt_key_names) + { + if (static_cast(masked_code) == name.code) + return name.icon_name; + } + + return nullptr; +} + u32 QtUtils::KeyEventToCode(const QKeyEvent* ev) { int key = ev->key(); diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 62a18c5cff..9ee68b253d 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -97,6 +97,7 @@ struct InputBindingInfo const char* name; const char* display_name; + const char* icon_name; Type bind_type; u16 bind_index; GenericInputBinding generic_mapping; diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index 5a9f1b1807..64b707c272 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -58,6 +58,7 @@ #include "common/Console.h" #include "common/FileSystem.h" #include "common/Path.h" +#include "common/SmallString.h" #include "common/StringUtil.h" #include "fmt/format.h" @@ -619,7 +620,7 @@ void GSgetInternalResolution(int* width, int* height) *height = res.y; } -void GSgetStats(std::string& info) +void GSgetStats(SmallStringBase& info) { GSPerfMon& pm = g_perfmon; const char* api_name = GSDevice::RenderAPIToString(g_gs_device->GetRenderAPI()); @@ -627,7 +628,7 @@ void GSgetStats(std::string& info) { const double fps = GetVerticalFrequency(); const double fillrate = pm.Get(GSPerfMon::Fillrate); - fmt::format_to(std::back_inserter(info), "{} SW | {} S | {} P | {} D | {:.2f} U | {:.2f} D | {:.2f} mpps", + info.fmt("{} SW | {} S | {} P | {} D | {:.2f} U | {:.2f} D | {:.2f} mpps", api_name, (int)pm.Get(GSPerfMon::SyncPoint), (int)pm.Get(GSPerfMon::Prim), @@ -642,7 +643,7 @@ void GSgetStats(std::string& info) } else { - fmt::format_to(std::back_inserter(info), "{} HW | {} P | {} D | {} DC | {} B | {} RP | {} RB | {} TC | {} TU", + info.fmt("{} HW | {} P | {} D | {} DC | {} B | {} RP | {} RB | {} TC | {} TU", api_name, (int)pm.Get(GSPerfMon::Prim), (int)pm.Get(GSPerfMon::Draw), @@ -655,7 +656,7 @@ void GSgetStats(std::string& info) } } -void GSgetMemoryStats(std::string& info) +void GSgetMemoryStats(SmallStringBase& info) { if (!g_texture_cache) return; diff --git a/pcsx2/GS/GS.h b/pcsx2/GS/GS.h index d44160a0dd..ff0a994f28 100644 --- a/pcsx2/GS/GS.h +++ b/pcsx2/GS/GS.h @@ -64,6 +64,7 @@ enum class GSDisplayAlignment extern Pcsx2Config::GSOptions GSConfig; class HostDisplay; +class SmallStringBase; // Returns the ID for the specified function, otherwise -1. s16 GSLookupGetSkipCountFunctionId(const std::string_view& name); @@ -107,8 +108,8 @@ void GSGetAdaptersAndFullscreenModes( GSRendererType renderer, std::vector* adapters, std::vector* fullscreen_modes); GSVideoMode GSgetDisplayMode(); void GSgetInternalResolution(int* width, int* height); -void GSgetStats(std::string& info); -void GSgetMemoryStats(std::string& info); +void GSgetStats(SmallStringBase& info); +void GSgetMemoryStats(SmallStringBase& info); void GSgetTitleStats(std::string& info); /// Converts window position to normalized display coordinates (0..1). A value less than 0 or greater than 1 is diff --git a/pcsx2/ImGui/FullscreenUI.cpp b/pcsx2/ImGui/FullscreenUI.cpp index 8b5a958142..ebb0efb263 100644 --- a/pcsx2/ImGui/FullscreenUI.cpp +++ b/pcsx2/ImGui/FullscreenUI.cpp @@ -378,8 +378,7 @@ namespace FullscreenUI static void BeginInputBinding(SettingsInterface* bsi, InputBindingInfo::Type type, const std::string_view& section, const std::string_view& key, const std::string_view& display_name); static void DrawInputBindingWindow(); - static void DrawInputBindingButton(SettingsInterface* bsi, InputBindingInfo::Type type, const char* section, const char* name, - const char* display_name, bool show_type = true); + static void DrawInputBindingButton(SettingsInterface* bsi, InputBindingInfo::Type type, const char* section, const char* name, const char* display_name, const char* icon_name, bool show_type = true); static void ClearInputBindingVariables(); static void StartAutomaticBinding(u32 port); static void DrawSettingInfoSetting(SettingsInterface* bsi, const char* section, const char* key, const SettingInfo& si, @@ -1155,53 +1154,87 @@ s32 FullscreenUI::GetEffectiveIntSetting(SettingsInterface* bsi, const char* sec } void FullscreenUI::DrawInputBindingButton( - SettingsInterface* bsi, InputBindingInfo::Type type, const char* section, const char* name, const char* display_name, bool show_type) + SettingsInterface* bsi, InputBindingInfo::Type type, const char* section, const char* name, const char* display_name, const char* icon_name, bool show_type) { - std::string title(fmt::format("{}/{}", section, name)); + TinyString title; + title.fmt("{}/{}", section, name); + + std::string value = bsi->GetStringValue(section, name); + const bool oneline = (std::count_if(value.begin(), value.end(), [](char ch) { return (ch == '&'); }) <= 1); ImRect bb; bool visible, hovered, clicked; - clicked = MenuButtonFrame(title.c_str(), true, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, &visible, &hovered, &bb.Min, &bb.Max); + clicked = MenuButtonFrame(title, true, + oneline ? ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY : + ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, + &visible, &hovered, &bb.Min, &bb.Max); if (!visible) return; - const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f); - const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint)); - const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max); + if (oneline) + InputManager::PrettifyInputBinding(value); if (show_type) { - switch (type) + if (icon_name) { - case InputBindingInfo::Type::Button: - title = fmt::format(ICON_FA_DOT_CIRCLE " {}", display_name); - break; - case InputBindingInfo::Type::Axis: - case InputBindingInfo::Type::HalfAxis: - title = fmt::format(ICON_FA_BULLSEYE " {}", display_name); - break; - case InputBindingInfo::Type::Motor: - title = fmt::format(ICON_FA_BELL " {}", display_name); - break; - case InputBindingInfo::Type::Macro: - title = fmt::format(ICON_FA_PIZZA_SLICE " {}", display_name); - break; - default: - title = display_name; - break; + title.fmt("{} {}", icon_name, display_name); + } + else + { + switch (type) + { + case InputBindingInfo::Type::Button: + title.fmt(ICON_FA_DOT_CIRCLE " {}", display_name); + break; + case InputBindingInfo::Type::Axis: + case InputBindingInfo::Type::HalfAxis: + title.fmt(ICON_FA_BULLSEYE " {}", display_name); + break; + case InputBindingInfo::Type::Motor: + title.fmt(ICON_FA_BELL " {}", display_name); + break; + case InputBindingInfo::Type::Macro: + title.fmt(ICON_FA_PIZZA_SLICE " {}", display_name); + break; + default: + title = display_name; + break; + } } } - ImGui::PushFont(g_large_font); - ImGui::RenderTextClipped( - title_bb.Min, title_bb.Max, show_type ? title.c_str() : display_name, nullptr, nullptr, ImVec2(0.0f, 0.0f), &title_bb); - ImGui::PopFont(); + const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f); - const std::string value(bsi->GetStringValue(section, name)); - ImGui::PushFont(g_medium_font); - ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, value.empty() ? FSUI_CSTR("No Binding") : value.c_str(), nullptr, nullptr, - ImVec2(0.0f, 0.0f), &summary_bb); - ImGui::PopFont(); + if (oneline) + { + ImGui::PushFont(g_large_font); + + const ImVec2 value_size(ImGui::CalcTextSize(value.empty() ? FSUI_CSTR("-") : value.c_str(), nullptr)); + const float text_end = bb.Max.x - value_size.x; + const ImRect title_bb(bb.Min, ImVec2(text_end, midpoint)); + + ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, show_type ? title.c_str() : display_name, nullptr, nullptr, + ImVec2(0.0f, 0.0f), &title_bb); + ImGui::RenderTextClipped(bb.Min, bb.Max, value.empty() ? FSUI_CSTR("-") : value.c_str(), nullptr, &value_size, + ImVec2(1.0f, 0.5f), &bb); + ImGui::PopFont(); + } + else + { + const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint)); + const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max); + + ImGui::PushFont(g_large_font); + ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, show_type ? title.c_str() : display_name, nullptr, nullptr, + ImVec2(0.0f, 0.0f), &title_bb); + ImGui::PopFont(); + + ImGui::PushFont(g_medium_font); + ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, value.empty() ? FSUI_CSTR("No Binding") : value.c_str(), + nullptr, nullptr, ImVec2(0.0f, 0.0f), &summary_bb); + ImGui::PopFont(); + } if (clicked) { @@ -4023,7 +4056,7 @@ void FullscreenUI::DrawControllerSettingsPage() StartAutomaticBinding(global_slot); for (const InputBindingInfo& bi : ci->bindings) - DrawInputBindingButton(bsi, bi.bind_type, section, bi.name, Host::TranslateToCString("Pad", bi.display_name), true); + DrawInputBindingButton(bsi, bi.bind_type, section, bi.name, Host::TranslateToCString("Pad", bi.display_name), bi.icon_name, true); if (mtap_enabled[mtap_port]) { @@ -4047,11 +4080,28 @@ void FullscreenUI::DrawControllerSettingsPage() continue; DrawInputBindingButton( - bsi, InputBindingInfo::Type::Macro, section, TinyString::from_fmt("Macro{}", macro_index + 1), "Trigger"); + bsi, InputBindingInfo::Type::Macro, section, TinyString::from_fmt("Macro{}", macro_index + 1), "Trigger", nullptr); std::string binds_string(bsi->GetStringValue(section, fmt::format("Macro{}Binds", macro_index + 1).c_str())); - if (MenuButton(FSUI_ICONSTR(ICON_FA_KEYBOARD, "Buttons"), - binds_string.empty() ? FSUI_CSTR("No Buttons Selected") : binds_string.c_str())) + TinyString pretty_binds_string; + if (!binds_string.empty()) + { + for (const std::string_view& bind : StringUtil::SplitString(binds_string, '&', true)) + { + const char* dispname = nullptr; + for (const InputBindingInfo& bi : ci->bindings) + { + if (bind == bi.name) + { + dispname = bi.icon_name ? bi.icon_name : Host::TranslateToCString("Pad", bi.display_name); + break; + } + } + pretty_binds_string.append_fmt("{}{}", pretty_binds_string.empty() ? "" : " ", dispname); + } + } + if (MenuButtonWithValue(FSUI_ICONSTR(ICON_FA_KEYBOARD, "Buttons"), nullptr, pretty_binds_string.empty() ? FSUI_CSTR("-") : pretty_binds_string.c_str(), true, + LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY)) { std::vector buttons_split(StringUtil::SplitString(binds_string, '&', true)); ImGuiFullscreen::ChoiceDialogOptions options; @@ -4114,12 +4164,12 @@ void FullscreenUI::DrawControllerSettingsPage() } const TinyString freq_key = TinyString::from_fmt("Macro{}Frequency", macro_index + 1); - const TinyString freq_label = TinyString::from_fmt(FSUI_FSTR("Macro {} Frequency"), macro_index + 1); + const TinyString freq_label = TinyString::from_fmt(ICON_FA_CLOCK " {}##macro_{}_frequency", FSUI_VSTR("Frequency"), macro_index + 1); s32 frequency = bsi->GetIntValue(section, freq_key.c_str(), 0); const SmallString freq_summary = - ((frequency == 0) ? TinyString(FSUI_VSTR("Macro will not auto-toggle.")) : - TinyString::from_fmt(FSUI_FSTR("Macro will toggle every {} frames."), frequency)); - if (MenuButton(FSUI_ICONSTR(ICON_FA_LIGHTBULB, "Frequency"), freq_summary.c_str())) + ((frequency == 0) ? TinyString(FSUI_VSTR("Disabled")) : + TinyString::from_fmt(FSUI_FSTR("{} Frames"), frequency)); + if (MenuButtonWithValue(freq_label, FSUI_CSTR("Determines the frequency at which the macro will toggle the buttons on and off (aka auto fire)."), freq_summary, true)) ImGui::OpenPopup(freq_label.c_str()); const std::string pressure_key(fmt::format("Macro{}Pressure", macro_index + 1)); @@ -4264,7 +4314,7 @@ void FullscreenUI::DrawControllerSettingsPage() for (const InputBindingInfo& bi : bindings) { DrawInputBindingButton(bsi, bi.bind_type, section.c_str(), USB::GetConfigSubKey(type, bi.name).c_str(), - Host::TranslateToCString("USB", bi.display_name)); + Host::TranslateToCString("USB", bi.display_name), bi.icon_name); } } @@ -4299,7 +4349,7 @@ void FullscreenUI::DrawHotkeySettingsPage() } DrawInputBindingButton( - bsi, InputBindingInfo::Type::Button, "Hotkeys", hotkey->name, Host::TranslateToCString("Hotkeys", hotkey->display_name), false); + bsi, InputBindingInfo::Type::Button, "Hotkeys", hotkey->name, Host::TranslateToCString("Hotkeys", hotkey->display_name), nullptr, false); } EndMenuButtons(); @@ -5512,7 +5562,7 @@ void FullscreenUI::DrawGameListWindow() default: break; } - + if (VMManager::GetState() != VMState::Shutdown) { // Dummy window to prevent interacting with the game list while loading. @@ -6133,9 +6183,9 @@ void FullscreenUI::DrawAboutWindow() if (ImGui::BeginPopupModal(FSUI_CSTR("About PCSX2"), &s_about_window_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize)) { ImGui::TextWrapped("%s", FSUI_CSTR( - "PCSX2 is a free and open-source PlayStation 2 (PS2) emulator. Its purpose is to emulate the PS2's hardware, using a " - "combination of MIPS CPU Interpreters, Recompilers and a Virtual Machine which manages hardware states and PS2 system memory. " - "This allows you to play PS2 games on your PC, with many additional features and benefits.")); + "PCSX2 is a free and open-source PlayStation 2 (PS2) emulator. Its purpose is to emulate the PS2's hardware, using a " + "combination of MIPS CPU Interpreters, Recompilers and a Virtual Machine which manages hardware states and PS2 system memory. " + "This allows you to play PS2 games on your PC, with many additional features and benefits.")); ImGui::NewLine(); @@ -6428,6 +6478,7 @@ TRANSLATE_NOOP("FullscreenUI", "Start the console without any disc inserted."); TRANSLATE_NOOP("FullscreenUI", "Start a game from a disc in your PC's DVD drive."); TRANSLATE_NOOP("FullscreenUI", "Change settings for the emulator."); TRANSLATE_NOOP("FullscreenUI", "Exits the program."); +TRANSLATE_NOOP("FullscreenUI", "-"); TRANSLATE_NOOP("FullscreenUI", "No Binding"); TRANSLATE_NOOP("FullscreenUI", "Setting %s binding %s."); TRANSLATE_NOOP("FullscreenUI", "Push a controller button or axis now."); @@ -6710,7 +6761,7 @@ TRANSLATE_NOOP("FullscreenUI", "The XInput source provides support for XBox 360/ TRANSLATE_NOOP("FullscreenUI", "Multitap"); TRANSLATE_NOOP("FullscreenUI", "Enables an additional three controller slots. Not supported in all games."); TRANSLATE_NOOP("FullscreenUI", "Attempts to map the selected port to a chosen controller."); -TRANSLATE_NOOP("FullscreenUI", "No Buttons Selected"); +TRANSLATE_NOOP("FullscreenUI", "Determines the frequency at which the macro will toggle the buttons on and off (aka auto fire)."); TRANSLATE_NOOP("FullscreenUI", "Determines how much pressure is simulated when macro is active."); TRANSLATE_NOOP("FullscreenUI", "Determines the pressure required to activate the macro."); TRANSLATE_NOOP("FullscreenUI", "Toggle every %d frames"); @@ -6866,8 +6917,7 @@ TRANSLATE_NOOP("FullscreenUI", "Input profile '{}' saved."); TRANSLATE_NOOP("FullscreenUI", "Failed to save input profile '{}'."); TRANSLATE_NOOP("FullscreenUI", "Port {} Controller Type"); TRANSLATE_NOOP("FullscreenUI", "Select Macro {} Binds"); -TRANSLATE_NOOP("FullscreenUI", "Macro {} Frequency"); -TRANSLATE_NOOP("FullscreenUI", "Macro will toggle every {} frames."); +TRANSLATE_NOOP("FullscreenUI", "{} Frames"); TRANSLATE_NOOP("FullscreenUI", "Port {} Device"); TRANSLATE_NOOP("FullscreenUI", "Port {} Subtype"); TRANSLATE_NOOP("FullscreenUI", "{} unlabelled patch codes will automatically activate."); @@ -7091,6 +7141,7 @@ TRANSLATE_NOOP("FullscreenUI", "CRC"); TRANSLATE_NOOP("FullscreenUI", "Time Played"); TRANSLATE_NOOP("FullscreenUI", "Last Played"); TRANSLATE_NOOP("FullscreenUI", "Size"); +TRANSLATE_NOOP("FullscreenUI", "Frequency"); TRANSLATE_NOOP("FullscreenUI", "Select Disc Image"); TRANSLATE_NOOP("FullscreenUI", "Select Disc Drive"); TRANSLATE_NOOP("FullscreenUI", "Start File"); @@ -7165,7 +7216,6 @@ TRANSLATE_NOOP("FullscreenUI", "Controller Port {}{} Macros"); TRANSLATE_NOOP("FullscreenUI", "Controller Port {} Macros"); TRANSLATE_NOOP("FullscreenUI", "Macro Button {}"); TRANSLATE_NOOP("FullscreenUI", "Buttons"); -TRANSLATE_NOOP("FullscreenUI", "Frequency"); TRANSLATE_NOOP("FullscreenUI", "Pressure"); TRANSLATE_NOOP("FullscreenUI", "Deadzone"); TRANSLATE_NOOP("FullscreenUI", "Controller Port {}{} Settings"); diff --git a/pcsx2/ImGui/ImGuiFullscreen.cpp b/pcsx2/ImGui/ImGuiFullscreen.cpp index de5efb4c7e..e0ee7e5da8 100644 --- a/pcsx2/ImGui/ImGuiFullscreen.cpp +++ b/pcsx2/ImGui/ImGuiFullscreen.cpp @@ -55,7 +55,6 @@ namespace ImGuiFullscreen static void DrawBackgroundProgressDialogs(ImVec2& position, float spacing); static void DrawNotifications(ImVec2& position, float spacing); static void DrawToast(); - static void GetMenuButtonFrameBounds(float height, ImVec2* pos, ImVec2* size); static bool MenuButtonFrame(const char* str_id, bool enabled, float height, bool* visible, bool* hovered, ImRect* bb, ImGuiButtonFlags flags = 0, float hover_alpha = 1.0f); static void PopulateFileSelectorItems(); diff --git a/pcsx2/ImGui/ImGuiFullscreen.h b/pcsx2/ImGui/ImGuiFullscreen.h index 7ed9e26a8a..1deff01906 100644 --- a/pcsx2/ImGui/ImGuiFullscreen.h +++ b/pcsx2/ImGui/ImGuiFullscreen.h @@ -154,6 +154,7 @@ namespace ImGuiFullscreen void BeginMenuButtons(u32 num_items = 0, float y_align = 0.0f, float x_padding = LAYOUT_MENU_BUTTON_X_PADDING, float y_padding = LAYOUT_MENU_BUTTON_Y_PADDING, float item_height = LAYOUT_MENU_BUTTON_HEIGHT); void EndMenuButtons(); + void GetMenuButtonFrameBounds(float height, ImVec2* pos, ImVec2* size); bool MenuButtonFrame(const char* str_id, bool enabled, float height, bool* visible, bool* hovered, ImVec2* min, ImVec2* max, ImGuiButtonFlags flags = 0, float hover_alpha = 1.0f); void MenuHeading(const char* title, bool draw_line = true); diff --git a/pcsx2/ImGui/ImGuiManager.cpp b/pcsx2/ImGui/ImGuiManager.cpp index 97fbd12faf..7bf793ef8d 100644 --- a/pcsx2/ImGui/ImGuiManager.cpp +++ b/pcsx2/ImGui/ImGuiManager.cpp @@ -90,7 +90,8 @@ static ImFont* s_large_font; static std::vector s_standard_font_data; static std::vector s_fixed_font_data; -static std::vector s_icon_font_data; +static std::vector s_icon_fa_font_data; +static std::vector s_icon_pf_font_data; static float s_window_width; static float s_window_height; @@ -425,14 +426,24 @@ bool ImGuiManager::LoadFontData() s_fixed_font_data = std::move(font_data.value()); } - if (s_icon_font_data.empty()) + if (s_icon_fa_font_data.empty()) { std::optional> font_data = FileSystem::ReadBinaryFile(Path::Combine(EmuFolders::Resources, "fonts" FS_OSPATH_SEPARATOR_STR "fa-solid-900.ttf").c_str()); if (!font_data.has_value()) return false; - s_icon_font_data = std::move(font_data.value()); + s_icon_fa_font_data = std::move(font_data.value()); + } + + if (s_icon_pf_font_data.empty()) + { + std::optional> font_data = + FileSystem::ReadBinaryFile(Path::Combine(EmuFolders::Resources, "fonts" FS_OSPATH_SEPARATOR_STR "promptfont.otf").c_str()); + if (!font_data.has_value()) + return false; + + s_icon_pf_font_data = std::move(font_data.value()); } return true; @@ -442,7 +453,8 @@ void ImGuiManager::UnloadFontData() { std::vector().swap(s_standard_font_data); std::vector().swap(s_fixed_font_data); - std::vector().swap(s_icon_font_data); + std::vector().swap(s_icon_fa_font_data); + std::vector().swap(s_icon_pf_font_data); } ImFont* ImGuiManager::AddTextFont(float size) @@ -486,17 +498,40 @@ bool ImGuiManager::AddIconFonts(float size) { // clang-format off static constexpr ImWchar range_fa[] = { 0xf002,0xf002,0xf005,0xf005,0xf007,0xf007,0xf00c,0xf00e,0xf011,0xf011,0xf013,0xf013,0xf017,0xf017,0xf019,0xf019,0xf01c,0xf01c,0xf021,0xf021,0xf023,0xf023,0xf025,0xf025,0xf027,0xf028,0xf02e,0xf02e,0xf030,0xf030,0xf03a,0xf03a,0xf03d,0xf03d,0xf04a,0xf04c,0xf04e,0xf04e,0xf050,0xf050,0xf052,0xf052,0xf059,0xf059,0xf05e,0xf05e,0xf063,0xf063,0xf065,0xf065,0xf067,0xf067,0xf06a,0xf06a,0xf071,0xf071,0xf077,0xf078,0xf07b,0xf07c,0xf084,0xf085,0xf091,0xf091,0xf0ac,0xf0ad,0xf0b0,0xf0b0,0xf0c5,0xf0c5,0xf0c7,0xf0c9,0xf0cb,0xf0cb,0xf0d0,0xf0d0,0xf0dc,0xf0dc,0xf0e2,0xf0e2,0xf0eb,0xf0eb,0xf0f1,0xf0f1,0xf0f3,0xf0f3,0xf0fe,0xf0fe,0xf110,0xf110,0xf119,0xf119,0xf11b,0xf11c,0xf121,0xf121,0xf133,0xf133,0xf140,0xf140,0xf144,0xf144,0xf14a,0xf14a,0xf15b,0xf15b,0xf15d,0xf15d,0xf188,0xf188,0xf191,0xf192,0xf1c9,0xf1c9,0xf1dd,0xf1de,0xf1e6,0xf1e6,0xf1ea,0xf1eb,0xf1f8,0xf1f8,0xf1fc,0xf1fc,0xf242,0xf242,0xf245,0xf245,0xf26c,0xf26c,0xf279,0xf279,0xf2d0,0xf2d0,0xf2db,0xf2db,0xf2f2,0xf2f2,0xf2f5,0xf2f5,0xf302,0xf302,0xf3c1,0xf3c1,0xf3fd,0xf3fd,0xf410,0xf410,0xf466,0xf466,0xf500,0xf500,0xf517,0xf517,0xf51f,0xf51f,0xf543,0xf543,0xf545,0xf545,0xf547,0xf548,0xf552,0xf552,0xf5a2,0xf5a2,0xf5e7,0xf5e7,0xf65d,0xf65e,0xf6a9,0xf6a9,0xf756,0xf756,0xf7c2,0xf7c2,0xf807,0xf807,0xf815,0xf815,0xf818,0xf818,0xf84c,0xf84c,0xf8cc,0xf8cc,0xf8d9,0xf8d9,0x0,0x0 }; + static constexpr ImWchar range_pf[] = { 0x2198,0x2199,0x219e,0x21a1,0x21b0,0x21b3,0x21ba,0x21c3,0x21d0,0x21d4,0x21dc,0x21dd,0x21e0,0x21e3,0x21f3,0x21f3,0x21f7,0x21f8,0x21fa,0x21fb,0x227a,0x227d,0x23f4,0x23f7,0x2427,0x243a,0x243c,0x243c,0x2460,0x246b,0x24f5,0x24fd,0x24ff,0x24ff,0x278a,0x278e,0xe001,0xe001,0xff21,0xff3a,0x0,0x0 }; // clang-format on - ImFontConfig cfg; - cfg.MergeMode = true; - cfg.PixelSnapH = true; - cfg.GlyphMinAdvanceX = size; - cfg.GlyphMaxAdvanceX = size; - cfg.FontDataOwnedByAtlas = false; + { + ImFontConfig cfg; + cfg.MergeMode = true; + cfg.PixelSnapH = true; + cfg.GlyphMinAdvanceX = size; + cfg.GlyphMaxAdvanceX = size; + cfg.FontDataOwnedByAtlas = false; - return (ImGui::GetIO().Fonts->AddFontFromMemoryTTF( - s_icon_font_data.data(), static_cast(s_icon_font_data.size()), size * 0.75f, &cfg, range_fa) != nullptr); + if (!ImGui::GetIO().Fonts->AddFontFromMemoryTTF( + s_icon_fa_font_data.data(), static_cast(s_icon_fa_font_data.size()), size * 0.75f, &cfg, range_fa)) + { + return false; + } + } + + { + ImFontConfig cfg; + cfg.MergeMode = true; + cfg.PixelSnapH = true; + cfg.GlyphMinAdvanceX = size; + cfg.GlyphMaxAdvanceX = size; + cfg.FontDataOwnedByAtlas = false; + + if (!ImGui::GetIO().Fonts->AddFontFromMemoryTTF( + s_icon_pf_font_data.data(), static_cast(s_icon_pf_font_data.size()), size * 1.2f, &cfg, range_pf)) + { + return false; + } + } + + return true; } bool ImGuiManager::AddImGuiFonts(bool fullscreen_fonts) diff --git a/pcsx2/ImGui/ImGuiOverlays.cpp b/pcsx2/ImGui/ImGuiOverlays.cpp index 68fba171d1..df41b5692e 100644 --- a/pcsx2/ImGui/ImGuiOverlays.cpp +++ b/pcsx2/ImGui/ImGuiOverlays.cpp @@ -53,7 +53,7 @@ namespace ImGuiManager { - static void FormatProcessorStat(std::string& text, double usage, double time); + static void FormatProcessorStat(SmallStringBase& text, double usage, double time); static void DrawPerformanceOverlay(float& position_y); static void DrawSettingsOverlay(); static void DrawInputsOverlay(); @@ -86,15 +86,15 @@ static std::tuple GetMinMax(std::span values) return std::tie(min, max); } -void ImGuiManager::FormatProcessorStat(std::string& text, double usage, double time) +void ImGuiManager::FormatProcessorStat(SmallStringBase& text, double usage, double time) { // Some values, such as GPU (and even CPU to some extent) can be out of phase with the wall clock, // which the processor time is divided by to get a utilization percentage. Let's clamp it at 100%, // so that people don't get confused, and remove the decimal places when it's there while we're at it. if (usage >= 99.95) - fmt::format_to(std::back_inserter(text), "100% ({:.2f}ms)", time); + text.append_fmt("100% ({:.2f}ms)", time); else - fmt::format_to(std::back_inserter(text), "{:.1f}% ({:.2f}ms)", usage, time); + text.append_fmt("{:.1f}% ({:.2f}ms)", usage, time); } void ImGuiManager::DrawPerformanceOverlay(float& position_y) @@ -108,11 +108,9 @@ void ImGuiManager::DrawPerformanceOverlay(float& position_y) ImFont* const standard_font = ImGuiManager::GetStandardFont(); ImDrawList* dl = ImGui::GetBackgroundDrawList(); - std::string text; + SmallString text; ImVec2 text_size; - text.reserve(128); - #define DRAW_LINE(font, text, color) \ do \ { \ @@ -136,31 +134,31 @@ void ImGuiManager::DrawPerformanceOverlay(float& position_y) switch (PerformanceMetrics::GetInternalFPSMethod()) { case PerformanceMetrics::InternalFPSMethod::GSPrivilegedRegister: - fmt::format_to(std::back_inserter(text), "G: {:.2f} [P] | V: {:.2f}", PerformanceMetrics::GetInternalFPS(), + text.append_fmt("G: {:.2f} [P] | V: {:.2f}", PerformanceMetrics::GetInternalFPS(), PerformanceMetrics::GetFPS()); break; case PerformanceMetrics::InternalFPSMethod::DISPFBBlit: - fmt::format_to(std::back_inserter(text), "G: {:.2f} [B] | V: {:.2f}", PerformanceMetrics::GetInternalFPS(), + text.append_fmt("G: {:.2f} [B] | V: {:.2f}", PerformanceMetrics::GetInternalFPS(), PerformanceMetrics::GetFPS()); break; case PerformanceMetrics::InternalFPSMethod::None: default: - fmt::format_to(std::back_inserter(text), "V: {:.2f}", PerformanceMetrics::GetFPS()); + text.append_fmt("V: {:.2f}", PerformanceMetrics::GetFPS()); break; } first = false; } if (GSConfig.OsdShowSpeed) { - fmt::format_to(std::back_inserter(text), "{}{}%", first ? "" : " | ", static_cast(std::round(speed))); + text.append_fmt("{}{}%", first ? "" : " | ", static_cast(std::round(speed))); const float target_speed = VMManager::GetTargetSpeed(); if (target_speed == 0.0f) - text += " (Max)"; + text.append(" (Max)"); else - fmt::format_to(std::back_inserter(text), " ({:.0f}%)", target_speed * 100.0f); + text.append_fmt(" ({:.0f}%)", target_speed * 100.0f); } if (!text.empty()) { @@ -193,20 +191,20 @@ void ImGuiManager::DrawPerformanceOverlay(float& position_y) GSgetInternalResolution(&width, &height); text.clear(); - fmt::format_to(std::back_inserter(text), "{}x{} {} {}", width, height, ReportVideoMode(), ReportInterlaceMode()); + text.append_fmt("{}x{} {} {}", width, height, ReportVideoMode(), ReportInterlaceMode()); DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255)); } if (GSConfig.OsdShowCPU) { text.clear(); - fmt::format_to(std::back_inserter(text), "{:.2f}ms | {:.2f}ms | {:.2f}ms", PerformanceMetrics::GetMinimumFrameTime(), + text.append_fmt("{:.2f}ms | {:.2f}ms | {:.2f}ms", PerformanceMetrics::GetMinimumFrameTime(), PerformanceMetrics::GetAverageFrameTime(), PerformanceMetrics::GetMaximumFrameTime()); DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255)); text.clear(); if (EmuConfig.Speedhacks.EECycleRate != 0 || EmuConfig.Speedhacks.EECycleSkip != 0) - fmt::format_to(std::back_inserter(text), "EE[{}/{}]: ", EmuConfig.Speedhacks.EECycleRate, EmuConfig.Speedhacks.EECycleSkip); + text.append_fmt("EE[{}/{}]: ", EmuConfig.Speedhacks.EECycleRate, EmuConfig.Speedhacks.EECycleSkip); else text = "EE: "; FormatProcessorStat(text, PerformanceMetrics::GetCPUThreadUsage(), PerformanceMetrics::GetCPUThreadAverageTime()); @@ -220,7 +218,7 @@ void ImGuiManager::DrawPerformanceOverlay(float& position_y) for (u32 i = 0; i < gs_sw_threads; i++) { text.clear(); - fmt::format_to(std::back_inserter(text), "SW-{}: ", i); + text.append_fmt("SW-{}: ", i); FormatProcessorStat(text, PerformanceMetrics::GetGSSWThreadUsage(i), PerformanceMetrics::GetGSSWThreadAverageTime(i)); DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255)); } @@ -297,7 +295,7 @@ void ImGuiManager::DrawPerformanceOverlay(float& position_y) const ImVec2 wpos(ImGui::GetCurrentWindow()->Pos); text.clear(); - fmt::format_to(std::back_inserter(text), "{:.1f} ms", max); + text.append_fmt("{:.1f} ms", max); text_size = fixed_font->CalcTextSizeA(fixed_font->FontSize, FLT_MAX, 0.0f, text.c_str(), text.c_str() + text.length()); win_dl->AddText(ImVec2(wpos.x + history_size.x - text_size.x - spacing + shadow_offset, wpos.y + shadow_offset), IM_COL32(0, 0, 0, 100), text.c_str(), text.c_str() + text.length()); @@ -305,7 +303,7 @@ void ImGuiManager::DrawPerformanceOverlay(float& position_y) text.c_str() + text.length()); text.clear(); - fmt::format_to(std::back_inserter(text), "{:.1f} ms", min); + text.append_fmt("{:.1f} ms", min); text_size = fixed_font->CalcTextSizeA(fixed_font->FontSize, FLT_MAX, 0.0f, text.c_str(), text.c_str() + text.length()); win_dl->AddText(ImVec2(wpos.x + history_size.x - text_size.x - spacing + shadow_offset, wpos.y + history_size.y - fixed_font->FontSize + shadow_offset), @@ -470,7 +468,7 @@ void ImGuiManager::DrawInputsOverlay() const float shadow_offset = 1.0f * scale; const float margin = 10.0f * scale; const float spacing = 5.0f * scale; - ImFont* font = ImGuiManager::GetFixedFont(); + ImFont* font = ImGuiManager::GetStandardFont(); static constexpr u32 text_color = IM_COL32(0xff, 0xff, 0xff, 255); static constexpr u32 shadow_color = IM_COL32(0x00, 0x00, 0x00, 100); @@ -497,8 +495,7 @@ void ImGuiManager::DrawInputsOverlay() const ImVec4 clip_rect(current_x, current_y, display_size.x - margin, display_size.y - margin); - std::string text; - text.reserve(256); + SmallString text; for (u32 slot = 0; slot < Pad::NUM_CONTROLLER_PORTS; slot++) { @@ -507,10 +504,12 @@ void ImGuiManager::DrawInputsOverlay() if (ctype == Pad::ControllerType::NotConnected) continue; - text.clear(); - fmt::format_to(std::back_inserter(text), "P{} |", slot + 1u); - const Pad::ControllerInfo& cinfo = pad->GetInfo(); + if (cinfo.icon_name) + text.fmt("{} {}", cinfo.icon_name, slot + 1u); + else + text.fmt("{} |", slot + 1u); + for (u32 bind = 0; bind < static_cast(cinfo.bindings.size()); bind++) { const InputBindingInfo& bi = cinfo.bindings[bind]; @@ -522,9 +521,9 @@ void ImGuiManager::DrawInputsOverlay() // axes are always shown const float value = static_cast(pad->GetRawInput(bind)) * (1.0f / 255.0f); if (value >= (254.0f / 255.0f)) - fmt::format_to(std::back_inserter(text), " {}", bi.name); + text.append_fmt(" {}", bi.icon_name ? bi.icon_name : bi.name); else if (value > (1.0f / 255.0f)) - fmt::format_to(std::back_inserter(text), " {}: {:.2f}", bi.name, value); + text.append_fmt(" {}: {:.2f}", bi.icon_name ? bi.icon_name : bi.name, value); } break; @@ -533,7 +532,7 @@ void ImGuiManager::DrawInputsOverlay() // buttons only shown when active const float value = static_cast(pad->GetRawInput(bind)) * (1.0f / 255.0f); if (value >= 0.5f) - fmt::format_to(std::back_inserter(text), " {}", bi.name); + text.append_fmt(" {}", bi.icon_name ? bi.icon_name : bi.name); } break; @@ -562,8 +561,7 @@ void ImGuiManager::DrawInputsOverlay() if (bindings.empty()) continue; - text.clear(); - fmt::format_to(std::back_inserter(text), "USB{} |", port + 1u); + text.fmt("USB{} |", port + 1u); for (const InputBindingInfo& bi : bindings) { @@ -575,9 +573,9 @@ void ImGuiManager::DrawInputsOverlay() // axes are always shown const float value = static_cast(USB::GetDeviceBindValue(port, bi.bind_index)); if (value >= (254.0f / 255.0f)) - fmt::format_to(std::back_inserter(text), " {}", bi.name); + text.append_fmt(" {}", bi.icon_name ? bi.icon_name : bi.name); else if (value > (1.0f / 255.0f)) - fmt::format_to(std::back_inserter(text), " {}: {:.2f}", bi.name, value); + text.append_fmt(" {}: {:.2f}", bi.icon_name ? bi.icon_name : bi.name, value); } break; @@ -586,7 +584,7 @@ void ImGuiManager::DrawInputsOverlay() // buttons only shown when active const float value = static_cast(USB::GetDeviceBindValue(port, bi.bind_index)); if (value >= 0.5f) - fmt::format_to(std::back_inserter(text), " {}", bi.name); + text.append_fmt(" {}", bi.icon_name ? bi.icon_name : bi.name); } break; diff --git a/pcsx2/Input/DInputSource.cpp b/pcsx2/Input/DInputSource.cpp index e3afb700e5..cd1a4e00dc 100644 --- a/pcsx2/Input/DInputSource.cpp +++ b/pcsx2/Input/DInputSource.cpp @@ -397,32 +397,38 @@ std::optional DInputSource::ParseKeyString(const std::string_vi return std::nullopt; } -std::string DInputSource::ConvertKeyToString(InputBindingKey key) +TinyString DInputSource::ConvertKeyToString(InputBindingKey key) { - std::string ret; + TinyString ret; if (key.source_type == InputSourceType::DInput) { if (key.source_subtype == InputSubclass::ControllerAxis) { const char* modifier = (key.modifier == InputModifier::FullAxis ? "Full" : (key.modifier == InputModifier::Negate ? "-" : "+")); - ret = fmt::format("DInput-{}/{}Axis{}{}", u32(key.source_index), modifier, u32(key.data), (key.invert && !m_ignore_inversion) ? "~" : ""); + ret.fmt("DInput-{}/{}Axis{}{}", u32(key.source_index), modifier, u32(key.data), (key.invert && !m_ignore_inversion) ? "~" : ""); } else if (key.source_subtype == InputSubclass::ControllerButton && key.data >= MAX_NUM_BUTTONS) { const u32 hat_num = (key.data - MAX_NUM_BUTTONS) / NUM_HAT_DIRECTIONS; const u32 hat_dir = (key.data - MAX_NUM_BUTTONS) % NUM_HAT_DIRECTIONS; - ret = fmt::format("DInput-{}/Hat{}{}", u32(key.source_index), hat_num, s_hat_directions[hat_dir]); + ret.fmt("DInput-{}/Hat{}{}", u32(key.source_index), hat_num, s_hat_directions[hat_dir]); } else if (key.source_subtype == InputSubclass::ControllerButton) { - ret = fmt::format("DInput-{}/Button{}", u32(key.source_index), u32(key.data)); + ret.fmt("DInput-{}/Button{}", u32(key.source_index), u32(key.data)); } } return ret; } + +TinyString DInputSource::ConvertKeyToIcon(InputBindingKey key) +{ + return {}; +} + void DInputSource::CheckForStateChanges(size_t index, const DIJOYSTATE2& new_state) { ControllerData& cd = m_controllers[index]; diff --git a/pcsx2/Input/DInputSource.h b/pcsx2/Input/DInputSource.h index daca234dea..e279d43443 100644 --- a/pcsx2/Input/DInputSource.h +++ b/pcsx2/Input/DInputSource.h @@ -60,7 +60,8 @@ public: void UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity, float small_intensity) override; std::optional ParseKeyString(const std::string_view& device, const std::string_view& binding) override; - std::string ConvertKeyToString(InputBindingKey key) override; + TinyString ConvertKeyToString(InputBindingKey key) override; + TinyString ConvertKeyToIcon(InputBindingKey key) override; private: struct ControllerData diff --git a/pcsx2/Input/InputManager.cpp b/pcsx2/Input/InputManager.cpp index 111300c498..04cceb4298 100644 --- a/pcsx2/Input/InputManager.cpp +++ b/pcsx2/Input/InputManager.cpp @@ -27,6 +27,8 @@ #include "common/StringUtil.h" #include "common/Timer.h" +#include "IconsPromptFont.h" + #include "fmt/core.h" #include @@ -104,6 +106,7 @@ namespace InputManager static std::vector SplitChord(const std::string_view& binding); static bool SplitBinding(const std::string_view& binding, std::string_view* source, std::string_view* sub_binding); + static void PrettifyInputBindingPart(const std::string_view binding, SmallString& ret, bool& changed); static void AddBinding(const std::string_view& binding, const InputEventHandler& handler); static void AddBindings(const std::vector& bindings, const InputEventHandler& handler); static bool ParseBindingAndGetSource(const std::string_view& binding, InputBindingKey* key, InputSource** source); @@ -325,7 +328,7 @@ std::string InputManager::ConvertInputBindingKeyToString(InputBindingInfo::Type } else if (key.source_type < InputSourceType::Count && s_input_sources[static_cast(key.source_type)]) { - return s_input_sources[static_cast(key.source_type)]->ConvertKeyToString(key); + return std::string(s_input_sources[static_cast(key.source_type)]->ConvertKeyToString(key)); } } @@ -358,6 +361,117 @@ std::string InputManager::ConvertInputBindingKeysToString(InputBindingInfo::Type return ss.str(); } +bool InputManager::PrettifyInputBinding(std::string& binding) +{ + if (binding.empty()) + return false; + + const std::string_view binding_view(binding); + + SmallString ret; + bool changed = false; + + std::string_view::size_type last = 0; + std::string_view::size_type next; + while ((next = binding_view.find('&', last)) != std::string_view::npos) + { + if (last != next) + { + const std::string_view part = StringUtil::StripWhitespace(binding_view.substr(last, next - last)); + if (!part.empty()) + { + if (!ret.empty()) + ret.append(" + "); + PrettifyInputBindingPart(part, ret, changed); + } + } + last = next + 1; + } + if (last < (binding_view.size() - 1)) + { + const std::string_view part = StringUtil::StripWhitespace(binding_view.substr(last)); + if (!part.empty()) + { + if (!ret.empty()) + ret.append(" + "); + PrettifyInputBindingPart(part, ret, changed); + } + } + + if (changed) + binding = ret.view(); + + return changed; +} + +void InputManager::PrettifyInputBindingPart(const std::string_view binding, SmallString& ret, bool& changed) +{ + std::string_view source, sub_binding; + if (!SplitBinding(binding, &source, &sub_binding)) + return; + + // lameee, string matching + if (StringUtil::StartsWith(source, "Keyboard")) + { + std::optional key = ParseHostKeyboardKey(source, sub_binding); + const char* icon = key.has_value() ? ConvertHostKeyboardCodeToIcon(key->data) : nullptr; + if (icon) + { + ret.append(icon); + changed = true; + return; + } + } + else if (StringUtil::StartsWith(source, "Pointer")) + { + const std::optional key = ParsePointerKey(source, sub_binding); + if (key.has_value()) + { + if (key->source_subtype == InputSubclass::PointerButton) + { + static constexpr const char* button_icons[] = { + ICON_PF_MOUSE_BUTTON_1, + ICON_PF_MOUSE_BUTTON_2, + ICON_PF_MOUSE_BUTTON_3, + ICON_PF_MOUSE_BUTTON_4, + ICON_PF_MOUSE_BUTTON_5, + }; + if (key->data < std::size(button_icons)) + { + ret.append(button_icons[key->data]); + changed = true; + return; + } + } + } + } + else + { + for (u32 i = FIRST_EXTERNAL_INPUT_SOURCE; i < LAST_EXTERNAL_INPUT_SOURCE; i++) + { + if (s_input_sources[i]) + { + std::optional key = s_input_sources[i]->ParseKeyString(source, sub_binding); + if (key.has_value()) + { + const TinyString icon = s_input_sources[i]->ConvertKeyToIcon(key.value()); + if (!icon.empty()) + { + ret.append(icon); + changed = true; + return; + } + + break; + } + } + } + } + + ret.append(binding); +} + + void InputManager::AddBinding(const std::string_view& binding, const InputEventHandler& handler) { std::shared_ptr ibinding; diff --git a/pcsx2/Input/InputManager.h b/pcsx2/Input/InputManager.h index acae4eec2c..5e7bd4eaff 100644 --- a/pcsx2/Input/InputManager.h +++ b/pcsx2/Input/InputManager.h @@ -196,6 +196,9 @@ namespace InputManager /// Converts a key code from an identifier to a human-readable string. std::optional ConvertHostKeyboardCodeToString(u32 code); + /// Converts a key code from an identifier to an icon which can be drawn. + const char* ConvertHostKeyboardCodeToIcon(u32 code); + /// Creates a key for a host-specific key code. InputBindingKey MakeHostKeyboardKey(u32 key_code); @@ -215,6 +218,9 @@ namespace InputManager /// Converts a chord of binding keys to a string. std::string ConvertInputBindingKeysToString(InputBindingInfo::Type binding_type, const InputBindingKey* keys, size_t num_keys); + /// Represents a binding with icon fonts, if available. + bool PrettifyInputBinding(std::string& binding); + /// Returns a list of all hotkeys. std::vector GetHotkeyList(); diff --git a/pcsx2/Input/InputSource.h b/pcsx2/Input/InputSource.h index 4900877b60..48b3603163 100644 --- a/pcsx2/Input/InputSource.h +++ b/pcsx2/Input/InputSource.h @@ -21,6 +21,7 @@ #include #include "common/Pcsx2Defs.h" +#include "common/SmallString.h" #include "Input/InputManager.h" class SettingsInterface; @@ -39,7 +40,8 @@ public: virtual void PollEvents() = 0; virtual std::optional ParseKeyString(const std::string_view& device, const std::string_view& binding) = 0; - virtual std::string ConvertKeyToString(InputBindingKey key) = 0; + virtual TinyString ConvertKeyToString(InputBindingKey key) = 0; + virtual TinyString ConvertKeyToIcon(InputBindingKey key) = 0; /// Enumerates available devices. Returns a pair of the prefix (e.g. SDL-0) and the device name. virtual std::vector> EnumerateDevices() = 0; diff --git a/pcsx2/Input/SDLInputSource.cpp b/pcsx2/Input/SDLInputSource.cpp index f94e29697e..e76cb81681 100644 --- a/pcsx2/Input/SDLInputSource.cpp +++ b/pcsx2/Input/SDLInputSource.cpp @@ -26,6 +26,8 @@ #include "common/Path.h" #include "common/StringUtil.h" +#include "IconsPromptFont.h" + #include #include @@ -39,6 +41,14 @@ static constexpr const char* s_sdl_axis_names[] = { "LeftTrigger", // SDL_CONTROLLER_AXIS_TRIGGERLEFT "RightTrigger", // SDL_CONTROLLER_AXIS_TRIGGERRIGHT }; +static constexpr const char* s_sdl_axis_icons[][2] = { + {ICON_PF_LEFT_ANALOG_LEFT, ICON_PF_LEFT_ANALOG_RIGHT}, // SDL_CONTROLLER_AXIS_LEFTX + {ICON_PF_LEFT_ANALOG_UP, ICON_PF_LEFT_ANALOG_DOWN}, // SDL_CONTROLLER_AXIS_LEFTY + {ICON_PF_RIGHT_ANALOG_LEFT, ICON_PF_RIGHT_ANALOG_RIGHT}, // SDL_CONTROLLER_AXIS_RIGHTX + {ICON_PF_RIGHT_ANALOG_UP, ICON_PF_RIGHT_ANALOG_DOWN}, // SDL_CONTROLLER_AXIS_RIGHTY + {nullptr, ICON_PF_LEFT_TRIGGER_PULL}, // SDL_CONTROLLER_AXIS_TRIGGERLEFT + {nullptr, ICON_PF_RIGHT_TRIGGER_PULL}, // SDL_CONTROLLER_AXIS_TRIGGERRIGHT +}; static constexpr const GenericInputBinding s_sdl_generic_binding_axis_mapping[][2] = { {GenericInputBinding::LeftStickLeft, GenericInputBinding::LeftStickRight}, // SDL_CONTROLLER_AXIS_LEFTX {GenericInputBinding::LeftStickUp, GenericInputBinding::LeftStickDown}, // SDL_CONTROLLER_AXIS_LEFTY @@ -71,6 +81,23 @@ static constexpr const char* s_sdl_button_names[] = { "Paddle4", // SDL_CONTROLLER_BUTTON_PADDLE4 "Touchpad", // SDL_CONTROLLER_BUTTON_TOUCHPAD }; +static constexpr const char* s_sdl_button_icons[] = { + ICON_PF_BUTTON_A, // SDL_CONTROLLER_BUTTON_A + ICON_PF_BUTTON_B, // SDL_CONTROLLER_BUTTON_B + ICON_PF_BUTTON_X, // SDL_CONTROLLER_BUTTON_X + ICON_PF_BUTTON_Y, // SDL_CONTROLLER_BUTTON_Y + ICON_PF_SHARE_CAPTURE, // SDL_CONTROLLER_BUTTON_BACK + ICON_PF_XBOX, // SDL_CONTROLLER_BUTTON_GUIDE + ICON_PF_BURGER_MENU, // SDL_CONTROLLER_BUTTON_START + ICON_PF_LEFT_ANALOG_CLICK, // SDL_CONTROLLER_BUTTON_LEFTSTICK + ICON_PF_RIGHT_ANALOG_CLICK, // SDL_CONTROLLER_BUTTON_RIGHTSTICK + ICON_PF_LEFT_SHOULDER_LB, // SDL_CONTROLLER_BUTTON_LEFTSHOULDER + ICON_PF_RIGHT_SHOULDER_RB, // SDL_CONTROLLER_BUTTON_RIGHTSHOULDER + ICON_PF_XBOX_DPAD_UP, // SDL_CONTROLLER_BUTTON_DPAD_UP + ICON_PF_XBOX_DPAD_DOWN, // SDL_CONTROLLER_BUTTON_DPAD_DOWN + ICON_PF_XBOX_DPAD_LEFT, // SDL_CONTROLLER_BUTTON_DPAD_LEFT + ICON_PF_XBOX_DPAD_RIGHT, // SDL_CONTROLLER_BUTTON_DPAD_RIGHT +}; static constexpr const GenericInputBinding s_sdl_generic_binding_button_mapping[] = { GenericInputBinding::Cross, // SDL_CONTROLLER_BUTTON_A GenericInputBinding::Circle, // SDL_CONTROLLER_BUTTON_B @@ -168,38 +195,38 @@ void SDLInputSource::LoadSettings(SettingsInterface& si) m_controller_raw_mode = si.GetBoolValue("InputSources", "SDLRawInput", false); m_sdl_hints = si.GetKeyValueList("SDLHints"); - for (u32 i = 0; i < MAX_LED_COLORS; i++) - { - const u32 color = GetRGBForPlayerId(si, i); - if (m_led_colors[i] == color) - continue; + for (u32 i = 0; i < MAX_LED_COLORS; i++) + { + const u32 color = GetRGBForPlayerId(si, i); + if (m_led_colors[i] == color) + continue; - m_led_colors[i] = color; + m_led_colors[i] = color; - const auto it = GetControllerDataForPlayerId(i); - if (it == m_controllers.end() || !it->game_controller || !SDL_GameControllerHasLED(it->game_controller)) - continue; + const auto it = GetControllerDataForPlayerId(i); + if (it == m_controllers.end() || !it->game_controller || !SDL_GameControllerHasLED(it->game_controller)) + continue; - SetControllerRGBLED(it->game_controller, color); - } + SetControllerRGBLED(it->game_controller, color); + } } u32 SDLInputSource::GetRGBForPlayerId(SettingsInterface& si, u32 player_id) { - return ParseRGBForPlayerId( - si.GetStringValue("SDLExtra", fmt::format("Player{}LED", player_id).c_str(), s_sdl_default_led_colors[player_id]), - player_id); + return ParseRGBForPlayerId( + si.GetStringValue("SDLExtra", fmt::format("Player{}LED", player_id).c_str(), s_sdl_default_led_colors[player_id]), + player_id); } u32 SDLInputSource::ParseRGBForPlayerId(const std::string_view& str, u32 player_id) { - if (player_id >= MAX_LED_COLORS) - return 0; + if (player_id >= MAX_LED_COLORS) + return 0; - const u32 default_color = StringUtil::FromChars(s_sdl_default_led_colors[player_id], 16).value_or(0); - const u32 color = StringUtil::FromChars(str, 16).value_or(default_color); + const u32 default_color = StringUtil::FromChars(s_sdl_default_led_colors[player_id], 16).value_or(0); + const u32 color = StringUtil::FromChars(str, 16).value_or(default_color); - return color; + return color; } void SDLInputSource::SetHints() @@ -420,9 +447,9 @@ std::optional SDLInputSource::ParseKeyString(const std::string_ return std::nullopt; } -std::string SDLInputSource::ConvertKeyToString(InputBindingKey key) +TinyString SDLInputSource::ConvertKeyToString(InputBindingKey key) { - std::string ret; + TinyString ret; if (key.source_type == InputSourceType::SDL) { @@ -430,30 +457,54 @@ std::string SDLInputSource::ConvertKeyToString(InputBindingKey key) { const char* modifier = (key.modifier == InputModifier::FullAxis ? "Full" : (key.modifier == InputModifier::Negate ? "-" : "+")); if (key.data < std::size(s_sdl_axis_names)) - ret = StringUtil::StdStringFromFormat("SDL-%u/%s%s", key.source_index, modifier, s_sdl_axis_names[key.data]); + ret.fmt("SDL-{}/{}{}", static_cast(key.source_index), modifier, s_sdl_axis_names[key.data]); else - ret = StringUtil::StdStringFromFormat("SDL-%u/%sAxis%u%s", key.source_index, modifier, key.data, key.invert ? "~" : ""); + ret.fmt("SDL-{}/{}Axis{}{}", static_cast(key.source_index), modifier, key.data, key.invert ? "~" : ""); } else if (key.source_subtype == InputSubclass::ControllerButton) { if (key.data < std::size(s_sdl_button_names)) - ret = StringUtil::StdStringFromFormat("SDL-%u/%s", key.source_index, s_sdl_button_names[key.data]); + ret.fmt("SDL-{}/{}", static_cast(key.source_index), s_sdl_button_names[key.data]); else - ret = StringUtil::StdStringFromFormat("SDL-%u/Button%u", key.source_index, key.data); + ret.fmt("SDL-{}/Button{}", static_cast(key.source_index), key.data); } else if (key.source_subtype == InputSubclass::ControllerHat) { const u32 hat_index = key.data / static_cast(std::size(s_sdl_hat_direction_names)); const u32 hat_direction = key.data % static_cast(std::size(s_sdl_hat_direction_names)); - ret = StringUtil::StdStringFromFormat("SDL-%u/Hat%u%s", key.source_index, hat_index, s_sdl_hat_direction_names[hat_direction]); + ret.fmt("SDL-{}/Hat{}{}", static_cast(key.source_index), hat_index, s_sdl_hat_direction_names[hat_direction]); } else if (key.source_subtype == InputSubclass::ControllerMotor) { - ret = StringUtil::StdStringFromFormat("SDL-%u/%sMotor", key.source_index, key.data ? "Large" : "Small"); + ret.fmt("SDL-{}/{}Motor", static_cast(key.source_index), key.data ? "Large" : "Small"); } else if (key.source_subtype == InputSubclass::ControllerHaptic) { - ret = StringUtil::StdStringFromFormat("SDL-%u/Haptic", key.source_index); + ret.fmt("SDL-{}/Haptic", static_cast(key.source_index)); + } + } + + return ret; +} + +TinyString SDLInputSource::ConvertKeyToIcon(InputBindingKey key) +{ + TinyString ret; + + if (key.source_type == InputSourceType::SDL) + { + if (key.source_subtype == InputSubclass::ControllerAxis) + { + if (key.data < std::size(s_sdl_axis_icons) && key.modifier != InputModifier::FullAxis) + { + ret.fmt("SDL-{} {}", static_cast(key.source_index), + s_sdl_axis_icons[key.data][key.modifier == InputModifier::None]); + } + } + else if (key.source_subtype == InputSubclass::ControllerButton) + { + if (key.data < std::size(s_sdl_button_icons)) + ret.fmt("SDL-{} {}", static_cast(key.source_index), s_sdl_button_icons[key.data]); } } diff --git a/pcsx2/Input/SDLInputSource.h b/pcsx2/Input/SDLInputSource.h index 8014413a2c..c54c8e4d2f 100644 --- a/pcsx2/Input/SDLInputSource.h +++ b/pcsx2/Input/SDLInputSource.h @@ -44,7 +44,8 @@ public: void UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity, float small_intensity) override; std::optional ParseKeyString(const std::string_view& device, const std::string_view& binding) override; - std::string ConvertKeyToString(InputBindingKey key) override; + TinyString ConvertKeyToString(InputBindingKey key) override; + TinyString ConvertKeyToIcon(InputBindingKey key) override; bool ProcessSDLEvent(const SDL_Event* event); diff --git a/pcsx2/Input/XInputSource.cpp b/pcsx2/Input/XInputSource.cpp index d25141ba48..91cb4c3c80 100644 --- a/pcsx2/Input/XInputSource.cpp +++ b/pcsx2/Input/XInputSource.cpp @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2022 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -14,14 +14,19 @@ */ #include "PrecompiledHeader.h" + #include "Input/XInputSource.h" #include "Input/InputManager.h" + #include "common/Assertions.h" #include "common/StringUtil.h" #include "common/Console.h" + +#include "IconsPromptFont.h" + #include -const char* XInputSource::s_axis_names[XInputSource::NUM_AXES] = { +static const char* s_axis_names[XInputSource::NUM_AXES] = { "LeftX", // AXIS_LEFTX "LeftY", // AXIS_LEFTY "RightX", // AXIS_RIGHTX @@ -29,6 +34,14 @@ const char* XInputSource::s_axis_names[XInputSource::NUM_AXES] = { "LeftTrigger", // AXIS_TRIGGERLEFT "RightTrigger", // AXIS_TRIGGERRIGHT }; +static constexpr const char* s_axis_icons[][2] = { + {ICON_PF_LEFT_ANALOG_LEFT, ICON_PF_LEFT_ANALOG_RIGHT}, // AXIS_LEFTX + {ICON_PF_LEFT_ANALOG_UP, ICON_PF_LEFT_ANALOG_DOWN}, // AXIS_LEFTY + {ICON_PF_RIGHT_ANALOG_LEFT, ICON_PF_RIGHT_ANALOG_RIGHT}, // AXIS_RIGHTX + {ICON_PF_RIGHT_ANALOG_UP, ICON_PF_RIGHT_ANALOG_DOWN}, // AXIS_RIGHTY + {nullptr, ICON_PF_LEFT_TRIGGER_PULL}, // AXIS_TRIGGERLEFT + {nullptr, ICON_PF_RIGHT_TRIGGER_PULL}, // AXIS_TRIGGERRIGHT +}; static const GenericInputBinding s_xinput_generic_binding_axis_mapping[][2] = { {GenericInputBinding::LeftStickLeft, GenericInputBinding::LeftStickRight}, // AXIS_LEFTX {GenericInputBinding::LeftStickUp, GenericInputBinding::LeftStickDown}, // AXIS_LEFTY @@ -38,7 +51,7 @@ static const GenericInputBinding s_xinput_generic_binding_axis_mapping[][2] = { {GenericInputBinding::Unknown, GenericInputBinding::R2}, // AXIS_TRIGGERRIGHT }; -const char* XInputSource::s_button_names[XInputSource::NUM_BUTTONS] = { +static const char* s_button_names[XInputSource::NUM_BUTTONS] = { "DPadUp", // XINPUT_GAMEPAD_DPAD_UP "DPadDown", // XINPUT_GAMEPAD_DPAD_DOWN "DPadLeft", // XINPUT_GAMEPAD_DPAD_LEFT @@ -55,12 +68,29 @@ const char* XInputSource::s_button_names[XInputSource::NUM_BUTTONS] = { "Y", // XINPUT_GAMEPAD_Y "Guide", // XINPUT_GAMEPAD_GUIDE }; -const u16 XInputSource::s_button_masks[XInputSource::NUM_BUTTONS] = { +static const u16 s_button_masks[XInputSource::NUM_BUTTONS] = { XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT, XINPUT_GAMEPAD_START, XINPUT_GAMEPAD_BACK, XINPUT_GAMEPAD_LEFT_THUMB, XINPUT_GAMEPAD_RIGHT_THUMB, XINPUT_GAMEPAD_LEFT_SHOULDER, XINPUT_GAMEPAD_RIGHT_SHOULDER, XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y, 0x400, // XINPUT_GAMEPAD_GUIDE }; +static constexpr const char* s_button_icons[] = { + ICON_PF_XBOX_DPAD_UP, // XINPUT_GAMEPAD_DPAD_UP + ICON_PF_XBOX_DPAD_DOWN, // XINPUT_GAMEPAD_DPAD_DOWN + ICON_PF_XBOX_DPAD_LEFT, // XINPUT_GAMEPAD_DPAD_LEFT + ICON_PF_XBOX_DPAD_RIGHT, // XINPUT_GAMEPAD_DPAD_RIGHT + ICON_PF_BURGER_MENU, // XINPUT_GAMEPAD_START + ICON_PF_SHARE_CAPTURE, // XINPUT_GAMEPAD_BACK + ICON_PF_LEFT_ANALOG_CLICK, // XINPUT_GAMEPAD_LEFT_THUMB + ICON_PF_RIGHT_ANALOG_CLICK, // XINPUT_GAMEPAD_RIGHT_THUMB + ICON_PF_LEFT_SHOULDER_LB, // XINPUT_GAMEPAD_LEFT_SHOULDER + ICON_PF_RIGHT_SHOULDER_RB, // XINPUT_GAMEPAD_RIGHT_SHOULDER + ICON_PF_BUTTON_A, // XINPUT_GAMEPAD_A + ICON_PF_BUTTON_B, // XINPUT_GAMEPAD_B + ICON_PF_BUTTON_X, // XINPUT_GAMEPAD_X + ICON_PF_BUTTON_Y, // XINPUT_GAMEPAD_Y + ICON_PF_XBOX, // XINPUT_GAMEPAD_GUIDE +}; static const GenericInputBinding s_xinput_generic_binding_button_mapping[] = { GenericInputBinding::DPadUp, // XINPUT_GAMEPAD_DPAD_UP GenericInputBinding::DPadDown, // XINPUT_GAMEPAD_DPAD_DOWN @@ -299,24 +329,48 @@ std::optional XInputSource::ParseKeyString(const std::string_vi return std::nullopt; } -std::string XInputSource::ConvertKeyToString(InputBindingKey key) +TinyString XInputSource::ConvertKeyToString(InputBindingKey key) { - std::string ret; + TinyString ret; if (key.source_type == InputSourceType::XInput) { if (key.source_subtype == InputSubclass::ControllerAxis && key.data < std::size(s_axis_names)) { const char modifier = key.modifier == InputModifier::Negate ? '-' : '+'; - ret = StringUtil::StdStringFromFormat("XInput-%u/%c%s", key.source_index, modifier, s_axis_names[key.data]); + ret.fmt("XInput-{}/{}{}", static_cast(key.source_index), modifier, s_axis_names[key.data]); } else if (key.source_subtype == InputSubclass::ControllerButton && key.data < std::size(s_button_names)) { - ret = StringUtil::StdStringFromFormat("XInput-%u/%s", key.source_index, s_button_names[key.data]); + ret.fmt("XInput-{}/{}", static_cast(key.source_index), s_button_names[key.data]); } else if (key.source_subtype == InputSubclass::ControllerMotor) { - ret = StringUtil::StdStringFromFormat("XInput-%u/%sMotor", key.source_index, key.data ? "Large" : "Small"); + ret.fmt("XInput-{}/{}Motor", static_cast(key.source_index), key.data ? "Large" : "Small"); + } + } + + return ret; +} + +TinyString XInputSource::ConvertKeyToIcon(InputBindingKey key) +{ + TinyString ret; + + if (key.source_type == InputSourceType::SDL) + { + if (key.source_subtype == InputSubclass::ControllerAxis) + { + if (key.data < std::size(s_axis_icons) && key.modifier != InputModifier::FullAxis) + { + ret.fmt("XInput-{} {}", static_cast(key.source_index), + s_axis_icons[key.data][key.modifier == InputModifier::None]); + } + } + else if (key.source_subtype == InputSubclass::ControllerButton) + { + if (key.data < std::size(s_button_icons)) + ret.fmt("XInput-{} {}", static_cast(key.source_index), s_button_icons[key.data]); } } diff --git a/pcsx2/Input/XInputSource.h b/pcsx2/Input/XInputSource.h index b42db78822..2bcf31616d 100644 --- a/pcsx2/Input/XInputSource.h +++ b/pcsx2/Input/XInputSource.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2023 PCSX2 Dev Team + * Copyright (C) 2002-2023 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -63,25 +63,6 @@ class SettingsInterface; class XInputSource final : public InputSource { public: - XInputSource(); - ~XInputSource(); - - bool Initialize(SettingsInterface& si, std::unique_lock& settings_lock) override; - void UpdateSettings(SettingsInterface& si, std::unique_lock& settings_lock) override; - bool ReloadDevices() override; - void Shutdown() override; - - void PollEvents() override; - std::vector> EnumerateDevices() override; - std::vector EnumerateMotors() override; - bool GetGenericBindingMapping(const std::string_view& device, InputManager::GenericInputBindingMapping* mapping) override; - void UpdateMotorState(InputBindingKey key, float intensity) override; - void UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity, float small_intensity) override; - - std::optional ParseKeyString(const std::string_view& device, const std::string_view& binding) override; - std::string ConvertKeyToString(InputBindingKey key) override; - -private: enum : u32 { NUM_CONTROLLERS = XUSER_MAX_COUNT, // 4 @@ -99,6 +80,26 @@ private: NUM_AXES, }; + XInputSource(); + ~XInputSource(); + + bool Initialize(SettingsInterface& si, std::unique_lock& settings_lock) override; + void UpdateSettings(SettingsInterface& si, std::unique_lock& settings_lock) override; + bool ReloadDevices() override; + void Shutdown() override; + + void PollEvents() override; + std::vector> EnumerateDevices() override; + std::vector EnumerateMotors() override; + bool GetGenericBindingMapping(const std::string_view& device, InputManager::GenericInputBindingMapping* mapping) override; + void UpdateMotorState(InputBindingKey key, float intensity) override; + void UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity, float small_intensity) override; + + std::optional ParseKeyString(const std::string_view& device, const std::string_view& binding) override; + TinyString ConvertKeyToString(InputBindingKey key) override; + TinyString ConvertKeyToIcon(InputBindingKey key) override; + +private: struct ControllerData { union @@ -126,8 +127,4 @@ private: DWORD(WINAPI* m_xinput_set_state)(DWORD, XINPUT_VIBRATION*); DWORD(WINAPI* m_xinput_get_capabilities)(DWORD, DWORD, XINPUT_CAPABILITIES*); DWORD(WINAPI* m_xinput_get_extended)(DWORD, SCP_EXTN*); - - static const char* s_axis_names[NUM_AXES]; - static const char* s_button_names[NUM_BUTTONS]; - static const u16 s_button_masks[NUM_BUTTONS]; }; diff --git a/pcsx2/SIO/Pad/PadDualshock2.cpp b/pcsx2/SIO/Pad/PadDualshock2.cpp index 9a6e98c291..cd7ae21743 100644 --- a/pcsx2/SIO/Pad/PadDualshock2.cpp +++ b/pcsx2/SIO/Pad/PadDualshock2.cpp @@ -24,36 +24,38 @@ #include "Input/InputManager.h" #include "Host.h" +#include "IconsPromptFont.h" + static const InputBindingInfo s_bindings[] = { // clang-format off - {"Up", TRANSLATE_NOOP("Pad", "D-Pad Up"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_UP, GenericInputBinding::DPadUp}, - {"Right", TRANSLATE_NOOP("Pad", "D-Pad Right"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_RIGHT, GenericInputBinding::DPadRight}, - {"Down", TRANSLATE_NOOP("Pad", "D-Pad Down"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_DOWN, GenericInputBinding::DPadDown}, - {"Left", TRANSLATE_NOOP("Pad", "D-Pad Left"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_LEFT, GenericInputBinding::DPadLeft}, - {"Triangle", TRANSLATE_NOOP("Pad", "Triangle"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_TRIANGLE, GenericInputBinding::Triangle}, - {"Circle", TRANSLATE_NOOP("Pad", "Circle"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_CIRCLE, GenericInputBinding::Circle}, - {"Cross", TRANSLATE_NOOP("Pad", "Cross"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_CROSS, GenericInputBinding::Cross}, - {"Square", TRANSLATE_NOOP("Pad", "Square"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_SQUARE, GenericInputBinding::Square}, - {"Select", TRANSLATE_NOOP("Pad", "Select"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_SELECT, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("Pad", "Start"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_START, GenericInputBinding::Start}, - {"L1", TRANSLATE_NOOP("Pad", "L1 (Left Bumper)"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_L1, GenericInputBinding::L1}, - {"L2", TRANSLATE_NOOP("Pad", "L2 (Left Trigger)"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L2, GenericInputBinding::L2}, - {"R1", TRANSLATE_NOOP("Pad", "R1 (Right Bumper)"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_R1, GenericInputBinding::R1}, - {"R2", TRANSLATE_NOOP("Pad", "R2 (Right Trigger)"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R2, GenericInputBinding::R2}, - {"L3", TRANSLATE_NOOP("Pad", "L3 (Left Stick Button)"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_L3, GenericInputBinding::L3}, - {"R3", TRANSLATE_NOOP("Pad", "R3 (Right Stick Button)"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_R3, GenericInputBinding::R3}, - {"Analog", TRANSLATE_NOOP("Pad", "Analog Toggle"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_ANALOG, GenericInputBinding::System}, - {"Pressure", TRANSLATE_NOOP("Pad", "Apply Pressure"), InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_PRESSURE, GenericInputBinding::Unknown}, - {"LUp", TRANSLATE_NOOP("Pad", "Left Stick Up"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_UP, GenericInputBinding::LeftStickUp}, - {"LRight", TRANSLATE_NOOP("Pad", "Left Stick Right"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_RIGHT, GenericInputBinding::LeftStickRight}, - {"LDown", TRANSLATE_NOOP("Pad", "Left Stick Down"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_DOWN, GenericInputBinding::LeftStickDown}, - {"LLeft", TRANSLATE_NOOP("Pad", "Left Stick Left"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_LEFT, GenericInputBinding::LeftStickLeft}, - {"RUp", TRANSLATE_NOOP("Pad", "Right Stick Up"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_UP, GenericInputBinding::RightStickUp}, - {"RRight", TRANSLATE_NOOP("Pad", "Right Stick Right"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_RIGHT, GenericInputBinding::RightStickRight}, - {"RDown", TRANSLATE_NOOP("Pad", "Right Stick Down"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_DOWN, GenericInputBinding::RightStickDown}, - {"RLeft", TRANSLATE_NOOP("Pad", "Right Stick Left"), InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_LEFT, GenericInputBinding::RightStickLeft}, - {"LargeMotor", TRANSLATE_NOOP("Pad", "Large (Low Frequency) Motor"), InputBindingInfo::Type::Motor, 0, GenericInputBinding::LargeMotor}, - {"SmallMotor", TRANSLATE_NOOP("Pad", "Small (High Frequency) Motor"), InputBindingInfo::Type::Motor, 0, GenericInputBinding::SmallMotor}, + {"Up", TRANSLATE_NOOP("Pad", "D-Pad Up"), ICON_PF_DPAD_UP, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_UP, GenericInputBinding::DPadUp}, + {"Right", TRANSLATE_NOOP("Pad", "D-Pad Right"), ICON_PF_DPAD_RIGHT, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_RIGHT, GenericInputBinding::DPadRight}, + {"Down", TRANSLATE_NOOP("Pad", "D-Pad Down"), ICON_PF_DPAD_DOWN, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_DOWN, GenericInputBinding::DPadDown}, + {"Left", TRANSLATE_NOOP("Pad", "D-Pad Left"), ICON_PF_DPAD_LEFT, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_LEFT, GenericInputBinding::DPadLeft}, + {"Triangle", TRANSLATE_NOOP("Pad", "Triangle"), ICON_PF_BUTTON_TRIANGLE, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_TRIANGLE, GenericInputBinding::Triangle}, + {"Circle", TRANSLATE_NOOP("Pad", "Circle"), ICON_PF_BUTTON_CIRCLE, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_CIRCLE, GenericInputBinding::Circle}, + {"Cross", TRANSLATE_NOOP("Pad", "Cross"), ICON_PF_BUTTON_CROSS, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_CROSS, GenericInputBinding::Cross}, + {"Square", TRANSLATE_NOOP("Pad", "Square"), ICON_PF_BUTTON_SQUARE, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_SQUARE, GenericInputBinding::Square}, + {"Select", TRANSLATE_NOOP("Pad", "Select"), ICON_PF_SELECT_SHARE, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_SELECT, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("Pad", "Start"), ICON_PF_START, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_START, GenericInputBinding::Start}, + {"L1", TRANSLATE_NOOP("Pad", "L1 (Left Bumper)"), ICON_PF_LEFT_SHOULDER_L1, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_L1, GenericInputBinding::L1}, + {"L2", TRANSLATE_NOOP("Pad", "L2 (Left Trigger)"), ICON_PF_LEFT_TRIGGER_L2, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L2, GenericInputBinding::L2}, + {"R1", TRANSLATE_NOOP("Pad", "R1 (Right Bumper)"), ICON_PF_RIGHT_SHOULDER_R1, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_R1, GenericInputBinding::R1}, + {"R2", TRANSLATE_NOOP("Pad", "R2 (Right Trigger)"), ICON_PF_RIGHT_TRIGGER_R2, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R2, GenericInputBinding::R2}, + {"L3", TRANSLATE_NOOP("Pad", "L3 (Left Stick Button)"), ICON_PF_LEFT_ANALOG_CLICK, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_L3, GenericInputBinding::L3}, + {"R3", TRANSLATE_NOOP("Pad", "R3 (Right Stick Button)"), ICON_PF_RIGHT_ANALOG_CLICK, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_R3, GenericInputBinding::R3}, + {"Analog", TRANSLATE_NOOP("Pad", "Analog Toggle"), ICON_PF_ANALOG_LEFT_RIGHT, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_ANALOG, GenericInputBinding::System}, + {"Pressure", TRANSLATE_NOOP("Pad", "Apply Pressure"), ICON_PF_ANALOG_ANY, InputBindingInfo::Type::Button, PadDualshock2::Inputs::PAD_PRESSURE, GenericInputBinding::Unknown}, + {"LUp", TRANSLATE_NOOP("Pad", "Left Stick Up"), ICON_PF_LEFT_ANALOG_UP, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_UP, GenericInputBinding::LeftStickUp}, + {"LRight", TRANSLATE_NOOP("Pad", "Left Stick Right"), ICON_PF_LEFT_ANALOG_RIGHT, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_RIGHT, GenericInputBinding::LeftStickRight}, + {"LDown", TRANSLATE_NOOP("Pad", "Left Stick Down"), ICON_PF_LEFT_ANALOG_DOWN, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_DOWN, GenericInputBinding::LeftStickDown}, + {"LLeft", TRANSLATE_NOOP("Pad", "Left Stick Left"), ICON_PF_LEFT_ANALOG_LEFT, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_L_LEFT, GenericInputBinding::LeftStickLeft}, + {"RUp", TRANSLATE_NOOP("Pad", "Right Stick Up"), ICON_PF_RIGHT_ANALOG_UP, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_UP, GenericInputBinding::RightStickUp}, + {"RRight", TRANSLATE_NOOP("Pad", "Right Stick Right"), ICON_PF_RIGHT_ANALOG_RIGHT, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_RIGHT, GenericInputBinding::RightStickRight}, + {"RDown", TRANSLATE_NOOP("Pad", "Right Stick Down"), ICON_PF_RIGHT_ANALOG_RIGHT, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_DOWN, GenericInputBinding::RightStickDown}, + {"RLeft", TRANSLATE_NOOP("Pad", "Right Stick Left"), ICON_PF_RIGHT_ANALOG_LEFT, InputBindingInfo::Type::HalfAxis, PadDualshock2::Inputs::PAD_R_LEFT, GenericInputBinding::RightStickLeft}, + {"LargeMotor", TRANSLATE_NOOP("Pad", "Large (Low Frequency) Motor"), nullptr, InputBindingInfo::Type::Motor, 0, GenericInputBinding::LargeMotor}, + {"SmallMotor", TRANSLATE_NOOP("Pad", "Small (High Frequency) Motor"), nullptr, InputBindingInfo::Type::Motor, 0, GenericInputBinding::SmallMotor}, // clang-format on }; @@ -93,7 +95,7 @@ static const SettingInfo s_settings[] = { }; const Pad::ControllerInfo PadDualshock2::ControllerInfo = {Pad::ControllerType::DualShock2, "DualShock2", - TRANSLATE_NOOP("Pad", "DualShock 2"), s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors}; + TRANSLATE_NOOP("Pad", "DualShock 2"), ICON_PF_GAMEPAD, s_bindings, s_settings, Pad::VibrationCapabilities::LargeSmallMotors}; void PadDualshock2::ConfigLog() { diff --git a/pcsx2/SIO/Pad/PadGuitar.cpp b/pcsx2/SIO/Pad/PadGuitar.cpp index e57c46bf7b..be773bdef7 100644 --- a/pcsx2/SIO/Pad/PadGuitar.cpp +++ b/pcsx2/SIO/Pad/PadGuitar.cpp @@ -25,17 +25,17 @@ // would do what actions, if you played Guitar Hero on a PS2 with a DS2 instead of a controller. static const InputBindingInfo s_bindings[] = { // clang-format off - {"Up", TRANSLATE_NOOP("Pad", "Strum Up"), InputBindingInfo::Type::Button, PadGuitar::Inputs::STRUM_UP, GenericInputBinding::DPadUp}, - {"Down", TRANSLATE_NOOP("Pad", "Strum Down"), InputBindingInfo::Type::Button, PadGuitar::Inputs::STRUM_DOWN, GenericInputBinding::DPadDown}, - {"Select", TRANSLATE_NOOP("Pad", "Select"), InputBindingInfo::Type::Button, PadGuitar::Inputs::SELECT, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("Pad", "Start"), InputBindingInfo::Type::Button, PadGuitar::Inputs::START, GenericInputBinding::Start}, - {"Green", TRANSLATE_NOOP("Pad", "Green Fret"), InputBindingInfo::Type::Button, PadGuitar::Inputs::GREEN, GenericInputBinding::R2}, - {"Red", TRANSLATE_NOOP("Pad", "Red Fret"), InputBindingInfo::Type::Button, PadGuitar::Inputs::RED, GenericInputBinding::Circle}, - {"Yellow", TRANSLATE_NOOP("Pad", "Yellow Fret"), InputBindingInfo::Type::Button, PadGuitar::Inputs::YELLOW, GenericInputBinding::Triangle}, - {"Blue", TRANSLATE_NOOP("Pad", "Blue Fret"), InputBindingInfo::Type::Button, PadGuitar::Inputs::BLUE, GenericInputBinding::Cross}, - {"Orange", TRANSLATE_NOOP("Pad", "Orange Fret"), InputBindingInfo::Type::Button, PadGuitar::Inputs::ORANGE, GenericInputBinding::Square}, - {"Whammy", TRANSLATE_NOOP("Pad", "Whammy Bar"), InputBindingInfo::Type::HalfAxis, PadGuitar::Inputs::WHAMMY, GenericInputBinding::LeftStickUp}, - {"Tilt", TRANSLATE_NOOP("Pad", "Tilt Up"), InputBindingInfo::Type::Button, PadGuitar::Inputs::TILT, GenericInputBinding::L2}, + {"Up", TRANSLATE_NOOP("Pad", "Strum Up"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::STRUM_UP, GenericInputBinding::DPadUp}, + {"Down", TRANSLATE_NOOP("Pad", "Strum Down"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::STRUM_DOWN, GenericInputBinding::DPadDown}, + {"Select", TRANSLATE_NOOP("Pad", "Select"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::SELECT, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("Pad", "Start"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::START, GenericInputBinding::Start}, + {"Green", TRANSLATE_NOOP("Pad", "Green Fret"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::GREEN, GenericInputBinding::R2}, + {"Red", TRANSLATE_NOOP("Pad", "Red Fret"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::RED, GenericInputBinding::Circle}, + {"Yellow", TRANSLATE_NOOP("Pad", "Yellow Fret"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::YELLOW, GenericInputBinding::Triangle}, + {"Blue", TRANSLATE_NOOP("Pad", "Blue Fret"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::BLUE, GenericInputBinding::Cross}, + {"Orange", TRANSLATE_NOOP("Pad", "Orange Fret"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::ORANGE, GenericInputBinding::Square}, + {"Whammy", TRANSLATE_NOOP("Pad", "Whammy Bar"), nullptr, InputBindingInfo::Type::HalfAxis, PadGuitar::Inputs::WHAMMY, GenericInputBinding::LeftStickUp}, + {"Tilt", TRANSLATE_NOOP("Pad", "Tilt Up"), nullptr, InputBindingInfo::Type::Button, PadGuitar::Inputs::TILT, GenericInputBinding::L2}, // clang-format on }; @@ -49,7 +49,7 @@ static const SettingInfo s_settings[] = { }; const Pad::ControllerInfo PadGuitar::ControllerInfo = {Pad::ControllerType::Guitar, "Guitar", - TRANSLATE_NOOP("Pad", "Guitar"), s_bindings, s_settings, Pad::VibrationCapabilities::NoVibration}; + TRANSLATE_NOOP("Pad", "Guitar"), nullptr, s_bindings, s_settings, Pad::VibrationCapabilities::NoVibration}; void PadGuitar::ConfigLog() { diff --git a/pcsx2/SIO/Pad/PadNotConnected.cpp b/pcsx2/SIO/Pad/PadNotConnected.cpp index b183823fe2..242c3b49f8 100644 --- a/pcsx2/SIO/Pad/PadNotConnected.cpp +++ b/pcsx2/SIO/Pad/PadNotConnected.cpp @@ -20,7 +20,7 @@ #include "Host.h" const Pad::ControllerInfo PadNotConnected::ControllerInfo = {Pad::ControllerType::NotConnected, "None", - TRANSLATE_NOOP("Pad", "Not Connected"), {}, {}, Pad::VibrationCapabilities::NoVibration }; + TRANSLATE_NOOP("Pad", "Not Connected"), nullptr, {}, {}, Pad::VibrationCapabilities::NoVibration }; PadNotConnected::PadNotConnected(u8 unifiedSlot, size_t ejectTicks) : PadBase(unifiedSlot, ejectTicks) diff --git a/pcsx2/SIO/Pad/PadTypes.h b/pcsx2/SIO/Pad/PadTypes.h index a639a1b469..0917a30227 100644 --- a/pcsx2/SIO/Pad/PadTypes.h +++ b/pcsx2/SIO/Pad/PadTypes.h @@ -92,6 +92,7 @@ namespace Pad ControllerType type; const char* name; const char* display_name; + const char* icon_name; std::span bindings; std::span settings; VibrationCapabilities vibration_caps; diff --git a/pcsx2/USB/usb-hid/usb-hid.cpp b/pcsx2/USB/usb-hid/usb-hid.cpp index 35d16224f1..5328f8143c 100644 --- a/pcsx2/USB/usb-hid/usb-hid.cpp +++ b/pcsx2/USB/usb-hid/usb-hid.cpp @@ -951,7 +951,7 @@ namespace usb_hid std::span HIDKbdDevice::Bindings(u32 subtype) const { static constexpr const InputBindingInfo info[] = { - {"Keyboard", TRANSLATE_NOOP("USB", "Keyboard"), InputBindingInfo::Type::Keyboard, 0, GenericInputBinding::Unknown}, + {"Keyboard", TRANSLATE_NOOP("USB", "Keyboard"), nullptr, InputBindingInfo::Type::Keyboard, 0, GenericInputBinding::Unknown}, }; return info; } @@ -1044,10 +1044,10 @@ namespace usb_hid std::span HIDMouseDevice::Bindings(u32 subtype) const { static constexpr const InputBindingInfo info[] = { - {"Pointer", TRANSLATE_NOOP("USB", "Pointer"), InputBindingInfo::Type::Pointer, INPUT_BUTTON__MAX, GenericInputBinding::Unknown}, - {"LeftButton", TRANSLATE_NOOP("USB", "Left Button"), InputBindingInfo::Type::Button, INPUT_BUTTON_LEFT, GenericInputBinding::Unknown}, - {"RightButton", TRANSLATE_NOOP("USB", "Right Button"), InputBindingInfo::Type::Button, INPUT_BUTTON_RIGHT, GenericInputBinding::Unknown}, - {"MiddleButton", TRANSLATE_NOOP("USB", "Middle Button"), InputBindingInfo::Type::Button, INPUT_BUTTON_MIDDLE, GenericInputBinding::Unknown}, + {"Pointer", TRANSLATE_NOOP("USB", "Pointer"), nullptr, InputBindingInfo::Type::Pointer, INPUT_BUTTON__MAX, GenericInputBinding::Unknown}, + {"LeftButton", TRANSLATE_NOOP("USB", "Left Button"), nullptr, InputBindingInfo::Type::Button, INPUT_BUTTON_LEFT, GenericInputBinding::Unknown}, + {"RightButton", TRANSLATE_NOOP("USB", "Right Button"), nullptr, InputBindingInfo::Type::Button, INPUT_BUTTON_RIGHT, GenericInputBinding::Unknown}, + {"MiddleButton", TRANSLATE_NOOP("USB", "Middle Button"), nullptr, InputBindingInfo::Type::Button, INPUT_BUTTON_MIDDLE, GenericInputBinding::Unknown}, }; return info; } diff --git a/pcsx2/USB/usb-lightgun/guncon2.cpp b/pcsx2/USB/usb-lightgun/guncon2.cpp index 0835e38583..40f0add0c5 100644 --- a/pcsx2/USB/usb-lightgun/guncon2.cpp +++ b/pcsx2/USB/usb-lightgun/guncon2.cpp @@ -587,25 +587,25 @@ namespace usb_lightgun { static constexpr const InputBindingInfo bindings[] = { //{"pointer", "Pointer/Aiming", InputBindingInfo::Type::Pointer, BID_POINTER_X, GenericInputBinding::Unknown}, - {"Up", TRANSLATE_NOOP("USB", "D-Pad Up"), InputBindingInfo::Type::Button, BID_DPAD_UP, GenericInputBinding::DPadUp}, - {"Down", TRANSLATE_NOOP("USB", "D-Pad Down"), InputBindingInfo::Type::Button, BID_DPAD_DOWN, GenericInputBinding::DPadDown}, - {"Left", TRANSLATE_NOOP("USB", "D-Pad Left"), InputBindingInfo::Type::Button, BID_DPAD_LEFT, GenericInputBinding::DPadLeft}, - {"Right", TRANSLATE_NOOP("USB", "D-Pad Right"), InputBindingInfo::Type::Button, BID_DPAD_RIGHT, + {"Up", TRANSLATE_NOOP("USB", "D-Pad Up"), nullptr, InputBindingInfo::Type::Button, BID_DPAD_UP, GenericInputBinding::DPadUp}, + {"Down", TRANSLATE_NOOP("USB", "D-Pad Down"), nullptr, InputBindingInfo::Type::Button, BID_DPAD_DOWN, GenericInputBinding::DPadDown}, + {"Left", TRANSLATE_NOOP("USB", "D-Pad Left"), nullptr, InputBindingInfo::Type::Button, BID_DPAD_LEFT, GenericInputBinding::DPadLeft}, + {"Right", TRANSLATE_NOOP("USB", "D-Pad Right"), nullptr, InputBindingInfo::Type::Button, BID_DPAD_RIGHT, GenericInputBinding::DPadRight}, - {"Trigger", TRANSLATE_NOOP("USB", "Trigger"), InputBindingInfo::Type::Button, BID_TRIGGER, GenericInputBinding::R2}, - {"ShootOffscreen", TRANSLATE_NOOP("USB", "Shoot Offscreen"), InputBindingInfo::Type::Button, BID_SHOOT_OFFSCREEN, + {"Trigger", TRANSLATE_NOOP("USB", "Trigger"), nullptr, InputBindingInfo::Type::Button, BID_TRIGGER, GenericInputBinding::R2}, + {"ShootOffscreen", TRANSLATE_NOOP("USB", "Shoot Offscreen"), nullptr, InputBindingInfo::Type::Button, BID_SHOOT_OFFSCREEN, GenericInputBinding::R1}, - {"Recalibrate", TRANSLATE_NOOP("USB", "Calibration Shot"), InputBindingInfo::Type::Button, BID_RECALIBRATE, + {"Recalibrate", TRANSLATE_NOOP("USB", "Calibration Shot"), nullptr, InputBindingInfo::Type::Button, BID_RECALIBRATE, GenericInputBinding::Unknown}, - {"A", TRANSLATE_NOOP("USB", "A"), InputBindingInfo::Type::Button, BID_A, GenericInputBinding::Cross}, - {"B", TRANSLATE_NOOP("USB", "B"), InputBindingInfo::Type::Button, BID_B, GenericInputBinding::Circle}, - {"C", TRANSLATE_NOOP("USB", "C"), InputBindingInfo::Type::Button, BID_C, GenericInputBinding::Triangle}, - {"Select", TRANSLATE_NOOP("USB", "Select"), InputBindingInfo::Type::Button, BID_SELECT, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("USB", "Start"), InputBindingInfo::Type::Button, BID_START, GenericInputBinding::Start}, - {"RelativeLeft", TRANSLATE_NOOP("USB", "Relative Left"), InputBindingInfo::Type::HalfAxis, BID_RELATIVE_LEFT, GenericInputBinding::Unknown}, - {"RelativeRight", TRANSLATE_NOOP("USB", "Relative Right"), InputBindingInfo::Type::HalfAxis, BID_RELATIVE_RIGHT, GenericInputBinding::Unknown}, - {"RelativeUp", TRANSLATE_NOOP("USB", "Relative Up"), InputBindingInfo::Type::HalfAxis, BID_RELATIVE_UP, GenericInputBinding::Unknown}, - {"RelativeDown", TRANSLATE_NOOP("USB", "Relative Down"), InputBindingInfo::Type::HalfAxis, BID_RELATIVE_DOWN, GenericInputBinding::Unknown}, + {"A", TRANSLATE_NOOP("USB", "A"), nullptr, InputBindingInfo::Type::Button, BID_A, GenericInputBinding::Cross}, + {"B", TRANSLATE_NOOP("USB", "B"), nullptr, InputBindingInfo::Type::Button, BID_B, GenericInputBinding::Circle}, + {"C", TRANSLATE_NOOP("USB", "C"), nullptr, InputBindingInfo::Type::Button, BID_C, GenericInputBinding::Triangle}, + {"Select", TRANSLATE_NOOP("USB", "Select"), nullptr, InputBindingInfo::Type::Button, BID_SELECT, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("USB", "Start"), nullptr, InputBindingInfo::Type::Button, BID_START, GenericInputBinding::Start}, + {"RelativeLeft", TRANSLATE_NOOP("USB", "Relative Left"), nullptr, InputBindingInfo::Type::HalfAxis, BID_RELATIVE_LEFT, GenericInputBinding::Unknown}, + {"RelativeRight", TRANSLATE_NOOP("USB", "Relative Right"), nullptr, InputBindingInfo::Type::HalfAxis, BID_RELATIVE_RIGHT, GenericInputBinding::Unknown}, + {"RelativeUp", TRANSLATE_NOOP("USB", "Relative Up"), nullptr, InputBindingInfo::Type::HalfAxis, BID_RELATIVE_UP, GenericInputBinding::Unknown}, + {"RelativeDown", TRANSLATE_NOOP("USB", "Relative Down"), nullptr, InputBindingInfo::Type::HalfAxis, BID_RELATIVE_DOWN, GenericInputBinding::Unknown}, }; return bindings; diff --git a/pcsx2/USB/usb-pad/usb-pad.cpp b/pcsx2/USB/usb-pad/usb-pad.cpp index fdd5aaaa70..575098b31d 100644 --- a/pcsx2/USB/usb-pad/usb-pad.cpp +++ b/pcsx2/USB/usb-pad/usb-pad.cpp @@ -86,25 +86,25 @@ namespace usb_pad case WT_GENERIC: { static constexpr const InputBindingInfo bindings[] = { - {"SteeringLeft", TRANSLATE_NOOP("USB", "Steering Left"), InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, - {"SteeringRight", TRANSLATE_NOOP("USB", "Steering Right"), InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, - {"Throttle", TRANSLATE_NOOP("USB", "Throttle"), InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::R2}, - {"Brake", TRANSLATE_NOOP("USB", "Brake"), InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::L2}, - {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), InputBindingInfo::Type::Button, CID_DPAD_UP, GenericInputBinding::DPadUp}, - {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), InputBindingInfo::Type::Button, CID_DPAD_DOWN, GenericInputBinding::DPadDown}, - {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), InputBindingInfo::Type::Button, CID_DPAD_LEFT, GenericInputBinding::DPadLeft}, - {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), InputBindingInfo::Type::Button, CID_DPAD_RIGHT, GenericInputBinding::DPadRight}, - {"Cross", TRANSLATE_NOOP("USB", "Cross"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Cross}, - {"Square", TRANSLATE_NOOP("USB", "Square"), InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Square}, - {"Circle", TRANSLATE_NOOP("USB", "Circle"), InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Circle}, - {"Triangle", TRANSLATE_NOOP("USB", "Triangle"), InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Triangle}, - {"L1", TRANSLATE_NOOP("USB", "L1"), InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::L1}, - {"R1", TRANSLATE_NOOP("USB", "R1"), InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::R1}, - {"L2", TRANSLATE_NOOP("USB", "L2"), InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::Unknown}, // used L2 for brake - {"R2", TRANSLATE_NOOP("USB", "R2"), InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, // used R2 for throttle - {"Select", TRANSLATE_NOOP("USB", "Select"), InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("USB", "Start"), InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, - {"FFDevice", TRANSLATE_NOOP("USB", "Force Feedback"), InputBindingInfo::Type::Device, 0, GenericInputBinding::Unknown}, + {"SteeringLeft", TRANSLATE_NOOP("USB", "Steering Left"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, + {"SteeringRight", TRANSLATE_NOOP("USB", "Steering Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, + {"Throttle", TRANSLATE_NOOP("USB", "Throttle"), nullptr, InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::R2}, + {"Brake", TRANSLATE_NOOP("USB", "Brake"), nullptr, InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::L2}, + {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_UP, GenericInputBinding::DPadUp}, + {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_DOWN, GenericInputBinding::DPadDown}, + {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_LEFT, GenericInputBinding::DPadLeft}, + {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_RIGHT, GenericInputBinding::DPadRight}, + {"Cross", TRANSLATE_NOOP("USB", "Cross"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Cross}, + {"Square", TRANSLATE_NOOP("USB", "Square"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Square}, + {"Circle", TRANSLATE_NOOP("USB", "Circle"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Circle}, + {"Triangle", TRANSLATE_NOOP("USB", "Triangle"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Triangle}, + {"L1", TRANSLATE_NOOP("USB", "L1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::L1}, + {"R1", TRANSLATE_NOOP("USB", "R1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::R1}, + {"L2", TRANSLATE_NOOP("USB", "L2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::Unknown}, // used L2 for brake + {"R2", TRANSLATE_NOOP("USB", "R2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, // used R2 for throttle + {"Select", TRANSLATE_NOOP("USB", "Select"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("USB", "Start"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, + {"FFDevice", TRANSLATE_NOOP("USB", "Force Feedback"), nullptr, InputBindingInfo::Type::Device, 0, GenericInputBinding::Unknown}, }; return bindings; @@ -114,27 +114,27 @@ namespace usb_pad case WT_DRIVING_FORCE_PRO_1102: { static constexpr const InputBindingInfo bindings[] = { - {"SteeringLeft", TRANSLATE_NOOP("USB", "Steering Left"), InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, - {"SteeringRight", TRANSLATE_NOOP("USB", "Steering Right"), InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, - {"Throttle", TRANSLATE_NOOP("USB", "Throttle"), InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::R2}, - {"Brake", TRANSLATE_NOOP("USB", "Brake"), InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::L2}, - {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), InputBindingInfo::Type::Button, CID_DPAD_UP, GenericInputBinding::DPadUp}, - {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), InputBindingInfo::Type::Button, CID_DPAD_DOWN, GenericInputBinding::DPadDown}, - {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), InputBindingInfo::Type::Button, CID_DPAD_LEFT, GenericInputBinding::DPadLeft}, - {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), InputBindingInfo::Type::Button, CID_DPAD_RIGHT, GenericInputBinding::DPadRight}, - {"Cross", TRANSLATE_NOOP("USB", "Cross"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Cross}, - {"Square", TRANSLATE_NOOP("USB", "Square"), InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Square}, - {"Circle", TRANSLATE_NOOP("USB", "Circle"), InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Circle}, - {"Triangle", TRANSLATE_NOOP("USB", "Triangle"), InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Triangle}, - {"R1", TRANSLATE_NOOP("USB", "Shift Up / R1"), InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::R1}, - {"L1", TRANSLATE_NOOP("USB", "Shift Down / L1"), InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::L1}, - {"Select", TRANSLATE_NOOP("USB", "Select"), InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("USB", "Start"), InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, - {"L2", TRANSLATE_NOOP("USB", "L2"), InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::Unknown}, // used L2 for brake - {"R2", TRANSLATE_NOOP("USB", "R2"), InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, // used R2 for throttle - {"L3", TRANSLATE_NOOP("USB", "L3"), InputBindingInfo::Type::Button, CID_BUTTON11, GenericInputBinding::L3}, - {"R3", TRANSLATE_NOOP("USB", "R3"), InputBindingInfo::Type::Button, CID_BUTTON10, GenericInputBinding::R3}, - {"FFDevice", "Force Feedback", InputBindingInfo::Type::Device, 0, GenericInputBinding::Unknown}, + {"SteeringLeft", TRANSLATE_NOOP("USB", "Steering Left"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, + {"SteeringRight", TRANSLATE_NOOP("USB", "Steering Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, + {"Throttle", TRANSLATE_NOOP("USB", "Throttle"), nullptr, InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::R2}, + {"Brake", TRANSLATE_NOOP("USB", "Brake"), nullptr, InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::L2}, + {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_UP, GenericInputBinding::DPadUp}, + {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_DOWN, GenericInputBinding::DPadDown}, + {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_LEFT, GenericInputBinding::DPadLeft}, + {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_RIGHT, GenericInputBinding::DPadRight}, + {"Cross", TRANSLATE_NOOP("USB", "Cross"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Cross}, + {"Square", TRANSLATE_NOOP("USB", "Square"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Square}, + {"Circle", TRANSLATE_NOOP("USB", "Circle"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Circle}, + {"Triangle", TRANSLATE_NOOP("USB", "Triangle"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Triangle}, + {"R1", TRANSLATE_NOOP("USB", "Shift Up / R1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::R1}, + {"L1", TRANSLATE_NOOP("USB", "Shift Down / L1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::L1}, + {"Select", TRANSLATE_NOOP("USB", "Select"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("USB", "Start"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, + {"L2", TRANSLATE_NOOP("USB", "L2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::Unknown}, // used L2 for brake + {"R2", TRANSLATE_NOOP("USB", "R2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, // used R2 for throttle + {"L3", TRANSLATE_NOOP("USB", "L3"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON11, GenericInputBinding::L3}, + {"R3", TRANSLATE_NOOP("USB", "R3"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON10, GenericInputBinding::R3}, + {"FFDevice", "Force Feedback", nullptr, InputBindingInfo::Type::Device, 0, GenericInputBinding::Unknown}, }; return bindings; @@ -143,17 +143,17 @@ namespace usb_pad case WT_GT_FORCE: { static constexpr const InputBindingInfo bindings[] = { - {"SteeringLeft", TRANSLATE_NOOP("USB", "Steering Left"), InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, - {"SteeringRight", TRANSLATE_NOOP("USB", "Steering Right"), InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, - {"Throttle", TRANSLATE_NOOP("USB", "Throttle"), InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::R2}, - {"Brake", TRANSLATE_NOOP("USB", "Brake"), InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::L2}, - {"MenuUp", TRANSLATE_NOOP("USB", "Menu Up"), InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::DPadUp}, - {"MenuDown", TRANSLATE_NOOP("USB", "Menu Down"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::DPadDown}, - {"X", TRANSLATE_NOOP("USB", "X"), InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Square}, - {"Y", TRANSLATE_NOOP("USB", "Y"), InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Triangle}, - {"A", TRANSLATE_NOOP("USB", "A"), InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Cross}, - {"B", TRANSLATE_NOOP("USB", "B"), InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::Circle}, - {"FFDevice", TRANSLATE_NOOP("USB", "Force Feedback"), InputBindingInfo::Type::Device, 0, GenericInputBinding::Unknown}, + {"SteeringLeft", TRANSLATE_NOOP("USB", "Steering Left"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, + {"SteeringRight", TRANSLATE_NOOP("USB", "Steering Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, + {"Throttle", TRANSLATE_NOOP("USB", "Throttle"), nullptr, InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::R2}, + {"Brake", TRANSLATE_NOOP("USB", "Brake"), nullptr, InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::L2}, + {"MenuUp", TRANSLATE_NOOP("USB", "Menu Up"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::DPadUp}, + {"MenuDown", TRANSLATE_NOOP("USB", "Menu Down"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::DPadDown}, + {"X", TRANSLATE_NOOP("USB", "X"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Square}, + {"Y", TRANSLATE_NOOP("USB", "Y"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Triangle}, + {"A", TRANSLATE_NOOP("USB", "A"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Cross}, + {"B", TRANSLATE_NOOP("USB", "B"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::Circle}, + {"FFDevice", TRANSLATE_NOOP("USB", "Force Feedback"), nullptr, InputBindingInfo::Type::Device, 0, GenericInputBinding::Unknown}, }; return bindings; @@ -941,13 +941,13 @@ namespace usb_pad std::span RBDrumKitDevice::Bindings(u32 subtype) const { static constexpr const InputBindingInfo bindings[] = { - {"Blue", TRANSLATE_NOOP("USB", "Blue"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::R1}, - {"Green", TRANSLATE_NOOP("USB", "Green"), InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Triangle}, - {"Red", TRANSLATE_NOOP("USB", "Red"), InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Circle}, - {"Yellow", TRANSLATE_NOOP("USB", "Yellow"), InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Square}, - {"Orange", TRANSLATE_NOOP("USB", "Orange"), InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Cross}, - {"Select", TRANSLATE_NOOP("USB", "Select"), InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("USB", "Start"), InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, + {"Blue", TRANSLATE_NOOP("USB", "Blue"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::R1}, + {"Green", TRANSLATE_NOOP("USB", "Green"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Triangle}, + {"Red", TRANSLATE_NOOP("USB", "Red"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Circle}, + {"Yellow", TRANSLATE_NOOP("USB", "Yellow"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Square}, + {"Orange", TRANSLATE_NOOP("USB", "Orange"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Cross}, + {"Select", TRANSLATE_NOOP("USB", "Select"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("USB", "Start"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, }; return bindings; @@ -978,29 +978,29 @@ namespace usb_pad std::span BuzzDevice::Bindings(u32 subtype) const { static constexpr const InputBindingInfo bindings[] = { - {"Red1", TRANSLATE_NOOP("USB", "Player 1 Red"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Circle}, - {"Blue1", TRANSLATE_NOOP("USB", "Player 1 Blue"), InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::R1}, - {"Orange1", TRANSLATE_NOOP("USB", "Player 1 Orange"), InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Cross}, - {"Green1", TRANSLATE_NOOP("USB", "Player 1 Green"), InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Triangle}, - {"Yellow1", TRANSLATE_NOOP("USB", "Player 1 Yellow"), InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Square}, + {"Red1", TRANSLATE_NOOP("USB", "Player 1 Red"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Circle}, + {"Blue1", TRANSLATE_NOOP("USB", "Player 1 Blue"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::R1}, + {"Orange1", TRANSLATE_NOOP("USB", "Player 1 Orange"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Cross}, + {"Green1", TRANSLATE_NOOP("USB", "Player 1 Green"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Triangle}, + {"Yellow1", TRANSLATE_NOOP("USB", "Player 1 Yellow"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Square}, - {"Red2", TRANSLATE_NOOP("USB", "Player 2 Red"), InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::Unknown}, - {"Blue2", TRANSLATE_NOOP("USB", "Player 2 Blue"), InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Unknown}, - {"Orange2", TRANSLATE_NOOP("USB", "Player 2 Orange"), InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Unknown}, - {"Green2", TRANSLATE_NOOP("USB", "Player 2 Green"), InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::Unknown}, - {"Yellow2", TRANSLATE_NOOP("USB", "Player 2 Yellow"), InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, + {"Red2", TRANSLATE_NOOP("USB", "Player 2 Red"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::Unknown}, + {"Blue2", TRANSLATE_NOOP("USB", "Player 2 Blue"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Unknown}, + {"Orange2", TRANSLATE_NOOP("USB", "Player 2 Orange"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Unknown}, + {"Green2", TRANSLATE_NOOP("USB", "Player 2 Green"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::Unknown}, + {"Yellow2", TRANSLATE_NOOP("USB", "Player 2 Yellow"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, - {"Red3", TRANSLATE_NOOP("USB", "Player 3 Red"), InputBindingInfo::Type::Button, CID_BUTTON10, GenericInputBinding::Unknown}, - {"Blue3", TRANSLATE_NOOP("USB", "Player 3 Blue"), InputBindingInfo::Type::Button, CID_BUTTON14, GenericInputBinding::Unknown}, - {"Orange3", TRANSLATE_NOOP("USB", "Player 3 Orange"), InputBindingInfo::Type::Button, CID_BUTTON13, GenericInputBinding::Unknown}, - {"Green3", TRANSLATE_NOOP("USB", "Player 3 Green"), InputBindingInfo::Type::Button, CID_BUTTON12, GenericInputBinding::Unknown}, - {"Yellow3", TRANSLATE_NOOP("USB", "Player 3 Yellow"), InputBindingInfo::Type::Button, CID_BUTTON11, GenericInputBinding::Unknown}, + {"Red3", TRANSLATE_NOOP("USB", "Player 3 Red"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON10, GenericInputBinding::Unknown}, + {"Blue3", TRANSLATE_NOOP("USB", "Player 3 Blue"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON14, GenericInputBinding::Unknown}, + {"Orange3", TRANSLATE_NOOP("USB", "Player 3 Orange"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON13, GenericInputBinding::Unknown}, + {"Green3", TRANSLATE_NOOP("USB", "Player 3 Green"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON12, GenericInputBinding::Unknown}, + {"Yellow3", TRANSLATE_NOOP("USB", "Player 3 Yellow"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON11, GenericInputBinding::Unknown}, - {"Red4", TRANSLATE_NOOP("USB", "Player 4 Red"), InputBindingInfo::Type::Button, CID_BUTTON15, GenericInputBinding::Unknown}, - {"Blue4", TRANSLATE_NOOP("USB", "Player 4 Blue"), InputBindingInfo::Type::Button, CID_BUTTON19, GenericInputBinding::Unknown}, - {"Orange4", TRANSLATE_NOOP("USB", "Player 4 Orange"), InputBindingInfo::Type::Button, CID_BUTTON18, GenericInputBinding::Unknown}, - {"Green4", TRANSLATE_NOOP("USB", "Player 4 Green"), InputBindingInfo::Type::Button, CID_BUTTON17, GenericInputBinding::Unknown}, - {"Yellow4", TRANSLATE_NOOP("USB", "Player 4 Yellow"), InputBindingInfo::Type::Button, CID_BUTTON16, GenericInputBinding::Unknown}, + {"Red4", TRANSLATE_NOOP("USB", "Player 4 Red"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON15, GenericInputBinding::Unknown}, + {"Blue4", TRANSLATE_NOOP("USB", "Player 4 Blue"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON19, GenericInputBinding::Unknown}, + {"Orange4", TRANSLATE_NOOP("USB", "Player 4 Orange"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON18, GenericInputBinding::Unknown}, + {"Green4", TRANSLATE_NOOP("USB", "Player 4 Green"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON17, GenericInputBinding::Unknown}, + {"Yellow4", TRANSLATE_NOOP("USB", "Player 4 Yellow"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON16, GenericInputBinding::Unknown}, }; return bindings; @@ -1052,35 +1052,35 @@ namespace usb_pad std::span KeyboardmaniaDevice::Bindings(u32 subtype) const { static constexpr const InputBindingInfo bindings[] = { - {"C1", TRANSLATE_NOOP("USB", "C 1"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Unknown}, - {"CSharp1", TRANSLATE_NOOP("USB", "C# 1"), InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Unknown}, - {"D1", TRANSLATE_NOOP("USB", "D 1"), InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Unknown}, - {"DSharp1", TRANSLATE_NOOP("USB", "D# 1"), InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Unknown}, - {"E1", TRANSLATE_NOOP("USB", "E 1"), InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Unknown}, - {"F1", TRANSLATE_NOOP("USB", "F 1"), InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::Unknown}, - {"FSharp1", TRANSLATE_NOOP("USB", "F# 1"), InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, - {"G1", TRANSLATE_NOOP("USB", "G 1"), InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Unknown}, - {"GSharp1", TRANSLATE_NOOP("USB", "G# 1"), InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Unknown}, - {"A1", TRANSLATE_NOOP("USB", "A 1"), InputBindingInfo::Type::Button, CID_BUTTON10, GenericInputBinding::Unknown}, - {"ASharp1", TRANSLATE_NOOP("USB", "A# 1"), InputBindingInfo::Type::Button, CID_BUTTON11, GenericInputBinding::Unknown}, - {"B1", TRANSLATE_NOOP("USB", "B 1"), InputBindingInfo::Type::Button, CID_BUTTON12, GenericInputBinding::Unknown}, - {"C2", TRANSLATE_NOOP("USB", "C 2"), InputBindingInfo::Type::Button, CID_BUTTON13, GenericInputBinding::Unknown}, - {"CSharp2", TRANSLATE_NOOP("USB", "C# 2"), InputBindingInfo::Type::Button, CID_BUTTON16, GenericInputBinding::Unknown}, - {"D2", TRANSLATE_NOOP("USB", "D 2"), InputBindingInfo::Type::Button, CID_BUTTON17, GenericInputBinding::Unknown}, - {"DSharp2", TRANSLATE_NOOP("USB", "D# 2"), InputBindingInfo::Type::Button, CID_BUTTON18, GenericInputBinding::Unknown}, - {"E2", TRANSLATE_NOOP("USB", "E 2"), InputBindingInfo::Type::Button, CID_BUTTON19, GenericInputBinding::Unknown}, - {"F2", TRANSLATE_NOOP("USB", "F 2"), InputBindingInfo::Type::Button, CID_BUTTON20, GenericInputBinding::Unknown}, - {"FSharp2", TRANSLATE_NOOP("USB", "F# 2"), InputBindingInfo::Type::Button, CID_BUTTON21, GenericInputBinding::Unknown}, - {"G2", TRANSLATE_NOOP("USB", "G 2"), InputBindingInfo::Type::Button, CID_BUTTON24, GenericInputBinding::Unknown}, - {"GSharp2", TRANSLATE_NOOP("USB", "G# 2"), InputBindingInfo::Type::Button, CID_BUTTON25, GenericInputBinding::Unknown}, - {"A2", TRANSLATE_NOOP("USB", "A 2"), InputBindingInfo::Type::Button, CID_BUTTON26, GenericInputBinding::Unknown}, - {"ASharp2", TRANSLATE_NOOP("USB", "A# 2"), InputBindingInfo::Type::Button, CID_BUTTON27, GenericInputBinding::Unknown}, - {"B2", TRANSLATE_NOOP("USB", "B 2"), InputBindingInfo::Type::Button, CID_BUTTON28, GenericInputBinding::Unknown}, + {"C1", TRANSLATE_NOOP("USB", "C 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Unknown}, + {"CSharp1", TRANSLATE_NOOP("USB", "C# 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Unknown}, + {"D1", TRANSLATE_NOOP("USB", "D 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::Unknown}, + {"DSharp1", TRANSLATE_NOOP("USB", "D# 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Unknown}, + {"E1", TRANSLATE_NOOP("USB", "E 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Unknown}, + {"F1", TRANSLATE_NOOP("USB", "F 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::Unknown}, + {"FSharp1", TRANSLATE_NOOP("USB", "F# 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::Unknown}, + {"G1", TRANSLATE_NOOP("USB", "G 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Unknown}, + {"GSharp1", TRANSLATE_NOOP("USB", "G# 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Unknown}, + {"A1", TRANSLATE_NOOP("USB", "A 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON10, GenericInputBinding::Unknown}, + {"ASharp1", TRANSLATE_NOOP("USB", "A# 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON11, GenericInputBinding::Unknown}, + {"B1", TRANSLATE_NOOP("USB", "B 1"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON12, GenericInputBinding::Unknown}, + {"C2", TRANSLATE_NOOP("USB", "C 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON13, GenericInputBinding::Unknown}, + {"CSharp2", TRANSLATE_NOOP("USB", "C# 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON16, GenericInputBinding::Unknown}, + {"D2", TRANSLATE_NOOP("USB", "D 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON17, GenericInputBinding::Unknown}, + {"DSharp2", TRANSLATE_NOOP("USB", "D# 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON18, GenericInputBinding::Unknown}, + {"E2", TRANSLATE_NOOP("USB", "E 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON19, GenericInputBinding::Unknown}, + {"F2", TRANSLATE_NOOP("USB", "F 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON20, GenericInputBinding::Unknown}, + {"FSharp2", TRANSLATE_NOOP("USB", "F# 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON21, GenericInputBinding::Unknown}, + {"G2", TRANSLATE_NOOP("USB", "G 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON24, GenericInputBinding::Unknown}, + {"GSharp2", TRANSLATE_NOOP("USB", "G# 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON25, GenericInputBinding::Unknown}, + {"A2", TRANSLATE_NOOP("USB", "A 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON26, GenericInputBinding::Unknown}, + {"ASharp2", TRANSLATE_NOOP("USB", "A# 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON27, GenericInputBinding::Unknown}, + {"B2", TRANSLATE_NOOP("USB", "B 2"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON28, GenericInputBinding::Unknown}, - {"Start", TRANSLATE_NOOP("USB", "Start"), InputBindingInfo::Type::Button, CID_BUTTON22, GenericInputBinding::Unknown}, - {"Select", TRANSLATE_NOOP("USB", "Select"), InputBindingInfo::Type::Button, CID_BUTTON14, GenericInputBinding::Unknown}, - {"WheelUp", TRANSLATE_NOOP("USB", "Wheel Up"), InputBindingInfo::Type::Button, CID_BUTTON29, GenericInputBinding::Unknown}, - {"WheelDown", TRANSLATE_NOOP("USB", "Wheel Down"), InputBindingInfo::Type::Button, CID_BUTTON30, GenericInputBinding::Unknown}, + {"Start", TRANSLATE_NOOP("USB", "Start"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON22, GenericInputBinding::Unknown}, + {"Select", TRANSLATE_NOOP("USB", "Select"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON14, GenericInputBinding::Unknown}, + {"WheelUp", TRANSLATE_NOOP("USB", "Wheel Up"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON29, GenericInputBinding::Unknown}, + {"WheelDown", TRANSLATE_NOOP("USB", "Wheel Down"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON30, GenericInputBinding::Unknown}, }; return bindings; diff --git a/pcsx2/USB/usb-pad/usb-seamic.cpp b/pcsx2/USB/usb-pad/usb-seamic.cpp index 0e9a11517f..8aac62820d 100644 --- a/pcsx2/USB/usb-pad/usb-seamic.cpp +++ b/pcsx2/USB/usb-pad/usb-seamic.cpp @@ -362,24 +362,24 @@ namespace usb_pad { // TODO: This is likely wrong. Someone who cares can fix it. static constexpr const InputBindingInfo bindings[] = { - {"StickLeft", TRANSLATE_NOOP("USB", "Stick Left"), InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, - {"StickRight", TRANSLATE_NOOP("USB", "Stick Right"), InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, - {"StickUp", TRANSLATE_NOOP("USB", "Stick Up"), InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::LeftStickUp}, - {"StickDown", TRANSLATE_NOOP("USB", "Stick Down"), InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::LeftStickDown}, - {"A", TRANSLATE_NOOP("USB", "A"), InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Cross}, - {"B", TRANSLATE_NOOP("USB", "B"), InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Circle}, - {"C", TRANSLATE_NOOP("USB", "C"), InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::R2}, - {"X", TRANSLATE_NOOP("USB", "X"), InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Square}, - {"Y", TRANSLATE_NOOP("USB", "Y"), InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Triangle}, - {"Z", TRANSLATE_NOOP("USB", "Z"), InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::L2}, - {"L", TRANSLATE_NOOP("USB", "L"), InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::L1}, - {"R", TRANSLATE_NOOP("USB", "R"), InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::R1}, - {"Select", TRANSLATE_NOOP("USB", "Select"), InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("USB", "Start"), InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, - {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), InputBindingInfo::Type::Button, CID_DPAD_UP, GenericInputBinding::DPadUp}, - {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), InputBindingInfo::Type::Button, CID_DPAD_DOWN, GenericInputBinding::DPadDown}, - {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), InputBindingInfo::Type::Button, CID_DPAD_LEFT, GenericInputBinding::DPadLeft}, - {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), InputBindingInfo::Type::Button, CID_DPAD_RIGHT, GenericInputBinding::DPadRight}, + {"StickLeft", TRANSLATE_NOOP("USB", "Stick Left"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_L, GenericInputBinding::LeftStickLeft}, + {"StickRight", TRANSLATE_NOOP("USB", "Stick Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_STEERING_R, GenericInputBinding::LeftStickRight}, + {"StickUp", TRANSLATE_NOOP("USB", "Stick Up"), nullptr, InputBindingInfo::Type::HalfAxis, CID_THROTTLE, GenericInputBinding::LeftStickUp}, + {"StickDown", TRANSLATE_NOOP("USB", "Stick Down"), nullptr, InputBindingInfo::Type::HalfAxis, CID_BRAKE, GenericInputBinding::LeftStickDown}, + {"A", TRANSLATE_NOOP("USB", "A"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON0, GenericInputBinding::Cross}, + {"B", TRANSLATE_NOOP("USB", "B"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON1, GenericInputBinding::Circle}, + {"C", TRANSLATE_NOOP("USB", "C"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON2, GenericInputBinding::R2}, + {"X", TRANSLATE_NOOP("USB", "X"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON3, GenericInputBinding::Square}, + {"Y", TRANSLATE_NOOP("USB", "Y"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON4, GenericInputBinding::Triangle}, + {"Z", TRANSLATE_NOOP("USB", "Z"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON5, GenericInputBinding::L2}, + {"L", TRANSLATE_NOOP("USB", "L"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON6, GenericInputBinding::L1}, + {"R", TRANSLATE_NOOP("USB", "R"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON7, GenericInputBinding::R1}, + {"Select", TRANSLATE_NOOP("USB", "Select"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON8, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("USB", "Start"), nullptr, InputBindingInfo::Type::Button, CID_BUTTON9, GenericInputBinding::Start}, + {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_UP, GenericInputBinding::DPadUp}, + {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_DOWN, GenericInputBinding::DPadDown}, + {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_LEFT, GenericInputBinding::DPadLeft}, + {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), nullptr, InputBindingInfo::Type::Button, CID_DPAD_RIGHT, GenericInputBinding::DPadRight}, }; return bindings; diff --git a/pcsx2/USB/usb-pad/usb-turntable.cpp b/pcsx2/USB/usb-pad/usb-turntable.cpp index 297227476f..861ddbe918 100644 --- a/pcsx2/USB/usb-pad/usb-turntable.cpp +++ b/pcsx2/USB/usb-pad/usb-turntable.cpp @@ -444,30 +444,30 @@ namespace usb_pad std::span DJTurntableDevice::Bindings(u32 subtype) const { static constexpr const InputBindingInfo bindings[] = { - {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), InputBindingInfo::Type::Button, CID_DJ_DPAD_UP, GenericInputBinding::DPadUp}, - {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), InputBindingInfo::Type::Button, CID_DJ_DPAD_DOWN, GenericInputBinding::DPadDown}, - {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), InputBindingInfo::Type::Button, CID_DJ_DPAD_LEFT, GenericInputBinding::DPadLeft}, - {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), InputBindingInfo::Type::Button, CID_DJ_DPAD_RIGHT, GenericInputBinding::DPadRight}, - {"Square", TRANSLATE_NOOP("USB", "Square"), InputBindingInfo::Type::Button, CID_DJ_SQUARE, GenericInputBinding::Unknown}, - {"Cross", TRANSLATE_NOOP("USB", "Cross"), InputBindingInfo::Type::Button, CID_DJ_CROSS, GenericInputBinding::Unknown}, - {"Circle", TRANSLATE_NOOP("USB", "Circle"), InputBindingInfo::Type::Button, CID_DJ_CIRCLE, GenericInputBinding::Unknown}, - {"Triangle", TRANSLATE_NOOP("USB", "Triangle / Euphoria"), InputBindingInfo::Type::Button, CID_DJ_TRIANGLE, GenericInputBinding::Triangle}, - {"Select", TRANSLATE_NOOP("USB", "Select"), InputBindingInfo::Type::Button, CID_DJ_SELECT, GenericInputBinding::Select}, - {"Start", TRANSLATE_NOOP("USB", "Start"), InputBindingInfo::Type::Button, CID_DJ_START, GenericInputBinding::Start}, - {"CrossFaderLeft", TRANSLATE_NOOP("USB", "Crossfader Left"), InputBindingInfo::Type::HalfAxis, CID_DJ_CROSSFADER_LEFT, GenericInputBinding::RightStickDown}, - {"CrossFaderRight", TRANSLATE_NOOP("USB", "Crossfader Right"), InputBindingInfo::Type::HalfAxis, CID_DJ_CROSSFADER_RIGHT, GenericInputBinding::RightStickUp}, - {"EffectsKnobLeft", TRANSLATE_NOOP("USB", "Effects Knob Left"), InputBindingInfo::Type::HalfAxis, CID_DJ_EFFECTSKNOB_LEFT, GenericInputBinding::RightStickLeft}, - {"EffectsKnobRight", TRANSLATE_NOOP("USB", "Effects Knob Right"), InputBindingInfo::Type::HalfAxis, CID_DJ_EFFECTSKNOB_RIGHT, GenericInputBinding::RightStickRight}, - {"LeftTurntableCW", TRANSLATE_NOOP("USB", "Left Turntable Clockwise"), InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CW, GenericInputBinding::LeftStickRight}, - {"LeftTurntableCCW", TRANSLATE_NOOP("USB", "Left Turntable Counterclockwise"), InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CCW, GenericInputBinding::LeftStickLeft}, - {"RightTurntableCW", TRANSLATE_NOOP("USB", "Right Turntable Clockwise"), InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CW, GenericInputBinding::LeftStickDown}, - {"RightTurntableCCW", TRANSLATE_NOOP("USB", "Right Turntable Counterclockwise"), InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CCW, GenericInputBinding::LeftStickUp}, - {"LeftTurntableGreen", TRANSLATE_NOOP("USB", "Left Turntable Green"), InputBindingInfo::Type::Button, CID_DJ_LEFT_GREEN, GenericInputBinding::Unknown}, - {"LeftTurntableRed", TRANSLATE_NOOP("USB", "Left Turntable Red"), InputBindingInfo::Type::Button, CID_DJ_LEFT_RED, GenericInputBinding::Unknown}, - {"LeftTurntableBlue", TRANSLATE_NOOP("USB", "Left Turntable Blue"), InputBindingInfo::Type::Button, CID_DJ_LEFT_BLUE, GenericInputBinding::Unknown}, - {"RightTurntableGreen", TRANSLATE_NOOP("USB", "Right Turntable Green"), InputBindingInfo::Type::Button, CID_DJ_RIGHT_GREEN, GenericInputBinding::Cross}, - {"RightTurntableRed", TRANSLATE_NOOP("USB", "Right Turntable Red "), InputBindingInfo::Type::Button, CID_DJ_RIGHT_RED, GenericInputBinding::Circle}, - {"RightTurntableBlue", TRANSLATE_NOOP("USB", "Right Turntable Blue"), InputBindingInfo::Type::Button, CID_DJ_RIGHT_BLUE, GenericInputBinding::Square} + {"DPadUp", TRANSLATE_NOOP("USB", "D-Pad Up"), nullptr, InputBindingInfo::Type::Button, CID_DJ_DPAD_UP, GenericInputBinding::DPadUp}, + {"DPadDown", TRANSLATE_NOOP("USB", "D-Pad Down"), nullptr, InputBindingInfo::Type::Button, CID_DJ_DPAD_DOWN, GenericInputBinding::DPadDown}, + {"DPadLeft", TRANSLATE_NOOP("USB", "D-Pad Left"), nullptr, InputBindingInfo::Type::Button, CID_DJ_DPAD_LEFT, GenericInputBinding::DPadLeft}, + {"DPadRight", TRANSLATE_NOOP("USB", "D-Pad Right"), nullptr, InputBindingInfo::Type::Button, CID_DJ_DPAD_RIGHT, GenericInputBinding::DPadRight}, + {"Square", TRANSLATE_NOOP("USB", "Square"), nullptr, InputBindingInfo::Type::Button, CID_DJ_SQUARE, GenericInputBinding::Unknown}, + {"Cross", TRANSLATE_NOOP("USB", "Cross"), nullptr, InputBindingInfo::Type::Button, CID_DJ_CROSS, GenericInputBinding::Unknown}, + {"Circle", TRANSLATE_NOOP("USB", "Circle"), nullptr, InputBindingInfo::Type::Button, CID_DJ_CIRCLE, GenericInputBinding::Unknown}, + {"Triangle", TRANSLATE_NOOP("USB", "Triangle / Euphoria"), nullptr, InputBindingInfo::Type::Button, CID_DJ_TRIANGLE, GenericInputBinding::Triangle}, + {"Select", TRANSLATE_NOOP("USB", "Select"), nullptr, InputBindingInfo::Type::Button, CID_DJ_SELECT, GenericInputBinding::Select}, + {"Start", TRANSLATE_NOOP("USB", "Start"), nullptr, InputBindingInfo::Type::Button, CID_DJ_START, GenericInputBinding::Start}, + {"CrossFaderLeft", TRANSLATE_NOOP("USB", "Crossfader Left"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_CROSSFADER_LEFT, GenericInputBinding::RightStickDown}, + {"CrossFaderRight", TRANSLATE_NOOP("USB", "Crossfader Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_CROSSFADER_RIGHT, GenericInputBinding::RightStickUp}, + {"EffectsKnobLeft", TRANSLATE_NOOP("USB", "Effects Knob Left"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_EFFECTSKNOB_LEFT, GenericInputBinding::RightStickLeft}, + {"EffectsKnobRight", TRANSLATE_NOOP("USB", "Effects Knob Right"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_EFFECTSKNOB_RIGHT, GenericInputBinding::RightStickRight}, + {"LeftTurntableCW", TRANSLATE_NOOP("USB", "Left Turntable Clockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CW, GenericInputBinding::LeftStickRight}, + {"LeftTurntableCCW", TRANSLATE_NOOP("USB", "Left Turntable Counterclockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_LEFT_TURNTABLE_CCW, GenericInputBinding::LeftStickLeft}, + {"RightTurntableCW", TRANSLATE_NOOP("USB", "Right Turntable Clockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CW, GenericInputBinding::LeftStickDown}, + {"RightTurntableCCW", TRANSLATE_NOOP("USB", "Right Turntable Counterclockwise"), nullptr, InputBindingInfo::Type::HalfAxis, CID_DJ_RIGHT_TURNTABLE_CCW, GenericInputBinding::LeftStickUp}, + {"LeftTurntableGreen", TRANSLATE_NOOP("USB", "Left Turntable Green"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_GREEN, GenericInputBinding::Unknown}, + {"LeftTurntableRed", TRANSLATE_NOOP("USB", "Left Turntable Red"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_RED, GenericInputBinding::Unknown}, + {"LeftTurntableBlue", TRANSLATE_NOOP("USB", "Left Turntable Blue"), nullptr, InputBindingInfo::Type::Button, CID_DJ_LEFT_BLUE, GenericInputBinding::Unknown}, + {"RightTurntableGreen", TRANSLATE_NOOP("USB", "Right Turntable Green"), nullptr, InputBindingInfo::Type::Button, CID_DJ_RIGHT_GREEN, GenericInputBinding::Cross}, + {"RightTurntableRed", TRANSLATE_NOOP("USB", "Right Turntable Red "), nullptr, InputBindingInfo::Type::Button, CID_DJ_RIGHT_RED, GenericInputBinding::Circle}, + {"RightTurntableBlue", TRANSLATE_NOOP("USB", "Right Turntable Blue"), nullptr, InputBindingInfo::Type::Button, CID_DJ_RIGHT_BLUE, GenericInputBinding::Square} }; diff --git a/tests/ctest/core/StubHost.cpp b/tests/ctest/core/StubHost.cpp index 11ee4fe00e..721f1d7f87 100644 --- a/tests/ctest/core/StubHost.cpp +++ b/tests/ctest/core/StubHost.cpp @@ -226,5 +226,10 @@ std::optional InputManager::ConvertHostKeyboardCodeToString(u32 cod return std::nullopt; } +const char* InputManager::ConvertHostKeyboardCodeToIcon(u32 code) +{ + return nullptr; +} + BEGIN_HOTKEY_LIST(g_host_hotkeys) END_HOTKEY_LIST() \ No newline at end of file diff --git a/tools/generate_fullscreen_ui_translation_strings.py b/tools/generate_fullscreen_ui_translation_strings.py index 119717be08..bfc944d425 100644 --- a/tools/generate_fullscreen_ui_translation_strings.py +++ b/tools/generate_fullscreen_ui_translation_strings.py @@ -9,7 +9,7 @@ with open(src_file, "r") as f: full_source = f.read() strings = [] -for token in ["FSUI_STR", "FSUI_CSTR", "FSUI_FSTR", "FSUI_NSTR", "FSUI_ICONSTR", "FSUI_ICONSTR_S"]: +for token in ["FSUI_STR", "FSUI_CSTR", "FSUI_FSTR", "FSUI_NSTR", "FSUI_VSTR", "FSUI_ICONSTR", "FSUI_ICONSTR_S"]: token_len = len(token) last_pos = 0 while True: diff --git a/tools/generate_update_fa_glyph_ranges.py b/tools/generate_update_fa_glyph_ranges.py index 00a5141523..115f4c2b2d 100644 --- a/tools/generate_update_fa_glyph_ranges.py +++ b/tools/generate_update_fa_glyph_ranges.py @@ -24,13 +24,16 @@ import functools src_dirs = [os.path.join(os.path.dirname(__file__), "..", "pcsx2"), os.path.join(os.path.dirname(__file__), "..", "pcsx2-qt")] fa_file = os.path.join(os.path.dirname(__file__), "..", "3rdparty", "include", "IconsFontAwesome5.h") +pf_file = os.path.join(os.path.dirname(__file__), "..", "3rdparty", "include", "IconsPromptFont.h") dst_file = os.path.join(os.path.dirname(__file__), "..", "pcsx2", "ImGui", "ImGuiManager.cpp") + all_source_files = list(functools.reduce(lambda prev, src_dir: prev + glob.glob(os.path.join(src_dir, "**", "*.cpp"), recursive=True) + \ glob.glob(os.path.join(src_dir, "**", "*.h"), recursive=True) + \ glob.glob(os.path.join(src_dir, "**", "*.inl"), recursive=True), src_dirs, [])) tokens = set() +pf_tokens = set() for filename in all_source_files: data = None with open(filename, "r") as f: @@ -40,9 +43,10 @@ for filename in all_source_files: continue tokens = tokens.union(set(re.findall("(ICON_FA_[a-zA-Z0-9_]+)", data))) + pf_tokens = pf_tokens.union(set(re.findall("(ICON_PF_[a-zA-Z0-9_]+)", data))) -print("{} tokens found.".format(len(tokens))) -if len(tokens) == 0: +print("{}/{} tokens found.".format(len(tokens), len(pf_tokens))) +if len(tokens) == 0 and len(pf_tokens) == 0: sys.exit(0) u8_encodings = {} @@ -52,44 +56,53 @@ with open(fa_file, "r") as f: if match is None: continue u8_encodings[match[1]] = bytes.fromhex(match[2].replace("\\x", "")) +with open(pf_file, "r") as f: + for line in f.readlines(): + match = re.match("#define (ICON_PF_[^ ]+) \"([^\"]+)\"", line) + if match is None: + continue + u8_encodings[match[1]] = bytes.fromhex(match[2].replace("\\x", "")) out_pattern = "(static constexpr ImWchar range_fa\[\] = \{)[0-9A-Z_a-z, \n]+(\};)" +out_pf_pattern = "(static constexpr ImWchar range_pf\[\] = \{)[0-9A-Z_a-z, \n]+(\};)" -codepoints = list() -for token in tokens: - u8_bytes = u8_encodings[token] - u8 = str(u8_bytes, "utf-8") - u16 = u8.encode("utf-16le") - if len(u16) > 2: - raise ValueError("{} too long".format(u8_bytes)) +def get_pairs(tokens): + codepoints = list() + for token in tokens: + u8_bytes = u8_encodings[token] + u8 = str(u8_bytes, "utf-8") + u16 = u8.encode("utf-16le") + if len(u16) > 2: + raise ValueError("{} {} too long".format(u8_bytes, token)) - codepoint = int.from_bytes(u16, byteorder="little", signed=False) - codepoints.append(codepoint) -codepoints.sort() -codepoints.append(0) # null terminator + codepoint = int.from_bytes(u16, byteorder="little", signed=False) + codepoints.append(codepoint) + codepoints.sort() + codepoints.append(0) # null terminator -startc = codepoints[0] -endc = None -pairs = [startc] -for codepoint in codepoints: - if endc is not None and (endc + 1) != codepoint: - pairs.append(endc) - pairs.append(codepoint) - startc = codepoint - endc = codepoint - else: - endc = codepoint -pairs.append(endc) + startc = codepoints[0] + endc = None + pairs = [startc] + for codepoint in codepoints: + if endc is not None and (endc + 1) != codepoint: + pairs.append(endc) + pairs.append(codepoint) + startc = codepoint + endc = codepoint + else: + endc = codepoint + pairs.append(endc) -pairs_str = ",".join(map("0x{:x}".format, pairs)) + pairs_str = ",".join(list(map("0x{:x}".format, pairs))) + return pairs_str with open(dst_file, "r") as f: original = f.read() - updated = re.sub(out_pattern, "\\1 " + pairs_str + " \\2", original) + updated = re.sub(out_pattern, "\\1 " + get_pairs(tokens) + " \\2", original) + updated = re.sub(out_pf_pattern, "\\1 " + get_pairs(pf_tokens) + " \\2", original) if original != updated: with open(dst_file, "w") as f: f.write(updated) print("Updated {}".format(dst_file)) else: - print("Skipping updating {}".format(dst_file)) - + print("Skipping updating {}".format(dst_file)) \ No newline at end of file