Move portable things to AerofoilPortable.

This commit is contained in:
elasota
2021-03-05 00:35:43 -05:00
parent d97bd8ad1c
commit a5562f96e0
13 changed files with 95 additions and 52 deletions

View File

@@ -0,0 +1 @@
../../../AerofoilPortable

View File

@@ -9,6 +9,7 @@ SDL_PATH := ../SDL
LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include \
$(LOCAL_PATH)/../GpShell \
$(LOCAL_PATH)/../GpCommon \
$(LOCAL_PATH)/../AerofoilPortable \
$(LOCAL_PATH)/../AerofoilSDL \
$(LOCAL_PATH)/../Common \
$(LOCAL_PATH)/../PortabilityLayer
@@ -23,7 +24,7 @@ LOCAL_SRC_FILES := \
LOCAL_SHARED_LIBRARIES := SDL2
LOCAL_STATIC_LIBRARIES := GpShell GpFontHandler_FreeType2 AerofoilSDL GpApp
LOCAL_STATIC_LIBRARIES := GpShell GpFontHandler_FreeType2 AerofoilPortable AerofoilSDL GpApp
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog

View File

@@ -1,7 +1,6 @@
#include "GpSystemServices_Android.h"
#include "GpMutex_Cpp11.h"
#include "GpThreadEvent_Cpp11.h"
#include "IGpThreadEvent.h"
#include "SDL.h"
#include <time.h>
@@ -32,29 +31,6 @@ GpSystemServices_Android::GpSystemServices_Android()
{
}
int64_t GpSystemServices_Android::GetTime() const
{
time_t t = time(nullptr);
return static_cast<int64_t>(t) - 2082844800;
}
void GpSystemServices_Android::GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const
{
time_t t = time(nullptr);
tm *tmObject = localtime(&t);
year = static_cast<unsigned int>(tmObject->tm_year);
month = static_cast<unsigned int>(tmObject->tm_mon + 1);
hour = static_cast<unsigned int>(tmObject->tm_hour);
minute = static_cast<unsigned int>(tmObject->tm_min);
second = static_cast<unsigned int>(tmObject->tm_sec);
}
IGpMutex *GpSystemServices_Android::CreateMutex()
{
return GpMutex_Cpp11_NonRecursive::Create();
}
void *GpSystemServices_Android::CreateThread(ThreadFunc_t threadFunc, void *context)
{
IGpThreadEvent *evt = CreateThreadEvent(true, false);
@@ -79,23 +55,6 @@ void *GpSystemServices_Android::CreateThread(ThreadFunc_t threadFunc, void *cont
return thread;
}
IGpMutex *GpSystemServices_Android::CreateRecursiveMutex()
{
return GpMutex_Cpp11_Recursive::Create();
}
IGpThreadEvent *GpSystemServices_Android::CreateThreadEvent(bool autoReset, bool startSignaled)
{
return GpThreadEvent_Cpp11::Create(autoReset, startSignaled);
}
uint64_t GpSystemServices_Android::GetFreeMemoryCosmetic() const
{
long pages = sysconf(_SC_AVPHYS_PAGES);
long pageSize = sysconf(_SC_PAGE_SIZE);
return pages * pageSize;
}
void GpSystemServices_Android::Beep() const
{
}

View File

@@ -1,20 +1,14 @@
#pragma once
#include "IGpSystemServices.h"
#include "GpSystemServices_POSIX.h"
#include "GpCoreDefs.h"
class GpSystemServices_Android final : public IGpSystemServices
class GpSystemServices_Android final : public GpSystemServices_POSIX
{
public:
GpSystemServices_Android();
int64_t GetTime() const override;
void GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const override;
IGpMutex *CreateMutex() override;
IGpMutex *CreateRecursiveMutex() override;
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
IGpThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) override;
uint64_t GetFreeMemoryCosmetic() const override;
void Beep() const override;
bool IsTouchscreen() const override;
bool IsUsingMouseAsTouch() const override;

View File

@@ -5,6 +5,7 @@ call remove_symlinks.bat
mklink /D app\jni\AerofoilSDL ..\..\..\AerofoilSDL
mklink /D app\jni\AerofoilPortable ..\..\..\AerofoilPortable
mklink /D app\jni\Common ..\..\..\Common
mklink /D app\jni\SDL2 ..\..\..\SDL2-2.0.12
mklink /D app\jni\GpApp ..\..\..\GpApp

View File

@@ -2,6 +2,7 @@
@cd /d "%~dp0"
rmdir app\jni\AerofoilSDL
rmdir app\jni\AerofoilPortable
rmdir app\jni\Common
rmdir app\jni\SDL2
rmdir app\jni\GpShell