summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.vscode/c_cpp_properties.json1
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/core/MenuScreensCustom.cpp12
-rw-r--r--src/core/common.h2
-rw-r--r--src/core/config.h20
-rw-r--r--src/skel/crossplatform.cpp4
-rw-r--r--src/skel/glfw/glfw.cpp24
7 files changed, 39 insertions, 28 deletions
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index a214042a..2ce82727 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -40,7 +40,6 @@
"cppStandard": "gnu++11",
"defines": [
"__SWITCH__",
- "GTA_SWITCH",
"LIBRW",
"RW_GL3",
"AUDIO_OAL"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 67dfb325..2989c145 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -149,10 +149,6 @@ endif()
# Build Nintendo Switch binaries
if(NINTENDO_SWITCH)
- target_compile_definitions(${EXECUTABLE} PRIVATE
- GTA_SWITCH
- )
-
# Needed for OpenAL-Soft
target_link_libraries(${EXECUTABLE} PRIVATE
openal # HACK - something broke with latest cmake
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index 033ed9b9..5b0fd60c 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -36,7 +36,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) },
#else
#define VIDEOMODE_SELECTOR
@@ -418,10 +418,10 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
},
// MENUPAGE_CONTROLLER_SETTINGS = 4
-#ifdef GAMEPAD_MENU
+#if defined(GAMEPAD_MENU) && !defined(GTA_HANDHELD)
{ "FET_AGS", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
#else
- { "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
+ { "FET_AGS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
#endif
MENUACTION_CTRLCONFIG, "FEC_CCF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
MENUACTION_CTRLDISPLAY, "FEC_CDP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
@@ -751,7 +751,11 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
// MENUPAGE_OPTIONS = 41
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
+#ifdef GTA_HANDHELD
+ MENUACTION_CHANGEMENU, "FET_CTL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
+#else
MENUACTION_CHANGEMENU, "FET_CTL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
+#endif
MENUACTION_LOADRADIO, "FET_AUD", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_CHANGEMENU, "FET_DIS", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#ifdef GRAPHICS_MENU_OPTIONS
@@ -885,7 +889,9 @@ 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
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
+#endif
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
VIDEOMODE_SELECTOR
MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
diff --git a/src/core/common.h b/src/core/common.h
index 99aafc5a..31aab2b3 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -11,7 +11,7 @@
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
#endif
-#ifdef GTA_SWITCH
+#ifdef __SWITCH__
#include <switch.h>
#endif
diff --git a/src/core/config.h b/src/core/config.h
index 462dd713..8171f987 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -158,6 +158,11 @@ enum Config {
#define GTA_VERSION GTA3_PC_11
+// Enable configuration for handheld console ports
+#if defined(__SWITCH__) || defined(PSP2)
+ #define GTA_HANDHELD
+#endif
+
#if defined GTA_PS2
# define GTA_PS2_STUFF
# define RANDOMSPLASH
@@ -166,7 +171,9 @@ enum Config {
# define ANIM_COMPRESSION
# 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
@@ -319,7 +326,7 @@ enum Config {
#if !defined(RW_GL3) && defined(_WIN32)
#define XINPUT
#endif
-#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined GTA_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
@@ -345,7 +352,7 @@ enum Config {
//# define PS2_MENU_USEALLPAGEICONS
#else
-# if defined(XINPUT) || defined(GTA_SWITCH)
+# if defined(XINPUT) || defined(GTA_HANDHELD)
# define GAMEPAD_MENU // Add gamepad menu
# endif
@@ -439,7 +446,7 @@ enum Config {
#endif
// Streaming
-#if !defined(_WIN32) && !defined(GTA_SWITCH)
+#if !defined(_WIN32) && !defined(__SWITCH__)
//#define ONE_THREAD_PER_CHANNEL // Don't use if you're not on SSD/Flash - also not utilized too much right now(see commented LoadAllRequestedModels in Streaming.cpp)
#define FLUSHABLE_STREAMING // Make it possible to interrupt reading when processing file isn't needed anymore.
#endif
@@ -461,8 +468,11 @@ enum Config {
#undef PEDS_REPORT_CRIMES_ON_PHONE
#endif
-#ifdef GTA_SWITCH
+#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
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp
index 758125e9..e69c22e1 100644
--- a/src/skel/crossplatform.cpp
+++ b/src/skel/crossplatform.cpp
@@ -200,7 +200,7 @@ char* casepath(char const* path, bool checkPathFirst)
DIR* d;
char* c;
- #if defined(GTA_SWITCH) || defined(GTA_VITA)
+ #if defined(__SWITCH__) || defined(PSP2)
if( (c = strstr(p, ":/")) != NULL) // scheme used by some environments, eg. switch, vita
{
size_t deviceNameOffset = c - p + 3;
@@ -294,7 +294,7 @@ char* casepath(char const* path, bool checkPathFirst)
}
#endif
-#ifdef GTA_SWITCH
+#ifdef __SWITCH__
/* Taken from glibc */
char *realpath(const char *name, char *resolved)
{
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index 754c43be..767d1bbd 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -12,7 +12,7 @@ DWORD _dwOperatingSystemVersion;
#include "resource.h"
#else
long _dwOperatingSystemVersion;
-#ifndef GTA_SWITCH
+#ifndef __SWITCH__
#ifndef __APPLE__
#include <sys/sysinfo.h>
#else
@@ -53,7 +53,7 @@ long _dwOperatingSystemVersion;
#include "MemoryMgr.h"
// We found out that GLFW's keyboard input handling is still pretty delayed/not stable, so now we fetch input from X11 directly on Linux.
-#if !defined _WIN32 && !defined __APPLE__ && !defined GTA_SWITCH // && !defined WAYLAND
+#if !defined _WIN32 && !defined __APPLE__ && !defined GTA_HANDHELD // && !defined WAYLAND
#define GET_KEYBOARD_INPUT_FROM_X11
#endif
@@ -330,7 +330,7 @@ psNativeTextureSupport(void)
*****************************************************************************
*/
-#ifdef GTA_SWITCH
+#ifdef __SWITCH__
static HidVibrationValue SwitchVibrationValues[2];
static HidVibrationDeviceHandle SwitchVibrationDeviceHandles[2][2];
@@ -338,10 +338,10 @@ static HidVibrationDeviceHandle SwitchVibrationDeviceGC;
static PadState SwitchPad;
-Result HidInitializationResult[2];
-Result HidInitializationGCResult;
+static Result HidInitializationResult[2];
+static Result HidInitializationGCResult;
-void _psInitializeVibration()
+static void _psInitializeVibration()
{
HidInitializationResult[0] = hidInitializeVibrationDevices(SwitchVibrationDeviceHandles[0], 2, HidNpadIdType_Handheld, HidNpadStyleTag_NpadHandheld);
if(R_FAILED(HidInitializationResult[0])) {
@@ -360,10 +360,10 @@ void _psInitializeVibration()
SwitchVibrationValues[0].freq_high = 320.0f;
padConfigureInput(1, HidNpadStyleSet_NpadFullCtrl);
- padInitializeDefault(&SwitchPad);
+ padInitializeDefault(&SwitchPad);
}
-void _psHandleVibration()
+static void _psHandleVibration()
{
padUpdate(&SwitchPad);
@@ -394,8 +394,8 @@ void _psHandleVibration()
}
}
#else
-void _psInitializeVibration() {}
-void _psHandleVibration() {}
+static void _psInitializeVibration() {}
+static void _psHandleVibration() {}
#endif
/*
@@ -561,7 +561,7 @@ psInitialize(void)
debug("Physical memory size %llu\n", _dwMemAvailPhys);
debug("Available physical memory %llu\n", size);
#else
-#ifndef GTA_SWITCH
+#ifndef __SWITCH__
struct sysinfo systemInfo;
sysinfo(&systemInfo);
_dwMemAvailPhys = systemInfo.freeram;
@@ -1871,7 +1871,7 @@ main(int argc, char *argv[])
InitMemoryMgr();
#endif
-#if !defined(_WIN32) && !defined(GTA_SWITCH)
+#if !defined(_WIN32) && !defined(__SWITCH__)
struct sigaction act;
act.sa_sigaction = terminateHandler;
act.sa_flags = SA_SIGINFO;