Add API for saving driver prefs. Save fullscreen state in D3D11 driver.

This commit is contained in:
elasota
2020-07-03 02:46:43 -04:00
parent ed9e0fec97
commit 05604e5604
23 changed files with 542 additions and 51 deletions

View File

@@ -21,6 +21,7 @@
struct IGpAudioDriver;
struct IGpLogDriver;
struct IGpInputDriver;
namespace PortabilityLayer
{
@@ -43,6 +44,7 @@ public:
virtual void PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance) = 0;
virtual void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) = 0;
virtual void PL_HostLogDriver_SetInstance(IGpLogDriver *instance) = 0;
virtual void PL_HostInputDriver_SetInstances(IGpInputDriver *const* instances, size_t numInstances) = 0;
virtual void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) = 0;
virtual void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) = 0;
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;

View File

@@ -0,0 +1,23 @@
#include "HostInputDriver.h"
namespace PortabilityLayer
{
size_t HostInputDriver::NumInstances()
{
return ms_numInstances;
}
IGpInputDriver *HostInputDriver::GetInstance(size_t index)
{
return ms_instances[index];
}
void HostInputDriver::SetInstances(IGpInputDriver *const* instances, size_t numInstances)
{
ms_instances = instances;
ms_numInstances = numInstances;
}
IGpInputDriver *const* HostInputDriver::ms_instances;
size_t HostInputDriver::ms_numInstances;
}

View File

@@ -1,17 +1,18 @@
#pragma once
#include "HostKeyID.h"
struct IGpInputDriver;
namespace PortabilityLayer
{
class HostInputDriver
{
public:
static HostInputDriver *GetInstance();
static void SetInstance(HostInputDriver *instance);
static size_t NumInstances();
static IGpInputDriver *GetInstance(size_t index);
static void SetInstances(IGpInputDriver *const* instances, size_t numInstances);
private:
static HostInputDriver *ms_instance;
static IGpInputDriver *const* ms_instances;
static size_t ms_numInstances;
};
}

View File

@@ -1,24 +1,24 @@
#include "PLApplication.h"
#include "PLApplication.h"
#include "PLCore.h"
#include "HostSystemServices.h"
#include <string.h>
#include <assert.h>
namespace PortabilityLayer
{
namespace Utils
{
void MakePStr(unsigned char *dest, size_t sz, const char *src)
{
assert(sz <= 255);
dest[0] = static_cast<uint8_t>(sz);
memcpy(dest + 1, src, sz);
}
}
}
void SysBeep(int duration)
#include "HostSystemServices.h"
#include <string.h>
#include <assert.h>
namespace PortabilityLayer
{
PortabilityLayer::HostSystemServices::GetInstance()->Beep();
}
namespace Utils
{
void MakePStr(unsigned char *dest, size_t sz, const char *src)
{
assert(sz <= 255);
dest[0] = static_cast<uint8_t>(sz);
memcpy(dest + 1, src, sz);
}
}
}
void SysBeep(int duration)
{
PortabilityLayer::HostSystemServices::GetInstance()->Beep();
}

View File

@@ -312,6 +312,7 @@
<ClCompile Include="HostDisplayDriver.cpp" />
<ClCompile Include="HostFileSystem.cpp" />
<ClCompile Include="HostFontHandler.cpp" />
<ClCompile Include="HostInputDriver.cpp" />
<ClCompile Include="HostLogDriver.cpp" />
<ClCompile Include="HostSuspendHook.cpp" />
<ClCompile Include="HostSystemServices.cpp" />

View File

@@ -728,5 +728,8 @@
<ClCompile Include="HostLogDriver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="HostInputDriver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>