Add Switch controller asset and configuration

* Add GXT string for the Nintendo Switch Controller
* Add frontend and button textures for Nintendo Switch controllers
* Fix wrong #ifndef when hiding screen resolution option on GTA_HANDHELD
This commit is contained in:
Adrian Graber 2021-07-06 18:05:21 +02:00
parent b09b489ae7
commit a99a04ed49
20 changed files with 58 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -2644,6 +2644,14 @@ const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
#undef PS2_CROSS #undef PS2_CROSS
#undef PS2_SQUARE #undef PS2_SQUARE
const char *NintendoSwitchButtons_noIcons[][MAX_CONTROLLERACTIONS] =
CONTROLLER_BUTTONS("Y", "A", "B", "X", "L", "ZL", "LS", "R", "ZR", "RS", "BACK");
#ifdef BUTTON_ICONS
const char *NintendoSwitchButtons[][MAX_CONTROLLERACTIONS] =
CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK");
#endif
#undef CONTROLLER_BUTTONS #undef CONTROLLER_BUTTONS
#undef VFB #undef VFB
@ -2664,6 +2672,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *
case CMenuManager::CONTROLLER_DUALSHOCK4: case CMenuManager::CONTROLLER_DUALSHOCK4:
Buttons = CFont::ButtonsSlot != -1 ? PlayStationButtons : PlayStationButtons_noIcons; Buttons = CFont::ButtonsSlot != -1 ? PlayStationButtons : PlayStationButtons_noIcons;
break; break;
case CMenuManager::CONTROLLER_NINTENDO_SWITCH:
Buttons = CFont::ButtonsSlot != -1 ? NintendoSwitchButtons : NintendoSwitchButtons_noIcons;
break;
default: default:
#endif #endif
Buttons = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons; Buttons = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
@ -2679,6 +2690,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *
case CMenuManager::CONTROLLER_DUALSHOCK4: case CMenuManager::CONTROLLER_DUALSHOCK4:
Buttons = PlayStationButtons_noIcons; Buttons = PlayStationButtons_noIcons;
break; break;
case CMenuManager::CONTROLLER_NINTENDO_SWITCH:
Buttons = NintendoSwitchButtons_noIcons;
break;
default: default:
Buttons = XboxButtons_noIcons; Buttons = XboxButtons_noIcons;
break; break;

View file

@ -142,8 +142,12 @@ int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
#endif #endif
#ifdef GAMEPAD_MENU #ifdef GAMEPAD_MENU
#ifdef __SWITCH__
int8 CMenuManager::m_PrefsControllerType = CONTROLLER_NINTENDO_SWITCH;
#else
int8 CMenuManager::m_PrefsControllerType = CONTROLLER_XBOXONE; int8 CMenuManager::m_PrefsControllerType = CONTROLLER_XBOXONE;
#endif #endif
#endif
int32 CMenuManager::OS_Language = LANG_ENGLISH; int32 CMenuManager::OS_Language = LANG_ENGLISH;
int8 CMenuManager::m_PrefsUseVibration; int8 CMenuManager::m_PrefsUseVibration;
@ -3674,6 +3678,7 @@ const char* controllerTypesPaths[] = {
"MODELS/FRONTEND_DS4.TXD", "MODELS/FRONTEND_DS4.TXD",
"MODELS/FRONTEND_X360.TXD", "MODELS/FRONTEND_X360.TXD",
"MODELS/FRONTEND_XONE.TXD", "MODELS/FRONTEND_XONE.TXD",
"MODELS/FRONTEND_NSW.TXD",
}; };
void void
@ -3686,6 +3691,9 @@ CMenuManager::LoadController(int8 type)
case CONTROLLER_DUALSHOCK4: case CONTROLLER_DUALSHOCK4:
CFont::LoadButtons("MODELS/PS3BTNS.TXD"); CFont::LoadButtons("MODELS/PS3BTNS.TXD");
break; break;
case CONTROLLER_NINTENDO_SWITCH:
CFont::LoadButtons("MODELS/NSWBTNS.TXD");
break;
default: default:
CFont::LoadButtons("MODELS/X360BTNS.TXD"); CFont::LoadButtons("MODELS/X360BTNS.TXD");
break; break;
@ -5928,6 +5936,18 @@ CMenuManager::PrintController(void)
TEXT_L2R2_Y += 5.0f; TEXT_L2R2_Y += 5.0f;
TEXT_SELECT_X += 3.0f; TEXT_SELECT_X += 3.0f;
break; break;
case CONTROLLER_NINTENDO_SWITCH:
TEXT_L1_Y += 5.0f;
TEXT_L1_Y_VEH = TEXT_L1_Y;
TEXT_R1_Y += 5.0f;
TEXT_TRIANGLE_Y += 3.0f;
TEXT_CIRCLE_Y += 3.0f;
TEXT_CROSS_Y += 3.0f;
TEXT_LSTICK_Y -= 23.0f;
TEXT_DPAD_Y += 25.0;
TEXT_RSTICK_Y += 1.0f;
TEXT_R3_Y += 1.0f;
break;
}; };
if (m_DisplayControllerOnFoot) { if (m_DisplayControllerOnFoot) {

View file

@ -760,6 +760,7 @@ public:
CONTROLLER_DUALSHOCK4, CONTROLLER_DUALSHOCK4,
CONTROLLER_XBOX360, CONTROLLER_XBOX360,
CONTROLLER_XBOXONE, CONTROLLER_XBOXONE,
CONTROLLER_NINTENDO_SWITCH,
}; };
static int8 m_PrefsControllerType; static int8 m_PrefsControllerType;

View file

@ -388,7 +388,7 @@ void DetectJoystickGoBack() {
#endif #endif
#ifdef GAMEPAD_MENU #ifdef GAMEPAD_MENU
const char* controllerTypes[] = { "FEC_DS2", "FEC_DS3", "FEC_DS4", "FEC_360", "FEC_ONE" }; const char* controllerTypes[] = { "FEC_DS2", "FEC_DS3", "FEC_DS4", "FEC_360", "FEC_ONE", "FEC_NSW" };
void ControllerTypeAfterChange(int8 before, int8 after) void ControllerTypeAfterChange(int8 before, int8 after)
{ {
FrontEndMenuManager.LoadController(after); FrontEndMenuManager.LoadController(after);
@ -889,7 +889,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
{ "FET_GFX", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, { "FET_GFX", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS,
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), GraphicsGoBack, new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), GraphicsGoBack,
#ifdef GTA_HANDHELD #ifndef GTA_HANDHELD
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
#endif #endif
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },

View file

@ -8061,6 +8061,9 @@ XBOX 360 CONTROLLER
[FEC_ONE] [FEC_ONE]
XBOX ONE CONTROLLER XBOX ONE CONTROLLER
[FEC_NSW]
NINTENDO SWITCH CONTROLLER
[FEC_TYP] [FEC_TYP]
GAMEPAD TYPE GAMEPAD TYPE

View file

@ -8329,6 +8329,9 @@ XBOX 360 CONTROLLER
[FEC_ONE] [FEC_ONE]
XBOX ONE CONTROLLER XBOX ONE CONTROLLER
[FEC_NSW]
NINTENDO SWITCH CONTROLLER
[FEC_TYP] [FEC_TYP]
GAMEPAD TYPE GAMEPAD TYPE

View file

@ -8146,6 +8146,9 @@ XBOX 360 CONTROLLER
[FEC_ONE] [FEC_ONE]
XBOX ONE CONTROLLER XBOX ONE CONTROLLER
[FEC_NSW]
NINTENDO SWITCH CONTROLLER
[FEC_TYP] [FEC_TYP]
GAMEPAD-TYP GAMEPAD-TYP

View file

@ -8158,6 +8158,9 @@ XBOX 360 CONTROLLER
[FEC_ONE] [FEC_ONE]
XBOX ONE CONTROLLER XBOX ONE CONTROLLER
[FEC_NSW]
NINTENDO SWITCH CONTROLLER
[FEC_TYP] [FEC_TYP]
GAMEPAD TYPE GAMEPAD TYPE

View file

@ -8067,6 +8067,9 @@ XBOX 360 CONTROLLER
[FEC_ONE] [FEC_ONE]
XBOX ONE CONTROLLER XBOX ONE CONTROLLER
[FEC_NSW]
NINTENDO SWITCH CONTROLLER
[FEC_TYP] [FEC_TYP]
GAMEPAD TYPE GAMEPAD TYPE

View file

@ -8069,6 +8069,9 @@ DUALSHOCK 4
[FEC_ONE] [FEC_ONE]
КОНТРОЛЛЕР XBOX ONE КОНТРОЛЛЕР XBOX ONE
[FEC_NSW]
КОНТРОЛЛЕР NINTENDO SWITCH
[FEC_TYP] [FEC_TYP]
ГЕЙМПАД ГЕЙМПАД

View file

@ -8128,6 +8128,9 @@ MANDO DE XBOX 360
[FEC_ONE] [FEC_ONE]
MANDO DE XBOX ONE MANDO DE XBOX ONE
[FEC_NSW]
MANDO DE NINTENDO SWITCH
[FEC_TYP] [FEC_TYP]
TIPO DE MANDO TIPO DE MANDO