diff -aurN a/SamTFE/Sources/CMakeLists.txt b/SamTFE/Sources/CMakeLists.txt --- a/SamTFE/Sources/CMakeLists.txt 2022-05-29 23:38:44.637615000 +0300 +++ b/SamTFE/Sources/CMakeLists.txt 2022-06-01 14:15:52.118403541 +0300 @@ -278,6 +278,11 @@ add_definitions(-DPLATFORM_PYRA=1) endif() +option(RPI4 "Raspberry PI 4" FALSE) +if(RPI4) + add_definitions(-DPLATFORM_RPI4=1) +endif() + option(USE_TREMOR "Use Tremor instead of Vorbis" FALSE) if (USE_TREMOR) add_definitions(-DUSE_TREMOR=1) diff -aurN a/SamTFE/Sources/Engine/Base/Timer.cpp b/SamTFE/Sources/Engine/Base/Timer.cpp diff -aurN a/SamTFE/Sources/Engine/Base/Timer.cpp b/SamTFE/Sources/Engine/Base/Timer.cpp --- a/SamTFE/Sources/Engine/Base/Timer.cpp 2022-05-29 23:18:11.604401775 +0300 +++ b/SamTFE/Sources/Engine/Base/Timer.cpp 2022-06-02 12:30:05.977583475 +0300 @@ -44,6 +44,10 @@ struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); return( (((__int64) tp.tv_sec) * 1000000000LL) + ((__int64) tp.tv_nsec)); +#elif (defined PLATFORM_RPI4) + struct timeval tv; + gettimeofday(&tv, NULL); + return( (((__int64) tv.tv_sec) * 1000000) + ((__int64) tv.tv_usec) ); #elif (defined __MSVC_INLINE__) __int64 mmRet; __asm { @@ -117,6 +121,7 @@ (uint64_t) tv.tv_usec; } +#if !defined(PLATFORM_PANDORA) && !defined(PLATFORM_PYRA) && !defined(PLATFORM_RPI4) // cpu_rdtsc void cpu_rdtsc(uint64_t* result) { @@ -239,7 +244,7 @@ // // END libcpuid functions // - +#endif // not PANDORA PYRA RPI4 // link with Win-MultiMedia #ifdef _MSC_VER @@ -484,7 +489,8 @@ #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) // just use gettimeofday. tm_llCPUSpeedHZ = tm_llPerformanceCounterFrequency = 1000000000LL; - +#elif PLATFORM_RPI4 + tm_llCPUSpeedHZ = tm_llPerformanceCounterFrequency = 1000000; #elif PLATFORM_WIN32 { // this part of code must be executed as precisely as possible CSetPriority sp(REALTIME_PRIORITY_CLASS, THREAD_PRIORITY_TIME_CRITICAL); diff -aurN a/SamTSE/Sources/CMakeLists.txt b/SamTSE/Sources/CMakeLists.txt --- a/SamTSE/Sources/CMakeLists.txt 2022-05-29 23:38:44.637615000 +0300 +++ b/SamTSE/Sources/CMakeLists.txt 2022-06-01 14:15:52.118403541 +0300 @@ -278,6 +278,11 @@ add_definitions(-DPLATFORM_PYRA=1) endif() +option(RPI4 "Raspberry PI 4" FALSE) +if(RPI4) + add_definitions(-DPLATFORM_RPI4=1) +endif() + option(USE_TREMOR "Use Tremor instead of Vorbis" FALSE) if (USE_TREMOR) add_definitions(-DUSE_TREMOR=1) diff -aurN a/SamTSE/Sources/Engine/Base/Timer.cpp b/SamTSE/Sources/Engine/Base/Timer.cpp --- a/SamTSE/Sources/Engine/Base/Timer.cpp 2022-05-29 23:18:11.604401775 +0300 +++ b/SamTSE/Sources/Engine/Base/Timer.cpp 2022-06-02 12:30:05.977583475 +0300 @@ -44,6 +44,10 @@ struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); return( (((__int64) tp.tv_sec) * 1000000000LL) + ((__int64) tp.tv_nsec)); +#elif (defined PLATFORM_RPI4) + struct timeval tv; + gettimeofday(&tv, NULL); + return( (((__int64) tv.tv_sec) * 1000000) + ((__int64) tv.tv_usec) ); #elif (defined __MSVC_INLINE__) __int64 mmRet; __asm { @@ -117,6 +121,7 @@ (uint64_t) tv.tv_usec; } +#if !defined(PLATFORM_PANDORA) && !defined(PLATFORM_PYRA) && !defined(PLATFORM_RPI4) // cpu_rdtsc void cpu_rdtsc(uint64_t* result) { @@ -239,7 +244,7 @@ // // END libcpuid functions // - +#endif // not PANDORA PYRA RPI4 // link with Win-MultiMedia #ifdef _MSC_VER @@ -484,7 +489,8 @@ #if defined(PLATFORM_PANDORA) || defined(PLATFORM_PYRA) // just use gettimeofday. tm_llCPUSpeedHZ = tm_llPerformanceCounterFrequency = 1000000000LL; - +#elif PLATFORM_RPI4 + tm_llCPUSpeedHZ = tm_llPerformanceCounterFrequency = 1000000; #elif PLATFORM_WIN32 { // this part of code must be executed as precisely as possible CSetPriority sp(REALTIME_PRIORITY_CLASS, THREAD_PRIORITY_TIME_CRITICAL);