From d1081324a26e3aa4f602be7c10e23d4ac8787c0a Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 13 Jun 2020 21:21:52 +0200 Subject: [PATCH] [PYRA] Added PYRA Profile --- Sources/CMakeLists.txt | 21 +++++++++++++++++++-- Sources/Engine/Base/SDL/SDLEvents.cpp | 10 +++++----- Sources/Engine/Engine.cpp | 2 ++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 7d35e9d..5aa08c7 100755 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -101,11 +101,15 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_compile_options(-Wall) add_compile_options(-pipe) add_compile_options(-fPIC) - if(NOT PANDORA) + if(NOT PANDORA AND NOT PYRA) add_compile_options(-march=native) endif() if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm.*") + if(PYRA) + add_compile_options(-mfpu=neon-vfpv4) + else() add_compile_options(-mfpu=neon) + endif() endif() add_compile_options(-fno-strict-aliasing) add_definitions(-D_REENTRANT=1) @@ -116,9 +120,13 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") ## For C flags set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -D_DEBUG=1 -DDEBUG=1 -O0") if(PANDORA) - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 - -faligned-new -ffast-math") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -faligned-new -ffast-math") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -faligned-new -ffast-math") set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -ffast-math") + elseif(PYRA) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -marm -faligned-new -ffast-math") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -marm -faligned-new -ffast-math") + set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -marm -ffast-math") else() set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations") @@ -131,6 +139,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -O3 -faligned-new -ffast-math") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -faligned-new -ffast-math") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -ffast-math") + elseif(PYRA) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -O3 -marm -faligned-new -ffast-math") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -marm -faligned-new -ffast-math") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -marm -ffast-math") else() set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -O3 -fno-unsafe-math-optimizations") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -g -O3 -fno-unsafe-math-optimizations") ## RAKE! Does -DNDEBUG=1 and -D_NDEBUG=1 mess with RelWithDebInfo? @@ -246,6 +258,11 @@ if (PANDORA) add_definitions(-DPLATFORM_PANDORA=1) endif() +option(PYRA "Compile for Pyra" FALSE) +if (PYRA) + add_definitions(-DPLATFORM_PYRAA=1) +endif() + option(USE_TREMOR "Use Tremor instead of Vorbis" FALSE) if (USE_TREMOR) add_definitions(-DUSE_TREMOR=1) diff --git a/Sources/Engine/Base/SDL/SDLEvents.cpp b/Sources/Engine/Base/SDL/SDLEvents.cpp index aad7b99..89af170 100755 --- a/Sources/Engine/Base/SDL/SDLEvents.cpp +++ b/Sources/Engine/Base/SDL/SDLEvents.cpp @@ -50,7 +50,7 @@ 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. - #ifdef PLATFORM_PANDORA + #if defined(PLATFORM_PANDORA) || defined(PPLATFORM_PTRA) if(sdlevent.key.keysym.sym == SDLK_RCTRL) { msg->message = (sdlevent.type==SDL_KEYDOWN)?WM_RBUTTONDOWN:WM_RBUTTONUP; } else if(sdlevent.key.keysym.sym == SDLK_RSHIFT) { @@ -114,7 +114,7 @@ void DispatchMessage(MSG *msg) SHORT GetKeyState(int vk) { SHORT retval = 0; -#ifdef PLATFORM_PANDORA +#if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) Uint8 *keystate = SDL_GetKeyboardState(NULL); #endif @@ -123,7 +123,7 @@ SHORT GetKeyState(int vk) case VK_LBUTTON: if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_LMASK) retval = 0x8000; - #ifdef PLATFORM_PANDORA + #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) if(keystate[SDL_SCANCODE_RSHIFT]) retval = 0x8000; #endif @@ -132,7 +132,7 @@ SHORT GetKeyState(int vk) case VK_RBUTTON: if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_RMASK) retval = 0x8000; - #ifdef PLATFORM_PANDORA + #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) if(keystate[SDL_SCANCODE_RCTRL]) retval = 0x8000; #endif @@ -145,7 +145,7 @@ SHORT GetKeyState(int vk) default: STUBBED("this can't possibly be right, yeah?"); - #ifdef PLATFORM_PANDORA + #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) if (keystate[SDL_GetScancodeFromKey((SDL_Keycode)vk)]) #else if (SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey((SDL_Keycode)vk)]) diff --git a/Sources/Engine/Engine.cpp b/Sources/Engine/Engine.cpp index 9f6e839..41ee6e8 100755 --- a/Sources/Engine/Engine.cpp +++ b/Sources/Engine/Engine.cpp @@ -216,6 +216,8 @@ static void DetectCPU(void) sys_bCPUHasCMOV = bCMOV!=0; #ifdef PLATFORM_PANDORA sys_iCPUMHz = 400; // conservative, ARM -> x86 cpu translation is not 1 to 1. +#elif defined(PLATFORM_PYRA) + sys_iCPUMHz = 1000; #else sys_iCPUMHz = INDEX(_pTimer->tm_llCPUSpeedHZ/1E6); #endif