mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4c3ccbd7fa | ||
|
9624c283c8 | ||
|
cfb66d9c9b | ||
|
c185c8d9ec | ||
|
7636fd6fa8 | ||
|
6c48debecd | ||
|
3f55eedcf0 | ||
|
856c7d5297 | ||
|
d7301402c5 | ||
|
2a98bfbc8c | ||
|
eac923c475 | ||
|
6fe0f2d964 | ||
|
a4abb0d95f | ||
|
c856607f46 | ||
|
611f53ef91 | ||
|
98afd82d64 | ||
|
efae9cacd8 | ||
|
5184d1594f | ||
|
42e124a90c | ||
|
11628ddd93 | ||
|
7d5f844fd4 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -28,6 +28,9 @@ InstallerPackages/*
|
||||
*.msi
|
||||
*.wixpdb
|
||||
*.wixobj
|
||||
*.CopyComplete
|
||||
ReleasePackageInstaller/obj/*
|
||||
ReleasePackageInstaller/bin/*
|
||||
ReleasePackageInstaller/AerofoilPackageDefs.wxi
|
||||
ReleasePackageInstaller/AerofoilPackageDefs.wxi
|
||||
ReleasePackageInstaller/AerofoilPackageVersion.wxi
|
||||
packages/*
|
||||
|
13
Aerofoil.sln
13
Aerofoil.sln
@@ -46,9 +46,14 @@ EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unpacktool", "unpacktool\unpacktool.vcxproj", "{A778D062-DE76-49F6-8D05-EB26852DD605}"
|
||||
EndProject
|
||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "ReleasePackageInstaller", "ReleasePackageInstaller\ReleasePackageInstaller.wixproj", "{D26BD501-28A7-4849-8130-FB5EA0A2B82F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B} = {7EFF1E21-C375-45EA-A069-4E2232C8A72B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsUnicodeToolShim", "WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj", "{15009625-1120-405E-8BBA-69A16CD6713D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EmitWiXVersion", "EmitWiXVersion\EmitWiXVersion.vcxproj", "{7EFF1E21-C375-45EA-A069-4E2232C8A72B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -237,6 +242,14 @@ Global
|
||||
{15009625-1120-405E-8BBA-69A16CD6713D}.Release|x64.Build.0 = Release|x64
|
||||
{15009625-1120-405E-8BBA-69A16CD6713D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{15009625-1120-405E-8BBA-69A16CD6713D}.Release|x86.Build.0 = Release|Win32
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x64.Build.0 = Debug|x64
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x86.Build.0 = Debug|Win32
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x64.ActiveCfg = Release|x64
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x64.Build.0 = Release|x64
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@@ -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,12 @@
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GpCommon\IGpLogDriver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GpLogDriver_Win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</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;
|
||||
}
|
||||
|
13
ApplicationResourcePatches/DITL/2000.json
Normal file
13
ApplicationResourcePatches/DITL/2000.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"items" :
|
||||
[
|
||||
{
|
||||
"name" : "Okay",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 376, 240 ],
|
||||
"size" : [ 58, 20 ],
|
||||
"id" : 1,
|
||||
"enabled" : true
|
||||
}
|
||||
]
|
||||
}
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"add" :
|
||||
{
|
||||
"DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json"
|
||||
"DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json",
|
||||
"DITL/2000.json" : "ApplicationResourcePatches/DITL/2000.json"
|
||||
},
|
||||
"delete" :
|
||||
[
|
||||
|
@@ -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.
|
||||
|
||||
|
27
EmitWiXVersion/EmitWiXVersion.cpp
Normal file
27
EmitWiXVersion/EmitWiXVersion.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "GpBuildVersion.h"
|
||||
#include "WindowsUnicodeToolShim.h"
|
||||
|
||||
|
||||
int toolMain(int argc, const char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: EmitWiXVersion <output>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
FILE *f = fopen_utf8(argv[1], "wb");
|
||||
if (!f)
|
||||
{
|
||||
fprintf(stderr, "EmitWiXVersion: Error opening output file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fprintf(f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
fprintf(f, "<Include>\n");
|
||||
fprintf(f, " <?define AerofoilReleaseVersion=\"%i.%i.%i.0\" ?>\n", GP_BUILD_VERSION_MAJOR, GP_BUILD_VERSION_MINOR, GP_BUILD_VERSION_UPDATE);
|
||||
fprintf(f, "</Include>\n");
|
||||
fclose(f);
|
||||
|
||||
return 0;
|
||||
}
|
139
EmitWiXVersion/EmitWiXVersion.vcxproj
Normal file
139
EmitWiXVersion/EmitWiXVersion.vcxproj
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{7EFF1E21-C375-45EA-A069-4E2232C8A72B}</ProjectGuid>
|
||||
<RootNamespace>EmitWiXVersion</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\WindowsUnicodeToolShim.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\WindowsUnicodeToolShim.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\WindowsUnicodeToolShim.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\WindowsUnicodeToolShim.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EmitWiXVersion.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PortabilityLayer\PortabilityLayer.vcxproj">
|
||||
<Project>{6ec62b0f-9353-40a4-a510-3788f1368b33}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj">
|
||||
<Project>{15009625-1120-405e-8bba-69a16cd6713d}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
22
EmitWiXVersion/EmitWiXVersion.vcxproj.filters
Normal file
22
EmitWiXVersion/EmitWiXVersion.vcxproj.filters
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EmitWiXVersion.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
113
GpApp/About.cpp
113
GpApp/About.cpp
@@ -7,10 +7,14 @@
|
||||
#include "PLArrayView.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "FontFamily.h"
|
||||
#include "PLButtonWidget.h"
|
||||
#include "PLLabelWidget.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLResources.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLSysCalls.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "PLWidgets.h"
|
||||
@@ -19,15 +23,23 @@
|
||||
#include "DialogUtils.h"
|
||||
#include "Environ.h"
|
||||
#include "Externs.h"
|
||||
#include "GpApplicationName.h"
|
||||
#include "GpBuildVersion.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedFontMetrics.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "ScanlineMask.h"
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
|
||||
static void HiLiteOkayButton (DrawSurface *surface);
|
||||
static void UnHiLiteOkayButton (DrawSurface *surface);
|
||||
static void UpdateMainPict (Dialog *);
|
||||
static int16_t AboutFilter(Dialog *, const TimeTaggedVOSEvent *evt);
|
||||
static int16_t AboutFrameworkFilter(Dialog *, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
|
||||
static Point okayButtLowerV, okayButtUpperV;
|
||||
@@ -86,6 +98,66 @@ void DoAbout (void)
|
||||
aboutDialog->Destroy();
|
||||
}
|
||||
|
||||
void DoAboutFramework (void)
|
||||
{
|
||||
#define kAboutFrameworkDialogTemplateID 2000
|
||||
|
||||
const Rect windowRect = Rect::Create(0, 0, 272, 450);
|
||||
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
|
||||
|
||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||
PortabilityLayer::RenderedFont *font = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||
PortabilityLayer::RenderedFont *fontLight = GetApplicationFont(8, PortabilityLayer::FontFamilyFlag_None, true);
|
||||
|
||||
int16_t verticalPoint = 16 + font->GetMetrics().m_ascent;
|
||||
int16_t horizontalOffset = 16;
|
||||
const int16_t spacing = 12;
|
||||
|
||||
PortabilityLayer::DialogManager *dialogManager = PortabilityLayer::DialogManager::GetInstance();
|
||||
Dialog *dialog = dialogManager->LoadDialogFromTemplate(kAboutFrameworkDialogTemplateID, windowRect, true, false, 0, 0, PL_GetPutInFrontWindowPtr(), PSTR(""), nullptr);
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define ABOUT_DIALOG_CONFIGURATION_TAG "Release"
|
||||
#else
|
||||
#define ABOUT_DIALOG_CONFIGURATION_TAG "Debug"
|
||||
#endif
|
||||
|
||||
Window *window = dialog->GetWindow();
|
||||
|
||||
DrawSurface *surface = window->GetDrawSurface();
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 0), PSTR(GP_APPLICATION_NAME " " GP_APPLICATION_VERSION_STRING " \xa9" GP_APPLICATION_COPYRIGHT_STRING), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 2), PSTR(GP_APPLICATION_NAME " is an unoffical third-party port of Glider PRO\xaa."), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 4), PSTR("This software is not maintained by, supported by, endorsed by, or"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 5), PSTR("otherwise associated with the authors and publishers of Glider PRO\xaa."), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 7), PSTR("Please do not contact any of them regarding issues that you have"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 8), PSTR("with " GP_APPLICATION_NAME "."), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 10), PSTR("If you would like to contribute to this project, visit:"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 11), PSTR(GP_APPLICATION_WEBSITE_STRING), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 13), PSTR("To report a problem or request support, submit an issue via"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 14), PSTR("the website above."), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 16), PSTR("For more information, please see the accompanying documentation."), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, windowRect.bottom - 16), PSTR("Build: " __TIMESTAMP__ " " ABOUT_DIALOG_CONFIGURATION_TAG), blackColor, fontLight);
|
||||
|
||||
DrawDefaultButton(dialog);
|
||||
|
||||
int16_t hit = 0;
|
||||
|
||||
do
|
||||
{
|
||||
hit = dialog->ExecuteModal(AboutFrameworkFilter);
|
||||
} while (hit != kOkayButton);
|
||||
|
||||
dialog->Destroy();
|
||||
}
|
||||
|
||||
//============================================================== Static Functions
|
||||
//-------------------------------------------------------------- HiLiteOkayButton
|
||||
// Draws my pseudo-button to appear as though it is clicked on.
|
||||
@@ -253,3 +325,44 @@ static int16_t AboutFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt)
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------- AboutFrameworkFilter
|
||||
// Dialog filter for the About Framework dialog.
|
||||
|
||||
static int16_t AboutFrameworkFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
bool handledIt = false;
|
||||
int16_t hit = -1;
|
||||
|
||||
if (!evt)
|
||||
return -1;
|
||||
|
||||
Window *window = dialog->GetWindow();
|
||||
DrawSurface *surface = window->GetDrawSurface();
|
||||
|
||||
if (evt->IsKeyDownEvent())
|
||||
{
|
||||
switch (PackVOSKeyCode(evt->m_vosEvent.m_event.m_keyboardInputEvent))
|
||||
{
|
||||
case PL_KEY_SPECIAL(kEnter):
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetHighlightStyle(kControlButtonPart, true);
|
||||
PLSysCalls::Sleep(8);
|
||||
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetHighlightStyle(kControlButtonPart, false);
|
||||
hit = kOkayButton;
|
||||
handledIt = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
handledIt = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handledIt)
|
||||
return -1;
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
@@ -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,10 +6,8 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLAppleEvents.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLQDraw.h"
|
||||
#include "DialogManager.h"
|
||||
#include "Externs.h"
|
||||
|
@@ -51,6 +51,7 @@ namespace PortabilityLayer
|
||||
#define kErrNeed16Or256Colors 13
|
||||
|
||||
#define iAbout 1
|
||||
#define iAboutAerofoil 3
|
||||
#define iNewGame 1
|
||||
#define iTwoPlayer 2
|
||||
#define iOpenSavedGame 3
|
||||
@@ -127,6 +128,7 @@ typedef struct
|
||||
//-------------------------------------------------------------- Prototypes
|
||||
|
||||
void DoAbout (void); // --- About.c
|
||||
void DoAboutFramework (void);
|
||||
|
||||
void LoadCursors (void); // --- AnimCursor.c
|
||||
void DisposCursors (void);
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "PLDialogs.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "DialogManager.h"
|
||||
#include "Externs.h"
|
||||
|
@@ -5,7 +5,6 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLEventQueue.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
@@ -163,7 +162,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 +464,7 @@ void DoDiedGameOver (void)
|
||||
InitDiedGameOver();
|
||||
CopyRectMainToWork(&workSrcRect);
|
||||
CopyRectMainToBack(&workSrcRect);
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
|
||||
nextLoop = TickCount() + 2;
|
||||
while (pagesStuck < 8)
|
||||
|
@@ -69,6 +69,7 @@
|
||||
<Import Project="GpApp.props" />
|
||||
<Import Project="..\Common.props" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\Release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
|
@@ -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);
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include "PLHacks.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLScript.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLStringCompare.h"
|
||||
#include "DialogUtils.h"
|
||||
@@ -397,7 +396,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 +502,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;
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include "PLMovies.h"
|
||||
#include "PLResources.h"
|
||||
#include "PLStringCompare.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "BitmapImage.h"
|
||||
#include "DialogManager.h"
|
||||
|
@@ -5,7 +5,6 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLDialogs.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "DialogManager.h"
|
||||
@@ -468,7 +467,7 @@ Boolean QuerySaveGame (void)
|
||||
short hitWhat;
|
||||
|
||||
InitCursor();
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
// CenterAlert(kSaveGameAlert);
|
||||
hitWhat = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(kSaveGameAlert, nullptr);
|
||||
if (hitWhat == kYesSaveGameButton)
|
||||
|
@@ -10,9 +10,11 @@
|
||||
#include "Environ.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "GpApplicationName.h"
|
||||
#include "Map.h"
|
||||
#include "MenuManager.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "RectUtils.h"
|
||||
#include "Tools.h"
|
||||
|
||||
@@ -46,11 +48,12 @@ extern Boolean twoPlayerGame, paused, hasMirror, splashDrawn;
|
||||
// The menus are loaded from disk and the menu bar set up and drawn.
|
||||
|
||||
void InitializeMenus (void)
|
||||
{
|
||||
{
|
||||
appleMenu = GetMenu(kAppleMenuID);
|
||||
if (appleMenu == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
//AppendResMenu(appleMenu, 'DRVR'); // GP: We don't support this
|
||||
AppendMenuItem(appleMenu, 0, 0, 0, 0, true, false, PSTR("About " GP_APPLICATION_NAME "\xc9"));
|
||||
InsertMenu(appleMenu, 0);
|
||||
|
||||
gameMenu = GetMenu(kGameMenuID);
|
||||
|
@@ -244,12 +244,13 @@ void OpenLinkWindow (void)
|
||||
basicState.m_text.Set(4, "Link");
|
||||
basicState.m_window = linkWindow;
|
||||
|
||||
linkControl = PortabilityLayer::ButtonWidget::Create(basicState, nullptr);
|
||||
PortabilityLayer::ButtonWidget::AdditionalData addlData;
|
||||
linkControl = PortabilityLayer::ButtonWidget::Create(basicState, &addlData);
|
||||
|
||||
basicState.m_rect = Rect::Create(5, 5, 25, 59);
|
||||
basicState.m_text.Set(6, "Unlink");
|
||||
basicState.m_window = linkWindow;
|
||||
unlinkControl = PortabilityLayer::ButtonWidget::Create(basicState, nullptr);
|
||||
unlinkControl = PortabilityLayer::ButtonWidget::Create(basicState, &addlData);
|
||||
|
||||
linkWindow->DrawControls();
|
||||
|
||||
|
@@ -396,7 +396,7 @@ int gpAppMain()
|
||||
}
|
||||
WriteOutPrefs();
|
||||
RestoreColorDepth();
|
||||
PL_DEAD(FlushEvents(everyEvent, 0));
|
||||
PL_DEAD(FlushEvents());
|
||||
// theErr = LoadScrap();
|
||||
|
||||
return 0;
|
||||
|
@@ -6,7 +6,6 @@
|
||||
|
||||
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include "PLHacks.h"
|
||||
#include "PLMenus.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLToolUtils.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
@@ -294,6 +293,10 @@ void DoAppleMenu (short theItem)
|
||||
DoAbout();
|
||||
break;
|
||||
|
||||
case iAboutAerofoil:
|
||||
DoAboutFramework();
|
||||
break;
|
||||
|
||||
default:
|
||||
// GetMenuItemText(appleMenu, theItem, daName);
|
||||
// GetPort(&wasPort);
|
||||
|
@@ -134,7 +134,7 @@ void ToggleMusicWhilePlaying (void)
|
||||
|
||||
void SetMusicalMode (short newMode)
|
||||
{
|
||||
if (dontLoadMusic)
|
||||
if (dontLoadMusic || failedMusic)
|
||||
return;
|
||||
|
||||
musicMutex->Lock();
|
||||
@@ -302,6 +302,12 @@ void InitMusic (void)
|
||||
return;
|
||||
}
|
||||
theErr = OpenMusicChannel();
|
||||
if (theErr != PLErrors::kNone)
|
||||
{
|
||||
YellowAlert(kYellowNoMusic, theErr);
|
||||
failedMusic = true;
|
||||
return;
|
||||
}
|
||||
|
||||
musicScore[0] = 0;
|
||||
musicScore[1] = 1;
|
||||
|
@@ -6,7 +6,6 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "DialogManager.h"
|
||||
#include "Externs.h"
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "BitmapImage.h"
|
||||
#include "PLResources.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "Externs.h"
|
||||
#include "FontFamily.h"
|
||||
|
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "BitmapImage.h"
|
||||
#include "Externs.h"
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
|
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLResources.h"
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "BitmapImage.h"
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "PLWidgets.h"
|
||||
#include "ResolveCachingColor.h"
|
||||
@@ -1270,7 +1269,7 @@ void DoSettingsMain (void)
|
||||
FlashSettingsButton(surface, 1);
|
||||
DoSoundPrefs();
|
||||
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||
FlushEvents(everyEvent, 0);
|
||||
FlushEvents();
|
||||
break;
|
||||
|
||||
case kControlsButton:
|
||||
|
@@ -5,7 +5,6 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -63,6 +63,7 @@
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\Release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
@@ -71,6 +72,7 @@
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\Release.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
@@ -130,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;
|
||||
};
|
||||
|
9
GpCommon/GpBuildVersion.h
Normal file
9
GpCommon/GpBuildVersion.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#define GP_BUILD_VERSION_MAJOR 1
|
||||
#define GP_BUILD_VERSION_MINOR 0
|
||||
#define GP_BUILD_VERSION_UPDATE 0
|
||||
|
||||
#define GP_APPLICATION_VERSION_STRING "1.0.0"
|
||||
#define GP_APPLICATION_COPYRIGHT_STRING "2020 Eric Lasota"
|
||||
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"
|
@@ -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);
|
||||
@@ -1239,7 +1416,7 @@ void GpDisplayDriverD3D11::SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, u
|
||||
|
||||
void GpDisplayDriverD3D11::RequestToggleFullScreen(uint32_t timestamp)
|
||||
{
|
||||
// Alt-Enter gets re-sent after a full-screen toggle, so we ignore toggle requests until half a second has seconds have elapsed
|
||||
// Alt-Enter gets re-sent after a full-screen toggle, so we ignore toggle requests until half a second has elapsed
|
||||
if (timestamp > m_lastFullScreenToggleTimeStamp + 30)
|
||||
{
|
||||
m_isFullScreenDesired = !m_isFullScreenDesired;
|
||||
|
@@ -65,6 +65,7 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\Common.props" />
|
||||
<Import Project="..\Release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
@@ -75,6 +76,7 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\Common.props" />
|
||||
<Import Project="..\Release.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
|
@@ -63,6 +63,7 @@
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\Release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
@@ -71,6 +72,7 @@
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\GpCommon.props" />
|
||||
<Import Project="..\Release.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
|
@@ -1,5 +1,7 @@
|
||||
rmdir /S /Q ReleasePkg
|
||||
|
||||
mkdir ReleasePkg
|
||||
|
||||
mkdir ReleasePkg\Aerofoil
|
||||
mkdir ReleasePkg\Aerofoil\Packaged
|
||||
mkdir ReleasePkg\Aerofoil\Resources
|
||||
@@ -7,6 +9,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
|
||||
@@ -21,6 +24,24 @@ copy /Y x64\Release\FTagData.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\gpr2gpa.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\unpacktool.exe ReleasePkg\Aerofoil\Tools
|
||||
|
||||
mkdir ReleasePkg\PDBs
|
||||
|
||||
copy /Y x64\Release\Aerofoil.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\GpAudioDriver_XAudio2.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\GpDisplayDriver_D3D11.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\GpInputDriver_XInput.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\FreeType.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\GpApp.pdb ReleasePkg\PDBs
|
||||
|
||||
copy /Y x64\Release\flattenmov.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\bin2gp.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\hqx2bin.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\hqx2gp.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\MakeTimestamp.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\FTagData.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\gpr2gpa.pdb ReleasePkg\PDBs
|
||||
copy /Y x64\Release\unpacktool.pdb ReleasePkg\PDBs
|
||||
|
||||
xcopy /I /E /Y /K Packaged ReleasePkg\Aerofoil\Packaged
|
||||
xcopy /I /E /Y /K Resources ReleasePkg\Aerofoil\Resources
|
||||
xcopy /I /E /Y /K Documentation ReleasePkg\Aerofoil\Documentation
|
||||
|
@@ -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,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RGBAColor;
|
||||
|
||||
struct AntiAliasTable
|
||||
struct AntiAliasTable
|
||||
{
|
||||
// Striped 256x16 because constant background color is more likely than constant sample
|
||||
uint8_t m_aaTranslate[256][16];
|
||||
|
@@ -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
|
||||
|
@@ -611,15 +611,15 @@ namespace PortabilityLayer
|
||||
{
|
||||
public:
|
||||
Dialog *LoadDialog(int16_t resID, Window *behindWindow, const DialogTextSubstitutions *substitutions) override;
|
||||
Dialog *LoadDialogFromTemplate(int16_t templateResID, const Rect &rect, bool visible, bool hasCloseBox, uint32_t referenceConstant, uint16_t positionSpec, Window *behindWindow, const PLPasStr &title, const DialogTextSubstitutions *substitutions) override;
|
||||
int16_t DisplayAlert(int16_t alertResID, const DialogTextSubstitutions *substitutions) override;
|
||||
void PositionWindow(Window *window, const Rect &rect) const override;
|
||||
|
||||
DialogTemplate *LoadDialogTemplate(int16_t resID);
|
||||
|
||||
static DialogManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
void PositionWindow(Window *window, const Rect &rect);
|
||||
Dialog *LoadDialogFromTemplate(int16_t templateResID, const Rect &rect, bool visible, bool hasCloseBox, uint32_t referenceConstant, uint16_t positionSpec, Window *behindWindow, const PLPasStr &title, const DialogTextSubstitutions *substitutions);
|
||||
|
||||
static int16_t AlertFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
@@ -827,7 +827,7 @@ namespace PortabilityLayer
|
||||
return dtemplate;
|
||||
}
|
||||
|
||||
void DialogManagerImpl::PositionWindow(Window *window, const Rect &rect)
|
||||
void DialogManagerImpl::PositionWindow(Window *window, const Rect &rect) const
|
||||
{
|
||||
unsigned int displayWidth, displayHeight;
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&displayWidth, &displayHeight, nullptr);
|
||||
|
@@ -4,8 +4,10 @@
|
||||
|
||||
struct Dialog;
|
||||
struct DialogTextSubstitutions;
|
||||
struct Rect;
|
||||
struct Window;
|
||||
struct TimeTaggedVOSEvent;
|
||||
class PLPasStr;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
@@ -16,7 +18,9 @@ namespace PortabilityLayer
|
||||
{
|
||||
public:
|
||||
virtual Dialog *LoadDialog(int16_t resID, Window *behindWindow, const DialogTextSubstitutions *substitutions) = 0;
|
||||
virtual Dialog *LoadDialogFromTemplate(int16_t templateResID, const Rect &rect, bool visible, bool hasCloseBox, uint32_t referenceConstant, uint16_t positionSpec, Window *behindWindow, const PLPasStr &title, const DialogTextSubstitutions *substitutions) = 0;
|
||||
virtual int16_t DisplayAlert(int16_t alertResID, const DialogTextSubstitutions *substitutions) = 0;
|
||||
virtual void PositionWindow(Window *window, const Rect &rect) const = 0;
|
||||
|
||||
static DialogManager *GetInstance();
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef __PL_MAC_FILE_WRITEABLE_MEM_H__
|
||||
#define __PL_MAC_FILE_WRITEABLE_MEM_H__
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class MacFileWriteableMem
|
||||
{
|
||||
public:
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@@ -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;
|
||||
|
@@ -128,6 +128,8 @@ namespace PortabilityLayer
|
||||
THandle<Menu> DeserializeMenu(const void *resData) const override;
|
||||
THandle<Menu> GetMenuByID(int id) const override;
|
||||
|
||||
PLError_t AppendMenuItem(const THandle<Menu> &menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text) const override;
|
||||
|
||||
void InsertMenuBefore(const THandle<Menu> &insertingMenu, const THandle<Menu> &existingMenu) override;
|
||||
void InsertMenuAfter(const THandle<Menu> &insertingMenu, const THandle<Menu> &existingMenu) override;
|
||||
void InsertMenuAtEnd(const THandle<Menu> &insertingMenu) override;
|
||||
@@ -391,6 +393,41 @@ namespace PortabilityLayer
|
||||
return THandle<Menu>();
|
||||
}
|
||||
|
||||
PLError_t MenuManagerImpl::AppendMenuItem(const THandle<Menu> &menuHdl, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text) const
|
||||
{
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
|
||||
Menu *menu = *menuHdl;
|
||||
|
||||
// This doesn't need a +1 because 1 is implicit
|
||||
if (!mm->ResizeHandle(menuHdl.MMBlock(), sizeof(Menu) + menu->numMenuItems * sizeof(MenuItem)))
|
||||
return PLErrors::kOutOfMemory;
|
||||
|
||||
menu = *menuHdl;
|
||||
size_t oldStringBlobSize = menu->stringBlobHandle->m_size;
|
||||
|
||||
if (!mm->ResizeHandle(menu->stringBlobHandle, oldStringBlobSize + text.Length() + 1))
|
||||
return PLErrors::kOutOfMemory;
|
||||
|
||||
MenuItem *lastItem = menu->menuItems + menu->numMenuItems;
|
||||
menu->numMenuItems++;
|
||||
menu->haveMenuLayout = false;
|
||||
|
||||
uint8_t *stringBlob = static_cast<uint8_t*>(menu->stringBlobHandle->m_contents);
|
||||
stringBlob[oldStringBlobSize] = text.Length();
|
||||
memcpy(stringBlob + oldStringBlobSize + 1, text.UChars(), text.Length());
|
||||
|
||||
lastItem->iconResID = iconResID;
|
||||
lastItem->key = key;
|
||||
lastItem->submenuID = submenuID;
|
||||
lastItem->textStyle = textStyle;
|
||||
lastItem->enabled = enabled;
|
||||
lastItem->checked = checked;
|
||||
lastItem->nameOffsetInStringBlob = oldStringBlobSize;
|
||||
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
void MenuManagerImpl::InsertMenuBefore(const THandle<Menu> &insertingMenu, const THandle<Menu> &existingMenu)
|
||||
{
|
||||
m_haveMenuBarLayout = false;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "PLErrorCodes.h"
|
||||
|
||||
template<class T>
|
||||
class THandle;
|
||||
@@ -22,6 +23,8 @@ namespace PortabilityLayer
|
||||
virtual THandle<Menu> DeserializeMenu(const void *resData) const = 0;
|
||||
virtual THandle<Menu> GetMenuByID(int id) const = 0;
|
||||
|
||||
virtual PLError_t AppendMenuItem(const THandle<Menu> &menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text) const = 0;
|
||||
|
||||
virtual void InsertMenuBefore(const THandle<Menu> &insertingMenu, const THandle<Menu> &existingMenu) = 0;
|
||||
virtual void InsertMenuAfter(const THandle<Menu> &insertingMenu, const THandle<Menu> &existingMenu) = 0;
|
||||
virtual void InsertMenuAtEnd(const THandle<Menu> &insertingMenu) = 0;
|
||||
|
@@ -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);
|
||||
|
||||
|
||||
|
@@ -73,6 +73,13 @@ void CheckMenuItem(MenuHandle menu, int index, Boolean checked)
|
||||
mm->SetItemChecked(menu, index - 1, checked != 0);
|
||||
}
|
||||
|
||||
|
||||
void AppendMenuItem(MenuHandle menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text)
|
||||
{
|
||||
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||
mm->AppendMenuItem(menu, iconResID, key, submenuID, textStyle, enabled, checked, text);
|
||||
}
|
||||
|
||||
void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
|
@@ -14,4 +14,6 @@ void DisableMenuItem(MenuHandle menu, int index);
|
||||
void CheckMenuItem(MenuHandle menu, int index, Boolean checked);
|
||||
void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text);
|
||||
|
||||
void AppendMenuItem(MenuHandle menu, int8_t iconResID, uint8_t key, uint8_t submenuID, uint8_t textStyle, bool enabled, bool checked, const PLPasStr &text);
|
||||
|
||||
#endif
|
||||
|
@@ -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
|
@@ -1 +0,0 @@
|
||||
#pragma once
|
@@ -353,12 +353,15 @@ namespace PortabilityLayer
|
||||
|
||||
AudioChannel *SoundSystemImpl::CreateChannel()
|
||||
{
|
||||
IGpAudioDriver *audioDriver = PortabilityLayer::HostAudioDriver::GetInstance();
|
||||
if (!audioDriver)
|
||||
return nullptr;
|
||||
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
void *storage = mm->Alloc(sizeof(PortabilityLayer::AudioChannelImpl));
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
IGpAudioDriver *audioDriver = PortabilityLayer::HostAudioDriver::GetInstance();
|
||||
IGpAudioChannel *audioChannel = audioDriver->CreateChannel();
|
||||
if (!audioChannel)
|
||||
{
|
||||
@@ -388,7 +391,12 @@ namespace PortabilityLayer
|
||||
|
||||
void SoundSystemImpl::SetVolume(uint8_t vol)
|
||||
{
|
||||
PortabilityLayer::HostAudioDriver::GetInstance()->SetMasterVolume(vol, 255);
|
||||
IGpAudioDriver *audioDriver = PortabilityLayer::HostAudioDriver::GetInstance();
|
||||
|
||||
if (!audioDriver)
|
||||
return;
|
||||
|
||||
audioDriver->SetMasterVolume(vol, 255);
|
||||
m_volume = vol;
|
||||
}
|
||||
|
||||
|
@@ -1 +0,0 @@
|
||||
#pragma once
|
@@ -1 +0,0 @@
|
||||
#pragma once
|
@@ -13,6 +13,7 @@ namespace PortabilityLayer
|
||||
PascalStr();
|
||||
PascalStr(size_t size, const char *str);
|
||||
explicit PascalStr(const PLPasStr &pstr);
|
||||
explicit PascalStr(const char *str);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,4 +39,10 @@ namespace PortabilityLayer
|
||||
: UnsafePascalStr<TSize, true>(pstr.Length(), pstr.Chars())
|
||||
{
|
||||
}
|
||||
|
||||
template<size_t TSize>
|
||||
PascalStr<TSize>::PascalStr(const char *str)
|
||||
: UnsafePascalStr<TSize, true>((str == nullptr) ? 0 : strlen(str), str)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -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" />
|
||||
@@ -192,7 +191,6 @@
|
||||
<ClInclude Include="MacBinary2.h" />
|
||||
<ClInclude Include="MacFileMem.h" />
|
||||
<ClInclude Include="MacFileInfo.h" />
|
||||
<ClInclude Include="MacFileWriteableMem.h" />
|
||||
<ClInclude Include="MacRsrcHeader.h" />
|
||||
<ClInclude Include="MacRsrcMap.h" />
|
||||
<ClInclude Include="MemoryManager.h" />
|
||||
@@ -203,8 +201,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 +260,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" />
|
||||
@@ -273,11 +268,8 @@
|
||||
<ClInclude Include="PLQDraw.h" />
|
||||
<ClInclude Include="ResourceManager.h" />
|
||||
<ClInclude Include="PLResources.h" />
|
||||
<ClInclude Include="PLScript.h" />
|
||||
<ClInclude Include="PLSound.h" />
|
||||
<ClInclude Include="PLStringCompare.h" />
|
||||
<ClInclude Include="PLTextUtils.h" />
|
||||
<ClInclude Include="PLToolUtils.h" />
|
||||
<ClInclude Include="ResTypeID.h" />
|
||||
<ClInclude Include="ResTypeIDCodec.h" />
|
||||
<ClInclude Include="RGBAColor.h" />
|
||||
@@ -301,7 +293,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 +312,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 +327,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 +343,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,21 +93,12 @@
|
||||
<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>
|
||||
<ClInclude Include="PLPasStr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<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>
|
||||
@@ -117,12 +108,6 @@
|
||||
<ClInclude Include="PLStringCompare.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLTextUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLScript.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLControlDefinitions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -165,15 +150,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>
|
||||
@@ -189,9 +165,6 @@
|
||||
<ClInclude Include="PLBigEndian.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MacFileWriteableMem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -483,6 +456,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 +494,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 +503,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 +536,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 +725,8 @@
|
||||
<ClCompile Include="ResolveCachingColor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HostLogDriver.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -1,26 +1,26 @@
|
||||
PL_PICTOP(0x0000, kNoop, 0)
|
||||
PL_PICTOP(0x0001, kClipRegion, Rule_SizeTagged16)
|
||||
PL_PICTOP(0x0002, kBackPattern, 8)
|
||||
PL_PICTOP(0x0003, kTextFont, 2)
|
||||
PL_PICTOP(0x0004, kTextFontStyle, 1)
|
||||
PL_PICTOP(0x0000, kNoop, 0)
|
||||
PL_PICTOP(0x0001, kClipRegion, Rule_SizeTagged16)
|
||||
PL_PICTOP(0x0002, kBackPattern, 8)
|
||||
PL_PICTOP(0x0003, kTextFont, 2)
|
||||
PL_PICTOP(0x0004, kTextFontStyle, 1)
|
||||
PL_PICTOP(0x0005, kTextSourceMode, 2)
|
||||
PL_PICTOP(0x0007, kPenSize, 4)
|
||||
PL_PICTOP(0x0008, kPenMode, 2)
|
||||
PL_PICTOP(0x0009, kPenPattern, 8)
|
||||
PL_PICTOP(0x000c, kOrigin, 4) // Relative
|
||||
PL_PICTOP(0x001a, kRGBForeColor, 6)
|
||||
PL_PICTOP(0x001b, kRGBBackColor, 6)
|
||||
PL_PICTOP(0x001e, kDefaultHilite, 0)
|
||||
PL_PICTOP(0x001f, kOpColor, 6)
|
||||
PL_PICTOP(0x0030, kFrameRect, 8)
|
||||
PL_PICTOP(0x00a0, kShortComment, 2)
|
||||
PL_PICTOP(0x00a1, kLongComment, Rule_LongComment)
|
||||
PL_PICTOP(0x0090, kBitsRect, Rule_BitsRect)
|
||||
PL_PICTOP(0x0091, kBitsRgn, Rule_BitsRgn)
|
||||
PL_PICTOP(0x0098, kPackBitsRect, Rule_PackBitsRect)
|
||||
PL_PICTOP(0x0099, kPackBitsRgn, Rule_PackBitsRgn)
|
||||
PL_PICTOP(0x009a, kDirectBitsRect, Rule_DirectBitsRect)
|
||||
PL_PICTOP(0x009b, kDirectBitsRgn, Rule_DirectBitsRgn)
|
||||
PL_PICTOP(0x8200, kCompressedQT, Rule_SizeTagged32)
|
||||
PL_PICTOP(0x8201, kUncompressedQT, Rule_SizeTagged32)
|
||||
PL_PICTOP(0x00ff, kEndOfPicture, 0)
|
||||
PL_PICTOP(0x001a, kRGBForeColor, 6)
|
||||
PL_PICTOP(0x001b, kRGBBackColor, 6)
|
||||
PL_PICTOP(0x001e, kDefaultHilite, 0)
|
||||
PL_PICTOP(0x001f, kOpColor, 6)
|
||||
PL_PICTOP(0x0030, kFrameRect, 8)
|
||||
PL_PICTOP(0x00a0, kShortComment, 2)
|
||||
PL_PICTOP(0x00a1, kLongComment, Rule_LongComment)
|
||||
PL_PICTOP(0x0090, kBitsRect, Rule_BitsRect)
|
||||
PL_PICTOP(0x0091, kBitsRgn, Rule_BitsRgn)
|
||||
PL_PICTOP(0x0098, kPackBitsRect, Rule_PackBitsRect)
|
||||
PL_PICTOP(0x0099, kPackBitsRgn, Rule_PackBitsRgn)
|
||||
PL_PICTOP(0x009a, kDirectBitsRect, Rule_DirectBitsRect)
|
||||
PL_PICTOP(0x009b, kDirectBitsRgn, Rule_DirectBitsRgn)
|
||||
PL_PICTOP(0x8200, kCompressedQT, Rule_SizeTagged32)
|
||||
PL_PICTOP(0x8201, kUncompressedQT, Rule_SizeTagged32)
|
||||
PL_PICTOP(0x00ff, kEndOfPicture, 0)
|
||||
|
@@ -16,6 +16,7 @@ namespace PortabilityLayer
|
||||
kFonts,
|
||||
kCursors,
|
||||
kHighScores,
|
||||
kLogs,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?include AerofoilPackageDefs.wxi ?>
|
||||
<?include AerofoilPackageVersion.wxi ?>
|
||||
<!--
|
||||
You're probably getting a build failure on this line ^^^
|
||||
This is because the Aerofoil upgrade code is not included in this project, to prevent collision with Aerofoil's upgrade GUID.
|
||||
@@ -9,7 +10,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Include>
|
||||
<?define AerofoilUpgradeCode="PUT A GUID HERE" ?>
|
||||
<?define AerofoilReleaseVersion="1.0.0.0" ?>
|
||||
</Include>
|
||||
|
||||
DO NOT USE AEROFOIL'S UPGRADE CODE GUID FOR YOUR OWN PROJECTS, it will cause your project to be considered a version of
|
||||
@@ -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" />
|
||||
|
||||
|
@@ -220,6 +220,7 @@ PackagedDataDir=$(SolutionDir)\Packaged;
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>cd "$(SolutionDir)"
|
||||
"$(PlatformName)\$(ConfigurationName)\EmitWiXVersion.exe" "$(ProjectDir)\AerofoilPackageVersion.wxi"
|
||||
call ConvertResources.bat
|
||||
call MakeRelease.bat</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
|
@@ -1095,6 +1095,7 @@ bool ApplyPatch(const std::vector<uint8_t> &patchFileContents, std::vector<Plann
|
||||
{
|
||||
archive.push_back(PlannedEntry());
|
||||
entry = &archive.back();
|
||||
entry->m_name = itemName.GetString();
|
||||
}
|
||||
|
||||
FILE *f = fopen_utf8(itemValue.GetString(), "rb");
|
||||
@@ -1342,10 +1343,10 @@ int ConvertDirectory(const std::string &basePath, const PortabilityLayer::Combin
|
||||
|
||||
int PrintUsage()
|
||||
{
|
||||
fprintf(stderr, "Usage: gpr2gpa <input.gpr> <input.ts> <output.gpa> [patch.json]");
|
||||
fprintf(stderr, " gpr2gpa <input dir>\* <input.ts>");
|
||||
fprintf(stderr, " gpr2gpa <input dir>/* <input.ts>");
|
||||
fprintf(stderr, " gpr2gpa * <input.ts>");
|
||||
fprintf(stderr, "Usage: gpr2gpa <input.gpr> <input.ts> <output.gpa> [patch.json]\n");
|
||||
fprintf(stderr, " gpr2gpa <input dir>\* <input.ts>\n");
|
||||
fprintf(stderr, " gpr2gpa <input dir>/* <input.ts>\n");
|
||||
fprintf(stderr, " gpr2gpa * <input.ts>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user