More Android stub-outs and bug fixes. Fix broken SDL fiber sync.

This commit is contained in:
elasota
2020-10-10 02:42:06 -04:00
parent a2f19f5ccb
commit 5c98783bbb
63 changed files with 1445 additions and 635 deletions

26
GpShell/Android.mk Normal file
View File

@@ -0,0 +1,26 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := GpShell
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../Common \
$(LOCAL_PATH)/../GpCommon \
$(LOCAL_PATH)/../PortabilityLayer
LOCAL_CFLAGS := -DGP_DEBUG_CONFIG=0
# Add your application source files here...
LOCAL_SRC_FILES := \
GpAppEnvironment.cpp \
GpAudioDriverFactory.cpp \
GpDisplayDriverFactory.cpp \
GpFontHandlerFactory.cpp \
GpGlobalConfig.cpp \
GpInputDriverFactory.cpp \
GpMain.cpp \
GpMemoryBuffer.cpp \
GpVOSEventQueue.cpp
include $(BUILD_STATIC_LIBRARY)

View File

@@ -18,6 +18,7 @@ GpAppEnvironment::GpAppEnvironment()
, m_numInputDrivers(0)
, m_fontHandler(nullptr)
, m_vosEventQueue(nullptr)
, m_systemServices(nullptr)
, m_applicationFiber(nullptr)
, m_vosFiber(nullptr)
, m_suspendCallID(PortabilityLayer::HostSuspendCallID_Unknown)
@@ -50,7 +51,7 @@ GpDisplayDriverTickStatus_t GpAppEnvironment::Tick(IGpFiber *vosFiber)
{
case ApplicationState_NotStarted:
InitializeApplicationState();
m_applicationFiber = GpFiberStarter::StartFiber(GpAppEnvironment::StaticAppThreadFunc, this, vosFiber);
m_applicationFiber = GpFiberStarter::StartFiber(m_systemServices, GpAppEnvironment::StaticAppThreadFunc, this, vosFiber);
m_applicationState = ApplicationState_Running;
break;
case ApplicationState_WaitingForEvents:
@@ -125,6 +126,11 @@ void GpAppEnvironment::SetVOSEventQueue(GpVOSEventQueue *eventQueue)
m_vosEventQueue = eventQueue;
}
void GpAppEnvironment::SetSystemServices(PortabilityLayer::HostSystemServices *systemServices)
{
m_systemServices = systemServices;
}
void GpAppEnvironment::StaticAppThreadFunc(void *context)
{
static_cast<GpAppEnvironment*>(context)->AppThreadFunc();

View File

@@ -10,6 +10,7 @@ namespace PortabilityLayer
{
union HostSuspendCallArgument;
class HostVOSEventQueue;
class HostSystemServices;
}
struct IGpDisplayDriver;
@@ -35,6 +36,7 @@ public:
void SetInputDrivers(IGpInputDriver *const* inputDrivers, size_t numDrivers);
void SetFontHandler(IGpFontHandler *fontHandler);
void SetVOSEventQueue(GpVOSEventQueue *eventQueue);
void SetSystemServices(PortabilityLayer::HostSystemServices *systemServices);
private:
enum ApplicationState
@@ -61,6 +63,7 @@ private:
IGpInputDriver *const* m_inputDrivers;
IGpFontHandler *m_fontHandler;
GpVOSEventQueue *m_vosEventQueue;
PortabilityLayer::HostSystemServices *m_systemServices;
IGpFiber *m_applicationFiber;
IGpFiber *m_vosFiber;

View File

@@ -1,11 +1,16 @@
#pragma once
struct IGpFiber;
struct IGpFiber;
namespace PortabilityLayer
{
class HostSystemServices;
}
class GpFiberStarter
{
public:
typedef void(*ThreadFunc_t)(void *context);
static IGpFiber *StartFiber(ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber);
static IGpFiber *StartFiber(PortabilityLayer::HostSystemServices *systemServices, ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber);
};

View File

@@ -1,19 +1,21 @@
#pragma once
#pragma once
#include "EGpDisplayDriverType.h"
#include "EGpAudioDriverType.h"
#include "EGpFontHandlerType.h"
#include "EGpInputDriverType.h"
#include <stdint.h>
struct IGpLogDriver;
namespace PortabilityLayer
{
class HostSystemServices;
}
struct GpGlobalConfig
{
{
class HostSystemServices;
}
struct GpGlobalConfig
{
EGpDisplayDriverType m_displayDriverType;
EGpAudioDriverType m_audioDriverType;
EGpFontHandlerType m_fontHandlerType;
@@ -23,7 +25,7 @@ struct GpGlobalConfig
IGpLogDriver *m_logger;
PortabilityLayer::HostSystemServices *m_systemServices;
void *m_osGlobals;
};
extern GpGlobalConfig g_gpGlobalConfig;
void *m_osGlobals;
};
extern GpGlobalConfig g_gpGlobalConfig;

View File

@@ -66,6 +66,7 @@ int GpMain::Run()
ddProps.m_osGlobals = g_gpGlobalConfig.m_osGlobals;
ddProps.m_eventQueue = eventQueue;
ddProps.m_logger = g_gpGlobalConfig.m_logger;
ddProps.m_systemServices = g_gpGlobalConfig.m_systemServices;
GpAudioDriverProperties adProps;
memset(&adProps, 0, sizeof(adProps));
@@ -116,6 +117,7 @@ int GpMain::Run()
appEnvironment->SetInputDrivers(inputDrivers, numCreatedInputDrivers);
appEnvironment->SetFontHandler(fontHandler);
appEnvironment->SetVOSEventQueue(eventQueue);
appEnvironment->SetSystemServices(g_gpGlobalConfig.m_systemServices);
// Start the display loop
displayDriver->Run();
@@ -129,7 +131,5 @@ int GpMain::Run()
free(inputDrivers);
}
// GP TODO: Cleanup
return 0;
}