diff options
author | Adrian Graber <adrian@adriangraber.com> | 2021-07-13 01:11:42 +0200 |
---|---|---|
committer | Adrian Graber <adrian@adriangraber.com> | 2021-07-13 01:18:49 +0200 |
commit | 6665b16ba279f9d92c5a5b2ddc62dd584e20b581 (patch) | |
tree | 1afbad268cc33b440c406ffa254304b3f819147c /src/core | |
parent | disable USE_CUTSCENE_SHADOW_FOR_PED if COMPATIBLE_SAVES isn't defined (diff) | |
download | re3-6665b16ba279f9d92c5a5b2ddc62dd584e20b581.tar re3-6665b16ba279f9d92c5a5b2ddc62dd584e20b581.tar.gz re3-6665b16ba279f9d92c5a5b2ddc62dd584e20b581.tar.bz2 re3-6665b16ba279f9d92c5a5b2ddc62dd584e20b581.tar.lz re3-6665b16ba279f9d92c5a5b2ddc62dd584e20b581.tar.xz re3-6665b16ba279f9d92c5a5b2ddc62dd584e20b581.tar.zst re3-6665b16ba279f9d92c5a5b2ddc62dd584e20b581.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ControllerConfig.cpp | 14 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 28 | ||||
-rw-r--r-- | src/core/Frontend.h | 1 | ||||
-rw-r--r-- | src/core/MenuScreensCustom.cpp | 14 | ||||
-rw-r--r-- | src/core/common.h | 5 | ||||
-rw-r--r-- | src/core/config.h | 21 | ||||
-rw-r--r-- | src/core/re3.cpp | 2 |
7 files changed, 78 insertions, 7 deletions
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index 72d31137..dbb0bd87 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -2673,6 +2673,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", "right stick up", "right stick down", "right stick left", "right stick right"); + +#ifdef BUTTON_ICONS +const char *NintendoSwitchButtons[][MAX_CONTROLLERACTIONS] = + CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK", "~H~", "~L~", "~(~", "~)~"); +#endif + #undef UP #undef DOWN #undef LEFT @@ -2698,6 +2706,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; @@ -2713,6 +2724,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 632a69ab..b0ef0627 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -539,8 +539,12 @@ CMenuManager::CMenuManager() #endif #ifdef GAMEPAD_MENU +#ifdef __SWITCH__ + m_PrefsControllerType = CONTROLLER_NINTENDO_SWITCH; +#else m_PrefsControllerType = CONTROLLER_XBOXONE; #endif +#endif } void @@ -566,7 +570,11 @@ CMenuManager::Initialise(void) m_nCurrOption = 0; m_nOptionHighlightTransitionBlend = 0; CentreMousePointer(); +#ifdef GTA_HANDHELD + m_bShowMouse = false; +#else m_bShowMouse = true; +#endif m_fMapSize = MENU_Y(162.0f); // Y because of HOR+ m_fMapCenterX = MENU_X_LEFT_ALIGNED(320.0f); m_fMapCenterY = MENU_Y(225.0f); @@ -5872,6 +5880,7 @@ const char* controllerTypesPaths[] = { "MODELS/FRONTEND_DS4.TXD", "MODELS/FRONTEND_X360.TXD", "MODELS/FRONTEND_XONE.TXD", + "MODELS/FRONTEND_NSW.TXD", }; void @@ -5982,6 +5991,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) { @@ -6278,6 +6299,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); switch (m_PrefsLanguage) { @@ -6358,6 +6380,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); switch (m_PrefsLanguage) { @@ -6441,6 +6464,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); switch (m_PrefsLanguage) { @@ -6525,6 +6549,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); CFont::PrintStringFromBottom(MENU_X_LEFT_ALIGNED(X(TEXT_SQUARE_X)), MENU_Y(Y(TEXT_SQUARE_Y)), TheText.Get("FEC_SMT")); break; @@ -6567,6 +6592,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; diff --git a/src/core/Frontend.h b/src/core/Frontend.h index b4e70613..b6a91517 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -685,6 +685,7 @@ public: CONTROLLER_DUALSHOCK4, CONTROLLER_XBOX360, CONTROLLER_XBOXONE, + CONTROLLER_NINTENDO_SWITCH, }; int8 m_PrefsControllerType; diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index 49bb33f8..340fee62 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -34,7 +34,7 @@ #ifdef CUSTOM_FRONTEND_OPTIONS -#ifdef IMPROVED_VIDEOMODE +#if defined(IMPROVED_VIDEOMODE) && !defined(GTA_HANDHELD) #define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, "VideoMode", "Windowed", screenModes, 2, true, ScreenModeAfterChange, true) }, 0, 0, MENUALIGN_LEFT, #else #define VIDEOMODE_SELECTOR @@ -354,7 +354,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); @@ -604,7 +604,11 @@ CMenuScreenCustom aScreens[] = { // MENUPAGE_OPTIONS = 27 { "FET_OPT", MENUPAGE_NONE, nil, nil, +#ifdef GTA_HANDHELD + MENUACTION_CHANGEMENU, "FEO_CON", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS}, 320, 132, MENUALIGN_CENTER, +#else MENUACTION_CHANGEMENU, "FEO_CON", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC}, 320, 132, MENUALIGN_CENTER, +#endif MENUACTION_LOADRADIO, "FEO_AUD", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_CENTER, MENUACTION_CHANGEMENU, "FEO_DIS", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 0, 0, MENUALIGN_CENTER, #ifdef GRAPHICS_MENU_OPTIONS @@ -660,7 +664,11 @@ CMenuScreenCustom aScreens[] = { { "", 0, nil, nil, }, #ifdef GAMEPAD_MENU +#ifdef GTA_HANDHELD + { "FET_AGS", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true, true}), nil, +#else { "FET_AGS", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({40, 78, 25, true, true}), nil, +#endif MENUACTION_CTRLCONFIG, "FEC_CCF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS }, 40, 76, MENUALIGN_LEFT, MENUACTION_CTRLDISPLAY, "FEC_CDP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS }, 0, 0, MENUALIGN_LEFT, INVERT_PAD_SELECTOR @@ -726,7 +734,9 @@ CMenuScreenCustom aScreens[] = { // MENUPAGE_GRAPHICS_SETTINGS { "FET_GFX", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true, true}), GraphicsGoBack, +#ifndef GTA_HANDHELD MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, +#endif MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, VIDEOMODE_SELECTOR #ifdef LEGACY_MENU_OPTIONS diff --git a/src/core/common.h b/src/core/common.h index 6f6acd49..13fadc27 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -11,6 +11,11 @@ #define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc #endif + +#ifdef __SWITCH__ +#include <switch.h> +#endif + #include <stdint.h> #include <string.h> #include <math.h> diff --git a/src/core/config.h b/src/core/config.h index 9c318350..1bff7c7f 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -165,6 +165,11 @@ enum Config { #define GTA_VERSION GTAVC_PC_11 +// Enable configuration for handheld console ports +#if defined(__SWITCH__) || defined(PSP2) + #define GTA_HANDHELD +#endif + // TODO(MIAMI): someone ought to find and check out uses of these defines: //#define GTA3_STEAM_PATCH //#define GTAVC_JP_PATCH @@ -176,7 +181,9 @@ enum Config { # define VU_COLLISION # define PS2_MENU #elif defined GTA_PC -# define PC_PLAYER_CONTROLS // mouse player/cam mode +# ifndef GTA_HANDHELD +# define PC_PLAYER_CONTROLS // mouse player/cam mode +# endif # define GTA_REPLAY # define GTA_SCENE_EDIT # define PC_MENU @@ -325,7 +332,7 @@ enum Config { #if !defined(RW_GL3) && defined(_WIN32) #define XINPUT #endif -#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined __SWITCH__) +#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined GTA_HANDHELD) #define DETECT_JOYSTICK_MENU // Then we'll expect user to enter Controller->Detect joysticks if his joystick isn't detected at the start. #endif #define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m @@ -347,7 +354,7 @@ enum Config { //# define PS2_MENU_USEALLPAGEICONS #else # define MAP_ENHANCEMENTS // Adding waypoint and better mouse support -# ifdef XINPUT +# if defined(XINPUT) || defined(GTA_HANDHELD) # define GAMEPAD_MENU // Add gamepad menu # endif # define TRIANGLE_BACK_BUTTON @@ -456,4 +463,12 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #undef USE_CUTSCENE_SHADOW_FOR_PED #endif +#ifdef GTA_HANDHELD + #define IGNORE_MOUSE_KEYBOARD // ignore mouse & keyboard input +#endif + +#ifdef __SWITCH__ + #define USE_UNNAMED_SEM // named semaphores are unsupported on the switch +#endif + #endif // VANILLA_DEFINES diff --git a/src/core/re3.cpp b/src/core/re3.cpp index e2220467..d78b997b 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -45,9 +45,7 @@ #include "MBlur.h" #include "ControllerConfig.h" -#ifdef DETECT_JOYSTICK_MENU #include "crossplatform.h" -#endif #ifndef _WIN32 #include "assert.h" |