Remove glue drivers, use Gp drivers instead

This commit is contained in:
elasota
2020-01-20 05:14:35 -05:00
parent 1d7a75c8a9
commit c112738f2e
23 changed files with 39 additions and 298 deletions

View File

@@ -158,9 +158,6 @@
<ClCompile Include="GpMain_Win32.cpp" />
<ClCompile Include="GpMemoryBuffer.cpp" />
<ClCompile Include="GpMutex_Win32.cpp" />
<ClCompile Include="GpPLGlueAudioChannel.cpp" />
<ClCompile Include="GpPLGlueAudioDriver.cpp" />
<ClCompile Include="GpPLGlueDisplayDriver.cpp" />
<ClCompile Include="GpSystemServices_Win32.cpp" />
<ClCompile Include="GpFiberStarter_Win32.cpp" />
<ClCompile Include="GpThreadEvent_Win32.cpp" />
@@ -193,9 +190,6 @@
<ClInclude Include="GpMain.h" />
<ClInclude Include="GpMemoryBuffer.h" />
<ClInclude Include="GpMutex_Win32.h" />
<ClInclude Include="GpPLGlueAudioChannel.h" />
<ClInclude Include="GpPLGlueAudioDriver.h" />
<ClInclude Include="GpPLGlueDisplayDriver.h" />
<ClInclude Include="GpRingBuffer.h" />
<ClInclude Include="GpSystemServices_Win32.h" />
<ClInclude Include="GpFiberStarter.h" />

View File

@@ -3,8 +3,6 @@
#include "GpAppInterface.h"
#include "GpDisplayDriverTickStatus.h"
#include "GpFontHandlerFactory.h"
#include "GpPLGlueAudioDriver.h"
#include "GpPLGlueDisplayDriver.h"
#include "HostSuspendCallArgument.h"
#include "IGpDisplayDriver.h"
#include "IGpFiber.h"
@@ -137,15 +135,12 @@ void GpAppEnvironment::AppThreadFunc()
void GpAppEnvironment::InitializeApplicationState()
{
GpAppInterface_Get()->PL_HostDisplayDriver_SetInstance(GpPLGlueDisplayDriver::GetInstance());
GpAppInterface_Get()->PL_HostAudioDriver_SetInstance(GpPLGlueAudioDriver::GetInstance());
GpAppInterface_Get()->PL_HostDisplayDriver_SetInstance(m_displayDriver);
GpAppInterface_Get()->PL_HostAudioDriver_SetInstance(m_audioDriver);
GpAppInterface_Get()->PL_InstallHostSuspendHook(GpAppEnvironment::StaticSuspendHookFunc, this);
GpAppInterface_Get()->PL_HostFontHandler_SetInstance(m_fontHandler);
GpAppInterface_Get()->PL_HostVOSEventQueue_SetInstance(m_vosEventQueue);
GpPLGlueDisplayDriver::GetInstance()->SetGpDisplayDriver(m_displayDriver);
GpPLGlueAudioDriver::GetInstance()->SetGpAudioDriver(m_audioDriver);
}
void GpAppEnvironment::SynchronizeState()

View File

@@ -1,54 +0,0 @@
#include "GpPLGlueAudioChannel.h"
#include "ClientAudioChannelContext.h"
#include "IGpAudioChannel.h"
#include <stdlib.h>
#include <new>
void GpPLGlueAudioChannel::SetClientAudioChannelContext(PortabilityLayer::ClientAudioChannelContext *context)
{
m_clientContext = context;
m_audioChannel->SetAudioChannelContext(this);
}
void GpPLGlueAudioChannel::PostBuffer(const void *buffer, size_t bufferSize)
{
m_audioChannel->PostBuffer(buffer, bufferSize);
}
void GpPLGlueAudioChannel::Stop()
{
m_audioChannel->Stop();
}
void GpPLGlueAudioChannel::Destroy()
{
this->~GpPLGlueAudioChannel();
free(this);
}
void GpPLGlueAudioChannel::NotifyBufferFinished()
{
if (m_clientContext)
m_clientContext->NotifyBufferFinished();
}
GpPLGlueAudioChannel *GpPLGlueAudioChannel::Create(IGpAudioChannel *audioChannel)
{
void *storage = malloc(sizeof(GpPLGlueAudioChannel));
if (!storage)
return nullptr;
return new (storage) GpPLGlueAudioChannel(audioChannel);
}
GpPLGlueAudioChannel::GpPLGlueAudioChannel(IGpAudioChannel *audioChannel)
: m_audioChannel(audioChannel)
, m_clientContext(nullptr)
{
}
GpPLGlueAudioChannel::~GpPLGlueAudioChannel()
{
m_audioChannel->Destroy();
}

View File

@@ -1,26 +0,0 @@
#pragma once
#include "HostAudioChannel.h"
#include "IGpAudioChannelCallbacks.h"
struct IGpAudioChannel;
class GpPLGlueAudioChannel final : public PortabilityLayer::HostAudioChannel, public IGpAudioChannelCallbacks
{
public:
void SetClientAudioChannelContext(PortabilityLayer::ClientAudioChannelContext *context) override;
void PostBuffer(const void *buffer, size_t bufferSize) override;
void Stop() override;
void Destroy() override;
void NotifyBufferFinished() override;
static GpPLGlueAudioChannel *Create(IGpAudioChannel *audioChannel);
private:
explicit GpPLGlueAudioChannel(IGpAudioChannel *audioChannel);
~GpPLGlueAudioChannel();
PortabilityLayer::ClientAudioChannelContext *m_clientContext;
IGpAudioChannel *m_audioChannel;
};

View File

@@ -1,43 +0,0 @@
#include "GpPLGlueAudioDriver.h"
#include "GpPLGlueAudioChannel.h"
#include "IGpAudioChannel.h"
#include "IGpAudioDriver.h"
GpPLGlueAudioDriver::GpPLGlueAudioDriver()
: m_audioDriver(nullptr)
{
}
PortabilityLayer::HostAudioChannel *GpPLGlueAudioDriver::CreateChannel()
{
IGpAudioChannel *channel = m_audioDriver->CreateChannel();
if (!channel)
return nullptr;
PortabilityLayer::HostAudioChannel *glueChannel = GpPLGlueAudioChannel::Create(channel);
if (!glueChannel)
{
channel->Destroy();
return nullptr;
}
return glueChannel;
}
void GpPLGlueAudioDriver::SetMasterVolume(uint32_t vol, uint32_t maxVolume)
{
m_audioDriver->SetMasterVolume(vol, maxVolume);
}
GpPLGlueAudioDriver *GpPLGlueAudioDriver::GetInstance()
{
return &ms_instance;
}
void GpPLGlueAudioDriver::SetGpAudioDriver(IGpAudioDriver *audioDriver)
{
m_audioDriver = audioDriver;
}
GpPLGlueAudioDriver GpPLGlueAudioDriver::ms_instance;

View File

@@ -1,23 +0,0 @@
#pragma once
#include "HostAudioDriver.h"
struct IGpAudioDriver;
class GpPLGlueAudioDriver final : public PortabilityLayer::HostAudioDriver
{
public:
GpPLGlueAudioDriver();
PortabilityLayer::HostAudioChannel *CreateChannel() override;
void SetMasterVolume(uint32_t vol, uint32_t maxVolume) override;
void SetGpAudioDriver(IGpAudioDriver *audioDriver);
static GpPLGlueAudioDriver *GetInstance();
private:
IGpAudioDriver *m_audioDriver;
static GpPLGlueAudioDriver ms_instance;
};

View File

@@ -1,40 +0,0 @@
#include "GpPLGlueDisplayDriver.h"
#include "VirtualDirectory.h"
#include "IGpDisplayDriver.h"
GpPLGlueDisplayDriver::GpPLGlueDisplayDriver()
: m_displayDriver(nullptr)
{
}
void GpPLGlueDisplayDriver::GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *bpp)
{
m_displayDriver->GetDisplayResolution(width, height, bpp);
}
IGpColorCursor *GpPLGlueDisplayDriver::LoadColorCursor(int cursorID)
{
return m_displayDriver->LoadColorCursor(cursorID);
}
void GpPLGlueDisplayDriver::SetColorCursor(IGpColorCursor *colorCursor)
{
m_displayDriver->SetColorCursor(colorCursor);
}
void GpPLGlueDisplayDriver::SetStandardCursor(EGpStandardCursor_t standardCursor)
{
m_displayDriver->SetStandardCursor(standardCursor);
}
GpPLGlueDisplayDriver *GpPLGlueDisplayDriver::GetInstance()
{
return &ms_instance;
}
void GpPLGlueDisplayDriver::SetGpDisplayDriver(IGpDisplayDriver *displayDriver)
{
m_displayDriver = displayDriver;
}
GpPLGlueDisplayDriver GpPLGlueDisplayDriver::ms_instance;

View File

@@ -1,25 +0,0 @@
#pragma once
#include "HostDisplayDriver.h"
struct IGpDisplayDriver;
class GpPLGlueDisplayDriver final : public PortabilityLayer::HostDisplayDriver
{
public:
GpPLGlueDisplayDriver();
void GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *bpp) override;
IGpColorCursor *LoadColorCursor(int id) override;
void SetColorCursor(IGpColorCursor *colorCursor) override;
void SetStandardCursor(EGpStandardCursor_t standardCursor) override;
void SetGpDisplayDriver(IGpDisplayDriver *displayDriver);
static GpPLGlueDisplayDriver *GetInstance();
private:
IGpDisplayDriver *m_displayDriver;
static GpPLGlueDisplayDriver ms_instance;
};