diff options
author | Adrian Graber <adrian@adriangraber.com> | 2021-07-06 18:05:21 +0200 |
---|---|---|
committer | Adrian Graber <adrian@adriangraber.com> | 2021-07-13 00:50:49 +0200 |
commit | a99a04ed49fe5cea1eb8292d9ffeefb40d10ac82 (patch) | |
tree | 250193cb6499602010e8501b8d0f563f29e455a7 /src | |
parent | b09b489ae7b15feb85b71a18f1b8e320f56d0ce8 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ControllerConfig.cpp | 14 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 20 | ||||
-rw-r--r-- | src/core/Frontend.h | 1 | ||||
-rw-r--r-- | src/core/MenuScreensCustom.cpp | 4 |
4 files changed, 37 insertions, 2 deletions
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index e72af7e4..8775792f 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -2644,6 +2644,14 @@ const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] = #undef PS2_CROSS #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 VFB @@ -2664,6 +2672,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar * case CMenuManager::CONTROLLER_DUALSHOCK4: Buttons = CFont::ButtonsSlot != -1 ? PlayStationButtons : PlayStationButtons_noIcons; break; + case CMenuManager::CONTROLLER_NINTENDO_SWITCH: + Buttons = CFont::ButtonsSlot != -1 ? NintendoSwitchButtons : NintendoSwitchButtons_noIcons; + break; default: #endif Buttons = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons; @@ -2679,6 +2690,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar * case CMenuManager::CONTROLLER_DUALSHOCK4: Buttons = PlayStationButtons_noIcons; break; + case CMenuManager::CONTROLLER_NINTENDO_SWITCH: + Buttons = NintendoSwitchButtons_noIcons; + break; default: Buttons = XboxButtons_noIcons; break; diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index ecb893b4..0f4218a4 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -142,8 +142,12 @@ int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW; #endif #ifdef GAMEPAD_MENU +#ifdef __SWITCH__ +int8 CMenuManager::m_PrefsControllerType = CONTROLLER_NINTENDO_SWITCH; +#else int8 CMenuManager::m_PrefsControllerType = CONTROLLER_XBOXONE; #endif +#endif int32 CMenuManager::OS_Language = LANG_ENGLISH; int8 CMenuManager::m_PrefsUseVibration; @@ -3674,6 +3678,7 @@ const char* controllerTypesPaths[] = { "MODELS/FRONTEND_DS4.TXD", "MODELS/FRONTEND_X360.TXD", "MODELS/FRONTEND_XONE.TXD", + "MODELS/FRONTEND_NSW.TXD", }; void @@ -3686,6 +3691,9 @@ CMenuManager::LoadController(int8 type) case CONTROLLER_DUALSHOCK4: CFont::LoadButtons("MODELS/PS3BTNS.TXD"); break; + case CONTROLLER_NINTENDO_SWITCH: + CFont::LoadButtons("MODELS/NSWBTNS.TXD"); + break; default: CFont::LoadButtons("MODELS/X360BTNS.TXD"); break; @@ -5928,6 +5936,18 @@ CMenuManager::PrintController(void) TEXT_L2R2_Y += 5.0f; TEXT_SELECT_X += 3.0f; 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) { diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 32e5ef9d..6e6c40f7 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -760,6 +760,7 @@ public: CONTROLLER_DUALSHOCK4, CONTROLLER_XBOX360, CONTROLLER_XBOXONE, + CONTROLLER_NINTENDO_SWITCH, }; static int8 m_PrefsControllerType; diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index 5b0fd60c..586b51fa 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -388,7 +388,7 @@ void DetectJoystickGoBack() { #endif #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) { FrontEndMenuManager.LoadController(after); @@ -889,7 +889,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = { { "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, -#ifdef GTA_HANDHELD +#ifndef GTA_HANDHELD MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, #endif MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, |