Compare commits

...

70 Commits

Author SHA1 Message Date
elasota
c95be907de Bump version to 1.0.7 2020-07-21 12:23:31 -04:00
elasota
3fd7fabb98 Fix full-screen being disabled when going to preferences but not viewing display options 2020-07-21 12:23:13 -04:00
elasota
53ecdabb43 Add full-screen option 2020-07-20 23:38:31 -04:00
elasota
7bf6147fa1 Fix transitions not spanning the entire screen and fix dissolve replaying when toggling full-screen 2020-07-20 12:17:36 -04:00
elasota
a77e1d868f Bump version to 1.0.6 2020-07-20 12:16:41 -04:00
elasota
c14d904ca7 Fix bad ZIP structure 2020-07-20 12:16:31 -04:00
elasota
ec275fcefd Bump version to 1.0.5 2020-07-04 00:35:18 -04:00
elasota
550465088e Remove architecture string code that doesn't work 2020-07-04 00:34:46 -04:00
elasota
68444a7240 Add transitions 2020-07-04 00:26:28 -04:00
elasota
7db0f8d7eb Fix loading empty house in the editor not working correctly 2020-07-03 19:40:26 -04:00
elasota
1fc846f7d8 Fix menu shortcuts activating disabled menu items 2020-07-03 19:31:30 -04:00
elasota
d978267c3e Remove selection scroll timer (which doesn't work anyway) 2020-07-03 18:06:30 -04:00
elasota
e05f37a28d Fix oval frames not drawing in 32-bit color mode 2020-07-03 17:32:26 -04:00
elasota
7069f4bf82 Add package release script 2020-07-03 14:04:54 -04:00
elasota
b197a9fb4b Fix copyright 2020-07-03 13:53:19 -04:00
elasota
62427de092 Add ICC profile option 2020-07-03 13:53:10 -04:00
elasota
037994d0f7 Add additional credits 2020-07-03 13:48:48 -04:00
elasota
7cdfc40ad9 Clarified ambiguous language 2020-07-03 13:48:33 -04:00
elasota
c53275d3fb Bump version to 1.0.4 2020-07-03 05:08:52 -04:00
elasota
8d58d22731 Add build version 2020-07-03 05:05:12 -04:00
elasota
58ad634085 Re-add clipboard functions 2020-07-03 04:59:40 -04:00
elasota
00ea1b2982 Fix invert image draw not working correctly if the image is partially out of bounds (happens when moving a tiki torch in the editor) 2020-07-03 04:18:08 -04:00
elasota
87bab26d47 Add home/end key support to edit box 2020-07-03 04:08:09 -04:00
elasota
3dbb231c5a Add edit box automatic scrolling 2020-07-03 04:00:25 -04:00
elasota
a2e8d414e8 Fix typing sound not working with forward delete 2020-07-03 03:16:42 -04:00
elasota
137f00b657 Fixed selection drawing out of bounds in multi-line editbox 2020-07-03 03:05:25 -04:00
elasota
7fec622e51 Add forward delete to editbox 2020-07-03 03:02:43 -04:00
elasota
05604e5604 Add API for saving driver prefs. Save fullscreen state in D3D11 driver. 2020-07-03 02:46:43 -04:00
elasota
ed9e0fec97 Update readme 2020-07-03 02:45:41 -04:00
elasota
82b93c627e Save house after opening so it doesn't throw an IO error if the user quits immediately. 2020-06-20 02:16:43 -04:00
elasota
c204b5ef7f Fix debug compile failure 2020-06-20 02:09:32 -04:00
elasota
343a8a0f04 Bump build version to 1.0.3 2020-06-20 02:08:35 -04:00
elasota
9d5adb9bb6 Remove port state, fix background not darkening in room editor 2020-06-20 02:08:22 -04:00
elasota
3bf689664f Default menu bar color to black 2020-06-20 01:46:38 -04:00
elasota
ccb7dd2edb Remove unused var 2020-06-20 01:46:27 -04:00
elasota
20acb4ef6b Bump prefs version 2020-06-20 01:33:47 -04:00
elasota
3c662845b4 Add option to enable or disable auto-scale 2020-06-20 01:33:26 -04:00
elasota
1981320afe Add support for 16-bit, stereo, and MACE 3:1 sound import. 2020-06-20 01:03:41 -04:00
elasota
1c15ea5940 Update project readme 2020-06-13 05:32:27 -04:00
elasota
4920781619 32-bit color support 2020-06-13 04:33:41 -04:00
elasota
24f43b973a Fix build timestamp 2020-06-07 22:17:02 -04:00
elasota
649d78a61b Tag release 1.0.1 2020-06-07 21:05:08 -04:00
elasota
836fc95f4a EOL fix 2020-06-07 20:45:30 -04:00
elasota
5b95fd8c6b Use Apple RGB color profile 2020-06-07 20:42:49 -04:00
elasota
b55a508686 Use error diffusion for 24-to-8 picture draws 2020-06-07 20:42:07 -04:00
elasota
47291cbf1d Support custom pause and banner graphics 2020-06-07 19:36:53 -04:00
elasota
01e6ff4f5d Fix >16bpp images emitting color table data, causing image corruption, especially in 24bpp images 2020-06-07 17:45:29 -04:00
elasota
d828eacd38 Clean "Packaged" dir when converting resources 2020-06-07 17:20:21 -04:00
elasota
b37b0a4f8a Add MACE 6:1 decompression to fix some missing audio samples, parallelize deflate compression 2020-06-07 17:18:04 -04:00
elasota
4c3ccbd7fa Only copy PDBs that are actually in the release package 2020-06-06 02:32:05 -04:00
elasota
9624c283c8 Updated version tagging and added about dialog 2020-06-06 02:25:10 -04:00
elasota
cfb66d9c9b Fix res patch file adding not working 2020-06-06 01:49:54 -04:00
elasota
c185c8d9ec Fix filters 2020-06-05 23:33:58 -04:00
elasota
7636fd6fa8 Remove unused file 2020-06-05 23:25:08 -04:00
elasota
6c48debecd Code cleanup 2020-06-05 23:21:56 -04:00
elasota
3f55eedcf0 Remove unused header 2020-06-05 23:19:47 -04:00
elasota
856c7d5297 Remove unused header 2020-06-05 22:17:35 -04:00
elasota
d7301402c5 Fix broken release script 2020-06-04 17:26:02 -04:00
elasota
2a98bfbc8c Remove AppleEvents API 2020-06-02 20:01:16 -04:00
elasota
eac923c475 Refactoring 2020-06-01 00:38:24 -04:00
elasota
6fe0f2d964 API refactoring 2020-06-01 00:33:50 -04:00
elasota
a4abb0d95f Use XAudio 2.9 redistributable instead of 2.9 SDK. Should fix Win7 compatibility. 2020-05-31 21:19:51 -04:00
elasota
c856607f46 Fixed some documentation issues 2020-05-29 22:03:13 -04:00
elasota
611f53ef91 Fix audio driver starting in debug mode, add -diagnostics mode 2020-05-29 21:56:33 -04:00
elasota
98afd82d64 Fix missing NDEBUG flags 2020-05-29 01:45:40 -04:00
elasota
efae9cacd8 Add PDB directory to release script 2020-05-29 00:00:11 -04:00
elasota
5184d1594f Fix comment typo 2020-05-28 23:10:30 -04:00
elasota
42e124a90c Fix crash if audio init fails (especially if there are no output devices) 2020-05-28 23:05:32 -04:00
elasota
11628ddd93 Fix link crash 2020-05-27 18:06:22 -04:00
elasota
7d5f844fd4 Fix bad usage formatting 2020-05-27 18:06:12 -04:00
179 changed files with 5387 additions and 1567 deletions

5
.gitignore vendored
View File

@@ -28,6 +28,9 @@ InstallerPackages/*
*.msi
*.wixpdb
*.wixobj
*.CopyComplete
ReleasePackageInstaller/obj/*
ReleasePackageInstaller/bin/*
ReleasePackageInstaller/AerofoilPackageDefs.wxi
ReleasePackageInstaller/AerofoilPackageDefs.wxi
ReleasePackageInstaller/AerofoilPackageVersion.wxi
packages/*

View File

@@ -27,4 +27,10 @@ Distributed under zlib license (See zlib/README)
The Unarchiver:
Copyright (C) 2006-2013 Dag Ågren
Distributed under the LGPLv2 license (See unpacktool/LICENSE.txt)
Distributed under the LGPLv2 license (See unpacktool/LICENSE.txt)
MACE Audio decoder:
Copyright (c) 2002 Laszlo Torok <torokl@alpha.dfmk.hu>
Distributed under the LGPLv2 license (See macedec.cpp comments)

View File

@@ -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

View File

@@ -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" />
@@ -169,12 +170,15 @@
<ClInclude Include="..\GpCommon\EGpInputDriverType.h" />
<ClInclude Include="..\GpCommon\EGpStandardCursor.h" />
<ClInclude Include="..\GpCommon\GpApplicationName.h" />
<ClInclude Include="..\GpCommon\GpBuildVersion.h" />
<ClInclude Include="..\GpCommon\GpDisplayDriverTickStatus.h" />
<ClInclude Include="..\GpCommon\GpFileCreationDisposition.h" />
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h" />
<ClInclude Include="..\GpCommon\IGpCursor.h" />
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h" />
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h" />
<ClInclude Include="..\GpCommon\IGpLogDriver.h" />
<ClInclude Include="..\GpCommon\IGpPrefsHandler.h" />
<ClInclude Include="GpAppEnvironment.h" />
<ClInclude Include="GpAudioDriverFactory.h" />
<ClInclude Include="GpDisplayDriverFactory.h" />
@@ -185,6 +189,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" />

View File

@@ -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,18 @@
<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>
<ClInclude Include="..\GpCommon\IGpPrefsHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\GpBuildVersion.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="ConvertedResources\Large128.ico">

View File

@@ -142,6 +142,7 @@ void GpAppEnvironment::InitializeApplicationState()
{
GpAppInterface_Get()->PL_HostDisplayDriver_SetInstance(m_displayDriver);
GpAppInterface_Get()->PL_HostAudioDriver_SetInstance(m_audioDriver);
GpAppInterface_Get()->PL_HostInputDriver_SetInstances(m_inputDrivers, m_numInputDrivers);
GpAppInterface_Get()->PL_InstallHostSuspendHook(GpAppEnvironment::StaticSuspendHookFunc, this);
GpAppInterface_Get()->PL_HostFontHandler_SetInstance(m_fontHandler);

View File

@@ -142,3 +142,8 @@ void GpFileStream_Win32::Close()
{
CloseHandle(m_handle);
}
void GpFileStream_Win32::Flush()
{
FlushFileBuffers(m_handle);
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
};

View 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;

View 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;
};

View File

@@ -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));

View File

@@ -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;
@@ -411,6 +429,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
g_gpWindowsGlobals.m_translateWindowsMessageFunc = TranslateWindowsMessage;
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_D3D11;
g_gpGlobalConfig.m_audioDriverType = EGpAudioDriverType_XAudio2;
EGpInputDriverType inputDrivers[] =
@@ -422,10 +441,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;
}

View File

@@ -65,10 +65,42 @@
"id" : 0,
"enabled" : false
},
{
"name" : "32-bit color (Requires restart)",
"itemType" : "CheckBox",
"pos" : [ 8, 85 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Scale to fit window",
"itemType" : "CheckBox",
"pos" : [ 8, 105 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Simulate Apple RGB monitor",
"itemType" : "CheckBox",
"pos" : [ 8, 125 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Beautiful opening color fade",
"itemType" : "CheckBox",
"pos" : [ 8, 142 ],
"pos" : [ 8, 152 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Full screen mode",
"itemType" : "CheckBox",
"pos" : [ 8, 172 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
@@ -76,7 +108,7 @@
{
"name" : "",
"itemType" : "UserItem",
"pos" : [ 8, 137 ],
"pos" : [ 8, 147 ],
"size" : [ 317, 1 ],
"id" : 0,
"enabled" : false

View File

@@ -0,0 +1,13 @@
{
"items" :
[
{
"name" : "Okay",
"itemType" : "Button",
"pos" : [ 376, 240 ],
"size" : [ 58, 20 ],
"id" : 1,
"enabled" : true
}
]
}

View File

@@ -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" :
[

View File

@@ -19,6 +19,11 @@ const D3D_SHADER_MACRO drawQuadDefs[] =
{ nullptr }
};
const D3D_SHADER_MACRO drawQuadICCProfileDefs[] =
{
{ "USE_ICC_PROFILE", nullptr }
};
const CompileJob kCompileJobs[] =
{
{
@@ -37,6 +42,14 @@ const CompileJob kCompileJobs[] =
"PSMain",
"ps_4_0"
},
{
L"ShaderSrc\\DrawQuadRGBP.hlsl",
L"GpDisplayDriver_D3D11\\CompiledShaders\\DrawQuadRGBP_ICC_D3D11.cpp",
"g_drawQuadRGBICCP_D3D11",
drawQuadICCProfileDefs,
"PSMain",
"ps_4_0"
},
{
L"ShaderSrc\\DrawQuadPaletteP.hlsl",
L"GpDisplayDriver_D3D11\\CompiledShaders\\DrawQuadPaletteP_D3D11.cpp",
@@ -45,6 +58,14 @@ const CompileJob kCompileJobs[] =
"PSMain",
"ps_4_0"
},
{
L"ShaderSrc\\DrawQuadPaletteP.hlsl",
L"GpDisplayDriver_D3D11\\CompiledShaders\\DrawQuadPaletteP_ICC_D3D11.cpp",
"g_drawQuadPaletteICCP_D3D11",
drawQuadICCProfileDefs,
"PSMain",
"ps_4_0"
},
{
L"ShaderSrc\\DrawQuad15BitP.hlsl",
L"GpDisplayDriver_D3D11\\CompiledShaders\\DrawQuad15BitP_D3D11.cpp",
@@ -53,6 +74,14 @@ const CompileJob kCompileJobs[] =
"PSMain",
"ps_4_0"
},
{
L"ShaderSrc\\DrawQuad15BitP.hlsl",
L"GpDisplayDriver_D3D11\\CompiledShaders\\DrawQuad15BitP_ICC_D3D11.cpp",
"g_drawQuad15BitICCP_D3D11",
drawQuadICCProfileDefs,
"PSMain",
"ps_4_0"
},
{
L"ShaderSrc\\ScaleQuadP.hlsl",
L"GpDisplayDriver_D3D11\\CompiledShaders\\ScaleQuadP_D3D11.cpp",

View File

@@ -1,3 +1,5 @@
rmdir /S /Q Packaged
mkdir Packaged
mkdir Packaged\Houses
mkdir Packaged\WinCursors

View File

@@ -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.

View File

@@ -26,7 +26,36 @@ LEGAL NOTICES
-------------------------------------------------------------------------------
Aerofoil is (c)2019-2020 Eric Lasota
Based on Glider PRO (c)1994-2000 Casady & Greene, Inc., written by John Calhoun
Distributed under the terms of the GNU General Public License version 2 (see license_gplv2.txt)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
A copy of the license is included in the accompanying license_gplv2.txt file.
ADDITIONAL CREDITS
-------------------------------------------------------------------------------
* Demo House and CD Demo House are by John Calhoun and Kim Money.
* Davis Station, Metropolis and Titanic are by Jonathan Chin (alias Paul Finn) and John Calhoun.
* Grand Prix, Leviathan, ImagineHouse PRO II and In The Mirror are by Jonathan Chin (alias Paul Finn).
* Land of Illusion, Nemo's Market, Rainbow's End and SpacePods are by Ward Hartenstein.
* Slumberland is by John Calhoun (first house and top of fourth house) Jonathan Chin (second house), Steve Sullivan (third house) and Ward Hartenstein (bottom of fourth house).
* Teddy World is by Shawn Brenneman.
* The Asylum Pro is by Steve Sullivan.
* PICT resource 3975 (Ozma) is derived from an illustration by John R. Neill from [Ozma of Oz](https://www.gutenberg.org/files/33361/33361-h/33361-h.htm).
* PICT resource 153 (About box) features a portion of [this Little Nemo comic](http://www.comicstriplibrary.org/display/116) by Winsor McCay.
Aerofoil uses the following third-party software:
@@ -90,3 +119,11 @@ The "unpacktool" utility is heavily based on code from The Unarchiver.
Copyright (C) 2006-2013 Dag Ågren
Distributed under the LGPLv2 license (See license_lgplv2.txt)
FFmpeg:
The "gpr2gpa" tool uses MACE decompression code from FFmpeg.
Copyright (c) 2002 Laszlo Torok <torokl@alpha.dfmk.hu>
Distributed under the LGPLv2 license (See license_lgplv2.txt)

View 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;
}

View 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>

View 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>

View File

@@ -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: " __DATE__ " " __TIME__ " " 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;
}

View File

@@ -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);
}

View File

@@ -62,17 +62,17 @@ void DrawBanner (Point *topLeft)
topLeft->v = wholePage.top;
partPage = wholePage;
partPage.bottom = partPage.top + 190;
LoadScaledGraphic(workSrcMap, kBannerPageTopPICT, &partPage);
LoadScaledGraphicCustom(workSrcMap, kBannerPageTopPICT, &partPage);
partPage = wholePage;
partPage.top = partPage.bottom - 30;
mapBounds = partPage;
ZeroRectCorner(&mapBounds);
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds, kPreferredPixelFormat);
LoadGraphic(tempMap, kBannerPageBottomPICT);
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds);
LoadGraphicCustom(tempMap, kBannerPageBottomPICT);
theErr = CreateOffScreenGWorld(&tempMask, &mapBounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kBannerPageBottomMask);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &mapBounds, GpPixelFormats::kBW1);
LoadGraphicCustom(tempMask, kBannerPageBottomMask);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
(BitMap *)*GetGWorldPixMap(tempMask),
@@ -116,10 +116,6 @@ void DrawBannerMessage (Point topLeft)
Str255 bannerStr, subStr;
short count;
DrawSurface *wasGWorld = GetGraphicsPort();
SetGraphicsPort(workSrcMap);
PasStringCopy((*thisHouse)->banner, bannerStr);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
@@ -157,8 +153,6 @@ void DrawBannerMessage (Point topLeft)
GetLocalizedString(5, subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, redColor, appFont);
}
SetGraphicsPort(wasGWorld);
}
//-------------------------------------------------------------- BringUpBanner
@@ -172,7 +166,7 @@ void BringUpBanner (void)
DrawBanner(&topLeft);
DrawBannerMessage(topLeft);
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
// if (quickerTransitions)
// DissBitsChunky(&justRoomsRect); // was workSrcRect
@@ -232,10 +226,10 @@ void DisplayStarsRemaining(void)
NumToString((long)numStarsRemaining, theStr);
if (numStarsRemaining < 2)
LoadScaledGraphic(surface, kStarRemainingPICT, &bounds);
LoadScaledGraphicCustom(surface, kStarRemainingPICT, &bounds);
else
{
LoadScaledGraphic(surface, kStarsRemainingPICT, &bounds);
LoadScaledGraphicCustom(surface, kStarsRemainingPICT, &bounds);
const Point textPoint = Point::Create(bounds.left + 102 - (appFont->MeasurePStr(theStr) / 2), bounds.top + 23);
ColorText(surface, textPoint, theStr, 4L, appFont);
}

View File

@@ -39,7 +39,6 @@ void BringUpDialog (Dialog **theDialog, short dialogID, const DialogTextSubstitu
// CenterDialog(dialogID);
if (*theDialog == nil)
RedAlert(kErrDialogDidntLoad);
SetGraphicsPort((*theDialog)->GetWindow()->GetDrawSurface());
ShowWindow((*theDialog)->GetWindow());
DrawDefaultButton(*theDialog);
}

View File

@@ -82,7 +82,7 @@ short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 componen
ZeroRectCorner(&mapRect);
savedMaps[numSavedMaps].dest = *theRect;
// CreateOffScreenPixMap(&mapRect, &savedMaps[numSavedMaps].map);
theErr = CreateOffScreenGWorld(&savedMaps[numSavedMaps].map, &mapRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&savedMaps[numSavedMaps].map, &mapRect);
CopyBits((BitMap *)*GetGWorldPixMap(backSrcMap),
GetPortBitMapForCopyBits(savedMaps[numSavedMaps].map),

View File

@@ -31,6 +31,8 @@
#define kDisplay12Inch 2
#define kDisplay13Inch 3
extern Boolean isAutoScale, isUseICCProfile;
typedef struct
{
@@ -207,30 +209,6 @@ Boolean DoWeHaveDragManager (void)
return true;
}
//-------------------------------------------------------------- WhatsOurDepth
// Determines the pixel bit depth for current device (monitor).
short WhatsOurDepth (void)
{
GpPixelFormat_t pixelFormat;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nil, nil, &pixelFormat);
switch (pixelFormat)
{
case GpPixelFormats::k8BitCustom:
case GpPixelFormats::k8BitStandard:
return 8;
case GpPixelFormats::kRGB555:
return 16;
case GpPixelFormats::kRGB24:
case GpPixelFormats::kRGB32:
return 32;
default:
return 0;
}
}
void SwitchToDepth (short, Boolean)
{
}
@@ -321,9 +299,6 @@ void CheckOurEnvirons (void)
thisMac.can4Bit = true;
thisMac.can8Bit = true;
thisMac.numScreens = HowManyUsableScreens(false, true, true);
thisMac.wasDepth = WhatsOurDepth();
thisMac.wasColorOrGray = AreWeColorOrGrayscale();
thisMac.isResolutionDirty = true;
FlushResolutionChange();
@@ -354,15 +329,20 @@ public:
if (physicalHeight < 480)
physicalHeight = 480;
double xMul = static_cast<double>(physicalWidth) / 640;
double yMul = static_cast<double>(physicalHeight) / 480;
double minMul = 1.0;
double granularity = 2.0;
if (isAutoScale)
{
double xMul = static_cast<double>(physicalWidth) / 640.0;
double yMul = static_cast<double>(physicalHeight) / 480.0;
xMul = floor(xMul * granularity) / granularity;
yMul = floor(yMul * granularity) / granularity;
double granularity = 2.0;
double minMul = std::max<double>(1.0, std::min(xMul, yMul));
xMul = floor(xMul * granularity) / granularity;
yMul = floor(yMul * granularity) / granularity;
minMul = std::max<double>(1.0, std::min(xMul, yMul));
}
virtualWidth = physicalWidth / minMul;
virtualHeight = physicalHeight / minMul;
@@ -417,53 +397,23 @@ void ReflectSecondMonitorEnvirons (Boolean use1Bit, Boolean use4Bit, Boolean use
void HandleDepthSwitching (void)
{
if (thisMac.hasColor)
switch (isDepthPref)
{
switch (isDepthPref)
{
case kSwitchIfNeeded:
if ((thisMac.wasDepth != 8) &&
((thisMac.wasDepth != 4) || (thisMac.wasColorOrGray)))
SwitchDepthOrAbort();
break;
case kSwitchTo256Colors:
if (thisMac.wasDepth != 8)
{
if (thisMac.can8Bit)
SwitchToDepth(8, true);
else
SwitchDepthOrAbort();
}
break;
case kSwitchTo16Grays:
if ((thisMac.wasDepth != 4) || (thisMac.wasColorOrGray))
{
if (thisMac.can4Bit)
SwitchToDepth(4, false);
else
SwitchDepthOrAbort();
}
break;
default:
break;
}
case 32:
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::kRGB32);
break;
case 8:
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::k8BitStandard);
break;
default:
isDepthPref = 8;
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::k8BitStandard);
break;
}
thisMac.isDepth = WhatsOurDepth();
}
//-------------------------------------------------------------- RestoreColorDepth
thisMac.isDepth = isDepthPref;
// Restores a monitor to its previous depth when we quit (if we changed it).
void RestoreColorDepth (void)
{
if ((thisMac.hasColor) && ((thisMac.wasDepth != thisMac.isDepth) ||
(thisMac.wasColorOrGray != AreWeColorOrGrayscale())))
SwitchToDepth(thisMac.wasDepth, true);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetUseICCProfile(isUseICCProfile != 0);
}
//-------------------------------------------------------------- CheckMemorySize
@@ -574,7 +524,7 @@ void GetDeviceRect(Rect *rect)
{
unsigned int width;
unsigned int height;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&width, &height, nil);
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&width, &height);
SetRect(rect, 0, 0, static_cast<short>(width), static_cast<short>(height));
}

View File

@@ -12,7 +12,7 @@ typedef struct
{
Rect fullScreen, constrainedScreen, gray;
long dirID;
short wasDepth, isDepth;
short isDepth;
short numScreens;
short vRefNum;
Boolean can1Bit;

View File

@@ -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"
@@ -39,7 +37,6 @@ short idleMode;
Boolean doAutoDemo, switchedOut;
extern WindowPtr mapWindow, toolsWindow, linkWindow;
extern WindowPtr menuWindow;
extern short isEditH, isEditV, isMapH, isMapV, isToolsH, isToolsV;
extern short isLinkH, isLinkV, isCoordH, isCoordV;
extern Boolean quitting, isMusicOn, failedMusic;
@@ -387,7 +384,6 @@ void HandleIdleTask (void)
HandleEditorResolutionChange();
}
SetPort(mainWindow->GetDrawSurface());
DoMarquee();
if ((autoRoomEdit) && (newRoomNow))

View File

@@ -21,10 +21,6 @@ namespace PortabilityLayer
class RenderedFont;
}
#define kPreferredDepth 8
#define kPreferredPixelFormat (GpPixelFormats::k8BitStandard)
#define kNilPointer 0L
#define kPutInFront (PL_GetPutInFrontWindowPtr())
#define kNormalUpdates TRUE
@@ -51,6 +47,7 @@ namespace PortabilityLayer
#define kErrNeed16Or256Colors 13
#define iAbout 1
#define iAboutAerofoil 3
#define iNewGame 1
#define iTwoPlayer 2
#define iOpenSavedGame 3
@@ -99,7 +96,6 @@ typedef struct
long wasGPFlipMap;
long wasGPFaceLeftMap, wasGPFaceRightMap;
short wasVolume;
short prefVersion;
short wasMaxFiles;
short wasEditH, wasEditV;
short wasMapH, wasMapV;
@@ -119,14 +115,16 @@ typedef struct
Boolean wasCoordOpen, wasQuickTrans;
Boolean wasIdleMusic, wasGameMusic;
Boolean wasEscPauseKey;
Boolean wasDoAutoDemo, wasScreen2;
Boolean wasDoAutoDemo, wasAutoScale;
Boolean wasDoBackground, wasHouseChecks;
Boolean wasPrettyMap, wasBitchDialogs;
Boolean wasUseICCProfile;
} prefsInfo;
//-------------------------------------------------------------- Prototypes
void DoAbout (void); // --- About.c
void DoAboutFramework (void);
void LoadCursors (void); // --- AnimCursor.c
void DisposCursors (void);
@@ -166,22 +164,21 @@ void DumpToResEditFile (Ptr, long);
void HandleEvent (void); // --- Event.c
void IgnoreThisClick (void);
short WhatsOurDepth (void); // --- Environs.c
void SwitchToDepth (short, Boolean);
void SwitchToDepth (short, Boolean); // --- Environs.c
void CheckOurEnvirons (void);
void InstallResolutionHandler (void);
//void ReflectSecondMonitorEnvirons (Boolean, Boolean, Boolean);
void HandleDepthSwitching (void);
void RestoreColorDepth (void);
void CheckMemorySize (void);
void SetAppMemorySize (long);
Boolean CheckFileError (short, const PLPasStr &); // --- File Error.c
THandle<void> LoadHouseResource(const PortabilityLayer::ResTypeID &resTypeID, int16_t resID); // --- HouseIO.c
Boolean SavePrefs (prefsInfo *, short); // --- Prefs.c
Boolean LoadPrefs (prefsInfo *, short);
Boolean SavePrefs (prefsInfo *, THandle<void> *modulePrefs, short); // --- Prefs.c
Boolean LoadPrefs (prefsInfo *, THandle<void> *modulePrefs, short);
Boolean SaveModulePrefs (THandle<void> currentModulePrefs, THandle<void> *outModulePrefs);
Boolean ApplyModulePrefs (THandle<void> *modulePrefs);
void PasStringCopy (StringPtr, StringPtr); // --- StringUtils.c
short WhichStringFirst (StringPtr, StringPtr);
@@ -235,6 +232,8 @@ void CloseThisWindow (WindowPtr *);
#endif
extern Boolean hasScrap, scrapIsARoom;
#include "GliderDefines.h"
#include "GliderStructs.h"
#include "GliderVars.h"

View File

@@ -7,7 +7,6 @@
#include "PLDialogs.h"
#include "PLNumberFormatting.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "DialogManager.h"
#include "Externs.h"

View File

@@ -5,7 +5,6 @@
//============================================================================
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "PLEventQueue.h"
#include "PLKeyEncoding.h"
@@ -71,7 +70,6 @@ void DoGameOver (void)
DrawSurface *surface = mainWindow->GetDrawSurface();
playing = false;
SetUpFinalScreen();
SetPort(mainWindow->GetDrawSurface());
ColorRect(surface, mainWindowRect, 244);
DoGameOverStarAnimation();
if (!TestHighScore())
@@ -163,7 +161,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;
@@ -279,14 +277,14 @@ void InitDiedGameOver (void)
PLError_t theErr;
QSetRect(&pageSrcRect, 0, 0, 25, 32 * 8);
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect);
LoadGraphic(gameOverSrcMap, kLettersPictID);
QSetRect(&pageSrcRect, 0, 0, 32, 32 * kPageFrames);
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect);
LoadGraphic(pageSrcMap, kPagesPictID);
theErr = CreateOffScreenGWorld(&pageMaskMap, &pageSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&pageMaskMap, &pageSrcRect, GpPixelFormats::kBW1);
LoadGraphic(pageMaskMap, kPagesMaskID);
for (i = 0; i < kPageFrames; i++) // initialize src page rects
@@ -465,7 +463,7 @@ void DoDiedGameOver (void)
InitDiedGameOver();
CopyRectMainToWork(&workSrcRect);
CopyRectMainToBack(&workSrcRect);
FlushEvents(everyEvent, 0);
FlushEvents();
nextLoop = TickCount() + 2;
while (pagesStuck < 8)

View File

@@ -41,8 +41,6 @@
#define kYellowCantOrderLinks 24
#define kSwitchIfNeeded 0
#define kSwitchTo256Colors 1
#define kSwitchTo16Grays 2
#define kProdGameScoreMode -4
#define kKickGameScoreMode -3

View File

@@ -435,8 +435,8 @@ void QuickBandsRefresh (Boolean);
void QuickFoilRefresh (Boolean);
void HandleScore (void);
//void PutRoomScrap (void); // --- Scrap.c
//void PutObjectScrap (void);
void PutRoomScrap (void); // --- Scrap.c
void PutObjectScrap (void);
void GetRoomScrap (void);
void GetObjectScrap (void);
//void SeeIfValidScrapAvailable (Boolean);
@@ -498,7 +498,7 @@ void FollowTheLeader (void);
void PourScreenOn (Rect *); // --- Transitions.c
void WipeScreenOn (SInt16, Rect *);
void DumpScreenOn (Rect *);
void DumpScreenOn (Rect *, Boolean);
//void DissBits (Rect *);
//void DissBitsChunky (Rect *);
//void FillColorNoise (Rect *);

View File

@@ -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" />
@@ -184,6 +185,7 @@
<ClCompile Include="RubberBands.cpp" />
<ClCompile Include="SavedGames.cpp" />
<ClCompile Include="Scoreboard.cpp" />
<ClCompile Include="Scrap.cpp" />
<ClCompile Include="SelectHouse.cpp" />
<ClCompile Include="Settings.cpp" />
<ClCompile Include="Sound.cpp" />

View File

@@ -213,6 +213,9 @@
<ClCompile Include="SoundSync_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Scrap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="SoundSync.h">

View File

@@ -5,7 +5,9 @@
#include "HostFileSystem.h"
#include "HostFontHandler.h"
#include "HostDisplayDriver.h"
#include "HostLogDriver.h"
#include "HostSystemServices.h"
#include "HostInputDriver.h"
#include "HostVOSEventQueue.h"
#include "MenuManager.h"
#include "WindowManager.h"
@@ -20,8 +22,10 @@ public:
void PL_Render(IGpDisplayDriver *displayDriver) override;
void PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance) override;
void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) override;
void PL_HostInputDriver_SetInstances(IGpInputDriver *const* instances, size_t numInstances) 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 +59,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);
@@ -65,6 +74,11 @@ void GpAppInterfaceImpl::PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance
PortabilityLayer::HostAudioDriver::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostInputDriver_SetInstances(IGpInputDriver *const* instances, size_t numInstances)
{
PortabilityLayer::HostInputDriver::SetInstances(instances, numInstances);
}
void GpAppInterfaceImpl::PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance)
{
PortabilityLayer::HostFontHandler::SetInstance(instance);

View File

@@ -270,7 +270,6 @@ void SpillGrease (short who, short index)
void RedrawAllGrease (void)
{
DrawSurface *wasCPort;
Rect src;
short i;
@@ -291,14 +290,10 @@ void RedrawAllGrease (void)
QOffsetRect(&src, playOriginH, playOriginV);
wasCPort = GetGraphicsPort();
backSrcMap->FillRect(src, blackColorBack);
workSrcMap->FillRect(src, blackColorWork);
AddRectToWorkRects(&src);
SetGraphicsPort(wasCPort);
}
}
}

View File

@@ -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"
@@ -74,7 +73,6 @@ void DoHighScores (void)
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
SpinCursor(3);
SetPort(workSrcMap);
workSrcMap->FillRect(workSrcRect, blackColor);
QSetRect(&tempRect, 0, 0, 640, 480);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
@@ -84,13 +82,13 @@ void DoHighScores (void)
// else
// DissBits(&workSrcRect);
DumpScreenOn(&workSrcRect);
DumpScreenOn(&workSrcRect, false);
SpinCursor(3);
DrawHighScores(workSrcMap);
DumpScreenOn(&workSrcRect);
DumpScreenOn(&workSrcRect, false);
SpinCursor(3);
// if (quickerTransitions)
@@ -132,10 +130,10 @@ void DrawHighScores (DrawSurface *surface)
dropIt = 129 + splashOriginV;
QSetRect(&tempRect, 0, 0, 332, 30);
theErr = CreateOffScreenGWorld(&tempMap, &tempRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &tempRect);
LoadGraphic(tempMap, kHighScoresPictID);
theErr = CreateOffScreenGWorld(&tempMask, &tempRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &tempRect, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kHighScoresMaskID);
tempRect2 = tempRect;
@@ -397,7 +395,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)
@@ -434,6 +432,32 @@ void UpdateNameDialog (Dialog *theDialog)
SetDialogNumToStr(theDialog, kNameNCharsItem, (long)nChars);
}
//-------------------------------------------------------------- EventIsTyping
// Checks if a keyboard event should make a typing sound
static bool EventIsTyping(const GpKeyboardInputEvent &kbEvent)
{
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
{
// Duplicate backspace event
if (kbEvent.m_keyIDSubset == GpKeyIDSubsets::kASCII && kbEvent.m_key.m_asciiChar == '\b')
return false;
return true;
}
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDown || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAuto)
{
if (kbEvent.m_keyIDSubset == GpKeyIDSubsets::kSpecial)
{
if (kbEvent.m_key.m_specialKey == GpKeySpecials::kBackspace || kbEvent.m_key.m_specialKey == GpKeySpecials::kDelete)
return true;
}
}
return false;
}
//-------------------------------------------------------------- NameFilter
// Dialog filter for the "Enter High Score Name" dialog.
@@ -455,7 +479,7 @@ int16_t NameFilter (Dialog *dial, const TimeTaggedVOSEvent *evt)
{
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
if (EventIsTyping(kbEvent))
{
PlayPrioritySound(kTypingSound, kTypingPriority);
keyStroke = true;
@@ -503,7 +527,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;
@@ -570,7 +594,7 @@ int16_t BannerFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
{
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
if (EventIsTyping(kbEvent))
{
PlayPrioritySound(kTypingSound, kTypingPriority);
keyStroke = true;

View File

@@ -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;

View File

@@ -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"
@@ -669,7 +668,6 @@ Boolean ReadHouse (void)
numberRooms = 0;
noRoomAtAll = true;
YellowAlert(kYellowNoRooms, 0);
return(false);
}
wasHouseVersion = (*thisHouse)->version;

View File

@@ -231,7 +231,6 @@ void DoHouseInfo (void)
houseInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kHouseInfoDialogID, kPutInFront, &substitutions);
if (houseInfoDialog == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(houseInfoDialog->GetWindow()->GetDrawSurface());
ShowWindow(houseInfoDialog->GetWindow());
static_cast<PortabilityLayer::EditboxWidget*>(houseInfoDialog->GetItems()[kBannerTextItem - 1].GetWidget())->SetMultiLine(true);

View File

@@ -5,7 +5,6 @@
//============================================================================
#include "PLToolUtils.h"
#include "PLDialogs.h"
#include "PLKeyEncoding.h"
#include "DialogManager.h"
@@ -89,9 +88,9 @@ void DoPause (void)
QSetRect(&bounds, 0, 0, 214, 54);
CenterRectInRect(&bounds, &houseRect);
if (isEscPauseKey)
LoadScaledGraphic(surface, kEscPausePictID, &bounds);
LoadScaledGraphicCustom(surface, kEscPausePictID, &bounds);
else
LoadScaledGraphic(surface, kTabPausePictID, &bounds);
LoadScaledGraphicCustom(surface, kTabPausePictID, &bounds);
const KeyDownStates *theKeys = nullptr;
@@ -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)

View File

@@ -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);
@@ -154,7 +157,7 @@ void VariableInit (void)
paused = false;
hasMirror = false;
demoGoing = false;
// scrapIsARoom = true;
scrapIsARoom = true;
splashDrawn = false;
#ifndef COMPILEDEMO

View File

@@ -205,7 +205,6 @@ void UpdateLinkWindow (void)
if (linkWindow == nil)
return;
SetPortWindowPort(linkWindow);
UpdateLinkControl();
#endif
}
@@ -244,12 +243,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();
@@ -378,7 +378,6 @@ void HandleLinkClick (Point wherePt)
if (linkWindow == nil)
return;
SetPortWindowPort(linkWindow);
wherePt -= linkWindow->GetTopLeftCoord();
part = FindControl(wherePt, linkWindow, &theControl);

View File

@@ -10,12 +10,14 @@
#include "PLKeyEncoding.h"
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "IOStream.h"
#include "House.h"
#include "WindowManager.h"
#define kPrefsVersion 0x0035
#define kPrefsVersion 0x0038
void ReadInPrefs (void);
@@ -25,7 +27,7 @@ int main(int argc, const char **argv);
short isVolume, wasVolume;
short isDepthPref, dataResFile, numSMWarnings;
Boolean quitting, doZooms, quickerTransitions, isUseSecondScreen;
Boolean quitting, doZooms, quickerTransitions, isAutoScale, isUseICCProfile;
extern Str31 highBanner;
@@ -45,6 +47,8 @@ extern Boolean isMapOpen, isToolsOpen, isCoordOpen;
extern Boolean doPrettyMap, doBitchDialogs;
//extern Boolean didValidation;
THandle<void> globalModulePrefs;
//============================================================== Functions
//-------------------------------------------------------------- ReadInPrefs
@@ -55,8 +59,10 @@ extern Boolean doPrettyMap, doBitchDialogs;
void ReadInPrefs (void)
{
prefsInfo thePrefs;
THandle<void> modulePrefs;
if (LoadPrefs(&thePrefs, kPrefsVersion))
if (LoadPrefs(&thePrefs, &modulePrefs, kPrefsVersion))
{
#ifdef COMPILEDEMO
PasStringCopy("\pDemo House", thisHouseName);
@@ -122,12 +128,18 @@ void ReadInPrefs (void)
toolMode = thePrefs.wasToolGroup;
doAutoDemo = thePrefs.wasDoAutoDemo;
isEscPauseKey = thePrefs.wasEscPauseKey;
isUseSecondScreen = thePrefs.wasScreen2;
if (thisMac.numScreens < 2)
isUseSecondScreen = false;
isAutoScale = thePrefs.wasAutoScale;
isUseICCProfile = thePrefs.wasUseICCProfile;
doBackground = thePrefs.wasDoBackground;
doPrettyMap = thePrefs.wasPrettyMap;
doBitchDialogs = thePrefs.wasBitchDialogs;
if (modulePrefs)
ApplyModulePrefs(&modulePrefs);
globalModulePrefs.Dispose();
globalModulePrefs = modulePrefs;
modulePrefs = nullptr;
}
else
{
@@ -199,10 +211,17 @@ void ReadInPrefs (void)
toolMode = kBlowerMode;
doAutoDemo = true;
isEscPauseKey = false;
isUseSecondScreen = false;
isAutoScale = true;
isUseICCProfile = true;
doBackground = false;
doPrettyMap = false;
doBitchDialogs = true;
IGpDisplayDriver *displayDriver = PortabilityLayer::HostDisplayDriver::GetInstance();
if (!displayDriver->IsFullScreen())
displayDriver->RequestToggleFullScreen(0);
modulePrefs.Dispose();
}
if ((numNeighbors > 1) && (thisMac.constrainedScreen.right <= 512))
@@ -291,13 +310,18 @@ void WriteOutPrefs (void)
thePrefs.wasToolGroup = toolMode;
thePrefs.wasDoAutoDemo = doAutoDemo;
thePrefs.wasEscPauseKey = isEscPauseKey;
thePrefs.wasScreen2 = isUseSecondScreen;
thePrefs.wasAutoScale = isAutoScale;
thePrefs.wasUseICCProfile = isUseICCProfile;
thePrefs.wasDoBackground = doBackground;
thePrefs.wasPrettyMap = doPrettyMap;
thePrefs.wasBitchDialogs = doBitchDialogs;
if (!SavePrefs(&thePrefs, kPrefsVersion))
THandle<void> modulePrefs;
if (!SaveModulePrefs(globalModulePrefs, &modulePrefs) || !SavePrefs(&thePrefs, &modulePrefs, kPrefsVersion))
SysBeep(1);
modulePrefs.Dispose();
UnivSetSoundVolume(wasVolume, thisMac.hasSM3);
}
@@ -327,6 +351,9 @@ int gpAppMain()
SetUpAppleEvents();
LoadCursors();
ReadInPrefs();
SpinCursor(2); // Tick once to let the display driver flush any resolution changes from prefs
FlushResolutionChange();
#if defined COMPILEDEMO
copyGood = true;
@@ -341,7 +368,7 @@ int gpAppMain()
else if (didValidation)
WriteOutPrefs(); SpinCursor(3);
#endif
// if ((thisMac.numScreens > 1) && (isUseSecondScreen))
// ReflectSecondMonitorEnvirons(false, true, true);
HandleDepthSwitching();
@@ -395,8 +422,7 @@ int gpAppMain()
}
}
WriteOutPrefs();
RestoreColorDepth();
PL_DEAD(FlushEvents(everyEvent, 0));
PL_DEAD(FlushEvents());
// theErr = LoadScrap();
return 0;

View File

@@ -6,7 +6,6 @@
#include "PLNumberFormatting.h"
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
@@ -55,7 +54,6 @@ extern short toolSelected;
extern Boolean noRoomAtAll, isUseSecondScreen;
extern Boolean quickerTransitions, houseIsReadOnly;
//============================================================== Functions
//-------------------------------------------------------------- DrawOnSplash
@@ -85,19 +83,6 @@ void DrawOnSplash(DrawSurface *surface)
else
ColorText(surface, textPoint, houseLoadedStr, 28L, appFont);
}
#if defined(powerc) || defined(__powerc)
TextSize(12);
TextFace(0);
TextFont(systemFont);
ForeColor(blackColor);
MoveTo(splashOriginH + 5, splashOriginV + 457);
DrawString("\pPowerPC Native!");
ForeColor(whiteColor);
MoveTo(splashOriginH + 4, splashOriginV + 456);
DrawString("\pPowerPC Native!");
ForeColor(blackColor);
#endif
}
//-------------------------------------------------------------- RedrawSplashScreen
@@ -115,8 +100,6 @@ void RedrawSplashScreen (void)
LoadScaledGraphic(surface, kSplash8BitPICT, &tempRect);
DrawOnSplash(surface);
SetPortWindowPort(mainWindow);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&workSrcRect, &workSrcRect, srcCopy);
@@ -139,8 +122,6 @@ void UpdateMainWindow (void)
{
Rect tempRect;
SetPortWindowPort(mainWindow);
if (theMode == kEditMode)
{
PauseMarquee();
@@ -160,7 +141,6 @@ void UpdateMainWindow (void)
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&workSrcRect, &mainWindowRect, srcCopy);
SetPortWindowPort(mainWindow);
DrawOnSplash(mainWindow->GetDrawSurface());
}
@@ -188,7 +168,7 @@ void OpenMainWindow (void)
if (theMode == kEditMode)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 51, 102, 255);
PortabilityLayer::WindowManager::GetInstance()->SetBackgroundColor(51, 51, 102);
QSetRect(&mainWindowRect, 0, 0, 512, 322);
mainWindow = GetNewCWindow(kEditWindowID, nil, kPutInFront);
@@ -214,9 +194,9 @@ void OpenMainWindow (void)
else
{
#ifdef NDEBUG
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(0, 0, 0, 255);
PortabilityLayer::WindowManager::GetInstance()->SetBackgroundColor(0, 0, 0);
#else
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 0, 0, 255);
PortabilityLayer::WindowManager::GetInstance()->SetBackgroundColor(51, 0, 0);
#endif
if (boardWindow == nil)
@@ -232,6 +212,9 @@ void OpenMainWindow (void)
windowManager->PutWindowBehind(boardWindow, PL_GetPutInFrontWindowPtr());
else
PL_NotYetImplemented_TODO("Errors");
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
boardWindow->GetDrawSurface()->FillRect(boardWindow->GetSurfaceRect(), blackColor);
}
mainWindowRect = thisMac.constrainedScreen;
ZeroRectCorner(&mainWindowRect);
@@ -246,7 +229,6 @@ void OpenMainWindow (void)
MoveWindow(boardWindow, mainWindowLeft, 0, true);
MoveWindow(mainWindow, mainWindowLeft, mainWindowTop, true); // thisMac.menuHigh
ShowWindow(mainWindow);
SetPortWindowPort(mainWindow);
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
@@ -273,7 +255,6 @@ void OpenMainWindow (void)
// ForceCTSeed((CGrafPtr)mainWindow, wasSeed);
// }
SetPortWindowPort(mainWindow);
UpdateMainWindow();
}
@@ -371,7 +352,6 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
(!houseUnlocked))
return;
SetPortWindowPort(mainWindow);
wherePt -= mainWindow->GetTopLeftCoord();
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();

View File

@@ -327,7 +327,6 @@ void UpdateMapWindow (void)
mapWindow->DrawControls();
SetPortWindowPort(mapWindow);
// PL_NotYetImplemented_TODO("Resize")
RedrawMapContents();
@@ -411,7 +410,6 @@ void OpenMapWindow (void)
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(mapWindow);
// FlagWindowFloating(mapWindow); TEMP - use flaoting windows
SetPort(mapWindow->GetDrawSurface());
QSetRect(&mapHScrollRect, -1, mapRoomsHigh * kMapRoomHeight,
mapRoomsWide * kMapRoomWidth + 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth);
@@ -619,7 +617,6 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
if (mapWindow == nil)
return;
SetPortWindowPort(mapWindow);
globalWhere = wherePt;
wherePt -= mapWindow->GetTopLeftCoord();
wherePt.h -= 1;
@@ -645,7 +642,6 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
if (thisMac.hasDrag)
{
SetPortWindowPort(mainWindow);
QSetRect(&aRoom, 0, 0, kMapRoomWidth, kMapRoomHeight);
CenterRectOnPoint(&aRoom, globalWhere);
// if (DragRoom(theEvent, &aRoom, itsNumber))
@@ -762,7 +758,7 @@ void CreateNailOffscreen (void)
if (nailSrcMap == nil)
{
QSetRect(&nailSrcRect, 0, 0, kMapRoomWidth, kMapRoomHeight * (kNumBackgrounds + 1));
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect);
LoadGraphic(nailSrcMap, kThumbnailPictID);
}

View File

@@ -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"
@@ -199,21 +198,21 @@ void UpdateClipboardMenus (void)
mm->SetItemEnabled(houseMenu, iCut - 1, true);
mm->SetItemEnabled(houseMenu, iCopy - 1, true);
// if (hasScrap)
// {
// EnableMenuItem(houseMenu, iPaste);
// if (scrapIsARoom)
// {
// GetLocalizedString(42, title);
// SetMenuItemText(houseMenu, iPaste, title);
// }
// else
// {
// GetLocalizedString(43, title);
// SetMenuItemText(houseMenu, iPaste, title);
// }
// }
// else
if (hasScrap)
{
EnableMenuItem(houseMenu, iPaste);
if (scrapIsARoom)
{
GetLocalizedString(42, title);
SetMenuItemText(houseMenu, iPaste, title);
}
else
{
GetLocalizedString(43, title);
SetMenuItemText(houseMenu, iPaste, title);
}
}
else
{
mm->SetItemEnabled(houseMenu, iPaste - 1, false);
GetLocalizedString(44, title);
@@ -294,6 +293,10 @@ void DoAppleMenu (short theItem)
DoAbout();
break;
case iAboutAerofoil:
DoAboutFramework();
break;
default:
// GetMenuItemText(appleMenu, theItem, daName);
// GetPort(&wasPort);
@@ -457,6 +460,7 @@ void DoHouseMenu (short theItem)
if (CreateNewHouse())
{
whoCares = InitializeEmptyHouse();
whoCares = WriteHouse(false); // Save initial house so it's not an empty file if reloaded immediately
OpenCloseEditWindows();
}
break;
@@ -512,12 +516,12 @@ void DoHouseMenu (short theItem)
{
if (objActive > kNoObjectSelected)
{
// PutObjectScrap();
PutObjectScrap();
DeleteObject();
}
else
{
// PutRoomScrap();
PutRoomScrap();
DeleteRoom(false);
}
UpdateClipboardMenus();
@@ -527,10 +531,10 @@ void DoHouseMenu (short theItem)
case iCopy:
if (houseUnlocked)
{
// if (objActive > kNoObjectSelected)
// PutObjectScrap();
// else
// PutRoomScrap();
if (objActive > kNoObjectSelected)
PutObjectScrap();
else
PutRoomScrap();
UpdateClipboardMenus();
}
break;
@@ -538,12 +542,11 @@ void DoHouseMenu (short theItem)
case iPaste:
if (houseUnlocked)
{
/* if (scrapIsARoom)
if (scrapIsARoom)
GetRoomScrap();
else
GetObjectScrap();
UpdateClipboardMenus();
*/
}
break;

View File

@@ -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;

View File

@@ -6,7 +6,6 @@
//============================================================================
#include "PLToolUtils.h"
#include "PLKeyEncoding.h"
#include "DialogManager.h"
#include "Externs.h"

View File

@@ -613,8 +613,7 @@ void DrawDresser(Rect *dresser)
short nRects, height, i;
Pattern dummyPattern;
DrawSurface *surface = reinterpret_cast<DrawSurface*>(PortabilityLayer::QDManager::GetInstance()->GetPort());
//surface = backSrcMap;
DrawSurface *surface = backSrcMap;
if (thisMac.isDepth == 4)
{

View File

@@ -7,7 +7,6 @@
#include "BitmapImage.h"
#include "PLResources.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "Externs.h"
#include "FontFamily.h"
@@ -170,10 +169,10 @@ void DrawMailboxLeft (Rect *theRect, short down)
}
bounds = srcRects[kMailboxLf];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMailboxLeftPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMailboxLeftMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -242,10 +241,10 @@ void DrawMailboxRight (Rect *theRect, short down)
}
bounds = srcRects[kMailboxRt];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMailboxRightPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMailboxRightMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -605,10 +604,10 @@ void DrawTV (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kTV];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kTVPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kTVMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -691,10 +690,10 @@ void DrawVCR (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kVCR];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kVCRPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kVCRMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -738,10 +737,10 @@ void DrawStereo (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kStereo];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kStereoPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kStereoMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -785,10 +784,10 @@ void DrawMicrowave (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kMicrowave];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMicrowavePictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMicrowaveMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1047,10 +1046,6 @@ void DrawCalendar (Rect *theRect)
Rect bounds;
THandle<BitmapImage> thePicture;
Str255 monthStr;
DrawSurface *wasCPort;
wasCPort = GetGraphicsPort();
SetGraphicsPort(backSrcMap);
thePicture = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', kCalendarPictID).StaticCast<BitmapImage>();
if (thePicture == nil)
@@ -1163,10 +1158,10 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
}
bounds = srcRects[what];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, pictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, maskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1274,7 +1269,7 @@ void DrawPictSansWhiteObject (short what, Rect *theRect)
}
bounds = srcRects[what];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, pictID);
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1294,7 +1289,7 @@ void DrawCustPictSansWhite (short pictID, Rect *theRect)
bounds = *theRect;
ZeroRectCorner(&bounds);
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphicCustom(tempMap, pictID);
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),

View File

@@ -6,7 +6,6 @@
#include "PLKeyEncoding.h"
#include "PLSound.h"
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "BitmapImage.h"
#include "Externs.h"

View File

@@ -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"
@@ -737,7 +736,6 @@ void DoBlowerObjectInfo (short what)
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kBlowerInfoDialogID, kPutInFront, &substitutions);
if (infoDial == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(infoDial->GetWindow()->GetDrawSurface());
newDirection = thisRoom->objects[objActive].data.a.vector & 0x0F;
if (thisRoom->objects[objActive].data.a.initial)
@@ -1354,7 +1352,6 @@ void DoLightObjectInfo (void)
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kLightInfoDialogID, kPutInFront, &substitutions);
if (infoDial == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(infoDial->GetWindow()->GetDrawSurface());
if (thisRoom->objects[objActive].data.f.initial)
SetDialogItemValue(infoDial, kInitialStateCheckbox, 1);

View File

@@ -168,16 +168,16 @@ void NewGame (short mode)
if (mode == kNewGameMode)
{
BringUpBanner();
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
}
else if (mode == kResumeGameMode)
{
DisplayStarsRemaining();
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
}
else
{
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
}
InitGarbageRects();
@@ -247,7 +247,6 @@ void NewGame (short mode)
StopTheMusic();
}
NilSavedMaps();
SetPortWindowPort(mainWindow);
UpdateMenus(false);
@@ -382,7 +381,7 @@ void HandleGameResolutionChange(void)
ResetLocale(true);
InitScoreboardMap();
RefreshScoreboard(wasScoreboardTitleMode);
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, true);
}
//-------------------------------------------------------------- PlayGame

View File

@@ -10,25 +10,42 @@
#include "Externs.h"
#include "Environ.h"
#include "FileManager.h"
#include "IGpAudioDriver.h"
#include "IGpDisplayDriver.h"
#include "IGpInputDriver.h"
#include "IGpPrefsHandler.h"
#include "IOStream.h"
#include "MemoryManager.h"
#include "HostAudioDriver.h"
#include "HostDisplayDriver.h"
#include "HostInputDriver.h"
#define kPrefCreatorType 'ozm5'
#define kPrefFileType 'gliP'
#define kPrefFileName PSTR("Glider Prefs")
#define kPrefFileName PSTR("Glider Prefs v2")
#define kDefaultPrefFName PSTR("Preferences")
#define kPrefsStringsID 160
#define kNewPrefsAlertID 160
#define kPrefsFNameIndex 1
typedef struct modulePrefsListEntry
{
THandle<char> m_identifier;
THandle<uint8_t> m_contents;
uint32_t m_version;
} modulePrefsListEntry;
Boolean CanUseFindFolder (void);
Boolean WritePrefs (const prefsInfo *);
PLError_t ReadPrefs (prefsInfo *);
Boolean WritePrefs (const prefsInfo *, short versionNow, THandle<modulePrefsListEntry> *theModulePrefs);
PLError_t ReadPrefs (prefsInfo *thePrefs, short versionNeed, Boolean *isOldVersion, THandle<modulePrefsListEntry> *theModulePrefs);
Boolean DeletePrefs ();
void BringUpDeletePrefsAlert (void);
THandle<modulePrefsListEntry> theModulePrefs;
//============================================================== Functions
//-------------------------------------------------------------- CanUseFindFolder
@@ -39,7 +56,7 @@ Boolean CanUseFindFolder (void)
//-------------------------------------------------------------- WritePrefs
Boolean WritePrefs (const prefsInfo *thePrefs)
Boolean WritePrefs (const prefsInfo *thePrefs, short versionNow, THandle<modulePrefsListEntry> modulePrefs)
{
PLError_t theErr;
PortabilityLayer::IOStream *fileStream;
@@ -66,15 +83,70 @@ Boolean WritePrefs (const prefsInfo *thePrefs)
CheckFileError(theErr, PSTR("Preferences"));
return(false);
}
uint32_t version = versionNow;
if (fileStream->Write(&version, sizeof(version)) != sizeof(version))
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(false);
}
byteCount = sizeof(*thePrefs);
if (fileStream->Write(thePrefs, byteCount) != byteCount)
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(false);
}
uint32_t numEntries = 0;
if (modulePrefs)
numEntries = modulePrefs.MMBlock()->m_size / sizeof(modulePrefsListEntry);
if (fileStream->Write(&numEntries, sizeof(numEntries)) != sizeof(numEntries))
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(false);
}
for (uint32_t i = 0; i < numEntries; i++)
{
modulePrefsListEntry *entry = (*modulePrefs) + i;
uint32_t version = entry->m_version;
if (fileStream->Write(&version, sizeof(version)) != sizeof(version))
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(false);
}
THandle<void> handles[2] = { entry->m_identifier.StaticCast<void>(), entry->m_contents.StaticCast<void>() };
for (int hi = 0; hi < 2; hi++)
{
uint32_t hSize = handles[hi].MMBlock()->m_size;
if (fileStream->Write(&hSize, sizeof(hSize)) != sizeof(hSize))
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(false);
}
if (fileStream->Write(*handles[hi], hSize) != hSize)
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(false);
}
}
}
fileStream->Close();
return(true);
@@ -82,19 +154,39 @@ Boolean WritePrefs (const prefsInfo *thePrefs)
//-------------------------------------------------------------- SavePrefs
Boolean SavePrefs (prefsInfo *thePrefs, short versionNow)
Boolean SavePrefs (prefsInfo *thePrefs, THandle<void> *modulePrefs, short versionNow)
{
thePrefs->prefVersion = versionNow;
if (!WritePrefs(thePrefs))
if (!WritePrefs(thePrefs, versionNow, modulePrefs->StaticCast<modulePrefsListEntry>()))
return(false);
return(true);
}
static void DestroyModulePrefs(THandle<modulePrefsListEntry> *theModulePrefs)
{
if (!*theModulePrefs)
return;
modulePrefsListEntry *firstOldEntry = **theModulePrefs;
if (!firstOldEntry)
return;
size_t numOldPrefs = theModulePrefs->MMBlock()->m_size / sizeof(modulePrefsListEntry);
for (size_t i = 0; i < numOldPrefs; i++)
{
firstOldEntry[i].m_contents.Dispose();
firstOldEntry[i].m_identifier.Dispose();
firstOldEntry[i].~modulePrefsListEntry();
}
theModulePrefs->Dispose();
}
//-------------------------------------------------------------- ReadPrefs
PLError_t ReadPrefs (prefsInfo *thePrefs)
PLError_t ReadPrefs (prefsInfo *thePrefs, short versionNeed, Boolean *isOldVersion, THandle<modulePrefsListEntry> *theModulePrefs)
{
PLError_t theErr;
PortabilityLayer::IOStream *fileStream;
@@ -102,6 +194,8 @@ PLError_t ReadPrefs (prefsInfo *thePrefs)
VFileSpec theSpecs;
Str255 fileName;
*isOldVersion = false;
PortabilityLayer::FileManager *fm = PortabilityLayer::FileManager::GetInstance();
PasStringCopy(kPrefFileName, fileName);
@@ -117,6 +211,21 @@ PLError_t ReadPrefs (prefsInfo *thePrefs)
CheckFileError(theErr, PSTR("Preferences"));
return(theErr);
}
uint32_t version = 0;
if (fileStream->Read(&version, sizeof(version)) != sizeof(version))
{
CheckFileError(theErr, PSTR("Preferences"));
fileStream->Close();
return(PLErrors::kIOError);
}
if (version != versionNeed)
{
*isOldVersion = true;
fileStream->Close();
return(PLErrors::kNone);
}
byteCount = sizeof(*thePrefs);
@@ -124,7 +233,81 @@ PLError_t ReadPrefs (prefsInfo *thePrefs)
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(theErr);
return(PLErrors::kIOError);
}
uint32_t numModulePrefs = 0;
if (fileStream->Read(&numModulePrefs, sizeof(numModulePrefs)) != sizeof(numModulePrefs))
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(PLErrors::kIOError);
}
DestroyModulePrefs(theModulePrefs);
if (numModulePrefs)
{
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
*theModulePrefs = THandle<modulePrefsListEntry>(mm->AllocHandle(numModulePrefs * sizeof(modulePrefsListEntry)));
if (!*theModulePrefs)
{
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(PLErrors::kIOError);
}
modulePrefsListEntry *firstNewEntry = **theModulePrefs;
for (size_t i = 0; i < numModulePrefs; i++)
new (firstNewEntry + i) modulePrefsListEntry();
for (uint32_t i = 0; i < numModulePrefs; i++)
{
if (fileStream->Read(&firstNewEntry[i].m_version, sizeof(firstNewEntry[i].m_version)) != sizeof(firstNewEntry[i].m_version))
{
DestroyModulePrefs(theModulePrefs);
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(PLErrors::kIOError);
}
for (int subHandle = 0; subHandle < 2; subHandle++)
{
uint32_t handleSz;
if (fileStream->Read(&handleSz, sizeof(handleSz)) != sizeof(handleSz))
{
DestroyModulePrefs(theModulePrefs);
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(PLErrors::kIOError);
}
PortabilityLayer::MMHandleBlock *mmBlock = mm->AllocHandle(handleSz);
if (!mmBlock)
{
DestroyModulePrefs(theModulePrefs);
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(PLErrors::kIOError);
}
if (subHandle == 0)
firstNewEntry[i].m_identifier = THandle<char>(mmBlock);
else
firstNewEntry[i].m_contents = THandle<uint8_t>(mmBlock);
if (fileStream->Read(mmBlock->m_contents, handleSz) != handleSz)
{
DestroyModulePrefs(theModulePrefs);
CheckFileError(PLErrors::kIOError, PSTR("Preferences"));
fileStream->Close();
return(PLErrors::kIOError);
}
}
}
}
fileStream->Close();
@@ -147,14 +330,42 @@ Boolean DeletePrefs ()
return PortabilityLayer::FileManager::GetInstance()->DeleteFile(theSpecs.m_dir, theSpecs.m_name);
}
//-------------------------------------------------------------- RunFunctionOnAllPrefsHandlers
bool RunFunctionOnAllPrefsHandlers (void *context, bool (*func) (void *context, IGpPrefsHandler *handler))
{
IGpPrefsHandler *ddHandler = PortabilityLayer::HostDisplayDriver::GetInstance()->GetPrefsHandler();
if (ddHandler && !func(context, ddHandler))
return false;
IGpPrefsHandler *adHandler = PortabilityLayer::HostAudioDriver::GetInstance()->GetPrefsHandler();
if (adHandler && !func(context, adHandler))
return false;
size_t numInputDrivers = PortabilityLayer::HostInputDriver::NumInstances();
for (size_t i = 0; i < numInputDrivers; i++)
{
IGpPrefsHandler *idHandler = PortabilityLayer::HostInputDriver::GetInstance(i)->GetPrefsHandler();
if (idHandler && !func(context, idHandler))
return false;
}
return true;
}
//-------------------------------------------------------------- LoadPrefs
Boolean LoadPrefs (prefsInfo *thePrefs, short versionNeed)
Boolean LoadPrefs (prefsInfo *thePrefs, THandle<void> *modulePrefs, short versionNeed)
{
PLError_t theErr;
Boolean noProblems;
Boolean isOldVersion = 0;
THandle<modulePrefsListEntry> mPrefs;
theErr = ReadPrefs(thePrefs);
theErr = ReadPrefs(thePrefs, versionNeed, &isOldVersion, &mPrefs);
if (theErr == PLErrors::kFileNotFound)
return (false);
@@ -165,19 +376,164 @@ Boolean LoadPrefs (prefsInfo *thePrefs, short versionNeed)
noProblems = DeletePrefs();
return (false);
}
if (thePrefs->prefVersion != versionNeed)
if (isOldVersion)
{
BringUpDeletePrefsAlert();
noProblems = DeletePrefs();
return(false);
}
*modulePrefs = mPrefs.StaticCast<void>();
return (true);
}
//-------------------------------------------------------------- BringUpDeletePrefsAlert
static THandle<void> CloneHandle(THandle<void> hdl)
{
if (!hdl)
return THandle<void>();
PortabilityLayer::MMHandleBlock *newHdl = PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(hdl.MMBlock()->m_size);
if (!newHdl)
return THandle<void>();
memcpy(newHdl->m_contents, hdl.MMBlock()->m_contents, hdl.MMBlock()->m_size);
return THandle<void>(newHdl);
}
struct SaveModulePrefsContext
{
size_t m_numModulePrefs;
THandle<modulePrefsListEntry> m_newPrefs;
};
bool SaveModulePrefsWriteFunc(void *vcontext, const void *identifier, size_t identifierSize, const void *contents, size_t contentsSize, uint32_t version)
{
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
SaveModulePrefsContext *context = static_cast<SaveModulePrefsContext*>(vcontext);
modulePrefsListEntry *saveToEntry = nullptr;
for (size_t i = 0; i < context->m_numModulePrefs; i++)
{
modulePrefsListEntry *checkEntry = (*context->m_newPrefs) + i;
THandle<char> candidateIdentHdl = checkEntry->m_identifier;
size_t candidateIdentSize = candidateIdentHdl.MMBlock()->m_size;
if (candidateIdentSize == identifierSize && !memcmp(*candidateIdentHdl, identifier, candidateIdentSize))
{
saveToEntry = checkEntry;
break;
}
}
if (!saveToEntry)
{
if (context->m_numModulePrefs == 0)
context->m_newPrefs = THandle<modulePrefsListEntry>(mm->AllocHandle(sizeof(modulePrefsListEntry)));
else
mm->ResizeHandle(context->m_newPrefs.MMBlock(), (context->m_numModulePrefs + 1) * sizeof(modulePrefsListEntry));
saveToEntry = (*context->m_newPrefs) + context->m_numModulePrefs;
new (saveToEntry) modulePrefsListEntry();
context->m_numModulePrefs++;
}
if (saveToEntry->m_contents)
saveToEntry->m_contents.Dispose();
if (!saveToEntry->m_identifier)
{
saveToEntry->m_identifier = THandle<char>(mm->AllocHandle(identifierSize));
memcpy(*saveToEntry->m_identifier, identifier, identifierSize);
}
saveToEntry->m_contents = THandle<uint8_t>(mm->AllocHandle(contentsSize));
memcpy(*saveToEntry->m_contents, contents, contentsSize);
saveToEntry->m_version = version;
return true;
}
bool SaveModulePrefsCallback(void *vcontext, IGpPrefsHandler *handler)
{
return handler->SavePrefs(vcontext, SaveModulePrefsWriteFunc);
}
Boolean SaveModulePrefs(THandle<void> currentModulePrefs, THandle<void> *outModulePrefs)
{
SaveModulePrefsContext context;
size_t numModulePrefs = 0;
THandle<modulePrefsListEntry> newPrefs;
if (currentModulePrefs)
{
numModulePrefs = currentModulePrefs.MMBlock()->m_size / sizeof(modulePrefsListEntry);
newPrefs = CloneHandle(currentModulePrefs).StaticCast<modulePrefsListEntry>();
modulePrefsListEntry *entries = *newPrefs;
for (size_t i = 0; i < numModulePrefs; i++)
{
entries[i].m_contents = CloneHandle(entries[i].m_contents.StaticCast<void>()).StaticCast<uint8_t>();
entries[i].m_identifier = CloneHandle(entries[i].m_identifier.StaticCast<void>()).StaticCast<char>();
}
}
else
newPrefs = THandle<modulePrefsListEntry>(PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(0));
context.m_newPrefs = newPrefs;
context.m_numModulePrefs = numModulePrefs;
bool savedOK = RunFunctionOnAllPrefsHandlers(&context, SaveModulePrefsCallback);
if (savedOK)
{
outModulePrefs->Dispose();
*outModulePrefs = context.m_newPrefs.StaticCast<void>();
}
return savedOK;
}
//-------------------------------------------------------------- BringUpDeletePrefsAlert
struct ApplyModulePrefsContext
{
size_t m_numModulePrefs;
THandle<modulePrefsListEntry> m_newPrefs;
};
bool ApplyModulePrefsCallback(void *vcontext, IGpPrefsHandler *handler)
{
ApplyModulePrefsContext *context = static_cast<ApplyModulePrefsContext*>(vcontext);
const modulePrefsListEntry *entries = *(context->m_newPrefs);
for (size_t i = 0; i < context->m_numModulePrefs; i++)
handler->ApplyPrefs(*entries[i].m_identifier, entries[i].m_identifier.MMBlock()->m_size, *entries[i].m_contents, entries[i].m_contents.MMBlock()->m_size, entries[i].m_version);
return true;
}
Boolean ApplyModulePrefs (THandle<void> *modulePrefs)
{
ApplyModulePrefsContext context;
context.m_newPrefs = modulePrefs->StaticCast<modulePrefsListEntry>();
context.m_numModulePrefs = context.m_newPrefs.MMBlock()->m_size / sizeof(modulePrefsListEntry);
return RunFunctionOnAllPrefsHandlers(&context, ApplyModulePrefsCallback);
}
//-------------------------------------------------------------- BringUpDeletePrefsAlert
void BringUpDeletePrefsAlert (void)
{
short whoCares;

View File

@@ -147,8 +147,6 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
dest = thisGlider->dest;
QOffsetRect(&dest, playOriginH - 20, playOriginV - 16);
SetPort(workSrcMap);
long numMirrorRects = GetHandleSize(mirrorRects.StaticCast<void>()) / sizeof(Rect);
for (long i = 0; i < numMirrorRects; i++)

View File

@@ -6,7 +6,6 @@
#include "PLKeyEncoding.h"
#include "PLResources.h"
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "PLStandardColors.h"
#include "BitmapImage.h"

View File

@@ -80,7 +80,6 @@ void ResetLocale (Boolean soft)
takingTheStairs = false;
DrawSurface *wasCPort = GetGraphicsPort();
const short roomV = (*thisHouse)->rooms[thisRoomNumber].floor;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
@@ -138,8 +137,6 @@ void ResetLocale (Boolean soft)
if (soft)
RedrawAllGrease();
SetGraphicsPort(wasCPort);
}
//-------------------------------------------------------------- LoadGraphicSpecial

View File

@@ -436,7 +436,7 @@ void DoRoomInfo(void)
NumToString(thisRoom->numObjects, objectsStr);
DialogTextSubstitutions substitutions(floorStr, suiteStr, objectsStr);
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect);
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
// SetPort((GrafPtr)tileSrcMap);
if ((tempBack > kStars) && (!PictIDExists(tempBack)))
@@ -457,7 +457,6 @@ void DoRoomInfo(void)
roomInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kRoomInfoDialogID, kPutInFront, &substitutions);
if (roomInfoDialog == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(roomInfoDialog->GetWindow()->GetDrawSurface());
{
PortabilityLayer::WidgetBasicState state;

View File

@@ -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;

File diff suppressed because one or more lines are too long

547
GpApp/Scrap.cpp Normal file
View File

@@ -0,0 +1,547 @@
//============================================================================
//----------------------------------------------------------------------------
// Scrap.c
//----------------------------------------------------------------------------
//============================================================================
#include "Externs.h"
#include "Environ.h"
#include "MemoryManager.h"
Boolean hasScrap, scrapIsARoom;
extern WindowPtr mapWindow;
extern Rect roomObjectRects[];
extern short objActive;
//============================================================== Functions
THandle<void> scrapData;
int32_t scrapType;
PLError_t ZeroScrap()
{
scrapType = 0;
scrapData.Dispose();
scrapData = nullptr;
return PLErrors::kNone;
}
PLError_t PutScrap(size_t size, int32_t typeID, const void *data)
{
scrapData.Dispose();
if (size)
{
scrapData = THandle<void>(PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(size));
if (!scrapData)
return PLErrors::kOutOfMemory;
memcpy(*scrapData, data, size);
}
scrapType = typeID;
return PLErrors::kNone;
}
PLError_t GetScrap(THandle<void> destHdl, int32_t typeID, long *outSize)
{
if (scrapType != typeID || !scrapData)
return PLErrors::kInvalidParameter;
size_t scrapSize = scrapData.MMBlock()->m_size;
if (scrapSize)
{
PortabilityLayer::MemoryManager::GetInstance()->ResizeHandle(destHdl.MMBlock(), scrapSize);
memcpy(*destHdl, *scrapData, scrapSize);
}
return PLErrors::kNone;
}
//-------------------------------------------------------------- PutRoomScrap
#ifndef COMPILEDEMO
void PutRoomScrap (void)
{
// this function copies the current room into the clipboard
Rect largeBounds, smallBounds;
PLError_t theErr;
theErr = ZeroScrap();
if (theErr == PLErrors::kNone)
{
SetRect(&largeBounds, 0, 0, kRoomWide, kTileHigh);
SetRect(&smallBounds, 0, 0, kRoomWide / 4, kTileHigh / 4);
theErr = PutScrap(sizeof(roomType), 'Room', (Ptr)thisRoom);
if (theErr == PLErrors::kNone)
{
if (!hasScrap)
{
hasScrap = true;
UpdateMenus(false);
}
scrapIsARoom = true;
}
else
YellowAlert(kYellowScrapError, theErr);
}
else
YellowAlert(kYellowScrapError, theErr);
}
#endif
//-------------------------------------------------------------- PutObjectScrap
#ifndef COMPILEDEMO
void PutObjectScrap (void)
{
// this function copies the currently selected object into the clipboard
Str255 kindStr;
objectPtr scrapObjPtr;
long theErr;
theErr = ZeroScrap();
if (theErr == PLErrors::kNone)
{
scrapObjPtr = &(thisRoom->objects[objActive]);
theErr = PutScrap(sizeof(objectType), 'Obj.', (Ptr)scrapObjPtr);
if (theErr == PLErrors::kNone)
{
if (!hasScrap)
{
hasScrap = true;
UpdateMenus(false);
}
scrapIsARoom = false;
}
else
YellowAlert(kYellowScrapError, theErr);
}
else
YellowAlert(kYellowScrapError, theErr);
}
#endif
//-------------------------------------------------------------- GetRoomScrap
#ifndef COMPILEDEMO
void GetRoomScrap (void)
{
// this function pastes a room from the clipboard
Handle tempRoom;
long theErr, scrapOffset;
short wasFloor, wasSuite, srcRoomNumber, destRoomNumber, i;
short linkRoomNumber;
tempRoom = NewHandle(0L);
if (tempRoom == nil)
{
YellowAlert(kYellowNoMemory, 0);
return;
}
theErr = GetScrap(tempRoom, 'Room', &scrapOffset);
if (theErr < 0)
YellowAlert(kYellowScrapError, theErr);
else
{
DeselectObject();
wasFloor = thisRoom->floor;
wasSuite = thisRoom->suite;
destRoomNumber = GetRoomNumber(thisRoom->floor, thisRoom->suite);
memcpy(thisRoom, *tempRoom, sizeof(roomType));
tempRoom.Dispose();
srcRoomNumber = GetRoomNumber(thisRoom->floor, thisRoom->suite);
thisRoom->floor = wasFloor;
thisRoom->suite = wasSuite;
for (i = 0; i < kMaxRoomObs; i++) // fix links
{ // first see if a linkable object
if ((ObjectIsLinkTransport(&thisRoom->objects[i])) ||
(ObjectIsLinkSwitch(&thisRoom->objects[i])))
{
linkRoomNumber = GetRoomLinked (&thisRoom->objects[i]);
if (linkRoomNumber == srcRoomNumber)
{ // if linked to an object in same room<6F>
if (ObjectIsLinkSwitch(&thisRoom->objects[i]))
{ // point to new room location
thisRoom->objects[i].data.d.where =
(wasSuite * 100) + wasFloor + kNumUndergroundFloors;
}
else
{ // point to new room location
thisRoom->objects[i].data.e.where =
(wasSuite * 100) + wasFloor + kNumUndergroundFloors;
}
}
}
}
CopyThisRoomToRoom();
ReflectCurrentRoom(false);
fileDirty = true;
UpdateMenus(false);
}
}
#endif
//-------------------------------------------------------------- GetObjectScrap
#ifndef COMPILEDEMO
void GetObjectScrap (void)
{
// this function pastes an object from the clipboard
objectType tempObject;
Handle tempObjectHand;
Point noPoint;
long theErr, scrapOffset;
short direction, dist;
tempObjectHand = NewHandle(0L);
if (tempObjectHand == nil)
{
YellowAlert(kYellowNoMemory, 0);
return;
}
theErr = GetScrap(tempObjectHand, 'Obj.', &scrapOffset);
if (theErr < 0)
YellowAlert(kYellowScrapError, theErr);
else
{
DeselectObject();
noPoint.h = 100;
noPoint.v = 100;
memcpy(&tempObject, *tempObjectHand, sizeof(objectType));
if (AddNewObject(noPoint, tempObject.what, false))
{
thisRoom->objects[objActive] = tempObject;
ReadyBackground(thisRoom->background, thisRoom->tiles);
GetThisRoomsObjRects();
DrawThisRoomsObjects();
UpdateMainWindow();
if (ObjectHasHandle(&direction, &dist))
{
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
HandleBlowerGlider();
}
else
StartMarquee(&roomObjectRects[objActive]);
}
tempObjectHand.Dispose();
}
}
#endif
//-------------------------------------------------------------- SeeIfValidScrapAvailable
#ifndef COMPILEDEMO
void SeeIfValidScrapAvailable (Boolean updateMenus)
{
Handle tempRoom, tempObject;
long theErr, scrapOffset;
hasScrap = false;
tempRoom = NewHandle(0L);
if (tempRoom != nil)
{
theErr = GetScrap(tempRoom, 'Room', &scrapOffset);
if (theErr >= 0)
{
hasScrap = true;
scrapIsARoom = true;
}
tempRoom.Dispose();
}
tempObject = NewHandle(0L);
if (tempObject != nil)
{
theErr = GetScrap(tempObject, 'Obj.', &scrapOffset);
if (theErr >= 0)
{
hasScrap = true;
scrapIsARoom = false;
}
tempObject.Dispose();
}
if (updateMenus)
UpdateClipboardMenus();
}
#endif
//-------------------------------------------------------------- DropLocationIsTrash
#if 0
Boolean DropLocationIsTrash (AEDesc *dropLocation)
{
AEDesc dropSpec;
FSSpec *theSpec;
CInfoPBRec thePB;
long trashDirID;
OSErr theErr;
short trashVRefNum;
if ((dropLocation->descriptorType != typeNull) &&
(AECoerceDesc(dropLocation, typeFSS, &dropSpec) == noErr))
{
HLock(dropSpec.dataHandle);
theSpec = (FSSpec *) *dropSpec.dataHandle;
thePB.dirInfo.ioCompletion = 0L;
thePB.dirInfo.ioNamePtr = (StringPtr) &theSpec->name;
thePB.dirInfo.ioVRefNum = theSpec->vRefNum;
thePB.dirInfo.ioFDirIndex = 0;
thePB.dirInfo.ioDrDirID = theSpec->parID;
theErr = PBGetCatInfo(&thePB, false);
HUnlock(dropSpec.dataHandle);
AEDisposeDesc(&dropSpec);
if (theErr != noErr)
return(false);
if (!(thePB.dirInfo.ioFlAttrib & (1 << 4)))
return(false);
FindFolder(theSpec->vRefNum, kTrashFolderType, kCreateFolder,
&trashVRefNum, &trashDirID);
if (thePB.dirInfo.ioDrDirID == trashDirID)
return(true);
}
return(false);
}
#endif
//-------------------------------------------------------------- DragTrackingFunc
#if 0
pascal OSErr DragTrackingFunc (DragTrackingMessage theMessage, WindowPtr theWindow,
void *theRefCon, DragReference theDrag)
{
DragAttributes attributes;
OSErr theErr;
theErr = noErr;
GetDragAttributes(theDrag, &attributes);
switch (theMessage)
{
case dragTrackingEnterWindow:
xxx;
break;
case dragTrackingInWindow:
xxx;
break;
case dragTrackingLeaveWindow:
xxx;
break;
}
return (theErr);
}
#endif
//-------------------------------------------------------------- DragRoom
#if 0
Boolean DragRoom (EventRecord *theEvent, Rect *roomSrc, short roomNumber)
{
DragReference theDrag;
DragAttributes attributes;
AEDesc dropLocation;
Rect largeBounds, smallBounds;
PicHandle smallPict;
roomType *theRoom;
RgnHandle boundsRgn, tempRgn;
// Point dragPoint;
OSErr theErr;
short mouseDnMods, mouseUpMods, copyRoom;
char wasState;
if (thisMac.hasDrag)
{
if (!WaitMouseMoved(theEvent->where))
return(false);
SetPort((GrafPtr)mainWindow);
BeginUpdate((GrafPtr)mainWindow);
UpdateMainWindow();
EndUpdate((GrafPtr)mainWindow);
theErr = NewDrag(&theDrag);
if (theErr != noErr)
return (false);
wasState = HGetState((Handle)thisHouse);
HLock((Handle)thisHouse);
theRoom = &((*thisHouse)->rooms[roomNumber]);
theErr = AddDragItemFlavor(theDrag, (ItemReference)roomNumber,
(FlavorType)'Room', (Ptr)theRoom,
sizeof(roomType), (FlavorFlags)0);
if (theErr != noErr)
{
HSetState((Handle)thisHouse, wasState);
DisposeDrag(theDrag);
return (false);
}
SetRect(&largeBounds, 0, 0, kRoomWide, kTileHigh);
SetRect(&smallBounds, 0, 0, kRoomWide / 4, kTileHigh / 4);
smallPict = OpenPicture(&smallBounds);
CopyBits(&(((GrafPtr)mainWindow)->portBits), &(((GrafPtr)mainWindow)->portBits),
&largeBounds, &smallBounds, srcCopy, nil);
ClosePicture();
HLock((Handle)smallPict);
theErr = AddDragItemFlavor(theDrag, (ItemReference)roomNumber,
(FlavorType)'PICT', (Ptr)(*smallPict),
GetHandleSize((Handle)smallPict), (FlavorFlags)0);
HUnlock((Handle)smallPict);
KillPicture(smallPict);
HSetState((Handle)thisHouse, wasState);
if (theErr != noErr)
{
DisposeDrag(theDrag);
return (false);
}
theErr = SetDragItemBounds(theDrag, (ItemReference)roomNumber, roomSrc);
if (theErr != noErr)
{
DisposeDrag(theDrag);
return (false);
}
boundsRgn = NewRgn();
RectRgn(boundsRgn, roomSrc);
tempRgn = NewRgn();
CopyRgn(boundsRgn, tempRgn);
InsetRgn(tempRgn, 1, 1);
DiffRgn(boundsRgn, tempRgn, boundsRgn);
DisposeRgn(tempRgn);
theErr = TrackDrag(theDrag, theEvent, boundsRgn);
if ((theErr != noErr) && (theErr != userCanceledErr))
{
DisposeRgn(boundsRgn);
DisposeDrag(theDrag);
return(true);
}
theErr = GetDragAttributes(theDrag, &attributes);
if (theErr != noErr)
{
DisposeRgn(boundsRgn);
DisposeDrag(theDrag);
return(true);
}
theErr = GetDropLocation(theDrag, &dropLocation);
if (theErr != noErr)
{
DisposeRgn(boundsRgn);
DisposeDrag(theDrag);
return(true);
}
theErr = GetDragModifiers(theDrag, 0L, &mouseDnMods, &mouseUpMods);
if (theErr != noErr)
{
DisposeRgn(boundsRgn);
DisposeDrag(theDrag);
return(true);
}
copyRoom = (mouseDnMods | mouseUpMods) & optionKey;
if (!(attributes & kDragInsideSenderApplication))
{
if ((!copyRoom) && (DropLocationIsTrash(&dropLocation)))
{
DeselectObject();
DeleteRoom(true);
}
}
else if (attributes & kDragInsideSenderWindow)
{
// SetPort(mapWindow);
// GetDragMouse(theDrag, &dragPoint, 0L);
// GlobalToLocal(&dragPoint);
// MoveRoom(dragPoint);
}
DisposeRgn(boundsRgn);
DisposeDrag(theDrag);
}
return (true);
}
#endif
//-------------------------------------------------------------- InitDragInfo
#if 0
OSErr InitDragInfo (DragInfoHandle dragInfo)
{
OSErr theErr;
DragTrackingHandlerUPP trackingProc;
DragReceiveHandlerUPP receiveProc;
if (!HasDragManager())
return (noErr);
trackingProc = NewDragTrackingHandlerProc(DragTrackingFunc);
(**dragInfo).dragTrackingProc = trackingProc;
theErr = InstallTrackingHandler(trackingProc, mapWindow, dragInfo);
if (theErr != noErr)
return (theErr);
receiveProc = NewDragReceiveHandlerProc(DragReceiveFunc);
(**dragInfo).dragReceiveProc = receiveProc;
theErr = InstallReceiveHandler(receiveProc, (**dragInfo).window, dragInfo);
return err;
}
#endif
//-------------------------------------------------------------- KillDragInfo
#if 0
void KillDragInfo (DragInfoHandle dragInfo)
{
OSErr theErr;
if (!HasDragManager())
return (noErr);
theErr = RemoveTrackingHandler((**dragInfo).dragTrackingProc,
(**dragInfo).window);
theErr = RemoveReceiveHandler((**dragInfo).dragReceiveProc,
(**dragInfo).window);
}
#endif

View File

@@ -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"
@@ -17,7 +16,9 @@
#include "DialogUtils.h"
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "House.h"
#include "IGpDisplayDriver.h"
#include "WindowManager.h"
@@ -26,6 +27,8 @@
#define kSoundPrefsDialID 1018
#define kControlPrefsDialID 1023
#define kBrainsPrefsDialID 1024
// Display dialog
#define kDisplayButton 3
#define kSoundButton 4
#define kControlsButton 5
@@ -34,21 +37,24 @@
#define kDisplay3Item 4
#define kDisplay9Item 5
#define kBorder1Item 8
#define kDoColorFadeItem 9
//#define kCurrentDepth 10
//#define k256Depth 11
//#define k16Depth 12
#define kBorder2Item 10
#define kBorder3Item 11
#define kDispDefault 12
//#define kUseQDItem 13
//#define kUseScreen2Item 14
#define k32BitColorItem 9
#define kScaleResolutionItem 10
#define kUseICCProfileItem 11
#define kDoColorFadeItem 12
#define kFullScreenItem 13
#define kBorder2Item 14
#define kBorder3Item 15
#define kDispDefault 16
// Sound dialog
#define kSofterItem 4
#define kLouderItem 5
#define kVolNumberItem 7
#define kIdleMusicItem 8
#define kPlayMusicItem 9
#define kSoundDefault 13
// Controls dialog
#define kRightControl 5
#define kLeftControl 6
#define kBattControl 7
@@ -56,6 +62,8 @@
#define kControlDefaults 13
#define kESCPausesRadio 14
#define kTABPausesRadio 15
// Brains dialog
#define kMaxFilesItem 5
#define kQuickTransitCheck 7
#define kDoZoomsCheck 8
@@ -99,11 +107,11 @@ Str15 tempLeftStr, tempRightStr, tempBattStr, tempBandStr;
long tempLeftMap, tempRightMap, tempBattMap, tempBandMap;
short whichCtrl, wasDepthPref;
Boolean wasFade, wasIdle, wasPlay, wasTransit, wasZooms, wasBackground;
Boolean wasEscPauseKey, wasDemos, wasScreen2, nextRestartChange, wasErrorCheck;
Boolean wasEscPauseKey, wasDemos, wasAutoScale, wasUseICCProfile, nextRestartChange, wasErrorCheck, wasFullscreenPref, needResolutionReset;
Boolean wasPrettyMap, wasBitchDialogs;
extern short numNeighbors, isDepthPref, maxFiles, willMaxFiles;
extern Boolean isDoColorFade, isPlayMusicIdle, isUseSecondScreen;
extern Boolean isDoColorFade, isPlayMusicIdle, isAutoScale, isUseICCProfile;
extern Boolean isHouseChecks, doBitchDialogs;
extern Boolean isEscPauseKey, failedMusic, isSoundOn, doBackground;
extern Boolean isMusicOn, quickerTransitions, doAutoDemo;
@@ -494,7 +502,6 @@ void DoControlPrefs (void)
prefDlg = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kControlPrefsDialID, kPutInFront, nullptr);
if (prefDlg == nil)
RedAlert(kErrDialogDidntLoad);
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
for (i = 0; i < 4; i++)
{
GetDialogItemRect(prefDlg, i + kRightControl, &controlRects[i]);
@@ -863,7 +870,8 @@ void DisplayDefaults (void)
numNeighbors = 9;
wasDepthPref = kSwitchIfNeeded;
wasFade = true;
wasScreen2 = false;
wasAutoScale = true;
wasUseICCProfile = true;
}
//-------------------------------------------------------------- FrameDisplayIcon
@@ -907,6 +915,10 @@ void DisplayUpdate (Dialog *theDialog)
DrawDefaultButton(theDialog);
SetDialogItemValue(theDialog, kDoColorFadeItem, (short)wasFade);
SetDialogItemValue(theDialog, k32BitColorItem, wasDepthPref == 32);
SetDialogItemValue(theDialog, kScaleResolutionItem, (short)isAutoScale);
SetDialogItemValue(theDialog, kUseICCProfileItem, (short)isUseICCProfile);
SetDialogItemValue(theDialog, kFullScreenItem, wasFullscreenPref);
FrameDisplayIcon(theDialog, StdColors::Red());
FrameDialogItemC(theDialog, kBorder1Item, kRedOrangeColor8);
@@ -1002,13 +1014,11 @@ void DoDisplayPrefs (void)
BringUpDialog(&prefDlg, kDisplayPrefsDialID, nullptr);
if (!thisMac.can8Bit)
MyDisableControl(prefDlg, kDoColorFadeItem);
wasNeighbors = numNeighbors;
wasFade = isDoColorFade;
wasDepthPref = isDepthPref;
wasScreen2 = isUseSecondScreen;
wasAutoScale = isAutoScale;
wasUseICCProfile = isUseICCProfile;
leaving = false;
DisplayUpdate(prefDlg);
@@ -1020,10 +1030,13 @@ void DoDisplayPrefs (void)
{
case kOkayButton:
isDoColorFade = wasFade;
isDepthPref = wasDepthPref;
if (isUseSecondScreen != wasScreen2)
if (isDepthPref != wasDepthPref)
nextRestartChange = true;
isUseSecondScreen = wasScreen2;
if (isAutoScale != wasAutoScale)
needResolutionReset = true;
isDepthPref = wasDepthPref;
isAutoScale = wasAutoScale;
isUseICCProfile = wasUseICCProfile;
leaving = true;
break;
@@ -1061,6 +1074,29 @@ void DoDisplayPrefs (void)
SetDialogItemValue(prefDlg, kDoColorFadeItem, (short)wasFade);
break;
case k32BitColorItem:
if (wasDepthPref == 32)
wasDepthPref = 8;
else
wasDepthPref = 32;
SetDialogItemValue(prefDlg, k32BitColorItem, wasDepthPref == 32);
break;
case kScaleResolutionItem:
wasAutoScale = !wasAutoScale;
SetDialogItemValue(prefDlg, kScaleResolutionItem, (short)wasAutoScale);
break;
case kUseICCProfileItem:
wasUseICCProfile = !wasUseICCProfile;
SetDialogItemValue(prefDlg, kUseICCProfileItem, (short)wasUseICCProfile);
break;
case kFullScreenItem:
wasFullscreenPref = !wasFullscreenPref;
SetDialogItemValue(prefDlg, kFullScreenItem, (short)wasFullscreenPref);
break;
case kDispDefault:
FrameDisplayIcon(prefDlg, StdColors::White());
DisplayDefaults();
@@ -1121,6 +1157,8 @@ void SetAllDefaults (void)
quickerTransitions = false;
isDepthPref = kSwitchIfNeeded;
isDoColorFade = true;
needResolutionReset = true;
}
//-------------------------------------------------------------- FlashSettingsButton
@@ -1246,6 +1284,8 @@ void DoSettingsMain (void)
leaving = false;
nextRestartChange = false;
wasFullscreenPref = PortabilityLayer::HostDisplayDriver::GetInstance()->IsFullScreen();
Window* exclWindow = prefDlg->GetWindow();
PortabilityLayer::WindowManager::GetInstance()->SwapExclusiveWindow(exclWindow); // Push exclusive window
@@ -1263,20 +1303,17 @@ void DoSettingsMain (void)
case kDisplayButton:
FlashSettingsButton(surface, 0);
DoDisplayPrefs();
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
break;
case kSoundButton:
FlashSettingsButton(surface, 1);
DoSoundPrefs();
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
FlushEvents(everyEvent, 0);
FlushEvents();
break;
case kControlsButton:
FlashSettingsButton(surface, 2);
DoControlPrefs();
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
break;
case kBrainsButton:
@@ -1288,7 +1325,6 @@ void DoSettingsMain (void)
}
FlashSettingsButton(surface, 3);
DoBrainsPrefs();
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
break;
case kAllDefaultsButton:
@@ -1302,7 +1338,26 @@ void DoSettingsMain (void)
prefDlg->Destroy();
if (nextRestartChange)
{
BitchAboutChanges();
nextRestartChange = false;
}
IGpDisplayDriver *displayDriver = PortabilityLayer::HostDisplayDriver::GetInstance();
if (displayDriver->IsFullScreen() != (wasFullscreenPref != 0))
{
displayDriver->RequestToggleFullScreen(0);
needResolutionReset = false;
}
if (needResolutionReset)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->RequestResetVirtualResolution();
needResolutionReset = false;
}
PortabilityLayer::HostDisplayDriver::GetInstance()->SetUseICCProfile(isUseICCProfile);
}
//-------------------------------------------------------------- BitchAboutChanges

View File

@@ -63,7 +63,6 @@ void InitScoreboardMap(void)
{
Rect bounds;
THandle<BitmapImage> thePicture;
DrawSurface *wasCPort;
PLError_t theErr;
short hOffset;
@@ -73,7 +72,7 @@ void InitScoreboardMap(void)
boardSrcRect = houseRect;
ZeroRectCorner(&boardSrcRect);
boardSrcRect.bottom = kScoreboardTall;
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect);
if (boardSrcRect.right >= 640)
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
@@ -91,7 +90,7 @@ void InitScoreboardMap(void)
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
if (!badgeSrcMap)
{
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect);
LoadGraphic(badgeSrcMap, kBadgePictID);
}
@@ -104,7 +103,7 @@ void InitScoreboardMap(void)
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
if (!boardTSrcMap)
{
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect);
}
boardTDestRect = boardTSrcRect;
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
@@ -112,7 +111,7 @@ void InitScoreboardMap(void)
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
if (!boardGSrcMap)
{
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect);
}
boardGDestRect = boardGSrcRect;
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
@@ -121,7 +120,7 @@ void InitScoreboardMap(void)
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
if (!boardPSrcMap)
{
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect);
}
boardPDestRect = boardPSrcRect;
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
@@ -166,13 +165,13 @@ void InitGliderMap (void)
short i;
QSetRect(&glidSrcRect, 0, 0, kGliderWide, 668); // 32112 pixels
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect);
LoadGraphic(glidSrcMap, kGliderPictID);
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect);
LoadGraphic(glid2SrcMap, kGlider2PictID);
theErr = CreateOffScreenGWorld(&glidMaskMap, &glidSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&glidMaskMap, &glidSrcRect, GpPixelFormats::kBW1);
LoadGraphic(glidMaskMap, kGliderPictID + 1000);
for (i = 0; i <= 20; i++)
@@ -192,10 +191,10 @@ void InitGliderMap (void)
QOffsetRect(&gliderSrc[30], 0, 648);
QSetRect(&shadowSrcRect, 0, 0, kGliderWide, kShadowHigh * kNumShadowSrcRects);
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect);
LoadGraphic(shadowSrcMap, kShadowPictID);
theErr = CreateOffScreenGWorld(&shadowMaskMap, &shadowSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&shadowMaskMap, &shadowSrcRect, GpPixelFormats::kBW1);
LoadGraphic(shadowMaskMap, kShadowPictID + 1000);
for (i = 0; i < kNumShadowSrcRects; i++)
@@ -205,10 +204,10 @@ void InitGliderMap (void)
}
QSetRect(&bandsSrcRect, 0, 0, 16, 18); // 304 pixels
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect);
LoadGraphic(bandsSrcMap, kRubberBandsPictID);
theErr = CreateOffScreenGWorld(&bandsMaskMap, &bandsSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&bandsMaskMap, &bandsSrcRect, GpPixelFormats::kBW1);
LoadGraphic(bandsMaskMap, kRubberBandsPictID + 1000);
for (i = 0; i < 3; i++)
@@ -228,10 +227,10 @@ void InitBlowers (void)
PLError_t theErr;
QSetRect(&blowerSrcRect, 0, 0, 48, 402); // 19344 pixels
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect);
LoadGraphic(blowerSrcMap, kBlowerPictID);
theErr = CreateOffScreenGWorld(&blowerMaskMap, &blowerSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&blowerMaskMap, &blowerSrcRect, GpPixelFormats::kBW1);
LoadGraphic(blowerMaskMap, kBlowerPictID + 1000);
for (i = 0; i < kNumCandleFlames; i++)
@@ -265,16 +264,13 @@ void InitBlowers (void)
void InitFurniture (void)
{
DrawSurface *wasCPort;
PLError_t theErr;
wasCPort = GetGraphicsPort();
QSetRect(&furnitureSrcRect, 0, 0, 64, 278); // 17856 pixels
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect);
LoadGraphic(furnitureSrcMap, kFurniturePictID);
theErr = CreateOffScreenGWorld(&furnitureMaskMap, &furnitureSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&furnitureMaskMap, &furnitureSrcRect, GpPixelFormats::kBW1);
LoadGraphic(furnitureMaskMap, kFurniturePictID + 1000);
QSetRect(&tableSrc, 0, 0, 64, 22);
@@ -300,8 +296,6 @@ void InitFurniture (void)
QSetRect(&deckSrc, 0, 0, 64, 21);
QOffsetRect(&deckSrc, 0, 162);
SetGraphicsPort(wasCPort);
}
//-------------------------------------------------------------- InitPrizes
@@ -314,10 +308,10 @@ void InitPrizes (void)
PLError_t theErr;
QSetRect(&bonusSrcRect, 0, 0, 88, 378); // 33264 pixels
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect);
LoadGraphic(bonusSrcMap, kBonusPictID);
theErr = CreateOffScreenGWorld(&bonusMaskMap, &bonusSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&bonusMaskMap, &bonusSrcRect, GpPixelFormats::kBW1);
LoadGraphic(bonusMaskMap, kBonusPictID + 1000);
for (i = 0; i < 11; i++)
@@ -365,10 +359,10 @@ void InitPrizes (void)
sparkleSrc[1] = sparkleSrc[3];
QSetRect(&pointsSrcRect, 0, 0, 24, 120); // 2880 pixels
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect);
LoadGraphic(pointsSrcMap, kPointsPictID);
theErr = CreateOffScreenGWorld(&pointsMaskMap, &pointsSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&pointsMaskMap, &pointsSrcRect, GpPixelFormats::kBW1);
LoadGraphic(pointsMaskMap, kPointsPictID + 1000);
for (i = 0; i < 15; i++)
@@ -387,10 +381,10 @@ void InitTransports (void)
PLError_t theErr;
QSetRect(&transSrcRect, 0, 0, 56, 32); // 1848 pixels
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect);
LoadGraphic(transSrcMap, kTransportPictID);
theErr = CreateOffScreenGWorld(&transMaskMap, &transSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&transMaskMap, &transSrcRect, GpPixelFormats::kBW1);
LoadGraphic(transMaskMap, kTransportPictID + 1000);
}
@@ -403,7 +397,7 @@ void InitSwitches (void)
PLError_t theErr;
QSetRect(&switchSrcRect, 0, 0, 32, 104); // 3360 pixels
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect);
LoadGraphic(switchSrcMap, kSwitchPictID);
QSetRect(&lightSwitchSrc[0], 0, 0, 15, 24);
@@ -442,10 +436,10 @@ void InitLights (void)
PLError_t theErr;
QSetRect(&lightSrcRect, 0, 0, 72, 126); // 9144 pixels
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect);
LoadGraphic(lightSrcMap, kLightPictID);
theErr = CreateOffScreenGWorld(&lightMaskMap, &lightSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&lightMaskMap, &lightSrcRect, GpPixelFormats::kBW1);
LoadGraphic(lightMaskMap, kLightPictID + 1000);
QSetRect(&flourescentSrc1, 0, 0, 16, 12);
@@ -471,24 +465,24 @@ void InitAppliances (void)
PLError_t theErr;
QSetRect(&applianceSrcRect, 0, 0, 80, 269); // 21600 pixels
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect);
LoadGraphic(applianceSrcMap, kAppliancePictID);
theErr = CreateOffScreenGWorld(&applianceMaskMap, &applianceSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&applianceMaskMap, &applianceSrcRect, GpPixelFormats::kBW1);
LoadGraphic(applianceMaskMap, kAppliancePictID + 1000);
QSetRect(&toastSrcRect, 0, 0, 32, 174); // 5600 pixels
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect);
LoadGraphic(toastSrcMap, kToastPictID);
theErr = CreateOffScreenGWorld(&toastMaskMap, &toastSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&toastMaskMap, &toastSrcRect, GpPixelFormats::kBW1);
LoadGraphic(toastMaskMap, kToastPictID + 1000);
QSetRect(&shredSrcRect, 0, 0, 40, 35); // 1440 pixels
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect);
LoadGraphic(shredSrcMap, kShreddedPictID);
theErr = CreateOffScreenGWorld(&shredMaskMap, &shredSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&shredMaskMap, &shredSrcRect, GpPixelFormats::kBW1);
LoadGraphic(shredMaskMap, kShreddedPictID + 1000);
QSetRect(&plusScreen1, 0, 0, 32, 22);
@@ -544,52 +538,52 @@ void InitEnemies (void)
PLError_t theErr;
QSetRect(&balloonSrcRect, 0, 0, 24, 30 * kNumBalloonFrames);
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect);
LoadGraphic(balloonSrcMap, kBalloonPictID);
theErr = CreateOffScreenGWorld(&balloonMaskMap, &balloonSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&balloonMaskMap, &balloonSrcRect, GpPixelFormats::kBW1);
LoadGraphic(balloonMaskMap, kBalloonPictID + 1000);
QSetRect(&copterSrcRect, 0, 0, 32, 30 * kNumCopterFrames);
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect);
LoadGraphic(copterSrcMap, kCopterPictID);
theErr = CreateOffScreenGWorld(&copterMaskMap, &copterSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&copterMaskMap, &copterSrcRect, GpPixelFormats::kBW1);
LoadGraphic(copterMaskMap, kCopterPictID + 1000);
QSetRect(&dartSrcRect, 0, 0, 64, 19 * kNumDartFrames);
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect);
LoadGraphic(dartSrcMap, kDartPictID);
theErr = CreateOffScreenGWorld(&dartMaskMap, &dartSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&dartMaskMap, &dartSrcRect, GpPixelFormats::kBW1);
LoadGraphic(dartMaskMap, kDartPictID + 1000);
QSetRect(&ballSrcRect, 0, 0, 32, 32 * kNumBallFrames);
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect);
LoadGraphic(ballSrcMap, kBallPictID);
theErr = CreateOffScreenGWorld(&ballMaskMap, &ballSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&ballMaskMap, &ballSrcRect, GpPixelFormats::kBW1);
LoadGraphic(ballMaskMap, kBallPictID + 1000);
QSetRect(&dripSrcRect, 0, 0, 16, 12 * kNumDripFrames);
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect);
LoadGraphic(dripSrcMap, kDripPictID);
theErr = CreateOffScreenGWorld(&dripMaskMap, &dripSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&dripMaskMap, &dripSrcRect, GpPixelFormats::kBW1);
LoadGraphic(dripMaskMap, kDripPictID + 1000);
QSetRect(&enemySrcRect, 0, 0, 36, 33);
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect);
LoadGraphic(enemySrcMap, kEnemyPictID);
theErr = CreateOffScreenGWorld(&enemyMaskMap, &enemySrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&enemyMaskMap, &enemySrcRect, GpPixelFormats::kBW1);
LoadGraphic(enemyMaskMap, kEnemyPictID + 1000);
QSetRect(&fishSrcRect, 0, 0, 16, 16 * kNumFishFrames);
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect);
LoadGraphic(fishSrcMap, kFishPictID);
theErr = CreateOffScreenGWorld(&fishMaskMap, &fishSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&fishMaskMap, &fishSrcRect, GpPixelFormats::kBW1);
LoadGraphic(fishMaskMap, kFishPictID + 1000);
for (i = 0; i < kNumBalloonFrames; i++)

View File

@@ -57,10 +57,10 @@ void InitClutter (void)
PLError_t theErr;
QSetRect(&clutterSrcRect, 0, 0, 128, 69);
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect);
LoadGraphic(clutterSrcMap, kClutterPictID);
theErr = CreateOffScreenGWorld(&clutterMaskMap, &clutterSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&clutterMaskMap, &clutterSrcRect, GpPixelFormats::kBW1);
LoadGraphic(clutterMaskMap, kClutterPictID + 1000);
QSetRect(&flowerSrc[0], 0, 0, 10, 28);
@@ -92,7 +92,7 @@ void InitSupport (void)
PLError_t theErr;
QSetRect(&suppSrcRect, 0, 0, kRoomWide, kFloorSupportTall); // 44
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect);
LoadGraphic(suppSrcMap, kSupportPictID);
}
@@ -106,10 +106,10 @@ void InitAngel (void)
PLError_t theErr;
QSetRect(&angelSrcRect, 0, 0, 96, 44);
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect);
LoadGraphic(angelSrcMap, kAngelPictID);
theErr = CreateOffScreenGWorld(&angelMaskMap, &angelSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&angelMaskMap, &angelSrcRect, GpPixelFormats::kBW1);
LoadGraphic(angelMaskMap, kAngelPictID + 1);
}
@@ -119,8 +119,6 @@ PLError_t RecreateOffscreens(void)
{
PLError_t theErr;
PortabilityLayer::QDManager::GetInstance()->SetPort(nullptr);
if (workSrcMap)
DisposeGWorld(workSrcMap);
@@ -132,11 +130,11 @@ PLError_t RecreateOffscreens(void)
workSrcRect = houseRect; // Set up work map
ZeroRectCorner(&workSrcRect);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect);
backSrcRect = houseRect; // Set up background map
ZeroRectCorner(&backSrcRect);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect);
return PLErrors::kNone;
}

View File

@@ -5,7 +5,6 @@
//============================================================================
#include "PLTextUtils.h"
#include "PLControlDefinitions.h"
#include "PLPasStr.h"
#include "PLStandardColors.h"
@@ -88,7 +87,7 @@ void CreateToolsOffscreen (void)
if (toolSrcMap == nil)
{
QSetRect(&toolSrcRect, 0, 0, 360, 216);
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect);
LoadGraphic(toolSrcMap, kToolsPictID);
}
}
@@ -199,8 +198,6 @@ void EraseSelectedTool (void)
if (toolsWindow == nil)
return;
SetPort(toolsWindow->GetDrawSurface());
toolIcon = toolSelected;
if ((toolMode == kBlowerMode) && (toolIcon >= 7))
{
@@ -471,7 +468,6 @@ void HandleToolsClick (Point wherePt)
if (toolsWindow == nil)
return;
SetPortWindowPort(toolsWindow);
wherePt -= toolsWindow->GetTopLeftCoord();
part = FindControl(wherePt, toolsWindow, &theControl);

View File

@@ -9,9 +9,15 @@
#include "Externs.h"
#include "Environ.h"
#include "MainWindow.h"
#include "MemoryManager.h"
#include "QDPixMap.h"
#include "PLQDraw.h"
#include "RectUtils.h"
#include "RandomNumberGenerator.h"
#include <algorithm>
extern Boolean quickerTransitions;
//============================================================== Functions
@@ -38,7 +44,10 @@ void PourScreenOn (Rect *theRect)
QSetRect(&columnRects[i], 0, 0, kChipWide, kChipHigh);
QOffsetRect(&columnRects[i], (i * kChipWide) + theRect->left, theRect->top);
}
const int kUnitsPerBlock = 128;
int unitsCommitted = 0;
while (working)
{
do
@@ -68,47 +77,73 @@ void PourScreenOn (Rect *theRect)
if (colsComplete >= colWide)
working = false;
}
unitsCommitted++;
if (unitsCommitted == kUnitsPerBlock)
{
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
Delay(1, nullptr);
unitsCommitted = 0;
}
}
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}
//-------------------------------------------------------------- WipeScreenOn
void WipeScreenOn (short direction, Rect *theRect)
{
#define kWipeRectThick 4
if (quickerTransitions)
{
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
theRect, theRect, srcCopy);
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
return;
}
Rect wipeRect;
short hOffset, vOffset;
short i, count;
const int kWipeTransitionTime = 10;
const int wipeRectThick = (theRect->Width() + kWipeTransitionTime - 1) / kWipeTransitionTime;
wipeRect = *theRect;
switch (direction)
{
case kAbove:
wipeRect.bottom = wipeRect.top + kWipeRectThick;
wipeRect.bottom = wipeRect.top + wipeRectThick;
hOffset = 0;
vOffset = kWipeRectThick;
count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1;
vOffset = wipeRectThick;
count = (theRect->bottom - theRect->top + wipeRectThick - 1) / wipeRectThick;
break;
case kToRight:
wipeRect.left = wipeRect.right - kWipeRectThick;
hOffset = -kWipeRectThick;
wipeRect.left = wipeRect.right - wipeRectThick;
hOffset = -wipeRectThick;
vOffset = 0;
count = workSrcRect.right / kWipeRectThick;
count = (workSrcRect.right + wipeRectThick - 1) / wipeRectThick;
break;
case kBelow:
wipeRect.top = wipeRect.bottom - kWipeRectThick;
wipeRect.top = wipeRect.bottom - wipeRectThick;
hOffset = 0;
vOffset = -kWipeRectThick;
count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1;
vOffset = -wipeRectThick;
count = (theRect->bottom - theRect->top + wipeRectThick - 1) / wipeRectThick;
break;
case kToLeft:
wipeRect.right = wipeRect.left + kWipeRectThick;
hOffset = kWipeRectThick;
wipeRect.right = wipeRect.left + wipeRectThick;
hOffset = wipeRectThick;
vOffset = 0;
count = workSrcRect.right / kWipeRectThick;
count = (workSrcRect.right + wipeRectThick - 1) / wipeRectThick;
break;
}
@@ -128,19 +163,95 @@ void WipeScreenOn (short direction, Rect *theRect)
wipeRect.bottom = theRect->top;
else if (wipeRect.bottom > theRect->bottom)
wipeRect.bottom = theRect->bottom;
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
Delay(1, nullptr);
}
}
//-------------------------------------------------------------- DissolveScreenOn
void DissolveScreenOn(Rect *theRect)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
const int kChunkHeight = 15;
const int kChunkWidth = 20;
const int rows = (theRect->Height() + kChunkHeight - 1) / kChunkHeight;
const int cols = (theRect->Width() + kChunkWidth - 1) / kChunkWidth;
const int numCells = rows * cols;
const int targetTransitionTime = 30;
Point *points = static_cast<Point*>(PortabilityLayer::MemoryManager::GetInstance()->Alloc(sizeof(Point) * numCells));
int rectLeft = theRect->left;
int rectTop = theRect->top;
for (int row = 0; row < rows; row++)
{
for (int col = 0; col < cols; col++)
points[col + row * cols] = Point::Create(col * kChunkWidth + rectLeft, row * kChunkHeight + rectTop);
}
PortabilityLayer::RandomNumberGenerator *rng = PortabilityLayer::RandomNumberGenerator::GetInstance();
for (unsigned int shuffleIndex = 0; shuffleIndex < static_cast<unsigned int>(numCells - 1); shuffleIndex++)
{
unsigned int shuffleRange = static_cast<unsigned int>(numCells - 1) - shuffleIndex;
unsigned int shuffleTarget = (rng->GetNextAndAdvance() % shuffleRange) + shuffleIndex;
if (shuffleTarget != shuffleIndex)
std::swap(points[shuffleIndex], points[shuffleTarget]);
}
const int numCellsAtOnce = numCells / targetTransitionTime;
const BitMap *srcBitmap = *GetGWorldPixMap(workSrcMap);
BitMap *destBitmap = GetPortBitMapForCopyBits(graf);
for (unsigned int firstCell = 0; firstCell < static_cast<unsigned int>(numCells); firstCell += numCellsAtOnce)
{
unsigned int lastCell = firstCell + numCellsAtOnce;
if (lastCell > static_cast<unsigned int>(numCells))
lastCell = numCells;
for (unsigned int i = firstCell; i < lastCell; i++)
{
const Point &point = points[i];
const Rect copyRect = Rect::Create(point.v, point.h, point.v + kChunkHeight, point.h + kChunkWidth);
CopyBits(srcBitmap, destBitmap, &copyRect, &copyRect, srcCopy);
}
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
Delay(1, nullptr);
}
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
PortabilityLayer::MemoryManager::GetInstance()->Release(points);
}
//-------------------------------------------------------------- DumpScreenOn
void DumpScreenOn (Rect *theRect)
void DumpScreenOn(Rect *theRect, Boolean fast)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
if (quickerTransitions || fast)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(graf),
theRect, theRect, srcCopy);
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}
else
DissolveScreenOn(theRect);
}

View File

@@ -15,6 +15,7 @@
#include "QDPixMap.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "DisplayDeviceManager.h"
#include "Externs.h"
#include "HostSystemServices.h"
#include "IconLoader.h"
@@ -211,13 +212,17 @@ void CreateOffScreenPixMap (Rect *theRect, CGrafPtr *offScreen)
//-------------------------------------------------------------------- CreateOffScreenGWorld
// Creates an offscreen GWorld<6C>using the depth passed in.
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds)
{
PLError_t theErr;
GpPixelFormat_t pixelFormat = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetPixelFormat();
theErr = NewGWorld(theGWorld, pixelFormat, bounds, nil);
return theErr;
return NewGWorld(theGWorld, pixelFormat, bounds, nil);
}
PLError_t CreateOffScreenGWorldCustomDepth(DrawSurface **theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
{
return NewGWorld(theGWorld, pixelFormat, bounds, nil);
}
//-------------------------------------------------------------- KillOffScreenPixMap
@@ -424,7 +429,7 @@ Boolean WaitForInputEvent (short seconds)
Boolean waiting, didResume;
timeToBail = TickCount() + 60L * (long)seconds;
FlushEvents(everyEvent, 0);
FlushEvents();
waiting = true;
didResume = false;
@@ -446,7 +451,7 @@ Boolean WaitForInputEvent (short seconds)
Delay(1, nullptr);
}
FlushEvents(everyEvent, 0);
FlushEvents();
return (didResume);
}
@@ -469,7 +474,7 @@ void WaitCommandQReleased (void)
Delay(1, nullptr);
}
FlushEvents(everyEvent, 0);
FlushEvents();
}
//-------------------------------------------------------------- KeyMapOffsetFromRawKey

View File

@@ -9,4 +9,5 @@
#include "GpPixelFormat.h"
PLError_t CreateOffScreenGWorld (DrawSurface **surface, Rect *bounds, GpPixelFormat_t pixelFormat);
PLError_t CreateOffScreenGWorld (DrawSurface **surface, Rect *bounds);
PLError_t CreateOffScreenGWorldCustomDepth (DrawSurface **surface, Rect *bounds, GpPixelFormat_t pixelFormat);

View File

@@ -65,10 +65,7 @@ void GetWindowRect (WindowPtr theWindow, Rect *bounds)
void GetLocalWindowRect (WindowPtr theWindow, Rect *bounds)
{
if (theWindow != nil)
{
SetPortWindowPort(theWindow);
*bounds = theWindow->GetDrawSurface()->m_port.GetRect();
}
}
//-------------------------------------------------------------- FlagWindowFloating

View File

@@ -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;
}

View File

@@ -1,5 +1,6 @@
#include "GpAudioDriverXAudio2.h"
#include "IGpLogDriver.h"
#include "GpAudioChannelXAudio2.h"
#include <xaudio2.h>
@@ -9,6 +10,11 @@ void GpAudioDriverXAudio2::Shutdown()
delete this;
}
IGpPrefsHandler *GpAudioDriverXAudio2::GetPrefsHandler() const
{
return nullptr;
}
const GpAudioDriverProperties &GpAudioDriverXAudio2::GetProperties() const
{
return m_properties;
@@ -31,34 +37,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);
}

View File

@@ -14,6 +14,8 @@ public:
void SetMasterVolume(uint32_t vol, uint32_t maxVolume) override;
void Shutdown() override;
IGpPrefsHandler *GetPrefsHandler() const override;
const GpAudioDriverProperties &GetProperties() const;
IXAudio2 *GetXA2() const;
IXAudio2MasteringVoice *GetMasteringVoice() const;

View File

@@ -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>

View File

@@ -42,4 +42,7 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

View 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>

View File

@@ -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;
};

View File

@@ -0,0 +1,9 @@
#pragma once
#define GP_BUILD_VERSION_MAJOR 1
#define GP_BUILD_VERSION_MINOR 0
#define GP_BUILD_VERSION_UPDATE 7
#define GP_APPLICATION_VERSION_STRING "1.0.7"
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2020 Eric Lasota"
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"

View File

@@ -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;
};

View File

@@ -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;

View File

@@ -3,6 +3,7 @@
#include <stdint.h>
struct IGpAudioChannel;
struct IGpPrefsHandler;
struct IGpAudioDriver
{
@@ -12,4 +13,6 @@ public:
virtual void SetMasterVolume(uint32_t vol, uint32_t maxVolume) = 0;
virtual void Shutdown() = 0;
virtual IGpPrefsHandler *GetPrefsHandler() const = 0;
};

View File

@@ -5,6 +5,8 @@
struct IGpDisplayDriverSurface;
struct IGpCursor;
struct IGpPrefsHandler;
struct GpDisplayDriverProperties;
struct GpDisplayDriverSurfaceEffects
{
@@ -26,7 +28,7 @@ public:
virtual void Run() = 0;
virtual void Shutdown() = 0;
virtual void GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *bpp) = 0;
virtual void GetDisplayResolution(unsigned int *width, unsigned int *height) = 0;
virtual IGpDisplayDriverSurface *CreateSurface(size_t width, size_t height, GpPixelFormat_t pixelFormat) = 0;
virtual void DrawSurface(IGpDisplayDriverSurface *surface, int32_t x, int32_t y, size_t width, size_t height, const GpDisplayDriverSurfaceEffects *effects) = 0;
@@ -38,8 +40,17 @@ public:
virtual void UpdatePalette(const void *paletteData) = 0;
virtual void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) = 0;
virtual void SetBackgroundDarkenEffect(bool isDark) = 0;
virtual void SetUseICCProfile(bool useICCProfile) = 0;
virtual void RequestToggleFullScreen(uint32_t timestamp) = 0;
virtual void RequestResetVirtualResolution() = 0;
virtual bool IsFullScreen() const = 0;
virtual const GpDisplayDriverProperties &GetProperties() const = 0;
virtual IGpPrefsHandler *GetPrefsHandler() const = 0;
};
inline GpDisplayDriverSurfaceEffects::GpDisplayDriverSurfaceEffects()

View File

@@ -1,7 +1,11 @@
#pragma once
struct IGpPrefsHandler;
struct IGpInputDriver
{
virtual void ProcessInput() = 0;
virtual void Shutdown() = 0;
virtual IGpPrefsHandler *GetPrefsHandler() const = 0;
};

28
GpCommon/IGpLogDriver.h Normal file
View 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);
}

View File

@@ -0,0 +1,11 @@
#pragma once
#include <stdint.h>
struct IGpPrefsHandler
{
typedef bool (*WritePrefsFunc_t) (void *context, const void *identifier, size_t identifierSize, const void *contents, size_t contentsSize, uint32_t version);
virtual void ApplyPrefs(const void *identifier, size_t identifierSize, const void *contents, size_t contentsSize, uint32_t version) = 0;
virtual bool SavePrefs(void *context, WritePrefsFunc_t writeFunc) = 0;
};

View File

@@ -0,0 +1,52 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 181, 133, 124, 121, 179, 141, 64, 216, 166, 21, 153,
10, 33, 21, 80, 169, 1, 0, 0, 0, 152, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 224, 0, 0, 0, 56, 1, 0, 0, 108,
1, 0, 0, 28, 2, 0, 0, 82, 68, 69, 70, 164, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 122, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
107, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0,
0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 115, 117, 114, 102, 97, 99, 101, 83, 97, 109, 112, 108, 101,
114, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114,
101, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 171, 171, 73,
83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0,
56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3,
3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71,
78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69,
84, 0, 171, 171, 83, 72, 68, 82, 168, 0, 0, 0, 64, 0, 0,
0, 42, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0,
0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85,
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0,
0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
18, 32, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
0, 54, 0, 0, 5, 98, 32, 16, 0, 0, 0, 0, 0, 6, 17,
16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0,
0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1,
83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
};
namespace GpBinarizedShaders
{
const unsigned char *g_drawQuad15BitICCP_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
};

View File

@@ -1,8 +1,8 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 123, 171, 231, 206, 83, 178, 250, 149, 189, 168, 129,
29, 12, 186, 195, 194, 1, 0, 0, 0, 24, 9, 0, 0, 5, 0,
68, 88, 66, 67, 167, 218, 15, 90, 211, 69, 240, 219, 76, 79, 17,
242, 61, 175, 125, 206, 1, 0, 0, 0, 44, 8, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 172, 2, 0, 0, 4, 3, 0, 0, 56,
3, 0, 0, 156, 8, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
3, 0, 0, 176, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 72, 2, 0, 0, 124, 0,
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
@@ -54,13 +54,13 @@ static unsigned char gs_shaderData[] = {
1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
72, 68, 82, 92, 5, 0, 0, 64, 0, 0, 0, 87, 1, 0, 0,
72, 68, 82, 112, 4, 0, 0, 64, 0, 0, 0, 28, 1, 0, 0,
89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0,
0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68,
0, 0, 88, 16, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85,
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
2, 4, 0, 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0,
2, 3, 0, 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 27, 0, 0, 5, 50,
0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0,
54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0,
@@ -93,68 +93,52 @@ static unsigned char gs_shaderData[] = {
0, 0, 0, 55, 0, 0, 12, 242, 0, 16, 0, 0, 0, 0, 0,
6, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0,
0, 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,
128, 63, 0, 0, 128, 63, 57, 0, 0, 8, 18, 0, 16, 0, 1,
0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0,
1, 64, 0, 0, 0, 0, 0, 0, 31, 0, 4, 3, 10, 0, 16,
0, 1, 0, 0, 0, 29, 0, 0, 10, 114, 0, 16, 0, 1, 0,
0, 0, 2, 64, 0, 0, 28, 46, 77, 59, 28, 46, 77, 59, 28,
46, 77, 59, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16,
0, 0, 0, 0, 0, 2, 64, 0, 0, 82, 184, 78, 65, 82, 184,
78, 65, 82, 184, 78, 65, 0, 0, 0, 0, 47, 0, 0, 5, 114,
0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16,
0, 3, 0, 0, 0, 2, 64, 0, 0, 85, 85, 213, 62, 85, 85,
213, 62, 85, 85, 213, 62, 0, 0, 0, 0, 25, 0, 0, 5, 114,
0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0,
50, 0, 0, 15, 114, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16,
0, 3, 0, 0, 0, 2, 64, 0, 0, 61, 10, 135, 63, 61, 10,
135, 63, 61, 10, 135, 63, 0, 0, 0, 0, 2, 64, 0, 0, 174,
71, 97, 189, 174, 71, 97, 189, 174, 71, 97, 189, 0, 0, 0, 0,
55, 0, 0, 9, 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2,
16, 0, 3, 0, 0, 0, 16, 0, 0, 10, 130, 0, 16, 0, 1,
0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0,
154, 153, 153, 62, 154, 153, 25, 63, 205, 204, 204, 61, 0, 0, 0,
0, 0, 0, 0, 9, 18, 0, 16, 0, 2, 0, 0, 0, 10, 128,
32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 8, 130, 0, 16, 0,
1, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32,
0, 0, 0, 0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 114, 0,
16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 6,
0, 16, 0, 2, 0, 0, 0, 246, 15, 16, 0, 1, 0, 0, 0,
29, 0, 0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 2, 64, 0,
0, 230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37, 61, 0, 0,
0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 56, 0, 0, 10, 114,
0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0,
2, 64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61, 145, 131, 158,
61, 0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, 174,
71, 97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114, 63, 110, 167,
114, 63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0, 0, 5, 114,
0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25, 64, 154, 153,
25, 64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114,
0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0,
55, 0, 0, 9, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
0, 2, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0, 70, 2,
16, 0, 1, 0, 0, 0, 21, 0, 0, 1, 29, 0, 0, 7, 18,
0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0,
58, 0, 16, 0, 0, 0, 0, 0, 13, 0, 4, 3, 10, 0, 16,
0, 1, 0, 0, 0, 54, 0, 0, 5, 242, 32, 16, 0, 0, 0,
0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
84, 65, 84, 116, 0, 0, 0, 42, 0, 0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 22, 0, 0, 0, 4, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
128, 63, 0, 0, 128, 63, 29, 0, 0, 7, 18, 0, 16, 0, 1,
0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
0, 0, 0, 0, 13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0,
0, 57, 0, 0, 8, 18, 0, 16, 0, 1, 0, 0, 0, 10, 128,
32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0,
0, 0, 0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153,
62, 154, 153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0,
0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65,
0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0,
0, 0, 128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0,
0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0,
0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1,
0, 0, 0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0,
1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 0, 0,
9, 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0,
0, 0, 150, 7, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 29, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0,
2, 64, 0, 0, 230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37,
61, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0,
0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 2, 64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61,
145, 131, 158, 61, 0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16,
0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64,
0, 0, 174, 71, 97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0,
0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114,
63, 110, 167, 114, 63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0,
0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25,
64, 154, 153, 25, 64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0,
0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 55, 0, 0, 9, 114, 32, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32,
16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62,
0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 34, 0, 0, 0,
3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 16, 0, 0,
0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
namespace GpBinarizedShaders

View File

@@ -0,0 +1,143 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 63, 150, 199, 197, 210, 83, 220, 166, 163, 78, 42,
252, 31, 18, 160, 91, 1, 0, 0, 0, 240, 7, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 172, 2, 0, 0, 4, 3, 0, 0, 56,
3, 0, 0, 116, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 72, 2, 0, 0, 124, 0,
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
139, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0,
0, 255, 255, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 13, 0,
0, 0, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
1, 0, 0, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116,
117, 114, 101, 0, 112, 97, 108, 101, 116, 116, 101, 84, 101, 120, 116,
117, 114, 101, 0, 83, 68, 114, 97, 119, 81, 117, 97, 100, 80, 105,
120, 101, 108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 171, 171,
154, 0, 0, 0, 6, 0, 0, 0, 204, 0, 0, 0, 48, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 1, 0, 0, 0, 0,
0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 116, 1, 0, 0, 0,
0, 0, 0, 132, 1, 0, 0, 16, 0, 0, 0, 8, 0, 0, 0,
2, 0, 0, 0, 156, 1, 0, 0, 0, 0, 0, 0, 172, 1, 0,
0, 24, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 204, 1,
0, 0, 0, 0, 0, 0, 220, 1, 0, 0, 28, 0, 0, 0, 4,
0, 0, 0, 2, 0, 0, 0, 204, 1, 0, 0, 0, 0, 0, 0,
250, 1, 0, 0, 32, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0,
0, 20, 2, 0, 0, 0, 0, 0, 0, 36, 2, 0, 0, 36, 0,
0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 56, 2, 0, 0, 0,
0, 0, 0, 99, 111, 110, 115, 116, 97, 110, 116, 115, 95, 77, 111,
100, 117, 108, 97, 116, 105, 111, 110, 0, 171, 171, 171, 1, 0, 3,
0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 111,
110, 115, 116, 97, 110, 116, 115, 95, 70, 108, 105, 99, 107, 101, 114,
65, 120, 105, 115, 0, 171, 171, 1, 0, 2, 0, 1, 0, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110,
116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 83, 116, 97, 114, 116,
84, 104, 114, 101, 115, 104, 111, 108, 100, 0, 0, 0, 2, 0, 1,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115,
116, 97, 110, 116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 69, 110,
100, 84, 104, 114, 101, 115, 104, 111, 108, 100, 0, 99, 111, 110, 115,
116, 97, 110, 116, 115, 95, 68, 101, 115, 97, 116, 117, 114, 97, 116,
105, 111, 110, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110,
116, 115, 95, 85, 110, 117, 115, 101, 100, 0, 171, 171, 171, 1, 0,
3, 0, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77,
105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105,
108, 101, 114, 32, 49, 48, 46, 49, 0, 73, 83, 71, 78, 80, 0,
0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86,
95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79,
79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0,
1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
72, 68, 82, 52, 4, 0, 0, 64, 0, 0, 0, 13, 1, 0, 0,
89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0,
0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68,
0, 0, 88, 16, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85,
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
2, 3, 0, 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 27, 0, 0, 5, 50,
0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0,
54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 45, 0, 0, 7, 242, 0, 16, 0, 1, 0, 0, 0, 70,
14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0,
54, 0, 0, 8, 226, 0, 16, 0, 1, 0, 0, 0, 2, 64, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 45, 0, 0, 7, 242, 0, 16, 0, 1, 0, 0, 0, 70,
14, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 1, 0, 0, 0,
56, 0, 0, 9, 242, 0, 16, 0, 2, 0, 0, 0, 70, 142, 32,
0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1,
0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 7,
242, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0,
0, 70, 14, 16, 0, 2, 0, 0, 0, 38, 0, 0, 9, 0, 208,
0, 0, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
0, 0, 0, 70, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0,
30, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16,
0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 34, 0,
0, 8, 34, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0,
0, 0, 0, 42, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0,
33, 0, 0, 8, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16,
0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0, 0, 0, 1, 0,
0, 0, 55, 0, 0, 12, 242, 0, 16, 0, 1, 0, 0, 0, 86,
5, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 14, 16,
0, 1, 0, 0, 0, 60, 0, 0, 7, 18, 0, 16, 0, 0, 0,
0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0,
0, 0, 0, 55, 0, 0, 12, 242, 0, 16, 0, 0, 0, 0, 0,
6, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0,
0, 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,
128, 63, 0, 0, 128, 63, 29, 0, 0, 7, 18, 0, 16, 0, 1,
0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
0, 0, 0, 0, 13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0,
0, 57, 0, 0, 8, 18, 0, 16, 0, 1, 0, 0, 0, 10, 128,
32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0,
0, 0, 0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153,
62, 154, 153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0,
0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65,
0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0,
0, 0, 128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0,
0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0,
0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1,
0, 0, 0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0,
1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 32, 0,
9, 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0,
0, 0, 150, 7, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 47, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16,
0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64,
0, 0, 102, 102, 230, 63, 102, 102, 230, 63, 102, 102, 230, 63, 0,
0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16,
0, 1, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 2, 64,
0, 0, 150, 246, 160, 189, 43, 199, 117, 63, 40, 177, 243, 60, 0,
0, 0, 0, 50, 0, 0, 12, 114, 0, 16, 0, 1, 0, 0, 0,
6, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 87, 203, 136,
63, 86, 131, 197, 60, 225, 104, 227, 58, 0, 0, 0, 0, 70, 2,
16, 0, 1, 0, 0, 0, 50, 32, 0, 12, 114, 32, 16, 0, 0,
0, 0, 0, 166, 10, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
5, 9, 34, 60, 158, 151, 129, 60, 194, 240, 119, 63, 0, 0, 0,
0, 70, 2, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32,
16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62,
0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 32, 0, 0, 0,
3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0,
0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
namespace GpBinarizedShaders
{
const unsigned char *g_drawQuadPaletteICCP_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
};

View File

@@ -1,46 +1,136 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 196, 70, 6, 103, 19, 68, 64, 241, 205, 255, 73,
188, 120, 217, 29, 231, 1, 0, 0, 0, 116, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 176, 0, 0, 0, 8, 1, 0, 0, 60,
1, 0, 0, 248, 1, 0, 0, 82, 68, 69, 70, 116, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 75, 0, 0, 0, 60, 0,
68, 88, 66, 67, 55, 11, 130, 121, 223, 86, 90, 24, 177, 20, 124,
204, 5, 205, 68, 19, 1, 0, 0, 0, 176, 7, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 124, 2, 0, 0, 212, 2, 0, 0, 8,
3, 0, 0, 52, 7, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 24, 2, 0, 0, 92, 0,
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 0,
115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114, 101, 0,
77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112,
105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 171, 73, 83, 71, 78,
80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0,
0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0,
83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88,
67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0,
0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171,
171, 83, 72, 68, 82, 180, 0, 0, 0, 64, 0, 0, 0, 45, 0,
0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85,
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
2, 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 8, 194,
0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0,
7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0,
0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114,
32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0,
0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2,
107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114,
101, 0, 83, 68, 114, 97, 119, 81, 117, 97, 100, 80, 105, 120, 101,
108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 171, 107, 0, 0,
0, 6, 0, 0, 0, 156, 0, 0, 0, 48, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0, 0, 0, 16,
0, 0, 0, 2, 0, 0, 0, 68, 1, 0, 0, 0, 0, 0, 0,
84, 1, 0, 0, 16, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0,
0, 108, 1, 0, 0, 0, 0, 0, 0, 124, 1, 0, 0, 24, 0,
0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 156, 1, 0, 0, 0,
0, 0, 0, 172, 1, 0, 0, 28, 0, 0, 0, 4, 0, 0, 0,
2, 0, 0, 0, 156, 1, 0, 0, 0, 0, 0, 0, 202, 1, 0,
0, 32, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 228, 1,
0, 0, 0, 0, 0, 0, 244, 1, 0, 0, 36, 0, 0, 0, 12,
0, 0, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 0,
99, 111, 110, 115, 116, 97, 110, 116, 115, 95, 77, 111, 100, 117, 108,
97, 116, 105, 111, 110, 0, 171, 171, 171, 1, 0, 3, 0, 1, 0,
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116,
97, 110, 116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 65, 120, 105,
115, 0, 171, 171, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110, 116, 115, 95,
70, 108, 105, 99, 107, 101, 114, 83, 116, 97, 114, 116, 84, 104, 114,
101, 115, 104, 111, 108, 100, 0, 0, 0, 2, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110,
116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 69, 110, 100, 84, 104,
114, 101, 115, 104, 111, 108, 100, 0, 99, 111, 110, 115, 116, 97, 110,
116, 115, 95, 68, 101, 115, 97, 116, 117, 114, 97, 116, 105, 111, 110,
0, 171, 171, 171, 0, 0, 3, 0, 1, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110, 116, 115, 95,
85, 110, 117, 115, 101, 100, 0, 171, 171, 171, 1, 0, 3, 0, 1,
0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114,
111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32,
83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114,
32, 49, 48, 46, 49, 0, 73, 83, 71, 78, 80, 0, 0, 0, 2,
0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79,
83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0,
0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83,
86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82,
36, 4, 0, 0, 64, 0, 0, 0, 9, 1, 0, 0, 89, 0, 0,
4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 88, 24,
0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98,
16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3,
242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 3, 0, 0,
0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 16,
16, 0, 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0,
0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8,
194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0,
0, 7, 242, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 0,
0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 56, 0, 0, 9,
242, 0, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, 0, 0, 0, 1,
64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 7, 242, 0, 16, 0,
1, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 14, 16,
0, 2, 0, 0, 0, 38, 0, 0, 9, 0, 208, 0, 0, 50, 0,
16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70,
128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 30, 0, 0, 7,
18, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0,
0, 10, 0, 16, 0, 0, 0, 0, 0, 34, 0, 0, 8, 34, 0,
16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 42,
128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 33, 0, 0, 8,
18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
0, 58, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 55, 0,
0, 12, 242, 0, 16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 0,
0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0,
0, 60, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0,
16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 55,
0, 0, 12, 242, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0,
0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 2, 64, 0,
0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,
128, 63, 29, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0, 1,
64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0,
13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 57, 0, 0,
8, 18, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0,
0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 16,
0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154, 153, 25,
63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9, 66, 0,
16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0, 0, 0,
0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63,
56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16,
0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 2, 0,
0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0, 0, 6,
9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0, 0, 0,
86, 5, 16, 0, 1, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16,
0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7,
16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 29,
0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0,
230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37, 61, 0, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0,
16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2,
64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61, 145, 131, 158, 61,
0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 174, 71,
97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0, 0, 0, 0, 56,
0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114, 63, 110, 167, 114,
63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0, 0, 5, 114, 0,
16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56,
0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25, 64, 154, 153, 25,
64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114, 0,
16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 55,
0, 0, 9, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2, 16,
0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
84, 65, 84, 116, 0, 0, 0, 32, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
};
namespace GpBinarizedShaders

View File

@@ -0,0 +1,135 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 59, 168, 168, 88, 76, 243, 83, 77, 18, 124, 254,
1, 241, 101, 79, 130, 1, 0, 0, 0, 116, 7, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 124, 2, 0, 0, 212, 2, 0, 0, 8,
3, 0, 0, 248, 6, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 24, 2, 0, 0, 92, 0,
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 0,
107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114,
101, 0, 83, 68, 114, 97, 119, 81, 117, 97, 100, 80, 105, 120, 101,
108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 171, 107, 0, 0,
0, 6, 0, 0, 0, 156, 0, 0, 0, 48, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0, 0, 0, 16,
0, 0, 0, 2, 0, 0, 0, 68, 1, 0, 0, 0, 0, 0, 0,
84, 1, 0, 0, 16, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0,
0, 108, 1, 0, 0, 0, 0, 0, 0, 124, 1, 0, 0, 24, 0,
0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 156, 1, 0, 0, 0,
0, 0, 0, 172, 1, 0, 0, 28, 0, 0, 0, 4, 0, 0, 0,
2, 0, 0, 0, 156, 1, 0, 0, 0, 0, 0, 0, 202, 1, 0,
0, 32, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 228, 1,
0, 0, 0, 0, 0, 0, 244, 1, 0, 0, 36, 0, 0, 0, 12,
0, 0, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 0,
99, 111, 110, 115, 116, 97, 110, 116, 115, 95, 77, 111, 100, 117, 108,
97, 116, 105, 111, 110, 0, 171, 171, 171, 1, 0, 3, 0, 1, 0,
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116,
97, 110, 116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 65, 120, 105,
115, 0, 171, 171, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110, 116, 115, 95,
70, 108, 105, 99, 107, 101, 114, 83, 116, 97, 114, 116, 84, 104, 114,
101, 115, 104, 111, 108, 100, 0, 0, 0, 2, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110,
116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 69, 110, 100, 84, 104,
114, 101, 115, 104, 111, 108, 100, 0, 99, 111, 110, 115, 116, 97, 110,
116, 115, 95, 68, 101, 115, 97, 116, 117, 114, 97, 116, 105, 111, 110,
0, 171, 171, 171, 0, 0, 3, 0, 1, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110, 116, 115, 95,
85, 110, 117, 115, 101, 100, 0, 171, 171, 171, 1, 0, 3, 0, 1,
0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114,
111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32,
83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114,
32, 49, 48, 46, 49, 0, 73, 83, 71, 78, 80, 0, 0, 0, 2,
0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79,
83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0,
0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83,
86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82,
232, 3, 0, 0, 64, 0, 0, 0, 250, 0, 0, 0, 89, 0, 0,
4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 88, 24,
0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98,
16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3,
242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 3, 0, 0,
0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 16,
16, 0, 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0,
0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8,
194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0,
0, 7, 242, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 0,
0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 56, 0, 0, 9,
242, 0, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, 0, 0, 0, 1,
64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 7, 242, 0, 16, 0,
1, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 14, 16,
0, 2, 0, 0, 0, 38, 0, 0, 9, 0, 208, 0, 0, 50, 0,
16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70,
128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 30, 0, 0, 7,
18, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0,
0, 10, 0, 16, 0, 0, 0, 0, 0, 34, 0, 0, 8, 34, 0,
16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 42,
128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 33, 0, 0, 8,
18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
0, 58, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 55, 0,
0, 12, 242, 0, 16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 0,
0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0,
0, 60, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0,
16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 55,
0, 0, 12, 242, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0,
0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 2, 64, 0,
0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,
128, 63, 29, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0, 1,
64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0,
13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 57, 0, 0,
8, 18, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0,
0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 16,
0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154, 153, 25,
63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9, 66, 0,
16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0, 0, 0,
0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63,
56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16,
0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 2, 0,
0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0, 0, 6,
9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0, 0, 0,
86, 5, 16, 0, 1, 0, 0, 0, 55, 32, 0, 9, 114, 0, 16,
0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7,
16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 47,
0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 102, 102,
230, 63, 102, 102, 230, 63, 102, 102, 230, 63, 0, 0, 0, 0, 25,
0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0,
0, 86, 5, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 150, 246,
160, 189, 43, 199, 117, 63, 40, 177, 243, 60, 0, 0, 0, 0, 50,
0, 0, 12, 114, 0, 16, 0, 1, 0, 0, 0, 6, 0, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 87, 203, 136, 63, 86, 131, 197,
60, 225, 104, 227, 58, 0, 0, 0, 0, 70, 2, 16, 0, 1, 0,
0, 0, 50, 32, 0, 12, 114, 32, 16, 0, 0, 0, 0, 0, 166,
10, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 5, 9, 34, 60,
158, 151, 129, 60, 194, 240, 119, 63, 0, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
84, 65, 84, 116, 0, 0, 0, 30, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 4, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
};
namespace GpBinarizedShaders
{
const unsigned char *g_drawQuadRGBICCP_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
};

View File

@@ -7,6 +7,8 @@
#include "IGpFiber.h"
#include "IGpVOSEventQueue.h"
#include "IGpLogDriver.h"
#include <d3d11.h>
#include <dxgi1_2.h>
#include <float.h>
@@ -19,13 +21,27 @@
static GpDisplayDriverSurfaceEffects gs_defaultEffects;
static const char *kPrefsIdentifier = "GpDisplayDriverD3D11";
static uint32_t kPrefsVersion = 1;
struct GpDisplayDriverD3D11_Prefs
{
bool m_isFullScreen;
};
namespace GpBinarizedShaders
{
extern const unsigned char *g_drawQuadV_D3D11[2];
extern const unsigned char *g_drawQuadPaletteP_D3D11[2];
extern const unsigned char *g_drawQuadRGBP_D3D11[2];
extern const unsigned char *g_scaleQuadP_D3D11[2];
extern const unsigned char *g_drawQuad15BitP_D3D11[2];
extern const unsigned char *g_drawQuadPaletteICCP_D3D11[2];
extern const unsigned char *g_drawQuadRGBICCP_D3D11[2];
extern const unsigned char *g_drawQuad15BitICCP_D3D11[2];
extern const unsigned char *g_scaleQuadP_D3D11[2];
}
struct GpShaderCodeBlob
@@ -125,7 +141,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 +169,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 +184,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 +199,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 +210,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 +233,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 +250,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 +267,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 +294,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 +311,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 +329,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 +344,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 +362,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 +382,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 +409,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 +442,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,20 +461,32 @@ 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);
const GpShaderCodeBlob drawQuadPalettePBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadPaletteP_D3D11);
const GpShaderCodeBlob drawQuadRGBPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadRGBP_D3D11);
const GpShaderCodeBlob drawQuad15BitPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuad15BitP_D3D11);
const GpShaderCodeBlob drawQuadPaletteICCPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadPaletteICCP_D3D11);
const GpShaderCodeBlob drawQuadRGBICCPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadRGBICCP_D3D11);
const GpShaderCodeBlob drawQuad15BitICCPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuad15BitICCP_D3D11);
const GpShaderCodeBlob scaleQuadPBlob = GetBinarizedShader(GpBinarizedShaders::g_scaleQuadP_D3D11);
m_device->CreateVertexShader(drawQuadVBlob.m_data, drawQuadVBlob.m_size, nullptr, m_drawQuadVertexShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadPalettePBlob.m_data, drawQuadPalettePBlob.m_size, nullptr, m_drawQuadPalettePixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadRGBPBlob.m_data, drawQuadRGBPBlob.m_size, nullptr, m_drawQuadRGBPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuad15BitPBlob.m_data, drawQuad15BitPBlob.m_size, nullptr, m_drawQuad15BitPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadPaletteICCPBlob.m_data, drawQuadPaletteICCPBlob.m_size, nullptr, m_drawQuadPaletteICCPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadRGBICCPBlob.m_data, drawQuadRGBICCPBlob.m_size, nullptr, m_drawQuadRGBICCPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuad15BitICCPBlob.m_data, drawQuad15BitICCPBlob.m_size, nullptr, m_drawQuad15BitICCPixelShader.GetMutablePtr());
m_device->CreatePixelShader(scaleQuadPBlob.m_data, scaleQuadPBlob.m_size, nullptr, m_scaleQuadPixelShader.GetMutablePtr());
// Quad input layout
@@ -386,7 +502,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 +530,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,11 +554,17 @@ 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;
DXGI_FORMAT paletteTextureFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
// Palette texture
{
@@ -455,8 +590,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 +608,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;
@@ -479,7 +626,18 @@ GpDisplayDriverTickStatus_t GpDisplayDriverD3D11::PresentFrameAndSync()
{
SynchronizeCursors();
m_deviceContext->ClearRenderTargetView(m_virtualScreenTextureRTV, m_bgColor);
FLOAT bgColor[4];
for (int i = 0; i < 4; i++)
bgColor[i] = m_bgColor[i];
if (m_bgIsDark)
{
for (int i = 0; i < 3; i++)
bgColor[i] *= 0.25f;
}
m_deviceContext->ClearRenderTargetView(m_virtualScreenTextureRTV, bgColor);
//ID3D11RenderTargetView *const rtv = m_backBufferRTV;
ID3D11RenderTargetView *const vsRTV = m_virtualScreenTextureRTV;
@@ -791,11 +949,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 +978,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 +1010,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 +1025,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 +1077,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 +1091,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 +1131,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);
@@ -975,7 +1183,7 @@ void GpDisplayDriverD3D11::Run()
unsigned int desiredWidth = clientRect.right - clientRect.left;
unsigned int desiredHeight = clientRect.bottom - clientRect.top;
if (clientRect.right - clientRect.left != m_windowWidthPhysical || clientRect.bottom - clientRect.top != m_windowHeightPhysical)
if (clientRect.right - clientRect.left != m_windowWidthPhysical || clientRect.bottom - clientRect.top != m_windowHeightPhysical || m_isResolutionResetDesired)
{
uint32_t prevWidthPhysical = m_windowWidthPhysical;
uint32_t prevHeightPhysical = m_windowHeightPhysical;
@@ -988,7 +1196,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);
@@ -1000,6 +1208,7 @@ void GpDisplayDriverD3D11::Run()
m_windowHeightVirtual = virtualHeight;
m_pixelScaleX = pixelScaleX;
m_pixelScaleY = pixelScaleY;
m_isResolutionResetDesired = false;
if (GpVOSEvent *resizeEvent = m_properties.m_eventQueue->QueueEvent())
{
@@ -1028,14 +1237,12 @@ void GpDisplayDriverD3D11::Shutdown()
free(this);
}
void GpDisplayDriverD3D11::GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *pixelFormat)
void GpDisplayDriverD3D11::GetDisplayResolution(unsigned int *width, unsigned int *height)
{
if (width)
*width = m_windowWidthVirtual;
if (height)
*height = m_windowHeightVirtual;
if (pixelFormat)
*pixelFormat = GpPixelFormats::k8BitStandard;
}
IGpDisplayDriverSurface *GpDisplayDriverD3D11::CreateSurface(size_t width, size_t height, GpPixelFormat_t pixelFormat)
@@ -1135,7 +1342,7 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
m_paletteTextureSRV
};
m_deviceContext->PSSetShader(m_drawQuadPalettePixelShader, nullptr, 0);
m_deviceContext->PSSetShader(m_useICCProfile ? m_drawQuadPaletteICCPixelShader : m_drawQuadPalettePixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else if (pixelFormat == GpPixelFormats::kRGB555)
@@ -1145,7 +1352,7 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
d3d11Surface->GetSRV(),
};
m_deviceContext->PSSetShader(m_drawQuad15BitPixelShader, nullptr, 0);
m_deviceContext->PSSetShader(m_useICCProfile ? m_drawQuad15BitICCPixelShader : m_drawQuad15BitPixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else if (pixelFormat == GpPixelFormats::kRGB32)
@@ -1155,7 +1362,7 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
d3d11Surface->GetSRV(),
};
m_deviceContext->PSSetShader(m_drawQuadRGBPixelShader, nullptr, 0);
m_deviceContext->PSSetShader(m_useICCProfile ? m_drawQuadRGBICCPixelShader : m_drawQuadRGBPixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else
@@ -1237,16 +1444,65 @@ void GpDisplayDriverD3D11::SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, u
m_bgColor[3] = static_cast<float>(a) / 255.0f;
}
void GpDisplayDriverD3D11::SetBackgroundDarkenEffect(bool isDark)
{
m_bgIsDark = isDark;
}
void GpDisplayDriverD3D11::SetUseICCProfile(bool useICCProfile)
{
m_useICCProfile = useICCProfile;
}
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
if (timestamp > m_lastFullScreenToggleTimeStamp + 30)
// Alt-Enter gets re-sent after a full-screen toggle, so we ignore toggle requests until half a second has elapsed
if (timestamp == 0 || timestamp > m_lastFullScreenToggleTimeStamp + 30)
{
m_isFullScreenDesired = !m_isFullScreenDesired;
m_lastFullScreenToggleTimeStamp = timestamp;
}
}
void GpDisplayDriverD3D11::RequestResetVirtualResolution()
{
m_isResolutionResetDesired = true;
}
bool GpDisplayDriverD3D11::IsFullScreen() const
{
return m_isFullScreenDesired;
}
const GpDisplayDriverProperties &GpDisplayDriverD3D11::GetProperties() const
{
return m_properties;
}
IGpPrefsHandler *GpDisplayDriverD3D11::GetPrefsHandler() const
{
const IGpPrefsHandler *cPrefsHandler = this;
return const_cast<IGpPrefsHandler*>(cPrefsHandler);
}
void GpDisplayDriverD3D11::ApplyPrefs(const void *identifier, size_t identifierSize, const void *contents, size_t contentsSize, uint32_t version)
{
if (version == kPrefsVersion && identifierSize == strlen(kPrefsIdentifier) && !memcmp(identifier, kPrefsIdentifier, identifierSize))
{
const GpDisplayDriverD3D11_Prefs *prefs = static_cast<const GpDisplayDriverD3D11_Prefs *>(contents);
m_isFullScreenDesired = prefs->m_isFullScreen;
}
}
bool GpDisplayDriverD3D11::SavePrefs(void *context, IGpPrefsHandler::WritePrefsFunc_t writeFunc)
{
GpDisplayDriverD3D11_Prefs prefs;
prefs.m_isFullScreen = m_isFullScreenDesired;
return writeFunc(context, kPrefsIdentifier, strlen(kPrefsIdentifier), &prefs, sizeof(prefs), kPrefsVersion);
}
GpDisplayDriverD3D11 *GpDisplayDriverD3D11::Create(const GpDisplayDriverProperties &properties)
{
void *storage = malloc(sizeof(GpDisplayDriverD3D11));
@@ -1274,7 +1530,10 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
, m_mouseIsInClientArea(false)
, m_isFullScreen(false)
, m_isFullScreenDesired(false)
, m_isResolutionResetDesired(false)
, m_lastFullScreenToggleTimeStamp(0)
, m_bgIsDark(false)
, m_useICCProfile(false)
{
memset(&m_syncTimeBase, 0, sizeof(m_syncTimeBase));
memset(&m_windowModeRevertRect, 0, sizeof(m_windowModeRevertRect));
@@ -1287,10 +1546,10 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
m_ibeamCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_IBEAM), IMAGE_CURSOR, 0, 0, LR_SHARED));
m_waitCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_WAIT), IMAGE_CURSOR, 0, 0, LR_SHARED));
m_bgColor[0] = 0;
m_bgColor[1] = 0;
m_bgColor[2] = 0;
m_bgColor[3] = 255;
m_bgColor[0] = 0.0f;
m_bgColor[1] = 0.0f;
m_bgColor[2] = 0.0f;
m_bgColor[3] = 1.0f;
}
GpDisplayDriverD3D11::~GpDisplayDriverD3D11()

View File

@@ -4,12 +4,15 @@
#include "GpRingBuffer.h"
#include "IGpDisplayDriver.h"
#include "IGpPrefsHandler.h"
#include "GpCoreDefs.h"
#include "GpDisplayDriverProperties.h"
#include "GpComPtr.h"
#include "GpPixelFormat.h"
#include "IGpPrefsHandler.h"
struct GpWindowsGlobals;
struct IGpCursor_Win32;
struct IGpCursor;
@@ -30,13 +33,13 @@ struct ID3D11Texture2D;
struct ID3D11VertexShader;
class GpDisplayDriverD3D11 : public IGpDisplayDriver
class GpDisplayDriverD3D11 : public IGpDisplayDriver, public IGpPrefsHandler
{
public:
void Run() override;
void Shutdown() override;
void GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *bpp) override;
void GetDisplayResolution(unsigned int *width, unsigned int *height) override;
IGpDisplayDriverSurface *CreateSurface(size_t width, size_t height, GpPixelFormat_t pixelFormat) override;
void DrawSurface(IGpDisplayDriverSurface *surface, int32_t x, int32_t y, size_t width, size_t height, const GpDisplayDriverSurfaceEffects *effects) override;
@@ -48,8 +51,20 @@ public:
void UpdatePalette(const void *paletteData) override;
void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) override;
void SetBackgroundDarkenEffect(bool isDark) override;
void SetUseICCProfile(bool useICCProfile) override;
void RequestToggleFullScreen(uint32_t timestamp) override;
void RequestResetVirtualResolution() override;
bool IsFullScreen() const override;
const GpDisplayDriverProperties &GetProperties() const override;
IGpPrefsHandler *GetPrefsHandler() const override;
void ApplyPrefs(const void *identifier, size_t identifierSize, const void *contents, size_t contentsSize, uint32_t version) override;
bool SavePrefs(void *context, IGpPrefsHandler::WritePrefsFunc_t writeFunc) override;
static GpDisplayDriverD3D11 *Create(const GpDisplayDriverProperties &properties);
@@ -118,6 +133,9 @@ private:
GpComPtr<ID3D11PixelShader> m_drawQuadPalettePixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuad15BitPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuadRGBPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuadPaletteICCPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuad15BitICCPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuadRGBICCPixelShader;
GpComPtr<ID3D11PixelShader> m_scaleQuadPixelShader;
GpComPtr<ID3D11Buffer> m_drawQuadVertexConstantBuffer;
GpComPtr<ID3D11Buffer> m_drawQuadPixelConstantBuffer;
@@ -144,6 +162,7 @@ private:
bool m_isFullScreen;
bool m_isFullScreenDesired;
bool m_isResolutionResetDesired;
RECT m_windowModeRevertRect;
uint32_t m_lastFullScreenToggleTimeStamp;
@@ -152,7 +171,7 @@ private:
DWORD m_windowWidthPhysical; // Physical resolution is the resolution of the actual window
DWORD m_windowHeightPhysical;
DWORD m_windowWidthVirtual; // Virtual resolution is the resolution reported to teh game
DWORD m_windowWidthVirtual; // Virtual resolution is the resolution reported to the game
DWORD m_windowHeightVirtual;
float m_pixelScaleX;
float m_pixelScaleY;
@@ -171,4 +190,7 @@ private:
HCURSOR m_ibeamCursor;
float m_bgColor[4];
bool m_bgIsDark;
bool m_useICCProfile;
};

View File

@@ -93,7 +93,7 @@ GpDisplayDriverSurfaceD3D11 *GpDisplayDriverSurfaceD3D11::Create(ID3D11Device *d
dxgiFormat = DXGI_FORMAT_R16_UINT;
break;
case GpPixelFormats::kRGB32:
dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
break;
case GpPixelFormats::kRGB24: // RGB24 is not supported as a surface format (PL must convert it)
default:

View File

@@ -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 />
@@ -124,8 +126,11 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CompiledShaders\DrawQuad15BitP_D3D11.cpp" />
<ClCompile Include="CompiledShaders\DrawQuad15BitP_ICC_D3D11.cpp" />
<ClCompile Include="CompiledShaders\DrawQuadPaletteP_D3D11.cpp" />
<ClCompile Include="CompiledShaders\DrawQuadPaletteP_ICC_D3D11.cpp" />
<ClCompile Include="CompiledShaders\DrawQuadRGBP_D3D11.cpp" />
<ClCompile Include="CompiledShaders\DrawQuadRGBP_ICC_D3D11.cpp" />
<ClCompile Include="CompiledShaders\DrawQuadV_D3D11.cpp" />
<ClCompile Include="CompiledShaders\ScaleQuadP_D3D11.cpp" />
<ClCompile Include="GpDisplayDriverD3D11.cpp" />

Some files were not shown because too many files have changed in this diff Show More