From a99a04ed49fe5cea1eb8292d9ffeefb40d10ac82 Mon Sep 17 00:00:00 2001 From: Adrian Graber Date: Tue, 6 Jul 2021 18:05:21 +0200 Subject: 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 --- gamefiles/TEXT/american.gxt | Bin 220642 -> 220708 bytes gamefiles/TEXT/french.gxt | Bin 246616 -> 246682 bytes gamefiles/TEXT/german.gxt | Bin 242680 -> 242746 bytes gamefiles/TEXT/italian.gxt | Bin 242050 -> 242116 bytes gamefiles/TEXT/polish.gxt | Bin 241682 -> 241748 bytes gamefiles/TEXT/russian.gxt | Bin 222468 -> 222534 bytes gamefiles/TEXT/spanish.gxt | Bin 235614 -> 235676 bytes gamefiles/models/frontend_nsw.txd | Bin 0 -> 2360104 bytes gamefiles/models/nswbtns.txd | Bin 0 -> 528424 bytes src/core/ControllerConfig.cpp | 14 ++++++++++++++ src/core/Frontend.cpp | 20 ++++++++++++++++++++ src/core/Frontend.h | 1 + src/core/MenuScreensCustom.cpp | 4 ++-- utils/gxt/american.txt | 3 +++ utils/gxt/french.txt | 3 +++ utils/gxt/german.txt | 3 +++ utils/gxt/italian.txt | 3 +++ utils/gxt/polish.txt | 3 +++ utils/gxt/russian.txt | 3 +++ utils/gxt/spanish.txt | 3 +++ 20 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 gamefiles/models/frontend_nsw.txd create mode 100644 gamefiles/models/nswbtns.txd diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt index d4034411..d7b7c956 100644 Binary files a/gamefiles/TEXT/american.gxt and b/gamefiles/TEXT/american.gxt differ diff --git a/gamefiles/TEXT/french.gxt b/gamefiles/TEXT/french.gxt index 16c7a716..3dece994 100644 Binary files a/gamefiles/TEXT/french.gxt and b/gamefiles/TEXT/french.gxt differ diff --git a/gamefiles/TEXT/german.gxt b/gamefiles/TEXT/german.gxt index c3309d61..7f25bd05 100644 Binary files a/gamefiles/TEXT/german.gxt and b/gamefiles/TEXT/german.gxt differ diff --git a/gamefiles/TEXT/italian.gxt b/gamefiles/TEXT/italian.gxt index b30b74f4..5a060a9a 100644 Binary files a/gamefiles/TEXT/italian.gxt and b/gamefiles/TEXT/italian.gxt differ diff --git a/gamefiles/TEXT/polish.gxt b/gamefiles/TEXT/polish.gxt index d771427b..782f656d 100755 Binary files a/gamefiles/TEXT/polish.gxt and b/gamefiles/TEXT/polish.gxt differ diff --git a/gamefiles/TEXT/russian.gxt b/gamefiles/TEXT/russian.gxt index 0075c691..914f5b52 100644 Binary files a/gamefiles/TEXT/russian.gxt and b/gamefiles/TEXT/russian.gxt differ diff --git a/gamefiles/TEXT/spanish.gxt b/gamefiles/TEXT/spanish.gxt index 8980eb4d..cb884689 100644 Binary files a/gamefiles/TEXT/spanish.gxt and b/gamefiles/TEXT/spanish.gxt differ diff --git a/gamefiles/models/frontend_nsw.txd b/gamefiles/models/frontend_nsw.txd new file mode 100644 index 00000000..1379a1a7 Binary files /dev/null and b/gamefiles/models/frontend_nsw.txd differ diff --git a/gamefiles/models/nswbtns.txd b/gamefiles/models/nswbtns.txd new file mode 100644 index 00000000..0b1756ee Binary files /dev/null and b/gamefiles/models/nswbtns.txd differ 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 }, diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index d8f79f05..57ec4d74 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -8061,6 +8061,9 @@ XBOX 360 CONTROLLER [FEC_ONE] XBOX ONE CONTROLLER +[FEC_NSW] +NINTENDO SWITCH CONTROLLER + [FEC_TYP] GAMEPAD TYPE diff --git a/utils/gxt/french.txt b/utils/gxt/french.txt index bd4acf96..bdb12c7b 100644 --- a/utils/gxt/french.txt +++ b/utils/gxt/french.txt @@ -8329,6 +8329,9 @@ XBOX 360 CONTROLLER [FEC_ONE] XBOX ONE CONTROLLER +[FEC_NSW] +NINTENDO SWITCH CONTROLLER + [FEC_TYP] GAMEPAD TYPE diff --git a/utils/gxt/german.txt b/utils/gxt/german.txt index 5f5c53c4..b77cb17c 100644 --- a/utils/gxt/german.txt +++ b/utils/gxt/german.txt @@ -8146,6 +8146,9 @@ XBOX 360 CONTROLLER [FEC_ONE] XBOX ONE CONTROLLER +[FEC_NSW] +NINTENDO SWITCH CONTROLLER + [FEC_TYP] GAMEPAD-TYP diff --git a/utils/gxt/italian.txt b/utils/gxt/italian.txt index 803b7fbf..9dfee85c 100644 --- a/utils/gxt/italian.txt +++ b/utils/gxt/italian.txt @@ -8158,6 +8158,9 @@ XBOX 360 CONTROLLER [FEC_ONE] XBOX ONE CONTROLLER +[FEC_NSW] +NINTENDO SWITCH CONTROLLER + [FEC_TYP] GAMEPAD TYPE diff --git a/utils/gxt/polish.txt b/utils/gxt/polish.txt index 33716291..98d373ef 100755 --- a/utils/gxt/polish.txt +++ b/utils/gxt/polish.txt @@ -8067,6 +8067,9 @@ XBOX 360 CONTROLLER [FEC_ONE] XBOX ONE CONTROLLER +[FEC_NSW] +NINTENDO SWITCH CONTROLLER + [FEC_TYP] GAMEPAD TYPE diff --git a/utils/gxt/russian.txt b/utils/gxt/russian.txt index 221e59f5..3b42bb21 100644 --- a/utils/gxt/russian.txt +++ b/utils/gxt/russian.txt @@ -8069,6 +8069,9 @@ DUALSHOCK 4 [FEC_ONE] КОНТРОЛЛЕР XBOX ONE +[FEC_NSW] +КОНТРОЛЛЕР NINTENDO SWITCH + [FEC_TYP] ГЕЙМПАД diff --git a/utils/gxt/spanish.txt b/utils/gxt/spanish.txt index 5f108d3b..2775d342 100644 --- a/utils/gxt/spanish.txt +++ b/utils/gxt/spanish.txt @@ -8128,6 +8128,9 @@ MANDO DE XBOX 360 [FEC_ONE] MANDO DE XBOX ONE +[FEC_NSW] +MANDO DE NINTENDO SWITCH + [FEC_TYP] TIPO DE MANDO -- cgit v1.2.3