From f777ad622b9dca56233b4912ac7a3a23ae41655c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 2 Aug 2021 08:59:05 +0200 Subject: [PATCH] Added PYRA option (also inverted Shoulder buttons function on Pandora/Pyra build) --- Sources/CMakeLists.txt | 12 +++++++++--- Sources/Engine/Base/SDL/SDLEvents.cpp | 12 ++++++------ Sources/Engine/Base/SDL/SDLInput.cpp | 6 +++--- Sources/Engine/Graphics/Graphics.cpp | 2 +- Sources/Engine/Math/Quaternion.h | 2 +- Sources/Engine/Terrain/TerrainMisc.cpp | 2 +- Sources/Engine/World/WorldCollisionGrid.cpp | 2 +- Sources/SeriousSam/SeriousSam.cpp | 2 +- 8 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 9fe259d..6947016 100755 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -106,10 +106,16 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") endif() if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm.*") if(PYRA) - add_compile_options(-mfpu=neon-vfpv4) - elseif(NOT (MACOSX AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")) - add_compile_options(-mfpu=neon) + add_compile_options(-mfpu=neon-vfpv4) + add_compile_options(-mcpu=cortex-a15) + add_compile_options(-mfloat-abi=hard) + add_compile_options(-marm) + elseif(NOT (MACOSX AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")) + add_compile_options(-mfpu=neon) + else() + add_compile_options(-mfpu=neon) endif() + add_compile_options(-fsigned-char) endif() add_compile_options(-fno-strict-aliasing) add_definitions(-D_REENTRANT=1) diff --git a/Sources/Engine/Base/SDL/SDLEvents.cpp b/Sources/Engine/Base/SDL/SDLEvents.cpp index 30a5c66..9d69ef1 100755 --- a/Sources/Engine/Base/SDL/SDLEvents.cpp +++ b/Sources/Engine/Base/SDL/SDLEvents.cpp @@ -50,10 +50,10 @@ BOOL PeekMessage(MSG *msg, void *hwnd, UINT wMsgFilterMin, case SDL_KEYUP: if (sdlevent.key.keysym.sym == SDLK_BACKQUOTE) msg->unicode = '~'; // !!! FIXME: this is all a hack. - #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) - if(sdlevent.key.keysym.sym == SDLK_RCTRL) { + #if defined(PLATFORM_PANDORA) || defined(PPLATFORM_PYRA) + if(sdlevent.key.keysym.sym == SDLK_RSHIFT) { msg->message = (sdlevent.type==SDL_KEYDOWN)?WM_RBUTTONDOWN:WM_RBUTTONUP; - } else if(sdlevent.key.keysym.sym == SDLK_RSHIFT) { + } else if(sdlevent.key.keysym.sym == SDLK_RCTRL) { msg->message = (sdlevent.type==SDL_KEYDOWN)?WM_LBUTTONDOWN:WM_LBUTTONUP; } else #endif @@ -115,7 +115,7 @@ SHORT GetKeyState(int vk) { SHORT retval = 0; #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) - Uint8 *keystate = SDL_GetKeyboardState(NULL); + const Uint8 *keystate = SDL_GetKeyboardState(NULL); #endif switch (vk) @@ -124,7 +124,7 @@ SHORT GetKeyState(int vk) if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_LMASK) retval = 0x8000; #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) - if(keystate[SDL_SCANCODE_RSHIFT]) + if(keystate[SDL_SCANCODE_RCTRL]) retval = 0x8000; #endif break; @@ -133,7 +133,7 @@ SHORT GetKeyState(int vk) if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_RMASK) retval = 0x8000; #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) - if(keystate[SDL_SCANCODE_RCTRL]) + if(keystate[SDL_SCANCODE_RSHIFT]) retval = 0x8000; #endif break; diff --git a/Sources/Engine/Base/SDL/SDLInput.cpp b/Sources/Engine/Base/SDL/SDLInput.cpp index a1b2c6e..32f10af 100755 --- a/Sources/Engine/Base/SDL/SDLInput.cpp +++ b/Sources/Engine/Base/SDL/SDLInput.cpp @@ -288,11 +288,11 @@ static void SetKeyFromEvent(const SDL_Event *event, const BOOL bDown) return; } // if - #ifdef PLATFORM_PANDORA - if(event->key.keysym.sym==SDLK_RSHIFT) { + #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) + if(event->key.keysym.sym==SDLK_RCTRL) { _abKeysPressed[KID_MOUSE1] = bDown; return; - } else if(event->key.keysym.sym==SDLK_RCTRL) { + } else if(event->key.keysym.sym==SDLK_RSHIFT) { _abKeysPressed[KID_MOUSE2] = bDown; return; } diff --git a/Sources/Engine/Graphics/Graphics.cpp b/Sources/Engine/Graphics/Graphics.cpp index 6d501f4..3216615 100644 --- a/Sources/Engine/Graphics/Graphics.cpp +++ b/Sources/Engine/Graphics/Graphics.cpp @@ -887,7 +887,7 @@ nextRowO: UWORD words[4]; WORD iwords[4]; UBYTE bytes[8]; - }; + } __attribute__((packed)); //avoid optimisation and BUSERROR on Pyra build for (int i=0; i::FromEuler(const Vector &a) template Type Quaternion::EPS(Type orig) const { -#ifdef PLATFORM_PANDORA +#if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) if ((orig <= 1e-4f) && (orig >= -1e-4f)) #else if ((orig <= 10e-6f) && (orig >= -10e-6f)) diff --git a/Sources/Engine/Terrain/TerrainMisc.cpp b/Sources/Engine/Terrain/TerrainMisc.cpp index af36a30..0cac959 100755 --- a/Sources/Engine/Terrain/TerrainMisc.cpp +++ b/Sources/Engine/Terrain/TerrainMisc.cpp @@ -310,7 +310,7 @@ Rect ExtractPolygonsInBox(CTerrain *ptrTerrain, const FLOATaabbox3D &bboxExtract if(!bFixSize) { // max vector of bbox in incremented for one, because first vertex is at 0,0,0 in world and in heightmap is at 1,1 #ifdef __arm__ -#ifdef PLATFORM_PANDORA +#if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) #define Isinf(a) (((*(unsigned int*)&a)&0x7fffffff)==0x7f800000) #else #define Isinf isinff diff --git a/Sources/Engine/World/WorldCollisionGrid.cpp b/Sources/Engine/World/WorldCollisionGrid.cpp index 4c53794..6261ab8 100755 --- a/Sources/Engine/World/WorldCollisionGrid.cpp +++ b/Sources/Engine/World/WorldCollisionGrid.cpp @@ -48,7 +48,7 @@ static inline void BoxToGrid( FLOAT fMaxX = boxEntity.Max()(1); FLOAT fMaxZ = boxEntity.Max()(3); #ifdef __arm__ -#ifdef PLATFORM_PANDORA +#if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) #define Isinf(a) (((*(unsigned int*)&a)&0x7fffffff)==0x7f800000) #else #define Isinf isinff diff --git a/Sources/SeriousSam/SeriousSam.cpp b/Sources/SeriousSam/SeriousSam.cpp index e21bf1d..a3895c1 100755 --- a/Sources/SeriousSam/SeriousSam.cpp +++ b/Sources/SeriousSam/SeriousSam.cpp @@ -286,7 +286,7 @@ static void UpdatePauseState(void) void LimitFrameRate(void) { // do not limit FPS on the Pandora, it's not powerfull enough and doesn't "iconise" games either - #ifndef PLATFORM_PANDORA + #if !defined(PLATFORM_PANDORA) && !defined(PLATFORM_PYRA) // measure passed time for each loop static CTimerValue tvLast(-1.0f); CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();