mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Move portable things to AerofoilPortable.
This commit is contained in:
1
AerofoilAndroid/app/jni/AerofoilPortable
Symbolic link
1
AerofoilAndroid/app/jni/AerofoilPortable
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../AerofoilPortable
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
{
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
20
AerofoilPortable/Android.mk
Normal file
20
AerofoilPortable/Android.mk
Normal file
@@ -0,0 +1,20 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := AerofoilPortable
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/../GpCommon \
|
||||
$(LOCAL_PATH)/../GpShell \
|
||||
$(LOCAL_PATH)/../Common \
|
||||
$(LOCAL_PATH)/../PortabilityLayer
|
||||
|
||||
LOCAL_CFLAGS := -DGP_DEBUG_CONFIG=0
|
||||
|
||||
# Add your application source files here...
|
||||
LOCAL_SRC_FILES := \
|
||||
GpThreadEvent_Cpp11.cpp \
|
||||
GpSystemServices_POSIX.cpp
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
50
AerofoilPortable/GpSystemServices_POSIX.cpp
Normal file
50
AerofoilPortable/GpSystemServices_POSIX.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "GpSystemServices_POSIX.h"
|
||||
|
||||
#include "GpMutex_Cpp11.h"
|
||||
#include "GpThreadEvent_Cpp11.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
GpSystemServices_POSIX::GpSystemServices_POSIX()
|
||||
{
|
||||
}
|
||||
|
||||
int64_t GpSystemServices_POSIX::GetTime() const
|
||||
{
|
||||
time_t t = time(nullptr);
|
||||
return static_cast<int64_t>(t) - 2082844800;
|
||||
}
|
||||
|
||||
void GpSystemServices_POSIX::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_POSIX::CreateMutex()
|
||||
{
|
||||
return GpMutex_Cpp11_NonRecursive::Create();
|
||||
}
|
||||
|
||||
IGpMutex *GpSystemServices_POSIX::CreateRecursiveMutex()
|
||||
{
|
||||
return GpMutex_Cpp11_Recursive::Create();
|
||||
}
|
||||
|
||||
IGpThreadEvent *GpSystemServices_POSIX::CreateThreadEvent(bool autoReset, bool startSignaled)
|
||||
{
|
||||
return GpThreadEvent_Cpp11::Create(autoReset, startSignaled);
|
||||
}
|
||||
|
||||
uint64_t GpSystemServices_POSIX::GetFreeMemoryCosmetic() const
|
||||
{
|
||||
long pages = sysconf(_SC_AVPHYS_PAGES);
|
||||
long pageSize = sysconf(_SC_PAGE_SIZE);
|
||||
return pages * pageSize;
|
||||
}
|
17
AerofoilPortable/GpSystemServices_POSIX.h
Normal file
17
AerofoilPortable/GpSystemServices_POSIX.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "IGpSystemServices.h"
|
||||
#include "GpCoreDefs.h"
|
||||
|
||||
class GpSystemServices_POSIX : public IGpSystemServices
|
||||
{
|
||||
public:
|
||||
GpSystemServices_POSIX();
|
||||
|
||||
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;
|
||||
IGpThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) override;
|
||||
uint64_t GetFreeMemoryCosmetic() const override;
|
||||
};
|
@@ -21,7 +21,6 @@ LOCAL_SRC_FILES := \
|
||||
GpDisplayDriver_SDL_GL2.cpp \
|
||||
GpFiber_SDL.cpp \
|
||||
GpFiberStarter_SDL.cpp \
|
||||
GpThreadEvent_Cpp11.cpp \
|
||||
ShaderCode/CopyQuadP.cpp \
|
||||
ShaderCode/DrawQuadPaletteP.cpp \
|
||||
ShaderCode/DrawQuad32P.cpp \
|
||||
|
Reference in New Issue
Block a user