mirror of
https://github.com/elasota/Aerofoil.git
synced 2026-03-02 05:42:18 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7301402c5 | ||
|
|
2a98bfbc8c | ||
|
|
eac923c475 | ||
|
|
6fe0f2d964 | ||
|
|
a4abb0d95f | ||
|
|
c856607f46 | ||
|
|
611f53ef91 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -28,6 +28,8 @@ InstallerPackages/*
|
||||
*.msi
|
||||
*.wixpdb
|
||||
*.wixobj
|
||||
*.CopyComplete
|
||||
ReleasePackageInstaller/obj/*
|
||||
ReleasePackageInstaller/bin/*
|
||||
ReleasePackageInstaller/AerofoilPackageDefs.wxi
|
||||
ReleasePackageInstaller/AerofoilPackageDefs.wxi
|
||||
packages/*
|
||||
|
||||
@@ -156,6 +156,7 @@
|
||||
<ClCompile Include="GpFontHandler_FreeType2.cpp" />
|
||||
<ClCompile Include="GpGlobalConfig.cpp" />
|
||||
<ClCompile Include="GpInputDriverFactory.cpp" />
|
||||
<ClCompile Include="GpLogDriver_Win32.cpp" />
|
||||
<ClCompile Include="GpMain.cpp" />
|
||||
<ClCompile Include="GpMain_Win32.cpp" />
|
||||
<ClCompile Include="GpMemoryBuffer.cpp" />
|
||||
@@ -175,6 +176,7 @@
|
||||
<ClInclude Include="..\GpCommon\IGpCursor.h" />
|
||||
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h" />
|
||||
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h" />
|
||||
<ClInclude Include="..\GpCommon\IGpLogDriver.h" />
|
||||
<ClInclude Include="GpAppEnvironment.h" />
|
||||
<ClInclude Include="GpAudioDriverFactory.h" />
|
||||
<ClInclude Include="GpDisplayDriverFactory.h" />
|
||||
@@ -185,6 +187,7 @@
|
||||
<ClInclude Include="GpFontHandlerFactory.h" />
|
||||
<ClInclude Include="GpGlobalConfig.h" />
|
||||
<ClInclude Include="GpInputDriverFactory.h" />
|
||||
<ClInclude Include="GpLogDriver_Win32.h" />
|
||||
<ClInclude Include="GpMain.h" />
|
||||
<ClInclude Include="GpMemoryBuffer.h" />
|
||||
<ClInclude Include="GpMutex_Win32.h" />
|
||||
|
||||
@@ -58,6 +58,9 @@
|
||||
<ClCompile Include="GpThreadEvent_Win32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GpLogDriver_Win32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GpCommon\EGpInputDriverType.h">
|
||||
@@ -141,6 +144,10 @@
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GpCommon\IGpLogDriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GpLogDriver_Win32.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="ConvertedResources\Large128.ico">
|
||||
|
||||
@@ -142,3 +142,8 @@ void GpFileStream_Win32::Close()
|
||||
{
|
||||
CloseHandle(m_handle);
|
||||
}
|
||||
|
||||
void GpFileStream_Win32::Flush()
|
||||
{
|
||||
FlushFileBuffers(m_handle);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ public:
|
||||
bool Truncate(PortabilityLayer::UFilePos_t loc) override;
|
||||
PortabilityLayer::UFilePos_t Size() const override;
|
||||
PortabilityLayer::UFilePos_t Tell() const override;
|
||||
void Close() override;
|
||||
void Close() override;
|
||||
void Flush() override;
|
||||
|
||||
private:
|
||||
HANDLE m_handle;
|
||||
|
||||
@@ -122,16 +122,19 @@ GpFileSystem_Win32::GpFileSystem_Win32()
|
||||
m_userHousesDir = m_prefsDir + L"\\Houses";
|
||||
m_userSavesDir = m_prefsDir + L"\\SavedGames";
|
||||
m_scoresDir = m_prefsDir + L"\\Scores";
|
||||
m_logsDir = m_prefsDir + L"\\Logs";
|
||||
|
||||
CreateDirectoryW(m_prefsDir.c_str(), nullptr);
|
||||
CreateDirectoryW(m_scoresDir.c_str(), nullptr);
|
||||
CreateDirectoryW(m_userHousesDir.c_str(), nullptr);
|
||||
CreateDirectoryW(m_userSavesDir.c_str(), nullptr);
|
||||
CreateDirectoryW(m_logsDir.c_str(), nullptr);
|
||||
|
||||
m_prefsDir.append(L"\\");
|
||||
m_scoresDir.append(L"\\");
|
||||
m_userHousesDir.append(L"\\");
|
||||
m_userSavesDir.append(L"\\");
|
||||
m_logsDir.append(L"\\");
|
||||
}
|
||||
|
||||
DWORD modulePathSize = GetModuleFileNameW(nullptr, m_executablePath, MAX_PATH);
|
||||
@@ -514,6 +517,9 @@ bool GpFileSystem_Win32::ResolvePath(PortabilityLayer::VirtualDirectory_t virtua
|
||||
case PortabilityLayer::VirtualDirectories::kHighScores:
|
||||
baseDir = m_scoresDir.c_str();
|
||||
break;
|
||||
case PortabilityLayer::VirtualDirectories::kLogs:
|
||||
baseDir = m_logsDir.c_str();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
std::wstring m_scoresDir;
|
||||
std::wstring m_packagedDir;
|
||||
std::wstring m_housesDir;
|
||||
std::wstring m_logsDir;
|
||||
std::wstring m_userHousesDir;
|
||||
std::wstring m_userSavesDir;
|
||||
std::wstring m_resourcesDir;
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#include "EGpDisplayDriverType.h"
|
||||
#include "EGpAudioDriverType.h"
|
||||
#include "EGpInputDriverType.h"
|
||||
#include "EGpInputDriverType.h"
|
||||
|
||||
struct IGpLogDriver;
|
||||
|
||||
struct GpGlobalConfig
|
||||
{
|
||||
@@ -11,6 +13,7 @@ struct GpGlobalConfig
|
||||
const EGpInputDriverType *m_inputDriverTypes;
|
||||
size_t m_numInputDrivers;
|
||||
|
||||
IGpLogDriver *m_logger;
|
||||
void *m_osGlobals;
|
||||
};
|
||||
|
||||
|
||||
113
Aerofoil/GpLogDriver_Win32.cpp
Normal file
113
Aerofoil/GpLogDriver_Win32.cpp
Normal file
@@ -0,0 +1,113 @@
|
||||
#include "GpLogDriver_Win32.h"
|
||||
#include "GpFileSystem_Win32.h"
|
||||
|
||||
#include "GpApplicationName.h"
|
||||
#include "IOStream.h"
|
||||
|
||||
GpLogDriver_Win32::GpLogDriver_Win32()
|
||||
: m_stream(nullptr)
|
||||
, m_isInitialized(false)
|
||||
{
|
||||
}
|
||||
|
||||
void GpLogDriver_Win32::Init()
|
||||
{
|
||||
ms_instance.InitInternal();
|
||||
}
|
||||
|
||||
void GpLogDriver_Win32::VPrintf(Category category, const char *fmt, va_list args)
|
||||
{
|
||||
size_t fmtSize = 0;
|
||||
bool hasFormatting = false;
|
||||
for (const char *fmtCheck = fmt; *fmtCheck; fmtCheck++)
|
||||
{
|
||||
if (*fmtCheck == '%')
|
||||
hasFormatting = true;
|
||||
|
||||
fmtSize++;
|
||||
}
|
||||
|
||||
SYSTEMTIME sysTime;
|
||||
GetSystemTime(&sysTime);
|
||||
|
||||
char timestampBuffer[64];
|
||||
sprintf(timestampBuffer, "[%02d:%02d:%02d:%03d] ", sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds);
|
||||
|
||||
m_stream->Write(timestampBuffer, strlen(timestampBuffer));
|
||||
|
||||
const char *debugTag = "";
|
||||
|
||||
switch (category)
|
||||
{
|
||||
case Category_Warning:
|
||||
debugTag = "[WARNING] ";
|
||||
break;
|
||||
case Category_Error:
|
||||
debugTag = "[ERROR] ";
|
||||
break;
|
||||
};
|
||||
|
||||
if (debugTag[0])
|
||||
m_stream->Write(debugTag, strlen(debugTag));
|
||||
|
||||
if (!hasFormatting)
|
||||
m_stream->Write(fmt, fmtSize);
|
||||
else
|
||||
{
|
||||
int formattedSize = vsnprintf(nullptr, 0, fmt, args);
|
||||
if (formattedSize <= 0)
|
||||
return;
|
||||
|
||||
char *charBuff = static_cast<char*>(malloc(formattedSize + 1));
|
||||
if (!charBuff)
|
||||
return;
|
||||
|
||||
vsnprintf(charBuff, formattedSize + 1, fmt, args);
|
||||
|
||||
m_stream->Write(charBuff, formattedSize);
|
||||
free(charBuff);
|
||||
}
|
||||
|
||||
m_stream->Write("\n", 1);
|
||||
|
||||
m_stream->Flush();
|
||||
}
|
||||
|
||||
void GpLogDriver_Win32::Shutdown()
|
||||
{
|
||||
if (m_stream)
|
||||
m_stream->Close();
|
||||
}
|
||||
|
||||
GpLogDriver_Win32 *GpLogDriver_Win32::GetInstance()
|
||||
{
|
||||
if (ms_instance.m_isInitialized)
|
||||
return &ms_instance;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GpLogDriver_Win32::InitInternal()
|
||||
{
|
||||
SYSTEMTIME utcTime;
|
||||
GetSystemTime(&utcTime);
|
||||
|
||||
char logFileName[256];
|
||||
|
||||
sprintf(logFileName, GP_APPLICATION_NAME "-%04d-%02d-%02d_%02d-%02d_%02d.txt", utcTime.wYear, utcTime.wMonth, utcTime.wDay, utcTime.wHour, utcTime.wMinute, utcTime.wSecond);
|
||||
|
||||
m_stream = GpFileSystem_Win32::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kLogs, logFileName, true, GpFileCreationDispositions::kCreateOrOverwrite);
|
||||
if (m_stream)
|
||||
{
|
||||
this->Printf(IGpLogDriver::Category_Information, GP_APPLICATION_NAME " build " __TIMESTAMP__);
|
||||
#ifdef NDEBUG
|
||||
this->Printf(IGpLogDriver::Category_Information, "Configuration: Release");
|
||||
#else
|
||||
this->Printf(IGpLogDriver::Category_Information, "Configuration: Debug");
|
||||
#endif
|
||||
|
||||
m_isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
GpLogDriver_Win32 GpLogDriver_Win32::ms_instance;
|
||||
29
Aerofoil/GpLogDriver_Win32.h
Normal file
29
Aerofoil/GpLogDriver_Win32.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "IGpLogDriver.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class IOStream;
|
||||
}
|
||||
|
||||
class GpLogDriver_Win32 : public IGpLogDriver
|
||||
{
|
||||
public:
|
||||
GpLogDriver_Win32();
|
||||
|
||||
static void Init();
|
||||
|
||||
void VPrintf(Category category, const char *fmt, va_list args) override;
|
||||
void Shutdown() override;
|
||||
|
||||
static GpLogDriver_Win32 *GetInstance();
|
||||
|
||||
private:
|
||||
void InitInternal();
|
||||
|
||||
PortabilityLayer::IOStream *m_stream;
|
||||
bool m_isInitialized;
|
||||
|
||||
static GpLogDriver_Win32 ms_instance;
|
||||
};
|
||||
@@ -63,6 +63,7 @@ int GpMain::Run()
|
||||
ddProps.m_type = g_gpGlobalConfig.m_displayDriverType;
|
||||
ddProps.m_osGlobals = g_gpGlobalConfig.m_osGlobals;
|
||||
ddProps.m_eventQueue = eventQueue;
|
||||
ddProps.m_logger = g_gpGlobalConfig.m_logger;
|
||||
|
||||
GpAudioDriverProperties adProps;
|
||||
memset(&adProps, 0, sizeof(adProps));
|
||||
@@ -72,10 +73,11 @@ int GpMain::Run()
|
||||
adProps.m_type = g_gpGlobalConfig.m_audioDriverType;
|
||||
adProps.m_sampleRate = (244800 * 2 + 11) / (11 * 2);
|
||||
#ifdef NDEBUG
|
||||
adProps.m_debug = true;
|
||||
#else
|
||||
adProps.m_debug = false;
|
||||
#else
|
||||
adProps.m_debug = true;
|
||||
#endif
|
||||
adProps.m_logger = g_gpGlobalConfig.m_logger;
|
||||
|
||||
IGpInputDriver **inputDrivers = static_cast<IGpInputDriver**>(malloc(sizeof(IGpInputDriver*) * g_gpGlobalConfig.m_numInputDrivers));
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "GpGlobalConfig.h"
|
||||
#include "GpFiber_Win32.h"
|
||||
#include "GpFileSystem_Win32.h"
|
||||
#include "GpLogDriver_Win32.h"
|
||||
#include "GpInputDriverFactory.h"
|
||||
#include "GpAppInterface.h"
|
||||
#include "GpSystemServices_Win32.h"
|
||||
@@ -17,6 +18,7 @@
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <stdio.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
@@ -394,12 +396,28 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
LPWSTR cmdLine = GetCommandLineW();
|
||||
|
||||
int nArgs;
|
||||
LPWSTR *cmdLineArgs = CommandLineToArgvW(cmdLine, &nArgs);
|
||||
|
||||
for (int i = 1; i < nArgs; i++)
|
||||
{
|
||||
if (!wcscmp(cmdLineArgs[i], L"-diagnostics"))
|
||||
GpLogDriver_Win32::Init();
|
||||
}
|
||||
|
||||
IGpLogDriver *logger = GpLogDriver_Win32::GetInstance();
|
||||
|
||||
GpAppInterface_Get()->PL_HostFileSystem_SetInstance(GpFileSystem_Win32::GetInstance());
|
||||
GpAppInterface_Get()->PL_HostSystemServices_SetInstance(GpSystemServices_Win32::GetInstance());
|
||||
GpAppInterface_Get()->PL_HostLogDriver_SetInstance(GpLogDriver_Win32::GetInstance());
|
||||
|
||||
g_gpWindowsGlobals.m_hInstance = hInstance;
|
||||
g_gpWindowsGlobals.m_hPrevInstance = hPrevInstance;
|
||||
g_gpWindowsGlobals.m_cmdLine = lpCmdLine;
|
||||
g_gpWindowsGlobals.m_cmdLine = cmdLine;
|
||||
g_gpWindowsGlobals.m_cmdLineArgc = nArgs;
|
||||
g_gpWindowsGlobals.m_cmdLineArgv = cmdLineArgs;
|
||||
g_gpWindowsGlobals.m_nCmdShow = nCmdShow;
|
||||
g_gpWindowsGlobals.m_baseDir = GpFileSystem_Win32::GetInstance()->GetBasePath();
|
||||
g_gpWindowsGlobals.m_hwnd = nullptr;
|
||||
@@ -422,10 +440,21 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
g_gpGlobalConfig.m_numInputDrivers = sizeof(inputDrivers) / sizeof(inputDrivers[0]);
|
||||
|
||||
g_gpGlobalConfig.m_osGlobals = &g_gpWindowsGlobals;
|
||||
g_gpGlobalConfig.m_logger = logger;
|
||||
|
||||
GpDisplayDriverFactory::RegisterDisplayDriverFactory(EGpDisplayDriverType_D3D11, GpDriver_CreateDisplayDriver_D3D11);
|
||||
GpAudioDriverFactory::RegisterAudioDriverFactory(EGpAudioDriverType_XAudio2, GpDriver_CreateAudioDriver_XAudio2);
|
||||
GpInputDriverFactory::RegisterInputDriverFactory(EGpInputDriverType_XInput, GpDriver_CreateInputDriver_XInput);
|
||||
|
||||
return GpMain::Run();
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "Windows environment configured, starting up");
|
||||
|
||||
int returnCode = GpMain::Run();
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "Windows environment exited with code %i, cleaning up", returnCode);
|
||||
|
||||
LocalFree(cmdLineArgs);
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
Many Glider PRO houses, including the bundled ones, contain images in QuickDraw
|
||||
PICT format in the game resource data.
|
||||
|
||||
Additionally, some PICT features are impossible to support because they
|
||||
PICT is a very complex format, many of its features are not completely
|
||||
documented, and some PICT features are impossible to support because they
|
||||
require copyrighted pattern sets and fonts that are bundled with the
|
||||
operating system.
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLAppleEvents.h"
|
||||
#include "AppEventHandler.h"
|
||||
#include "DialogManager.h"
|
||||
#include "Externs.h"
|
||||
@@ -15,6 +14,9 @@
|
||||
|
||||
#define kNoPrintingAlert 1031
|
||||
|
||||
extern Boolean quitting;
|
||||
|
||||
#if 0
|
||||
|
||||
PLError_t DoOpenAppAE (const AppleEvent *, AppleEvent *, UInt32);
|
||||
PLError_t DoOpenDocAE (const AppleEvent *, AppleEvent *, UInt32);
|
||||
@@ -28,7 +30,6 @@ AEEventHandlerUPP openAppAEUPP, openDocAEUPP, printDocAEUPP, quitAEUPP;
|
||||
extern VFileSpec *theHousesSpecs;
|
||||
extern long incrementModeTime;
|
||||
extern short thisHouseIndex, splashOriginH, splashOriginV;
|
||||
extern Boolean quitting;
|
||||
|
||||
|
||||
//============================================================== Functions
|
||||
@@ -52,7 +53,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
|
||||
VFileInfo finderInfo;
|
||||
AEDescList docList;
|
||||
long itemsInList;
|
||||
Size actualSize;
|
||||
size_t actualSize;
|
||||
AEKeyword keywd;
|
||||
DescType returnedType;
|
||||
PLError_t theErr, whoCares;
|
||||
@@ -162,12 +163,13 @@ PLError_t DoQuitAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
|
||||
PLError_t MyGotRequiredParams (const AppleEvent *theAE)
|
||||
{
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
size_t actualSize;
|
||||
|
||||
return (AEGetAttributePtr(theAE, keyMissedKeywordAttr, typeWildCard,
|
||||
&returnedType, 0L, 0, &actualSize) == errAEDescNotFound) ? PLErrors::kNone :
|
||||
PLErrors::kInvalidParameter;
|
||||
}
|
||||
#endif
|
||||
|
||||
class SystemEventHandlerImpl : public PortabilityLayer::IAppEventHandler
|
||||
{
|
||||
@@ -201,34 +203,5 @@ void SetUpAppleEvents (void)
|
||||
PLError_t theErr;
|
||||
|
||||
PortabilityLayer::AppEventHandler::SetInstance(SystemEventHandlerImpl::GetInstance());
|
||||
|
||||
openAppAEUPP = NewAEEventHandlerProc(DoOpenAppAE);
|
||||
openDocAEUPP = NewAEEventHandlerProc(DoOpenDocAE);
|
||||
printDocAEUPP = NewAEEventHandlerProc(DoPrintDocAE);
|
||||
quitAEUPP = NewAEEventHandlerProc(DoQuitAE);
|
||||
|
||||
theErr = AEInstallEventHandler(kCoreEventClass, // install oapp
|
||||
kAEOpenApplication, openAppAEUPP, 0, false);
|
||||
if (theErr != PLErrors::kNone)
|
||||
YellowAlert(kYellowAppleEventErr, theErr);
|
||||
|
||||
theErr = AEInstallEventHandler(kCoreEventClass, // install odoc
|
||||
kAEOpenDocuments, openDocAEUPP, 0, false);
|
||||
if (theErr != PLErrors::kNone)
|
||||
YellowAlert(kYellowAppleEventErr, theErr);
|
||||
|
||||
theErr = AEInstallEventHandler(kCoreEventClass, // install pdoc
|
||||
kAEPrintDocuments, printDocAEUPP, 0, false);
|
||||
if (theErr != PLErrors::kNone)
|
||||
YellowAlert(kYellowAppleEventErr, theErr);
|
||||
|
||||
theErr = AEInstallEventHandler(kCoreEventClass, // install quit
|
||||
kAEQuitApplication, quitAEUPP, 0, false);
|
||||
if (theErr != PLErrors::kNone)
|
||||
YellowAlert(kYellowAppleEventErr, theErr);
|
||||
|
||||
theErr = AESetInteractionAllowed(kAEInteractWithAll);
|
||||
if (theErr != PLErrors::kNone)
|
||||
YellowAlert(kYellowAppleEventErr, theErr);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLAppleEvents.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "PLToolUtils.h"
|
||||
|
||||
@@ -163,7 +163,7 @@ void DoGameOverStarAnimation (void)
|
||||
nextLoop = TickCount() + 2;
|
||||
count = 0;
|
||||
pass = 0;
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
|
||||
if (workSrcRect.bottom - angelDest.bottom > kMaxFramesAlive * starFallSpeed)
|
||||
starFallSpeed = (workSrcRect.bottom - angelDest.bottom + kMaxFramesAlive - 1) / kMaxFramesAlive;
|
||||
@@ -465,7 +465,7 @@ void DoDiedGameOver (void)
|
||||
InitDiedGameOver();
|
||||
CopyRectMainToWork(&workSrcRect);
|
||||
CopyRectMainToBack(&workSrcRect);
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
|
||||
nextLoop = TickCount() + 2;
|
||||
while (pagesStuck < 8)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "HostLogDriver.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "HostVOSEventQueue.h"
|
||||
#include "MenuManager.h"
|
||||
@@ -22,6 +23,7 @@ public:
|
||||
void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) override;
|
||||
void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) override;
|
||||
void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) override;
|
||||
void PL_HostLogDriver_SetInstance(IGpLogDriver *instance) override;
|
||||
void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) override;
|
||||
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
|
||||
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
|
||||
@@ -55,6 +57,11 @@ void GpAppInterfaceImpl::PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *inst
|
||||
PortabilityLayer::HostDisplayDriver::SetInstance(instance);
|
||||
}
|
||||
|
||||
void GpAppInterfaceImpl::PL_HostLogDriver_SetInstance(IGpLogDriver *instance)
|
||||
{
|
||||
PortabilityLayer::HostLogDriver::SetInstance(instance);
|
||||
}
|
||||
|
||||
void GpAppInterfaceImpl::PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance)
|
||||
{
|
||||
PortabilityLayer::HostSystemServices::SetInstance(instance);
|
||||
|
||||
@@ -397,7 +397,7 @@ Boolean TestHighScore (void)
|
||||
else if (scoreTimestamp > 0xffffffff)
|
||||
scoreTimestamp = 0xffffffff;
|
||||
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
GetHighScoreName(placing + 1);
|
||||
PasStringCopy(highName, thisHousePtr->highScores.names[kMaxScores - 1]);
|
||||
if (placing == 0)
|
||||
@@ -503,7 +503,7 @@ void GetHighScoreName (short place)
|
||||
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
BringUpDialog(&theDial, kHighNameDialogID, &substitutions);
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
SetDialogString(theDial, kHighNameItem, highName);
|
||||
SelectDialogItemText(theDial, kHighNameItem, 0, 1024);
|
||||
leaving = false;
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
//============================================================================
|
||||
|
||||
#include "PLAppleEvents.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLNavigation.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLResources.h"
|
||||
@@ -56,9 +54,7 @@ extern Boolean twoPlayerGame, wardBitSet, phoneBitSet;
|
||||
#ifndef COMPILEDEMO
|
||||
Boolean CreateNewHouse (void)
|
||||
{
|
||||
AEKeyword theKeyword;
|
||||
DescType actualType;
|
||||
Size actualSize;
|
||||
size_t actualSize;
|
||||
VFileSpec tempSpec;
|
||||
VFileSpec theSpec;
|
||||
PLError_t theErr;
|
||||
|
||||
@@ -468,7 +468,7 @@ Boolean QuerySaveGame (void)
|
||||
short hitWhat;
|
||||
|
||||
InitCursor();
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
// CenterAlert(kSaveGameAlert);
|
||||
hitWhat = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(kSaveGameAlert, nullptr);
|
||||
if (hitWhat == kYesSaveGameButton)
|
||||
|
||||
@@ -396,7 +396,7 @@ int gpAppMain()
|
||||
}
|
||||
WriteOutPrefs();
|
||||
RestoreColorDepth();
|
||||
PL_DEAD(FlushEvents(everyEvent, 0));
|
||||
PL_DEAD(FlushEvents());
|
||||
// theErr = LoadScrap();
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -42,7 +42,7 @@ void SaveGame2 (void)
|
||||
PortabilityLayer::InputManager::GetInstance()->ClearState();
|
||||
|
||||
Str255 gameNameStr;
|
||||
Size byteCount;
|
||||
size_t byteCount;
|
||||
houseType *thisHousePtr;
|
||||
roomType *srcRoom;
|
||||
savedRoom *destRoom;
|
||||
@@ -54,7 +54,7 @@ void SaveGame2 (void)
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
PortabilityLayer::FileManager *fm = PortabilityLayer::FileManager::GetInstance();
|
||||
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
|
||||
thisHousePtr = *thisHouse;
|
||||
|
||||
|
||||
@@ -1270,7 +1270,7 @@ void DoSettingsMain (void)
|
||||
FlashSettingsButton(surface, 1);
|
||||
DoSoundPrefs();
|
||||
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
break;
|
||||
|
||||
case kControlsButton:
|
||||
|
||||
@@ -424,7 +424,7 @@ Boolean WaitForInputEvent (short seconds)
|
||||
Boolean waiting, didResume;
|
||||
|
||||
timeToBail = TickCount() + 60L * (long)seconds;
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
waiting = true;
|
||||
didResume = false;
|
||||
|
||||
@@ -446,7 +446,7 @@ Boolean WaitForInputEvent (short seconds)
|
||||
|
||||
Delay(1, nullptr);
|
||||
}
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
return (didResume);
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ void WaitCommandQReleased (void)
|
||||
|
||||
Delay(1, nullptr);
|
||||
}
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- KeyMapOffsetFromRawKey
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
#include "GpAudioChannelXAudio2.h"
|
||||
#include "GpAudioDriverXAudio2.h"
|
||||
#include "IGpAudioChannelCallbacks.h"
|
||||
#include "IGpLogDriver.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
|
||||
GpAudioChannelXAudio2 *GpAudioChannelXAudio2::Create(GpAudioDriverXAudio2 *driver)
|
||||
{
|
||||
IGpLogDriver *logger = driver->GetProperties().m_logger;
|
||||
|
||||
void *storage = malloc(sizeof(GpAudioChannelXAudio2));
|
||||
if (!storage)
|
||||
{
|
||||
if (!logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpAudioChannelXAudio2::Create failed, malloc failed");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GpAudioChannelXAudio2 *channel = new (storage) GpAudioChannelXAudio2(driver);
|
||||
if (!channel->Init())
|
||||
{
|
||||
if (!logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpAudioChannelXAudio2::Init failed");
|
||||
|
||||
channel->Destroy();
|
||||
return nullptr;
|
||||
}
|
||||
@@ -23,6 +34,8 @@ GpAudioChannelXAudio2 *GpAudioChannelXAudio2::Create(GpAudioDriverXAudio2 *drive
|
||||
|
||||
bool GpAudioChannelXAudio2::Init()
|
||||
{
|
||||
IGpLogDriver *logger = m_driver->GetProperties().m_logger;
|
||||
|
||||
const unsigned int sampleRate = m_driver->GetRealSampleRate();
|
||||
IXAudio2 *const xa2 = m_driver->GetXA2();
|
||||
|
||||
@@ -49,7 +62,12 @@ bool GpAudioChannelXAudio2::Init()
|
||||
|
||||
HRESULT hr = xa2->CreateSourceVoice(&m_sourceVoice, &format, XAUDIO2_VOICE_NOPITCH | XAUDIO2_VOICE_NOSRC, 1.0f, &m_xAudioCallbacks, nullptr, nullptr);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
if (!logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "CreateSourceVoice failed with code %lx", hr);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "GpAudioDriverXAudio2.h"
|
||||
|
||||
#include "IGpLogDriver.h"
|
||||
#include "GpAudioChannelXAudio2.h"
|
||||
|
||||
#include <xaudio2.h>
|
||||
@@ -31,34 +32,62 @@ unsigned int GpAudioDriverXAudio2::GetRealSampleRate() const
|
||||
|
||||
GpAudioDriverXAudio2 *GpAudioDriverXAudio2::Create(const GpAudioDriverProperties &properties)
|
||||
{
|
||||
IGpLogDriver *logger = properties.m_logger;
|
||||
|
||||
IXAudio2 *xa = nullptr;
|
||||
IXAudio2MasteringVoice *mv = nullptr;
|
||||
|
||||
const unsigned int realSampleRate = (properties.m_sampleRate + 50) / XAUDIO2_QUANTUM_DENOMINATOR * XAUDIO2_QUANTUM_DENOMINATOR;
|
||||
|
||||
if (CoInitializeEx(nullptr, COINIT_MULTITHREADED) != S_OK)
|
||||
if (logger)
|
||||
{
|
||||
logger->Printf(IGpLogDriver::Category_Information, "XAudio2 Driver starting");
|
||||
logger->Printf(IGpLogDriver::Category_Information, "Real sample rate: %u", realSampleRate);
|
||||
}
|
||||
|
||||
HRESULT result = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "CoInitializeEx failed with code %lx", result);
|
||||
|
||||
CoUninitialize();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UINT flags = 0;
|
||||
if (properties.m_debug)
|
||||
flags |= XAUDIO2_DEBUG_ENGINE;
|
||||
|
||||
if (FAILED(XAudio2Create(&xa, flags, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "Starting XAudio in debug mode");
|
||||
|
||||
flags |= XAUDIO2_DEBUG_ENGINE;
|
||||
}
|
||||
|
||||
result = XAudio2Create(&xa, flags, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
if (FAILED(result))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "XAudio2Create failed with code %lx", result);
|
||||
|
||||
CoUninitialize();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (FAILED(xa->CreateMasteringVoice(&mv, 2, realSampleRate, 0, nullptr, nullptr, AudioCategory_GameEffects)))
|
||||
result = xa->CreateMasteringVoice(&mv, 2, realSampleRate, 0, nullptr, nullptr, AudioCategory_GameEffects);
|
||||
if (FAILED(result))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "CreateMasteringVoice failed with code %lx", result);
|
||||
|
||||
CoUninitialize();
|
||||
xa->Release();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "XAudio2 started OK", result);
|
||||
|
||||
return new GpAudioDriverXAudio2(properties, realSampleRate, xa, mv);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,17 @@
|
||||
<ClCompile Include="GpAudioDriverFactoryXAudio2.cpp" />
|
||||
<ClCompile Include="GpAudioDriverXAudio2.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets" Condition="Exists('..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -42,4 +42,7 @@
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
GpAudioDriver_XAudio2/packages.config
Normal file
4
GpAudioDriver_XAudio2/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.XAudio2.Redist" version="1.2.1" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "EGpAudioDriverType.h"
|
||||
|
||||
struct IGpAudioDriver;
|
||||
struct IGpLogDriver;
|
||||
|
||||
struct GpAudioDriverProperties
|
||||
{
|
||||
@@ -10,4 +11,6 @@ struct GpAudioDriverProperties
|
||||
|
||||
unsigned int m_sampleRate;
|
||||
bool m_debug;
|
||||
|
||||
IGpLogDriver *m_logger;
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
struct IGpDisplayDriver;
|
||||
struct IGpFiber;
|
||||
struct IGpVOSEventQueue;
|
||||
struct IGpLogDriver;
|
||||
|
||||
struct GpDisplayDriverProperties
|
||||
{
|
||||
@@ -39,4 +40,5 @@ struct GpDisplayDriverProperties
|
||||
void *m_adjustRequestedResolutionFuncContext;
|
||||
|
||||
IGpVOSEventQueue *m_eventQueue;
|
||||
IGpLogDriver *m_logger;
|
||||
};
|
||||
|
||||
@@ -19,7 +19,9 @@ struct GpWindowsGlobals
|
||||
{
|
||||
HINSTANCE m_hInstance;
|
||||
HINSTANCE m_hPrevInstance;
|
||||
LPCSTR m_cmdLine;
|
||||
LPCWSTR m_cmdLine;
|
||||
int m_cmdLineArgc;
|
||||
LPWSTR *m_cmdLineArgv;
|
||||
LPCWSTR m_baseDir;
|
||||
HWND m_hwnd;
|
||||
HICON m_hIcon;
|
||||
|
||||
28
GpCommon/IGpLogDriver.h
Normal file
28
GpCommon/IGpLogDriver.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdarg>
|
||||
#include <stdio.h>
|
||||
|
||||
struct IGpLogDriver
|
||||
{
|
||||
enum Category
|
||||
{
|
||||
Category_Information,
|
||||
Category_Warning,
|
||||
Category_Error,
|
||||
};
|
||||
|
||||
virtual void VPrintf(Category category, const char *fmt, va_list args) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
void Printf(Category category, const char *fmt, ...);
|
||||
};
|
||||
|
||||
|
||||
inline void IGpLogDriver::Printf(Category category, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
this->VPrintf(category, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "IGpFiber.h"
|
||||
#include "IGpVOSEventQueue.h"
|
||||
|
||||
#include "IGpLogDriver.h"
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <float.h>
|
||||
@@ -125,7 +127,7 @@ bool ResizeSwapChain(IDXGISwapChain1 *swapChain, UINT width, UINT height)
|
||||
return true;
|
||||
}
|
||||
|
||||
void StartD3DForWindow(HWND hWnd, GpComPtr<IDXGISwapChain1>& outSwapChain, GpComPtr<ID3D11Device>& outDevice, GpComPtr<ID3D11DeviceContext>& outContext)
|
||||
void StartD3DForWindow(HWND hWnd, GpComPtr<IDXGISwapChain1>& outSwapChain, GpComPtr<ID3D11Device>& outDevice, GpComPtr<ID3D11DeviceContext>& outContext, IGpLogDriver *logger)
|
||||
{
|
||||
DXGI_SWAP_CHAIN_FULLSCREEN_DESC swapChainFullscreenDesc;
|
||||
|
||||
@@ -153,6 +155,14 @@ void StartD3DForWindow(HWND hWnd, GpComPtr<IDXGISwapChain1>& outSwapChain, GpCom
|
||||
HRESULT result = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, featureLevels, sizeof(featureLevels) / sizeof(featureLevels[0]),
|
||||
D3D11_SDK_VERSION, &device, &selectedFeatureLevel, &context);
|
||||
|
||||
if (logger)
|
||||
{
|
||||
if (result == S_OK)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "StartD3DForWindow: D3D11CreateDevice succeeded. Selected feature level is %i", static_cast<int>(selectedFeatureLevel));
|
||||
else
|
||||
logger->Printf(IGpLogDriver::Category_Error, "StartD3DForWindow: D3D11CreateDevice failed with code %lx", result);
|
||||
}
|
||||
|
||||
InitSwapChainForWindow(hWnd, device, outSwapChain);
|
||||
|
||||
// GP TODO: Fix the error handling here, it's bad...
|
||||
@@ -160,8 +170,11 @@ void StartD3DForWindow(HWND hWnd, GpComPtr<IDXGISwapChain1>& outSwapChain, GpCom
|
||||
outContext = context;
|
||||
}
|
||||
|
||||
bool ResizeD3DWindow(HWND hWnd, DWORD &windowWidth, DWORD &windowHeight, LONG desiredWidth, LONG desiredHeight, DWORD windowStyle, HMENU menus)
|
||||
bool ResizeD3DWindow(HWND hWnd, DWORD &windowWidth, DWORD &windowHeight, LONG desiredWidth, LONG desiredHeight, DWORD windowStyle, HMENU menus, IGpLogDriver *logger)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "ResizeD3DWindow: %i x %i", static_cast<int>(desiredWidth), static_cast<int>(desiredHeight));
|
||||
|
||||
if (desiredWidth < 640)
|
||||
desiredWidth = 640;
|
||||
else if (desiredWidth > MAXDWORD)
|
||||
@@ -172,6 +185,9 @@ bool ResizeD3DWindow(HWND hWnd, DWORD &windowWidth, DWORD &windowHeight, LONG de
|
||||
else if (desiredHeight > MAXDWORD)
|
||||
desiredHeight = MAXDWORD;
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "ResizeD3DWindow: Adjusted dimensions: %i x %i", static_cast<int>(desiredWidth), static_cast<int>(desiredHeight));
|
||||
|
||||
RECT windowRect;
|
||||
GetClientRect(hWnd, &windowRect);
|
||||
windowRect.right = windowRect.left + desiredWidth;
|
||||
@@ -180,9 +196,20 @@ bool ResizeD3DWindow(HWND hWnd, DWORD &windowWidth, DWORD &windowHeight, LONG de
|
||||
LONG_PTR style = GetWindowLongPtrA(hWnd, GWL_STYLE);
|
||||
|
||||
if (!AdjustWindowRect(&windowRect, static_cast<DWORD>(style), menus != nullptr))
|
||||
return false;
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "ResizeD3DWindow: AdjustWindowRect failed");
|
||||
|
||||
SetWindowPos(hWnd, HWND_TOP, windowRect.left, windowRect.top, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOZORDER | SWP_NOMOVE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SetWindowPos(hWnd, HWND_TOP, windowRect.left, windowRect.top, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOZORDER | SWP_NOMOVE))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "ResizeD3DWindow: SetWindowPos failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
windowWidth = desiredWidth;
|
||||
windowHeight = desiredHeight;
|
||||
@@ -192,6 +219,11 @@ bool ResizeD3DWindow(HWND hWnd, DWORD &windowWidth, DWORD &windowHeight, LONG de
|
||||
|
||||
bool GpDisplayDriverD3D11::DetachSwapChain()
|
||||
{
|
||||
IGpLogDriver *logger = m_properties.m_logger;
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "GpDisplayDriverD3D11::DetachSwapChain");
|
||||
|
||||
m_deviceContext->OMSetRenderTargets(0, nullptr, nullptr);
|
||||
m_backBufferRTV = nullptr;
|
||||
m_backBufferTexture = nullptr;
|
||||
@@ -204,6 +236,11 @@ bool GpDisplayDriverD3D11::DetachSwapChain()
|
||||
|
||||
bool GpDisplayDriverD3D11::InitBackBuffer(uint32_t virtualWidth, uint32_t virtualHeight)
|
||||
{
|
||||
IGpLogDriver *logger = m_properties.m_logger;
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "GpDisplayDriverD3D11::InitBackBuffer");
|
||||
|
||||
m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<LPVOID*>(m_backBufferTexture.GetMutablePtr()));
|
||||
|
||||
{
|
||||
@@ -216,8 +253,14 @@ bool GpDisplayDriverD3D11::InitBackBuffer(uint32_t virtualWidth, uint32_t virtua
|
||||
rtvDesc.Texture2D.MipSlice = 0;
|
||||
|
||||
m_backBufferRTV = nullptr;
|
||||
if (m_device->CreateRenderTargetView(m_backBufferTexture, &rtvDesc, m_backBufferRTV.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateRenderTargetView(m_backBufferTexture, &rtvDesc, m_backBufferRTV.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitBackBuffer: CreateRenderTargetView for back buffer failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DXGI_FORMAT vbbFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||
@@ -237,8 +280,14 @@ bool GpDisplayDriverD3D11::InitBackBuffer(uint32_t virtualWidth, uint32_t virtua
|
||||
vbbTextureDesc.MiscFlags = 0;
|
||||
|
||||
m_virtualScreenTexture = nullptr;
|
||||
if (m_device->CreateTexture2D(&vbbTextureDesc, nullptr, m_virtualScreenTexture.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateTexture2D(&vbbTextureDesc, nullptr, m_virtualScreenTexture.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitBackBuffer: CreateTexture2D for virtual screen texture failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -248,8 +297,14 @@ bool GpDisplayDriverD3D11::InitBackBuffer(uint32_t virtualWidth, uint32_t virtua
|
||||
rtvDesc.Texture2D.MipSlice = 0;
|
||||
|
||||
m_virtualScreenTextureRTV = nullptr;
|
||||
if (m_device->CreateRenderTargetView(m_virtualScreenTexture, &rtvDesc, m_virtualScreenTextureRTV.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateRenderTargetView(m_virtualScreenTexture, &rtvDesc, m_virtualScreenTextureRTV.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitBackBuffer: CreateRenderTargetView for virtual screen texture failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -260,8 +315,14 @@ bool GpDisplayDriverD3D11::InitBackBuffer(uint32_t virtualWidth, uint32_t virtua
|
||||
srvDesc.Texture2D.MostDetailedMip = 0;
|
||||
|
||||
m_virtualScreenTextureSRV = nullptr;
|
||||
if (m_device->CreateShaderResourceView(m_virtualScreenTexture, &srvDesc, m_virtualScreenTextureSRV.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateShaderResourceView(m_virtualScreenTexture, &srvDesc, m_virtualScreenTextureSRV.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitBackBuffer: CreateRenderTargetView for virtual screen texture failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -269,6 +330,11 @@ bool GpDisplayDriverD3D11::InitBackBuffer(uint32_t virtualWidth, uint32_t virtua
|
||||
|
||||
bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtualHeight)
|
||||
{
|
||||
IGpLogDriver *logger = m_properties.m_logger;
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "GpDisplayDriverD3D11::InitResources");
|
||||
|
||||
if (!InitBackBuffer(virtualWidth, virtualHeight))
|
||||
return false;
|
||||
|
||||
@@ -282,8 +348,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
bufferDesc.MiscFlags = 0;
|
||||
bufferDesc.StructureByteStride = 0;
|
||||
|
||||
if (m_device->CreateBuffer(&bufferDesc, nullptr, m_drawQuadVertexConstantBuffer.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateBuffer(&bufferDesc, nullptr, m_drawQuadVertexConstantBuffer.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateBuffer for draw quad vertex constant buffer failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Quad pixel constant buffer
|
||||
@@ -296,8 +368,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
bufferDesc.MiscFlags = 0;
|
||||
bufferDesc.StructureByteStride = 0;
|
||||
|
||||
if (m_device->CreateBuffer(&bufferDesc, nullptr, m_drawQuadPixelConstantBuffer.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateBuffer(&bufferDesc, nullptr, m_drawQuadPixelConstantBuffer.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateBuffer for draw quad pixel constant buffer failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Quad index buffer
|
||||
@@ -317,8 +395,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
initialData.SysMemPitch = 0;
|
||||
initialData.SysMemSlicePitch = 0;
|
||||
|
||||
if (m_device->CreateBuffer(&bufferDesc, &initialData, m_quadIndexBuffer.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateBuffer(&bufferDesc, &initialData, m_quadIndexBuffer.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateBuffer for draw quad index buffer failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Quad vertex buffer
|
||||
@@ -344,8 +428,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
initialData.SysMemPitch = 0;
|
||||
initialData.SysMemSlicePitch = 0;
|
||||
|
||||
if (m_device->CreateBuffer(&bufferDesc, &initialData, m_quadVertexBuffer.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateBuffer(&bufferDesc, &initialData, m_quadVertexBuffer.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateBuffer for draw quad vertex buffer failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -357,8 +447,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
bufferDesc.MiscFlags = 0;
|
||||
bufferDesc.StructureByteStride = 0;
|
||||
|
||||
if (m_device->CreateBuffer(&bufferDesc, nullptr, m_scaleQuadPixelConstantBuffer.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateBuffer(&bufferDesc, nullptr, m_scaleQuadPixelConstantBuffer.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateBuffer for scale quad pixel constant buffer failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const GpShaderCodeBlob drawQuadVBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadV_D3D11);
|
||||
@@ -386,7 +482,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
0 // Instance data step rate
|
||||
};
|
||||
|
||||
m_device->CreateInputLayout(descs, sizeof(descs) / sizeof(descs[0]), drawQuadVBlob.m_data, drawQuadVBlob.m_size, m_drawQuadInputLayout.GetMutablePtr());
|
||||
HRESULT result = m_device->CreateInputLayout(descs, sizeof(descs) / sizeof(descs[0]), drawQuadVBlob.m_data, drawQuadVBlob.m_size, m_drawQuadInputLayout.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateInputLayout for draw quad input failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Quad depth stencil state
|
||||
@@ -407,8 +510,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
desc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
||||
desc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
||||
|
||||
if (m_device->CreateDepthStencilState(&desc, m_drawQuadDepthStencilState.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateDepthStencilState(&desc, m_drawQuadDepthStencilState.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateDepthStencilState for draw quad with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Nearest neighbor sampler desc
|
||||
@@ -425,8 +534,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
samplerDesc.MinLOD = -FLT_MAX;
|
||||
samplerDesc.MaxLOD = FLT_MAX;
|
||||
|
||||
if (m_device->CreateSamplerState(&samplerDesc, m_nearestNeighborSamplerState.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateSamplerState(&samplerDesc, m_nearestNeighborSamplerState.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateSamplerState for nearest neighbor failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DXGI_FORMAT paletteTextureFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||
@@ -455,8 +570,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
initialData.SysMemPitch = 256 * 4;
|
||||
initialData.SysMemSlicePitch = 256 * 4;
|
||||
|
||||
if (m_device->CreateTexture1D(&desc, &initialData, m_paletteTexture.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateTexture1D(&desc, &initialData, m_paletteTexture.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateTexture1D for palette failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Palette texture SRV
|
||||
@@ -467,8 +588,14 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
|
||||
desc.Texture1D.MostDetailedMip = 0;
|
||||
desc.Texture1D.MipLevels = 1;
|
||||
|
||||
if (m_device->CreateShaderResourceView(m_paletteTexture, &desc, m_paletteTextureSRV.GetMutablePtr()) != S_OK)
|
||||
HRESULT result = m_device->CreateShaderResourceView(m_paletteTexture, &desc, m_paletteTextureSRV.GetMutablePtr());
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::InitResources: CreateShaderResourceView for palette failed with code %lx", result);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -791,11 +918,21 @@ void GpDisplayDriverD3D11::ChangeToStandardCursor(EGpStandardCursor_t cursor)
|
||||
|
||||
void GpDisplayDriverD3D11::BecomeFullScreen(LONG &windowStyle)
|
||||
{
|
||||
IGpLogDriver *logger = m_properties.m_logger;
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "GpDisplayDriverD3D11::BecomeFullScreen");
|
||||
|
||||
assert(!m_isFullScreen);
|
||||
|
||||
RECT windowRect;
|
||||
if (!GetWindowRect(m_osGlobals->m_hwnd, &windowRect))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::BecomeFullScreen: GetWindowRect failed");
|
||||
|
||||
return; // ???
|
||||
}
|
||||
|
||||
HMONITOR monitor = MonitorFromRect(&windowRect, MONITOR_DEFAULTTONULL);
|
||||
if (!monitor)
|
||||
@@ -810,17 +947,31 @@ void GpDisplayDriverD3D11::BecomeFullScreen(LONG &windowStyle)
|
||||
}
|
||||
|
||||
if (!monitor)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::BecomeFullScreen: Couldn't find any monitors");
|
||||
|
||||
return; // No monitor?
|
||||
}
|
||||
|
||||
MONITORINFO monitorInfo;
|
||||
monitorInfo.cbSize = sizeof(monitorInfo);
|
||||
if (!GetMonitorInfoA(monitor, &monitorInfo))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::BecomeFullScreen: GetMonitorInfoA failed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_windowModeRevertRect = windowRect;
|
||||
SetWindowLongPtr(m_osGlobals->m_hwnd, GWL_STYLE, WS_VISIBLE | WS_POPUP);
|
||||
|
||||
SetWindowPos(m_osGlobals->m_hwnd, HWND_TOP, monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.top, monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top, SWP_FRAMECHANGED);
|
||||
if (!SetWindowPos(m_osGlobals->m_hwnd, HWND_TOP, monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.top, monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top, SWP_FRAMECHANGED))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::BecomeFullScreen: SetWindowPos failed");
|
||||
}
|
||||
|
||||
m_isFullScreen = true;
|
||||
windowStyle = (WS_VISIBLE | WS_POPUP);
|
||||
@@ -828,6 +979,11 @@ void GpDisplayDriverD3D11::BecomeFullScreen(LONG &windowStyle)
|
||||
|
||||
void GpDisplayDriverD3D11::BecomeWindowed(LONG &windowStyle)
|
||||
{
|
||||
IGpLogDriver *logger = m_properties.m_logger;
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "GpDisplayDriverD3D11::BecomeWindowed");
|
||||
|
||||
assert(m_isFullScreen);
|
||||
|
||||
RECT revertRect = m_windowModeRevertRect;
|
||||
@@ -838,12 +994,22 @@ void GpDisplayDriverD3D11::BecomeWindowed(LONG &windowStyle)
|
||||
// If the window is off-screen, use the primary monitor
|
||||
monitor = MonitorFromRect(&revertRect, MONITOR_DEFAULTTOPRIMARY);
|
||||
if (!monitor)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::BecomeWindowed: MonitorFromRect fallback failed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MONITORINFO monitorInfo;
|
||||
monitorInfo.cbSize = sizeof(monitorInfo);
|
||||
if (!GetMonitorInfoA(monitor, &monitorInfo))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::BecomeWindowed: GetMonitorInfoA failed");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RECT monitorRect = monitorInfo.rcWork;
|
||||
LONG monitorWidth = monitorRect.right - monitorRect.left;
|
||||
@@ -880,9 +1046,13 @@ void GpDisplayDriverD3D11::BecomeWindowed(LONG &windowStyle)
|
||||
revertRect.right = revertRect.right + revertWidth;
|
||||
}
|
||||
|
||||
SetWindowLongPtr(m_osGlobals->m_hwnd, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW);
|
||||
SetWindowLongPtrW(m_osGlobals->m_hwnd, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW);
|
||||
|
||||
SetWindowPos(m_osGlobals->m_hwnd, HWND_TOP, revertRect.left, revertRect.top, revertRect.right - revertRect.left, revertRect.bottom - revertRect.top, SWP_FRAMECHANGED);
|
||||
if (!SetWindowPos(m_osGlobals->m_hwnd, HWND_TOP, revertRect.left, revertRect.top, revertRect.right - revertRect.left, revertRect.bottom - revertRect.top, SWP_FRAMECHANGED))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriverD3D11::BecomeWindowed: SetWindowPos failed");
|
||||
}
|
||||
|
||||
m_isFullScreen = false;
|
||||
windowStyle = (WS_VISIBLE | WS_OVERLAPPEDWINDOW);
|
||||
@@ -890,11 +1060,18 @@ void GpDisplayDriverD3D11::BecomeWindowed(LONG &windowStyle)
|
||||
|
||||
void GpDisplayDriverD3D11::Run()
|
||||
{
|
||||
IGpLogDriver *logger = m_properties.m_logger;
|
||||
|
||||
WNDCLASSEX wc;
|
||||
|
||||
LPVOID fiber = ConvertThreadToFiberEx(this, 0);
|
||||
if (!fiber)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "ConvertThreadToFiberEx failed");
|
||||
|
||||
return; // ???
|
||||
}
|
||||
|
||||
m_vosFiber = m_osGlobals->m_createFiberFunc(fiber);
|
||||
|
||||
@@ -923,7 +1100,7 @@ void GpDisplayDriverD3D11::Run()
|
||||
|
||||
ShowWindow(m_osGlobals->m_hwnd, m_osGlobals->m_nCmdShow);
|
||||
|
||||
StartD3DForWindow(m_osGlobals->m_hwnd, m_swapChain, m_device, m_deviceContext);
|
||||
StartD3DForWindow(m_osGlobals->m_hwnd, m_swapChain, m_device, m_deviceContext, logger);
|
||||
|
||||
InitResources(m_windowWidthVirtual, m_windowHeightVirtual);
|
||||
|
||||
@@ -988,7 +1165,7 @@ void GpDisplayDriverD3D11::Run()
|
||||
|
||||
if (m_properties.m_adjustRequestedResolutionFunc(m_properties.m_adjustRequestedResolutionFuncContext, desiredWidth, desiredHeight, virtualWidth, virtualHeight, pixelScaleX, pixelScaleY))
|
||||
{
|
||||
bool resizedOK = ResizeD3DWindow(m_osGlobals->m_hwnd, m_windowWidthPhysical, m_windowHeightPhysical, desiredWidth, desiredHeight, windowStyle, menus);
|
||||
bool resizedOK = ResizeD3DWindow(m_osGlobals->m_hwnd, m_windowWidthPhysical, m_windowHeightPhysical, desiredWidth, desiredHeight, windowStyle, menus, logger);
|
||||
resizedOK = resizedOK && DetachSwapChain();
|
||||
resizedOK = resizedOK && ResizeSwapChain(m_swapChain, m_windowWidthPhysical, m_windowHeightPhysical);
|
||||
resizedOK = resizedOK && InitBackBuffer(virtualWidth, virtualHeight);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
rmdir /S /Q ReleasePkg
|
||||
|
||||
mkdir ReleasePkg
|
||||
|
||||
mkdir ReleasePkg\PDBs
|
||||
|
||||
mkdir ReleasePkg\Aerofoil
|
||||
@@ -9,6 +11,7 @@ mkdir ReleasePkg\Aerofoil\Tools
|
||||
|
||||
copy /Y x64\Release\Aerofoil.exe ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\GpAudioDriver_XAudio2.dll ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\xaudio2_9redist.dll ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\GpDisplayDriver_D3D11.dll ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\GpInputDriver_XInput.dll ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\FreeType.dll ReleasePkg\Aerofoil
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef __PL_AE_HANDLER_DESC_H__
|
||||
#define __PL_AE_HANDLER_DESC_H__
|
||||
|
||||
#include "PLAppleEventsCommonTypes.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct AEHandlerDesc
|
||||
{
|
||||
AEEventClass m_eventClass;
|
||||
AEEventID m_eventID;
|
||||
AEEventHandler m_handler;
|
||||
uint32_t m_ref;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
#include "AEManager.h"
|
||||
#include "AEHandlerDesc.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class AEManagerImpl final : public AEManager
|
||||
{
|
||||
public:
|
||||
AEManagerImpl();
|
||||
|
||||
void Init() override;
|
||||
void Shutdown() override;
|
||||
|
||||
void InstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandler handler, uint32_t ref, bool isSysHandler) override;
|
||||
void SetInteractAllowed(AEInteractAllowed interactAllowed) override;
|
||||
|
||||
static AEManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
std::vector<AEHandlerDesc> m_handlers;
|
||||
AEInteractAllowed m_interactAllowed;
|
||||
|
||||
static AEManagerImpl ms_instance;
|
||||
};
|
||||
|
||||
AEManagerImpl::AEManagerImpl()
|
||||
: m_interactAllowed(kAEInteractUnknown)
|
||||
{
|
||||
}
|
||||
|
||||
void AEManagerImpl::Init()
|
||||
{
|
||||
m_interactAllowed = kAEInteractUnknown;
|
||||
}
|
||||
|
||||
void AEManagerImpl::Shutdown()
|
||||
{
|
||||
m_handlers.clear();
|
||||
}
|
||||
|
||||
void AEManagerImpl::InstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandler handler, uint32_t ref, bool isSysHandler)
|
||||
{
|
||||
AEHandlerDesc desc;
|
||||
desc.m_eventClass = eventClass;
|
||||
desc.m_eventID = eventID;
|
||||
desc.m_handler = handler;
|
||||
desc.m_ref = ref;
|
||||
|
||||
m_handlers.push_back(desc);
|
||||
}
|
||||
|
||||
void AEManagerImpl::SetInteractAllowed(AEInteractAllowed interactAllowed)
|
||||
{
|
||||
m_interactAllowed = interactAllowed;
|
||||
}
|
||||
|
||||
AEManagerImpl *AEManagerImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
}
|
||||
|
||||
AEManagerImpl AEManagerImpl::ms_instance;
|
||||
|
||||
|
||||
AEManager *AEManager::GetInstance()
|
||||
{
|
||||
return AEManagerImpl::GetInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef __PL_AE_MANAGER_H__
|
||||
#define __PL_AE_MANAGER_H__
|
||||
|
||||
#include "PLAppleEventsCommonTypes.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class AEManager
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual void InstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandler handler, uint32_t ref, bool isSysHandler) = 0;
|
||||
virtual void SetInteractAllowed(AEInteractAllowed interactAllowed) = 0;
|
||||
|
||||
static AEManager *GetInstance();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,110 +1,117 @@
|
||||
#include "CFileStream.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
CFileStream::CFileStream(FILE *f)
|
||||
: m_file(f)
|
||||
, m_readOnly(false)
|
||||
, m_writeOnly(false)
|
||||
, m_seekable(true)
|
||||
{
|
||||
}
|
||||
|
||||
CFileStream::CFileStream(FILE *f, bool isReadOnly, bool isWriteOnly, bool isSeekable)
|
||||
: m_file(f)
|
||||
, m_readOnly(isReadOnly)
|
||||
, m_writeOnly(isWriteOnly)
|
||||
, m_seekable(isSeekable)
|
||||
{
|
||||
}
|
||||
|
||||
size_t CFileStream::Read(void *bytesOut, size_t size)
|
||||
{
|
||||
if (!m_file || m_writeOnly)
|
||||
return 0;
|
||||
|
||||
return fread(bytesOut, 1, size, m_file);
|
||||
}
|
||||
|
||||
size_t CFileStream::Write(const void *bytes, size_t size)
|
||||
{
|
||||
if (!m_file || m_readOnly)
|
||||
return 0;
|
||||
|
||||
return fwrite(bytes, 1, size, m_file);
|
||||
}
|
||||
|
||||
bool CFileStream::IsSeekable() const
|
||||
{
|
||||
return m_seekable;
|
||||
}
|
||||
|
||||
bool CFileStream::IsReadOnly() const
|
||||
{
|
||||
return m_readOnly;
|
||||
}
|
||||
|
||||
bool CFileStream::IsWriteOnly() const
|
||||
{
|
||||
return m_writeOnly;
|
||||
}
|
||||
|
||||
bool CFileStream::SeekStart(UFilePos_t loc)
|
||||
{
|
||||
if (!m_file)
|
||||
return false;
|
||||
|
||||
return fseek(m_file, static_cast<long>(loc), SEEK_SET) == 0;
|
||||
}
|
||||
|
||||
bool CFileStream::SeekCurrent(FilePos_t loc)
|
||||
{
|
||||
if (!m_file)
|
||||
return false;
|
||||
|
||||
return fseek(m_file, static_cast<long>(loc), SEEK_CUR) == 0;;
|
||||
}
|
||||
|
||||
bool CFileStream::SeekEnd(UFilePos_t loc)
|
||||
{
|
||||
if (!m_file)
|
||||
return false;
|
||||
|
||||
return fseek(m_file, static_cast<long>(loc), SEEK_END) == 0;
|
||||
}
|
||||
|
||||
bool CFileStream::Truncate(UFilePos_t loc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UFilePos_t CFileStream::Tell() const
|
||||
{
|
||||
if (!m_file)
|
||||
return 0;
|
||||
|
||||
return static_cast<UFilePos_t>(ftell(m_file));
|
||||
}
|
||||
|
||||
void CFileStream::Close()
|
||||
{
|
||||
if (m_file)
|
||||
{
|
||||
fclose(m_file);
|
||||
m_file = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
UFilePos_t CFileStream::Size() const
|
||||
{
|
||||
if (!m_file || !m_seekable)
|
||||
return 0;
|
||||
|
||||
long oldPos = ftell(m_file);
|
||||
fseek(m_file, 0, SEEK_END);
|
||||
const UFilePos_t endPos = static_cast<UFilePos_t>(ftell(m_file));
|
||||
fseek(m_file, oldPos, SEEK_SET);
|
||||
|
||||
return endPos;
|
||||
}
|
||||
}
|
||||
#include "CFileStream.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
CFileStream::CFileStream(FILE *f)
|
||||
: m_file(f)
|
||||
, m_readOnly(false)
|
||||
, m_writeOnly(false)
|
||||
, m_seekable(true)
|
||||
{
|
||||
}
|
||||
|
||||
CFileStream::CFileStream(FILE *f, bool isReadOnly, bool isWriteOnly, bool isSeekable)
|
||||
: m_file(f)
|
||||
, m_readOnly(isReadOnly)
|
||||
, m_writeOnly(isWriteOnly)
|
||||
, m_seekable(isSeekable)
|
||||
{
|
||||
}
|
||||
|
||||
size_t CFileStream::Read(void *bytesOut, size_t size)
|
||||
{
|
||||
if (!m_file || m_writeOnly)
|
||||
return 0;
|
||||
|
||||
return fread(bytesOut, 1, size, m_file);
|
||||
}
|
||||
|
||||
size_t CFileStream::Write(const void *bytes, size_t size)
|
||||
{
|
||||
if (!m_file || m_readOnly)
|
||||
return 0;
|
||||
|
||||
return fwrite(bytes, 1, size, m_file);
|
||||
}
|
||||
|
||||
bool CFileStream::IsSeekable() const
|
||||
{
|
||||
return m_seekable;
|
||||
}
|
||||
|
||||
bool CFileStream::IsReadOnly() const
|
||||
{
|
||||
return m_readOnly;
|
||||
}
|
||||
|
||||
bool CFileStream::IsWriteOnly() const
|
||||
{
|
||||
return m_writeOnly;
|
||||
}
|
||||
|
||||
bool CFileStream::SeekStart(UFilePos_t loc)
|
||||
{
|
||||
if (!m_file)
|
||||
return false;
|
||||
|
||||
return fseek(m_file, static_cast<long>(loc), SEEK_SET) == 0;
|
||||
}
|
||||
|
||||
bool CFileStream::SeekCurrent(FilePos_t loc)
|
||||
{
|
||||
if (!m_file)
|
||||
return false;
|
||||
|
||||
return fseek(m_file, static_cast<long>(loc), SEEK_CUR) == 0;;
|
||||
}
|
||||
|
||||
bool CFileStream::SeekEnd(UFilePos_t loc)
|
||||
{
|
||||
if (!m_file)
|
||||
return false;
|
||||
|
||||
return fseek(m_file, static_cast<long>(loc), SEEK_END) == 0;
|
||||
}
|
||||
|
||||
bool CFileStream::Truncate(UFilePos_t loc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UFilePos_t CFileStream::Tell() const
|
||||
{
|
||||
if (!m_file)
|
||||
return 0;
|
||||
|
||||
return static_cast<UFilePos_t>(ftell(m_file));
|
||||
}
|
||||
|
||||
void CFileStream::Close()
|
||||
{
|
||||
if (m_file)
|
||||
{
|
||||
fclose(m_file);
|
||||
m_file = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CFileStream::Flush()
|
||||
{
|
||||
if (m_file)
|
||||
fflush(m_file);
|
||||
}
|
||||
|
||||
|
||||
UFilePos_t CFileStream::Size() const
|
||||
{
|
||||
if (!m_file || !m_seekable)
|
||||
return 0;
|
||||
|
||||
long oldPos = ftell(m_file);
|
||||
fseek(m_file, 0, SEEK_END);
|
||||
const UFilePos_t endPos = static_cast<UFilePos_t>(ftell(m_file));
|
||||
fseek(m_file, oldPos, SEEK_SET);
|
||||
|
||||
return endPos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __PL_CFILESTREAM_H__
|
||||
#define __PL_CFILESTREAM_H__
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "CoreDefs.h"
|
||||
#include "IOStream.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class CFileStream final : public IOStream
|
||||
{
|
||||
public:
|
||||
explicit CFileStream(FILE *f);
|
||||
CFileStream(FILE *f, bool isReadOnly, bool isWriteOnly, bool isSeekable);
|
||||
|
||||
size_t Read(void *bytesOut, size_t size) override;
|
||||
size_t Write(const void *bytes, size_t size) override;
|
||||
bool IsSeekable() const override;
|
||||
bool IsReadOnly() const override;
|
||||
bool IsWriteOnly() const override;
|
||||
bool SeekStart(UFilePos_t loc) override;
|
||||
bool SeekCurrent(FilePos_t loc) override;
|
||||
bool SeekEnd(UFilePos_t loc) override;
|
||||
bool Truncate(UFilePos_t loc) override;
|
||||
UFilePos_t Size() const override;
|
||||
UFilePos_t Tell() const override;
|
||||
void Close() override;
|
||||
|
||||
private:
|
||||
CFileStream(const CFileStream &other) GP_DELETED;
|
||||
|
||||
FILE *m_file;
|
||||
bool m_readOnly;
|
||||
bool m_writeOnly;
|
||||
bool m_seekable;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#pragma once
|
||||
|
||||
#ifndef __PL_CFILESTREAM_H__
|
||||
#define __PL_CFILESTREAM_H__
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "CoreDefs.h"
|
||||
#include "IOStream.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class CFileStream final : public IOStream
|
||||
{
|
||||
public:
|
||||
explicit CFileStream(FILE *f);
|
||||
CFileStream(FILE *f, bool isReadOnly, bool isWriteOnly, bool isSeekable);
|
||||
|
||||
size_t Read(void *bytesOut, size_t size) override;
|
||||
size_t Write(const void *bytes, size_t size) override;
|
||||
bool IsSeekable() const override;
|
||||
bool IsReadOnly() const override;
|
||||
bool IsWriteOnly() const override;
|
||||
bool SeekStart(UFilePos_t loc) override;
|
||||
bool SeekCurrent(FilePos_t loc) override;
|
||||
bool SeekEnd(UFilePos_t loc) override;
|
||||
bool Truncate(UFilePos_t loc) override;
|
||||
UFilePos_t Size() const override;
|
||||
UFilePos_t Tell() const override;
|
||||
void Close() override;
|
||||
void Flush() override;
|
||||
|
||||
private:
|
||||
CFileStream(const CFileStream &other) GP_DELETED;
|
||||
|
||||
FILE *m_file;
|
||||
bool m_readOnly;
|
||||
bool m_writeOnly;
|
||||
bool m_seekable;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#endif
|
||||
|
||||
struct IGpAudioDriver;
|
||||
struct IGpLogDriver;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
@@ -41,6 +42,7 @@ public:
|
||||
virtual void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) = 0;
|
||||
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_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) = 0;
|
||||
virtual void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) = 0;
|
||||
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
||||
|
||||
16
PortabilityLayer/HostLogDriver.cpp
Normal file
16
PortabilityLayer/HostLogDriver.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "HostLogDriver.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
void HostLogDriver::SetInstance(IGpLogDriver *instance)
|
||||
{
|
||||
ms_instance = instance;
|
||||
}
|
||||
|
||||
IGpLogDriver *HostLogDriver::GetInstance()
|
||||
{
|
||||
return ms_instance;
|
||||
}
|
||||
|
||||
IGpLogDriver *HostLogDriver::ms_instance;
|
||||
}
|
||||
16
PortabilityLayer/HostLogDriver.h
Normal file
16
PortabilityLayer/HostLogDriver.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
struct IGpLogDriver;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostLogDriver
|
||||
{
|
||||
public:
|
||||
static void SetInstance(IGpLogDriver *instance);
|
||||
static IGpLogDriver *GetInstance();
|
||||
|
||||
private:
|
||||
static IGpLogDriver *ms_instance;
|
||||
};
|
||||
}
|
||||
@@ -23,6 +23,7 @@ namespace PortabilityLayer
|
||||
virtual UFilePos_t Size() const = 0;
|
||||
virtual UFilePos_t Tell() const = 0;
|
||||
virtual void Close() = 0;
|
||||
virtual void Flush() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -107,4 +107,8 @@ namespace PortabilityLayer
|
||||
void MemReaderStream::Close()
|
||||
{
|
||||
}
|
||||
|
||||
void MemReaderStream::Flush()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace PortabilityLayer
|
||||
UFilePos_t Size() const override;
|
||||
UFilePos_t Tell() const override;
|
||||
void Close() override;
|
||||
void Flush() override;
|
||||
|
||||
private:
|
||||
MemReaderStream() GP_DELETED;
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
#include "PLAppleEvents.h"
|
||||
#include "AEManager.h"
|
||||
|
||||
PLError_t AEGetParamDesc(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, AEDescList *descList)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t AEDisposeDesc(AEDescList *descList)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t AECountItems(AEDescList *descList, long *count)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, Size maxSize, Size *actualSize)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, Size maxSize, Size *actualSize)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t AEInstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandlerUPP handler, UInt32 ref, bool isSysHandler)
|
||||
{
|
||||
PortabilityLayer::AEManager::GetInstance()->InstallEventHandler(eventClass, eventID, handler, ref, isSysHandler);
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t AESetInteractionAllowed(AEInteractAllowed level)
|
||||
{
|
||||
PortabilityLayer::AEManager::GetInstance()->SetInteractAllowed(level);
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
AEEventHandlerUPP NewAEEventHandlerProc(AEEventHandler handler)
|
||||
{
|
||||
return handler;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef __PL_APPLEEVENTS_H__
|
||||
#define __PL_APPLEEVENTS_H__
|
||||
|
||||
#include "PLCore.h"
|
||||
#include "PLAppleEventsCommonTypes.h"
|
||||
|
||||
struct AppleEvent
|
||||
{
|
||||
};
|
||||
|
||||
struct AEDescList
|
||||
{
|
||||
};
|
||||
|
||||
struct AEDesc
|
||||
{
|
||||
};
|
||||
|
||||
typedef AEEventHandler AEEventHandlerUPP;
|
||||
|
||||
PLError_t AEGetParamDesc(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, AEDescList *descList);
|
||||
PLError_t AEDisposeDesc(AEDescList *descList);
|
||||
PLError_t AECountItems(AEDescList *descList, long *count);
|
||||
PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, Size maxSize, Size *actualSize);
|
||||
PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, Size maxSize, Size *actualSize);
|
||||
PLError_t AEInstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandlerUPP handler, UInt32 ref, bool isSysHandler);
|
||||
PLError_t AESetInteractionAllowed(AEInteractAllowed level);
|
||||
|
||||
AEEventHandlerUPP NewAEEventHandlerProc(AEEventHandler handler);
|
||||
|
||||
#endif
|
||||
@@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef __PL_APPLE_EVENTS_COMMON_TYPES_H__
|
||||
#define __PL_APPLE_EVENTS_COMMON_TYPES_H__
|
||||
|
||||
#include "PLErrorCodes.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct AppleEvent;
|
||||
|
||||
enum AEError
|
||||
{
|
||||
errAEEventNotHandled = 1,
|
||||
errAEDescNotFound,
|
||||
errAEParamMissed,
|
||||
};
|
||||
|
||||
enum AEKeyword
|
||||
{
|
||||
keyDirectObject,
|
||||
keyMissedKeywordAttr,
|
||||
};
|
||||
|
||||
enum DescType
|
||||
{
|
||||
typeAEList,
|
||||
typeFSS,
|
||||
typeWildCard,
|
||||
};
|
||||
|
||||
enum AEEventID
|
||||
{
|
||||
kAEOpenApplication,
|
||||
kAEOpenDocuments,
|
||||
kAEPrintDocuments,
|
||||
kAEQuitApplication
|
||||
};
|
||||
|
||||
enum AEEventClass
|
||||
{
|
||||
kCoreEventClass
|
||||
};
|
||||
|
||||
enum AEInteractAllowed
|
||||
{
|
||||
kAEInteractUnknown,
|
||||
kAEInteractWithAll
|
||||
};
|
||||
|
||||
typedef PLError_t (*AEEventHandler)(const AppleEvent *theAE, AppleEvent *reply, uint32_t ref);
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLQDraw.h"
|
||||
|
||||
#include "AEManager.h"
|
||||
#include "DisplayDeviceManager.h"
|
||||
#include "FileManager.h"
|
||||
#include "FilePermission.h"
|
||||
@@ -547,7 +546,7 @@ void GetTime(DateTimeRec *dateTime)
|
||||
dateTime->minute = minute;
|
||||
}
|
||||
|
||||
void FlushEvents(int mask, int unknown)
|
||||
void FlushEvents()
|
||||
{
|
||||
PortabilityLayer::EventQueue *queue = PortabilityLayer::EventQueue::GetInstance();
|
||||
|
||||
@@ -561,7 +560,7 @@ void ExitToShell()
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
Handle NewHandle(Size size)
|
||||
Handle NewHandle(size_t size)
|
||||
{
|
||||
PortabilityLayer::MMHandleBlock *hBlock = PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(size);
|
||||
if (!hBlock)
|
||||
@@ -578,7 +577,7 @@ long GetHandleSize(Handle handle)
|
||||
return handle.MMBlock()->m_size;
|
||||
}
|
||||
|
||||
PLError_t SetHandleSize(Handle hdl, Size newSize)
|
||||
PLError_t SetHandleSize(Handle hdl, size_t newSize)
|
||||
{
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
if (!mm->ResizeHandle(hdl.MMBlock(), newSize))
|
||||
@@ -587,12 +586,12 @@ PLError_t SetHandleSize(Handle hdl, Size newSize)
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
void *NewPtr(Size size)
|
||||
void *NewPtr(size_t size)
|
||||
{
|
||||
return PortabilityLayer::MemoryManager::GetInstance()->Alloc(size);
|
||||
}
|
||||
|
||||
void *NewPtrClear(Size size)
|
||||
void *NewPtrClear(size_t size)
|
||||
{
|
||||
void *data = NewPtr(size);
|
||||
if (data != nullptr && size != 0)
|
||||
@@ -644,7 +643,6 @@ void PL_Init()
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Init();
|
||||
PortabilityLayer::ResourceManager::GetInstance()->Init();
|
||||
PortabilityLayer::DisplayDeviceManager::GetInstance()->Init();
|
||||
PortabilityLayer::AEManager::GetInstance()->Init();
|
||||
PortabilityLayer::QDManager::GetInstance()->Init();
|
||||
PortabilityLayer::MenuManager::GetInstance()->Init();
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ typedef int16_t SInt16;
|
||||
typedef int32_t Int32;
|
||||
typedef uint32_t UInt32;
|
||||
|
||||
typedef size_t Size;
|
||||
|
||||
typedef unsigned char Str15[16];
|
||||
typedef unsigned char Str31[32];
|
||||
typedef unsigned char Str63[64];
|
||||
@@ -204,11 +202,6 @@ typedef WindowPtr WindowRef; // wtf?
|
||||
|
||||
struct KeyDownStates;
|
||||
|
||||
static const int everyEvent = -1;
|
||||
|
||||
static const int iBeamCursor = 1;
|
||||
static const int watchCursor = 4;
|
||||
|
||||
static const Boolean TRUE = 1;
|
||||
static const Boolean FALSE = 0;
|
||||
|
||||
@@ -216,8 +209,6 @@ static const Boolean FALSE = 0;
|
||||
|
||||
static const int nullEvent = 0;
|
||||
|
||||
//void FlushEvents(int eventMask, int stopMask);
|
||||
|
||||
void InitCursor();
|
||||
void HideCursor();
|
||||
|
||||
@@ -261,15 +252,15 @@ Boolean WaitMouseUp();
|
||||
short Random();
|
||||
void GetTime(DateTimeRec *dateTime);
|
||||
|
||||
void FlushEvents(int mask, int unknown);
|
||||
void FlushEvents();
|
||||
|
||||
Handle NewHandle(Size size);
|
||||
Handle NewHandle(size_t size);
|
||||
long GetHandleSize(Handle handle);
|
||||
|
||||
PLError_t SetHandleSize(Handle hdl, Size newSize);
|
||||
PLError_t SetHandleSize(Handle hdl, size_t newSize);
|
||||
|
||||
void *NewPtr(Size size);
|
||||
void *NewPtrClear(Size size);
|
||||
void *NewPtr(size_t size);
|
||||
void *NewPtrClear(size_t size);
|
||||
void DisposePtr(void *ptr);
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#include "PLNavigation.h"
|
||||
|
||||
PLError_t NavGetDefaultDialogOptions(NavDialogOptions *options)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t NavPutFile(AEDesc *defaultLocation, NavReplyRecord *reply, NavDialogOptions *dlgOptions, void *unknown, UInt32 fileType, UInt32 fileCreator, void *unknown2)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef __PL_NAVIGATION_H__
|
||||
#define __PL_NAVIGATION_H__
|
||||
|
||||
#include "PLCore.h"
|
||||
#include "PLAppleEvents.h"
|
||||
|
||||
struct AEDesc;
|
||||
|
||||
struct NavReplyRecord
|
||||
{
|
||||
bool validRecord;
|
||||
bool replacing;
|
||||
int vRefNum;
|
||||
long parID; // Directory?
|
||||
AEDescList selection;
|
||||
};
|
||||
|
||||
struct NavDialogOptions
|
||||
{
|
||||
};
|
||||
|
||||
PLError_t NavGetDefaultDialogOptions(NavDialogOptions *options);
|
||||
PLError_t NavPutFile(AEDesc *defaultLocation, NavReplyRecord *reply, NavDialogOptions *dlgOptions, void *unknown, UInt32 fileType, UInt32 fileCreator, void *unknown2);
|
||||
|
||||
#endif
|
||||
@@ -143,8 +143,6 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GpCommon\GpBitfield.h" />
|
||||
<ClInclude Include="AEHandlerDesc.h" />
|
||||
<ClInclude Include="AEManager.h" />
|
||||
<ClInclude Include="AntiAliasTable.h" />
|
||||
<ClInclude Include="AppEventHandler.h" />
|
||||
<ClInclude Include="ArrayTools.h" />
|
||||
@@ -176,6 +174,7 @@
|
||||
<ClInclude Include="HostFontHandler.h" />
|
||||
<ClInclude Include="HostFontRenderedGlyph.h" />
|
||||
<ClInclude Include="HostInputDriver.h" />
|
||||
<ClInclude Include="HostLogDriver.h" />
|
||||
<ClInclude Include="HostMutex.h" />
|
||||
<ClInclude Include="HostSuspendCallArgument.h" />
|
||||
<ClInclude Include="HostSuspendCallID.h" />
|
||||
@@ -203,8 +202,6 @@
|
||||
<ClInclude Include="PascalStrLiteral.h" />
|
||||
<ClInclude Include="HostMemoryBuffer.h" />
|
||||
<ClInclude Include="HostFileSystem.h" />
|
||||
<ClInclude Include="PLAppleEvents.h" />
|
||||
<ClInclude Include="PLAppleEventsCommonTypes.h" />
|
||||
<ClInclude Include="PLApplication.h" />
|
||||
<ClInclude Include="PLArrayView.h" />
|
||||
<ClInclude Include="PLArrayViewIterator.h" />
|
||||
@@ -264,7 +261,6 @@
|
||||
<ClInclude Include="ResourceCompiledTypeList.h" />
|
||||
<ClInclude Include="ResourceFile.h" />
|
||||
<ClInclude Include="PLMenus.h" />
|
||||
<ClInclude Include="PLNavigation.h" />
|
||||
<ClInclude Include="PLNumberFormatting.h" />
|
||||
<ClInclude Include="PLPalettes.h" />
|
||||
<ClInclude Include="PLPasStr.h" />
|
||||
@@ -301,7 +297,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\stb\stb_image_write.c" />
|
||||
<ClCompile Include="AEManager.cpp" />
|
||||
<ClCompile Include="AntiAliasTable.cpp" />
|
||||
<ClCompile Include="AppEventHandler.cpp" />
|
||||
<ClCompile Include="BinHex4.cpp" />
|
||||
@@ -321,6 +316,7 @@
|
||||
<ClCompile Include="HostDisplayDriver.cpp" />
|
||||
<ClCompile Include="HostFileSystem.cpp" />
|
||||
<ClCompile Include="HostFontHandler.cpp" />
|
||||
<ClCompile Include="HostLogDriver.cpp" />
|
||||
<ClCompile Include="HostSuspendHook.cpp" />
|
||||
<ClCompile Include="HostSystemServices.cpp" />
|
||||
<ClCompile Include="HostVOSEventQueue.cpp" />
|
||||
@@ -335,7 +331,6 @@
|
||||
<ClCompile Include="MenuManager.cpp" />
|
||||
<ClCompile Include="MMBlock.cpp" />
|
||||
<ClCompile Include="MMHandleBlock.cpp" />
|
||||
<ClCompile Include="PLAppleEvents.cpp" />
|
||||
<ClCompile Include="PLApplication.cpp" />
|
||||
<ClCompile Include="PLButtonWidget.cpp" />
|
||||
<ClCompile Include="PLControlDefinitions.cpp" />
|
||||
@@ -352,7 +347,6 @@
|
||||
<ClCompile Include="PLLabelWidget.cpp" />
|
||||
<ClCompile Include="PLMenus.cpp" />
|
||||
<ClCompile Include="PLMovies.cpp" />
|
||||
<ClCompile Include="PLNavigation.cpp" />
|
||||
<ClCompile Include="PLNumberFormatting.cpp" />
|
||||
<ClCompile Include="PLPopupMenuWidget.cpp" />
|
||||
<ClCompile Include="PLQDOffscreen.cpp" />
|
||||
|
||||
@@ -93,9 +93,6 @@
|
||||
<ClInclude Include="PLResources.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLAppleEvents.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLToolUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -105,9 +102,6 @@
|
||||
<ClInclude Include="PLSound.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLNavigation.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLNumberFormatting.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -165,15 +159,6 @@
|
||||
<ClInclude Include="HostDisplayDriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLAppleEventsCommonTypes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AEManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AEHandlerDesc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ByteSwap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -483,6 +468,9 @@
|
||||
<ClInclude Include="ResolveCachingColor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HostLogDriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CFileStream.cpp">
|
||||
@@ -518,9 +506,6 @@
|
||||
<ClCompile Include="PLQDOffscreen.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PLAppleEvents.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PLStringCompare.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -530,9 +515,6 @@
|
||||
<ClCompile Include="PLDialogs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PLNavigation.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PLNumberFormatting.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -566,9 +548,6 @@
|
||||
<ClCompile Include="HostDisplayDriver.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AEManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ByteSwap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -758,5 +737,8 @@
|
||||
<ClCompile Include="ResolveCachingColor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HostLogDriver.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -16,6 +16,7 @@ namespace PortabilityLayer
|
||||
kFonts,
|
||||
kCursors,
|
||||
kHighScores,
|
||||
kLogs,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
<Component Id="GpAudioDriver_XAudio2.dll" Guid="*">
|
||||
<File Id="GpAudioDriver_XAudio2.dll" Source="$(var.GpAudioDriver_XAudio2.TargetPath)" KeyPath="yes" Checksum="yes"/>
|
||||
</Component>
|
||||
<Component Id="xaudio2_9redist.dll" Guid="*">
|
||||
<File Id="xaudio2_9redist.dll" Source="$(var.GpAudioDriver_XAudio2.TargetDir)xaudio2_9redist.dll" KeyPath="yes" Checksum="yes"/>
|
||||
</Component>
|
||||
<Component Id="GpDisplayDriver_D3D11.dll" Guid="*">
|
||||
<File Id="GpDisplayDriver_D3D11.dll" Source="$(var.GpDisplayDriver_D3D11.TargetPath)" KeyPath="yes" Checksum="yes"/>
|
||||
</Component>
|
||||
@@ -132,6 +135,7 @@
|
||||
<ComponentRef Id="FreeType.dll" />
|
||||
<ComponentRef Id="GpApp.dll" />
|
||||
<ComponentRef Id="GpAudioDriver_XAudio2.dll" />
|
||||
<ComponentRef Id="xaudio2_9redist.dll" />
|
||||
<ComponentRef Id="GpDisplayDriver_D3D11.dll" />
|
||||
<ComponentRef Id="GpInputDriver_XInput.dll" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user