mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-22 22:45:39 +00:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e539b93de9 | ||
|
f952b1c63a | ||
|
44c32a06ab | ||
|
e1f9e86c56 | ||
|
231c4b411f | ||
|
9ddaec8add | ||
|
e9d65697f3 | ||
|
ebb6d7608e | ||
|
b849d23f4e | ||
|
62d9766ee0 | ||
|
e546c05ea0 | ||
|
3b7858f96a | ||
|
92c4878492 | ||
|
e2127038ef | ||
|
cea0a72ebc | ||
|
3c5dd5f562 | ||
|
5bb6b074f0 | ||
|
ea217285c0 | ||
|
cd4e0ae8de | ||
|
c357ca2b7c | ||
|
b5a3db860f | ||
|
69e3fb3023 | ||
|
94f26d0be1 | ||
|
d893b356f1 | ||
|
c3f3fb4621 | ||
|
0335dd7786 | ||
|
ffd9d9cc1f | ||
|
f46ae55d62 | ||
|
5c1aacc268 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -24,3 +24,9 @@
|
||||
Packaged/*
|
||||
DebugData/*
|
||||
ReleasePkg/*
|
||||
InstallerPackages/*
|
||||
*.msi
|
||||
*.wixpdb
|
||||
*.wixobj
|
||||
ReleasePackageInstaller/obj/*
|
||||
ReleasePackageInstaller/bin/*
|
||||
|
@@ -21,4 +21,10 @@ Distributed under the MIT license (See rapidjson/license.txt)
|
||||
|
||||
zlib:
|
||||
(C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
Distributed under zlib license (See zlib/README)
|
||||
Distributed under zlib license (See zlib/README)
|
||||
|
||||
|
||||
The Unarchiver:
|
||||
Copyright (C) 2006-2013 Dag Ågren
|
||||
|
||||
Distributed under the LGPLv2 license (See unpacktool/LICENSE.txt)
|
12
Aerofoil.sln
12
Aerofoil.sln
@@ -43,6 +43,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MakeTimestamp", "MakeTimest
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flattenmov", "flattenmov\flattenmov.vcxproj", "{89F8D13E-F216-4B67-8DE9-7F842D349E94}"
|
||||
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}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -129,6 +133,14 @@ Global
|
||||
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Debug|x64.Build.0 = Debug|x64
|
||||
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x64.ActiveCfg = Release|x64
|
||||
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x64.Build.0 = Release|x64
|
||||
{A778D062-DE76-49F6-8D05-EB26852DD605}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A778D062-DE76-49F6-8D05-EB26852DD605}.Debug|x64.Build.0 = Debug|x64
|
||||
{A778D062-DE76-49F6-8D05-EB26852DD605}.Release|x64.ActiveCfg = Release|x64
|
||||
{A778D062-DE76-49F6-8D05-EB26852DD605}.Release|x64.Build.0 = Release|x64
|
||||
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Debug|x64.Build.0 = Debug|x64
|
||||
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Release|x64.ActiveCfg = Release|x64
|
||||
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@@ -94,9 +94,9 @@ void GpAppEnvironment::Render()
|
||||
GpAppInterface_Get()->PL_Render(m_displayDriver);
|
||||
}
|
||||
|
||||
void GpAppEnvironment::AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
||||
bool GpAppEnvironment::AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
|
||||
{
|
||||
GpAppInterface_Get()->PL_AdjustRequestedResolution(width, height);
|
||||
return GpAppInterface_Get()->PL_AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
|
||||
}
|
||||
|
||||
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
|
||||
@@ -175,6 +175,10 @@ void GpAppEnvironment::DispatchSystemCall(PortabilityLayer::HostSuspendCallID ca
|
||||
m_applicationState = ApplicationState_TimedSuspend;
|
||||
m_delaySuspendTicks = args[0].m_uint;
|
||||
break;
|
||||
case PortabilityLayer::HostSuspendCallID_CallOnVOSThread:
|
||||
args[0].m_functionPtr(static_cast<const PortabilityLayer::HostSuspendCallArgument*>(args[1].m_constPointer), static_cast<PortabilityLayer::HostSuspendCallArgument*>(args[2].m_pointer));
|
||||
m_applicationState = ApplicationState_Running;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ public:
|
||||
|
||||
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
|
||||
void Render();
|
||||
void AdjustRequestedResolution(unsigned int &width, unsigned int &height);
|
||||
bool AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY);
|
||||
|
||||
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
|
||||
void SetAudioDriver(IGpAudioDriver *audioDriver);
|
||||
|
@@ -13,6 +13,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
extern GpWindowsGlobals g_gpWindowsGlobals;
|
||||
|
||||
class GpDirectoryCursor_Win32 final : public PortabilityLayer::HostDirectoryCursor
|
||||
{
|
||||
public:
|
||||
@@ -307,6 +309,7 @@ bool GpFileSystem_Win32::PromptSaveFile(PortabilityLayer::VirtualDirectory_t vir
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = baseDir;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT;
|
||||
ofn.hwndOwner = g_gpWindowsGlobals.m_hwnd;
|
||||
|
||||
if (!GetSaveFileNameW(&ofn))
|
||||
return false;
|
||||
@@ -387,6 +390,7 @@ bool GpFileSystem_Win32::PromptOpenFile(PortabilityLayer::VirtualDirectory_t vir
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = baseDir;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
|
||||
ofn.hwndOwner = g_gpWindowsGlobals.m_hwnd;
|
||||
|
||||
if (!GetOpenFileNameW(&ofn))
|
||||
return false;
|
||||
|
@@ -28,9 +28,9 @@ namespace
|
||||
static_cast<GpAppEnvironment*>(context)->Render();
|
||||
}
|
||||
|
||||
void AdjustRequestedResolution(void *context, unsigned int &width, unsigned int &height)
|
||||
bool AdjustRequestedResolution(void *context, uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
|
||||
{
|
||||
static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(width, height);
|
||||
return static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ extern "C" __declspec(dllimport) IGpAudioDriver *GpDriver_CreateAudioDriver_XAud
|
||||
extern "C" __declspec(dllimport) IGpDisplayDriver *GpDriver_CreateDisplayDriver_D3D11(const GpDisplayDriverProperties &properties);
|
||||
extern "C" __declspec(dllimport) IGpInputDriver *GpDriver_CreateInputDriver_XInput(const GpInputDriverProperties &properties);
|
||||
|
||||
static void PostMouseEvent(IGpVOSEventQueue *eventQueue, GpMouseEventType_t eventType, GpMouseButton_t button, int32_t x, int32_t y)
|
||||
static void PostMouseEvent(IGpVOSEventQueue *eventQueue, GpMouseEventType_t eventType, GpMouseButton_t button, int32_t x, int32_t y, float pixelScaleX, float pixelScaleY)
|
||||
{
|
||||
if (GpVOSEvent *evt = eventQueue->QueueEvent())
|
||||
{
|
||||
@@ -35,6 +35,12 @@ static void PostMouseEvent(IGpVOSEventQueue *eventQueue, GpMouseEventType_t even
|
||||
mEvent.m_x = x;
|
||||
mEvent.m_y = y;
|
||||
mEvent.m_eventType = eventType;
|
||||
|
||||
if (pixelScaleX != 1.0f)
|
||||
mEvent.m_x = static_cast<int32_t>(static_cast<float>(x) / pixelScaleX);
|
||||
|
||||
if (pixelScaleY != 1.0f)
|
||||
mEvent.m_y = static_cast<int32_t>(static_cast<float>(y) / pixelScaleX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +297,7 @@ static void PostKeyboardEvent(IGpVOSEventQueue *eventQueue, GpKeyboardInputEvent
|
||||
}
|
||||
}
|
||||
|
||||
static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue)
|
||||
static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue, float pixelScaleX, float pixelScaleY)
|
||||
{
|
||||
WPARAM wParam = msg->wParam;
|
||||
LPARAM lParam = msg->lParam;
|
||||
@@ -299,40 +305,40 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
|
||||
switch (msg->message)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_MBUTTONDOWN:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_MBUTTONUP:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_RBUTTONDOWN:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_RBUTTONUP:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_XBUTTONDOWN:
|
||||
if (GET_XBUTTON_WPARAM(wParam) == XBUTTON1)
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
else if (GET_XBUTTON_WPARAM(wParam) == XBUTTON2)
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_XBUTTONUP:
|
||||
if (GET_XBUTTON_WPARAM(wParam) == XBUTTON1)
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
else if (GET_XBUTTON_WPARAM(wParam) == XBUTTON2)
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kMove, GpMouseButtons::kNone, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kMove, GpMouseButtons::kNone, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_MOUSELEAVE:
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kLeave, GpMouseButtons::kNone, 0, 0);
|
||||
PostMouseEvent(eventQueue, GpMouseEventTypes::kLeave, GpMouseButtons::kNone, 0, 0, pixelScaleX, pixelScaleY);
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
@@ -373,6 +379,12 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
|
||||
PostKeyboardEvent(eventQueue, keyEventType, subset, key, (lParam & 0xffff));
|
||||
}
|
||||
break;
|
||||
case WM_QUIT:
|
||||
{
|
||||
if (GpVOSEvent *evt = eventQueue->QueueEvent())
|
||||
evt->m_eventType = GpVOSEventTypes::kQuit;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -388,6 +400,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
g_gpWindowsGlobals.m_cmdLine = lpCmdLine;
|
||||
g_gpWindowsGlobals.m_nCmdShow = nCmdShow;
|
||||
g_gpWindowsGlobals.m_baseDir = GpFileSystem_Win32::GetInstance()->GetBasePath();
|
||||
g_gpWindowsGlobals.m_hwnd = nullptr;
|
||||
|
||||
g_gpWindowsGlobals.m_createFiberFunc = GpFiber_Win32::Create;
|
||||
g_gpWindowsGlobals.m_loadCursorFunc = GpCursor_Win32::Load;
|
||||
|
@@ -7,6 +7,7 @@
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
@@ -52,6 +52,14 @@ const CompileJob kCompileJobs[] =
|
||||
drawQuadDefs,
|
||||
"PSMain",
|
||||
"ps_4_0"
|
||||
},
|
||||
{
|
||||
L"ShaderSrc\\ScaleQuadP.hlsl",
|
||||
L"GpDisplayDriver_D3D11\\CompiledShaders\\ScaleQuadP_D3D11.cpp",
|
||||
"g_scaleQuadP_D3D11",
|
||||
drawQuadDefs,
|
||||
"PSMain",
|
||||
"ps_4_0"
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -79,4 +79,18 @@ copy /Y GliderProData\ConvertedMovies\*.mov.gpa Packaged\Houses\
|
||||
|
||||
attrib +R Packaged\Houses\*
|
||||
|
||||
mkdir InstallerPackages
|
||||
mkdir InstallerPackages\DefaultHouses
|
||||
mkdir InstallerPackages\HousePack1
|
||||
mkdir InstallerPackages\LooseDocumentation
|
||||
|
||||
copy /Y Packaged\Houses\* InstallerPackages\HousePack1\
|
||||
del /Q InstallerPackages\HousePack1\Slumberland.*
|
||||
del /Q "InstallerPackages\HousePack1\Demo House.*"
|
||||
copy /Y Packaged\Houses\Slumberland.* InstallerPackages\DefaultHouses
|
||||
copy /Y "Packaged\Houses\Demo House.*" InstallerPackages\DefaultHouses
|
||||
|
||||
copy /Y Documentation\* InstallerPackages\LooseDocumentation\
|
||||
del /Q InstallerPackages\LooseDocumentation\readme.txt
|
||||
|
||||
pause
|
||||
|
@@ -1,55 +1,57 @@
|
||||
Aerofoil is a third-party port of Glider PRO
|
||||
Thank you for trying Aerofoil!
|
||||
|
||||
Aerofoil is (c)2019-2020 Eric Lasota
|
||||
Glider PRO is (c)1994-2000 Casady & Greene, Inc., written by John Calhoun
|
||||
|
||||
|
||||
Aerofoil is not maintained by, supported by, endorsed by, or otherwise associated with the authors and publishers of Glider PRO.
|
||||
IMPORTANT: Aerofoil is not maintained by, supported by, endorsed by, or
|
||||
otherwise associated with the authors and publishers of Glider PRO.
|
||||
Please do not contact any of them regarding issues related to Aerofoil.
|
||||
|
||||
|
||||
If you have an issue with Aerofoil, please post an issue to the Aerofoil issue tracker on GitHub:
|
||||
If you have an issue with Aerofoil, please post an issue to the Aerofoil
|
||||
issue tracker on GitHub:
|
||||
https://github.com/elasota/Aerofoil/issues
|
||||
|
||||
|
||||
Requires Windows 8 and the Visual Studio 2017 redistributable runtime.
|
||||
Please see this page for more info:
|
||||
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
|
||||
|
||||
XInput gamepads are supported. Other gamepads may be supported via third-party software that maps them to XInput (i.e. PS4 gamepads are supported via DS4Windows)
|
||||
|
||||
Some shortcuts:
|
||||
- While in-game, Ctrl-S saves the game. You can then reload the game from the main menu.
|
||||
IN-GAME SHORTCUT COMMANDS
|
||||
-------------------------------------------------------------------------------
|
||||
- Ctrl-S saves the game. You can reload a saved game from the main menu.
|
||||
- Ctrl-Q quits the game.
|
||||
- Alt-Enter toggles full screen.
|
||||
|
||||
|
||||
GAMEPAD SUPPORT
|
||||
-------------------------------------------------------------------------------
|
||||
XInput gamepads are supported. Other gamepads may be supported via third-party
|
||||
software that maps them to XInput (i.e. PS4 gamepads are supported via DS4Windows)
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
Aerofoil uses the following third-party software:
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Open Sans font:
|
||||
(c)2011 Google
|
||||
Distributed under the Apache License (see license_apache.txt)
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stb_image_write:
|
||||
Created by Sean Barrett
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
LIBICONV:
|
||||
Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc.
|
||||
|
||||
Distributed under the LGPLv2 license (See license_lgplv2.txt)
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
RapidJSON:
|
||||
Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
|
||||
|
||||
Distributed under the MIT license (See license_rapidjson.txt)
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
zlib:
|
||||
|
||||
(C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
@@ -74,9 +76,17 @@ zlib:
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
FreeType:
|
||||
|
||||
Portions of this software are copyright (c)2020 The FreeType Project (www.freetype.org). All rights reserved.
|
||||
Portions of this software are copyright (c)2020 The FreeType Project (www.freetype.org).
|
||||
All rights reserved.
|
||||
|
||||
Distributed under the GPLv2 license (see license_gplv2.txt)
|
||||
|
||||
|
||||
The Unarchiver:
|
||||
|
||||
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)
|
||||
|
@@ -1,16 +1,26 @@
|
||||
If you want to import an existing third-party Glider PRO house to Aerofoil, a few steps are required.
|
||||
|
||||
First, you need to generate a timestamp file. Use the "MakeTimestamp" utility to dump the current time to a timestamp file.
|
||||
You need to convert the file into Aerofoil's "triplet" format, which consists of a metadata file (extension .gpf), and file forks (.gpd for data, .gpr for resources). How you get these depends on the input format:
|
||||
- For MacBinary files (.bin), use the "bin2gp" utility
|
||||
- For BinHex files (.hqx), use the "hqx2gp" utility
|
||||
- For StuffIt (.sit) and Compact Pro (.cpt) archives, use the "unpacktool" utility to extract the contents in triplet format. The "unpacktool" utility should support any most vintage StuffIt archives made with StuffIt Deluxe 6 or lower.
|
||||
|
||||
Second, you need to extract the house data from the original archive. Most existing Glider PRO houses are in StuffIt! archives (.sit extension), which can be difficult to extract. There is a utility called The Unarchiver for macOS which appears to support it. An alternative is to extract the file on an actual vintage Mac.
|
||||
(NOTE: ".sea" files are self-extracting archives, typically StuffIt or Compact Pro archives with the self-extractor program in the resources. These will always be distributed in a fork-grouping container like MacBinary or BinHex. For cases like these, you need to split the self-extracting archive using "bin2gp" or "hqx2gp" and then pass the ".sea.gpd" file (which contains the archive data) to "unpacktool" to decompress it.)
|
||||
|
||||
The next step depends on whether or not the house has custom resources. If the house doesn't have custom resources, then add a ".gpd" extension to the house and use the FTagData utility to generate a corresponding ".gpf" metadata file, using the timestamp you generated in the first step. You need to specify "gliH" as the file type ID and "ozm5" as the file creator ID.
|
||||
Once you've done that, if the house has custom resources (i.e. a .gpr file), you need to convert it to an Aerofoil resource archive, which you can do using the "gpr2gpa" tool.
|
||||
|
||||
If the house does have custom resources, then you need to get the resource data somehow, and you still need to generate the metadata. There are a few options there:
|
||||
- If extracting the file generated a separate file containing the resource data, which I think is what happens when extracting files on macOS, then you can use the resource file directly, and handle the other steps the same as you would if it didn't have custom resources.
|
||||
- If you can get the house into MacBinary format, then you can use the "bin2gp" utility to convert it to .gpf, .gpd, and .gpr files.
|
||||
- If you can get the house into BinHex4 (.hqx) format, then you can use the "hqx2gp" utility to convert it to .gpf, .gpd, and .gpr files.
|
||||
gpr2gpa's PICT converter may not support all PICT encodings. If you find a house with custom PICT resources that isn't supported, please submit a sample to Aerofoil's issue tracker.
|
||||
|
||||
Once you have a .gpr file of the raw Mac-format resource data, you need to convert it to Aerofoil's ZIP-based resource archive format and convert the internal resources out of Mac-specific formats. Use the "gpr2gpa" utility to do this.
|
||||
|
||||
gpr2gpa's PICT converter may not support all PICT encodings. If you find a house with custom PICT resources that isn't supported, please submit a sample to Aerofoil's issue tracker.
|
||||
Converting QuickTime movies for displaying on in-game TVs is a bit more complex. First, you need to convert the movie to a sequence of BMP images, which you can do with third-party tools such as FFMPEG. Second, you need to create a JSON file containing the movie metadata, which looks like this, for example:
|
||||
|
||||
{
|
||||
"frameRateNumerator" : 8,
|
||||
"frameRateDenominator" : 1
|
||||
}
|
||||
|
||||
Once you've done that, create a ZIP archive where the path of the JSON file is "muvi\0.json" and the frames are "PICT\<frame number>.bmp", where <frame number> is the frame number, starting with 1 as the first frame, and name that the same as the house name, but with a ".mov.gpa" extension.
|
||||
|
||||
Next, you need to create a metadata file for the movie, which should have a ".mov.gpf" extension. You can create the metadata file using the "FTagData" utility, using a timestamp file created with the "MakeTimestamp" utility.
|
||||
|
||||
Some old QuickTime movies contain movie tracking information in the movie resource fork, in which case you need to merge them into the data for modern utilities to read them. You can use the "flattenmov" tool to do this: Pass it the data (.gpd) and resource (.gpr) data files for a movie, and it will merge them into a single .mov file.
|
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
#include "PLAppleEvents.h"
|
||||
#include "AppEventHandler.h"
|
||||
#include "DialogManager.h"
|
||||
#include "Externs.h"
|
||||
#include "House.h"
|
||||
@@ -168,12 +169,38 @@ PLError_t MyGotRequiredParams (const AppleEvent *theAE)
|
||||
PLErrors::kInvalidParameter;
|
||||
}
|
||||
|
||||
class SystemEventHandlerImpl : public PortabilityLayer::IAppEventHandler
|
||||
{
|
||||
public:
|
||||
void OnQuit() override;
|
||||
|
||||
static SystemEventHandlerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
static SystemEventHandlerImpl ms_instance;
|
||||
};
|
||||
|
||||
void SystemEventHandlerImpl::OnQuit()
|
||||
{
|
||||
quitting = true;
|
||||
}
|
||||
|
||||
|
||||
SystemEventHandlerImpl *SystemEventHandlerImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
}
|
||||
|
||||
SystemEventHandlerImpl SystemEventHandlerImpl::ms_instance;
|
||||
|
||||
//-------------------------------------------------------------- SetUpAppleEvents
|
||||
// Initializes all handlers, etc. for dealing with Apple Events.
|
||||
|
||||
void SetUpAppleEvents (void)
|
||||
{
|
||||
PLError_t theErr;
|
||||
|
||||
PortabilityLayer::AppEventHandler::SetInstance(SystemEventHandlerImpl::GetInstance());
|
||||
|
||||
openAppAEUPP = NewAEEventHandlerProc(DoOpenAppAE);
|
||||
openDocAEUPP = NewAEEventHandlerProc(DoOpenDocAE);
|
||||
|
@@ -59,6 +59,7 @@ void NilSavedMaps (void)
|
||||
}
|
||||
savedMaps[i].where = -1;
|
||||
savedMaps[i].who = -1;
|
||||
savedMaps[i].component = -1;
|
||||
}
|
||||
numSavedMaps = 0;
|
||||
}
|
||||
@@ -69,7 +70,7 @@ void NilSavedMaps (void)
|
||||
// room that it obscured so that, should the player get the object,<2C>
|
||||
// it can be made to "disappear".
|
||||
|
||||
short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who)
|
||||
short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component)
|
||||
{
|
||||
Rect mapRect;
|
||||
PLError_t theErr;
|
||||
@@ -89,6 +90,7 @@ short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who)
|
||||
|
||||
savedMaps[numSavedMaps].where = where;
|
||||
savedMaps[numSavedMaps].who = who;
|
||||
savedMaps[numSavedMaps].component = component;
|
||||
numSavedMaps++;
|
||||
|
||||
return (numSavedMaps - 1); // return array index
|
||||
@@ -99,7 +101,7 @@ short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who)
|
||||
// a slot in the pixmap array for the object. It re-copies the background<6E>
|
||||
// and is needed when the lights in the room go on or off.
|
||||
|
||||
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who)
|
||||
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component)
|
||||
{
|
||||
Rect mapRect;
|
||||
short i, foundIndex;
|
||||
@@ -108,7 +110,7 @@ SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who)
|
||||
|
||||
for (i = 0; i < numSavedMaps; i++)
|
||||
{
|
||||
if ((savedMaps[i].where == where) && (savedMaps[i].who == who))
|
||||
if ((savedMaps[i].where == where) && (savedMaps[i].who == who) && (savedMaps[i].component == component))
|
||||
{
|
||||
foundIndex = i;
|
||||
mapRect = *theRect;
|
||||
@@ -124,7 +126,7 @@ SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who)
|
||||
}
|
||||
}
|
||||
|
||||
return BackUpToSavedMap(theRect, where, who);
|
||||
return BackUpToSavedMap(theRect, where, who, component);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- RemoveFromSavedMap
|
||||
@@ -179,14 +181,14 @@ SInt16 RemoveFromSavedMap (SInt16 index)
|
||||
// This copies the saved background swatch to the screen - effectively<6C>
|
||||
// covering up or "erasing" the object.
|
||||
|
||||
void RestoreFromSavedMap (short where, short who, Boolean doSparkle)
|
||||
void RestoreFromSavedMap (SInt16 where, SInt16 who, SInt16 component, Boolean doSparkle)
|
||||
{
|
||||
Rect mapRect, bounds;
|
||||
short i;
|
||||
|
||||
for (i = 0; i < numSavedMaps; i++)
|
||||
{
|
||||
if ((savedMaps[i].where == where) && (savedMaps[i].who == who) &&
|
||||
if ((savedMaps[i].where == where) && (savedMaps[i].who == who) && (savedMaps[i].component == component) &&
|
||||
(savedMaps[i].map != nil))
|
||||
{
|
||||
mapRect = savedMaps[i].dest;
|
||||
@@ -384,7 +386,7 @@ void AddCandleFlame (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
|
||||
QOffsetRect(&src, 2, 0);
|
||||
}
|
||||
QSetRect(&bounds, 0, 0, 16, 15 * kNumCandleFlames);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who, kCandleFlameComponent);
|
||||
if (savedNum != -1)
|
||||
{
|
||||
BackUpFlames(&src, savedNum);
|
||||
@@ -471,7 +473,7 @@ void AddTikiFlame (short where, short who, short h, short v)
|
||||
}
|
||||
QOffsetRect(&src, h, v);
|
||||
QSetRect(&bounds, 0, 0, 8, 10 * kNumTikiFlames);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who, kTikiFlamesComponent);
|
||||
if (savedNum != -1)
|
||||
{
|
||||
BackUpTikiFlames(&src, savedNum);
|
||||
@@ -560,7 +562,7 @@ void AddBBQCoals (short where, short who, short h, short v)
|
||||
}
|
||||
QOffsetRect(&src, h, v);
|
||||
QSetRect(&bounds, 0, 0, 32, 9 * kNumBBQCoals);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who, kBBQCoalsComponent);
|
||||
if (savedNum != -1)
|
||||
{
|
||||
BackUpBBQCoals(&src, savedNum);
|
||||
@@ -644,7 +646,7 @@ void AddPendulum (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
|
||||
|
||||
clockFrame = 10;
|
||||
QSetRect(&bounds, 0, 0, 32, 28 * kNumPendulums);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who, kPendulumComponent);
|
||||
if (savedNum != -1)
|
||||
{
|
||||
QSetRect(&src, 0, 0, 32, 28);
|
||||
@@ -745,7 +747,7 @@ void AddStar (short where, short who, short h, short v)
|
||||
QOffsetRect(&src, h, v);
|
||||
|
||||
QSetRect(&bounds, 0, 0, 32, 31 * 6);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who, kStarComponent);
|
||||
if (savedNum != -1)
|
||||
{
|
||||
BackUpStar(&src, savedNum);
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define kSwitchDepthAlert 130
|
||||
#define kSetMemoryAlert 180
|
||||
#define kLowMemoryAlert 181
|
||||
@@ -344,8 +346,28 @@ public:
|
||||
HandleResolutionChange(prevWidth, prevHeight, newWidth, newHeight);
|
||||
}
|
||||
|
||||
void AdjustRequestedResolution(uint32_t &width, uint32_t &height) override
|
||||
void AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualHeight, float &pixelScaleX, float &pixelScaleY) override
|
||||
{
|
||||
if (physicalWidth < 640)
|
||||
physicalWidth = 640;
|
||||
|
||||
if (physicalHeight < 480)
|
||||
physicalHeight = 480;
|
||||
|
||||
double xMul = static_cast<double>(physicalWidth) / 640;
|
||||
double yMul = static_cast<double>(physicalHeight) / 480;
|
||||
|
||||
double granularity = 2.0;
|
||||
|
||||
xMul = floor(xMul * granularity) / granularity;
|
||||
yMul = floor(yMul * granularity) / granularity;
|
||||
|
||||
double minMul = std::max<double>(1.0, std::min(xMul, yMul));
|
||||
|
||||
virtualWidth = physicalWidth / minMul;
|
||||
virtualHeight = physicalHeight / minMul;
|
||||
pixelScaleX = static_cast<float>(minMul);
|
||||
pixelScaleY = static_cast<float>(minMul);
|
||||
}
|
||||
|
||||
static GpAppResolutionChangeHandler ms_instance;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "House.h"
|
||||
#include "InputManager.h"
|
||||
#include "ObjectEdit.h"
|
||||
#include "Rect2i.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
|
||||
@@ -30,6 +31,7 @@ void HandleIdleTask (void);
|
||||
void IncrementMode (void);
|
||||
|
||||
|
||||
|
||||
long lastUp, incrementModeTime;
|
||||
UInt32 doubleTime;
|
||||
Point lastWhere;
|
||||
@@ -66,7 +68,7 @@ short BitchAboutColorDepth (void)
|
||||
void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
|
||||
{
|
||||
WindowPtr whichWindow;
|
||||
long menuChoice, newSize;
|
||||
long menuChoice;
|
||||
short thePart, hDelta, vDelta;
|
||||
Boolean isDoubleClick;
|
||||
Point evtPoint = Point::Create(theEvent.m_x, theEvent.m_y);
|
||||
@@ -108,11 +110,11 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
|
||||
}
|
||||
break;
|
||||
|
||||
case RegionIDs::kExpand:
|
||||
case RegionIDs::kResize:
|
||||
if (whichWindow == mapWindow)
|
||||
{
|
||||
newSize = GrowWindow(mapWindow, evtPoint, &thisMac.gray);
|
||||
ResizeMapWindow(LoWord(newSize), HiWord(newSize));
|
||||
PortabilityLayer::Vec2i newSize = TrackResize(mapWindow, evtPoint, 47, 35, &thisMac.gray);
|
||||
ResizeMapWindow(newSize.m_x, newSize.m_y);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -440,6 +442,22 @@ void HandleSplashResolutionChange(void)
|
||||
//DumpScreenOn(&justRoomsRect);
|
||||
}
|
||||
|
||||
void KeepWindowInBounds(Window *window)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
PortabilityLayer::Rect2i windowRect = PortabilityLayer::WindowManager::GetInstance()->GetWindowFullRect(window);
|
||||
|
||||
int32_t topNudge = std::max<int32_t>(kScoreboardTall - windowRect.Top(), 0);
|
||||
int32_t bottomNudge = std::min<int32_t>(thisMac.fullScreen.bottom - windowRect.Bottom(), 0);
|
||||
int32_t leftNudge = std::max<int32_t>(-windowRect.Left(), 0);
|
||||
int32_t rightNudge = std::min<int32_t>(thisMac.fullScreen.right - windowRect.Right(), 0);
|
||||
|
||||
window->m_wmX += leftNudge + rightNudge;
|
||||
window->m_wmY += topNudge + bottomNudge;
|
||||
}
|
||||
|
||||
void HandleEditorResolutionChange(void)
|
||||
{
|
||||
FlushResolutionChange();
|
||||
@@ -461,6 +479,10 @@ void HandleEditorResolutionChange(void)
|
||||
|
||||
if (mapWindow)
|
||||
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(mapWindow, PortabilityLayer::WindowManager::GetInstance()->GetPutInFrontSentinel());
|
||||
|
||||
KeepWindowInBounds(mainWindow);
|
||||
KeepWindowInBounds(toolsWindow);
|
||||
KeepWindowInBounds(mapWindow);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- HandleIdleTask
|
||||
|
@@ -16,6 +16,7 @@ namespace PortabilityLayer
|
||||
class ResourceArchive;
|
||||
class ScanlineMask;
|
||||
class ResTypeID;
|
||||
struct RGBAColor;
|
||||
}
|
||||
|
||||
#define kPreferredDepth 8
|
||||
@@ -222,7 +223,7 @@ void GetLocalWindowRect (WindowPtr, Rect *);
|
||||
//void FlagWindowFloating (WindowPtr);
|
||||
//Boolean IsWindowFloating (WindowPtr);
|
||||
void OpenMessageWindow (const PLPasStr&);
|
||||
void SetMessageWindowMessage (StringPtr);
|
||||
void SetMessageWindowMessage (StringPtr msg, const PortabilityLayer::RGBAColor &color);
|
||||
void CloseMessageWindow (void);
|
||||
void CloseThisWindow (WindowPtr *);
|
||||
|
||||
|
@@ -621,3 +621,10 @@ static const Boolean kFaceLeft = FALSE; // Conflicts with GP input driver
|
||||
#define kDemoLength 6702
|
||||
|
||||
#define kGamepadDeadzone 4096 // Out of 32768
|
||||
|
||||
#define kDefaultComponent 0
|
||||
#define kCandleFlameComponent 1
|
||||
#define kTikiFlamesComponent 1
|
||||
#define kBBQCoalsComponent 1
|
||||
#define kPendulumComponent 1
|
||||
#define kStarComponent 1
|
||||
|
@@ -23,10 +23,10 @@ void CloseCoordWindow (void);
|
||||
void ToggleCoordinateWindow (void);
|
||||
|
||||
void NilSavedMaps (void); // --- DynamicMaps.c
|
||||
SInt16 BackUpToSavedMap (Rect *, SInt16, SInt16);
|
||||
SInt16 ReBackUpSavedMap (Rect *, SInt16, SInt16);
|
||||
SInt16 BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component);
|
||||
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component);
|
||||
SInt16 RemoveFromSavedMap(SInt16);
|
||||
void RestoreFromSavedMap (SInt16, SInt16, Boolean);
|
||||
void RestoreFromSavedMap (SInt16 where, SInt16 who, SInt16 component, Boolean doSparkle);
|
||||
void AddSparkle (Rect *);
|
||||
void AddFlyingPoint (Rect *, SInt16, SInt16, SInt16);
|
||||
Boolean ReBackUpFlames (SInt16, SInt16, SInt16, SInt16);
|
||||
|
@@ -241,6 +241,7 @@ typedef struct
|
||||
DrawSurface *map;
|
||||
short where;
|
||||
short who;
|
||||
short component;
|
||||
} savedType, *savedPtr;
|
||||
|
||||
typedef struct
|
||||
|
@@ -25,7 +25,7 @@ public:
|
||||
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;
|
||||
void PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) override;
|
||||
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -80,13 +80,16 @@ void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspend
|
||||
PortabilityLayer::InstallHostSuspendHook(hook, context);
|
||||
}
|
||||
|
||||
void GpAppInterfaceImpl::PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
||||
bool GpAppInterfaceImpl::PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
|
||||
{
|
||||
uint32_t w32 = width;
|
||||
uint32_t h32 = height;
|
||||
PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler()->AdjustRequestedResolution(w32, h32);
|
||||
width = w32;
|
||||
height = h32;
|
||||
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
|
||||
|
||||
if (!handler)
|
||||
return false;
|
||||
|
||||
handler->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -213,7 +213,7 @@ short AddGrease (short where, short who, short h, short v,
|
||||
QOffsetRect(&src, h, v);
|
||||
|
||||
QSetRect(&bounds, 0, 0, 32, 27 * 4);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who);
|
||||
savedNum = BackUpToSavedMap(&bounds, where, who, kDefaultComponent);
|
||||
if (savedNum != -1)
|
||||
{
|
||||
BackupGrease (&src, savedNum, isRight);
|
||||
@@ -332,5 +332,5 @@ void RemapGreaseSavedMap(SInt16 removedItem, SInt16 substituteItem)
|
||||
grease[i].mapNum = removedItem;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "FileManager.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "House.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "RectUtils.h"
|
||||
#include "ResourceManager.h"
|
||||
@@ -730,7 +731,7 @@ void ConvertHouseVer1To2 (void)
|
||||
NumToString((long)i, roomStr);
|
||||
GetLocalizedString(14, message);
|
||||
PasStringConcat(message, roomStr);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Black());
|
||||
SpinCursor(1);
|
||||
|
||||
ForceThisRoom(i);
|
||||
|
@@ -8,8 +8,10 @@
|
||||
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLStringCompare.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "ObjectEdit.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -739,9 +741,8 @@ void LopOffExtraRooms (void)
|
||||
newSize = sizeof(houseType) + (sizeof(roomType) * (long)r);
|
||||
if (SetHandleSize(thisHouse.StaticCast<void>(), newSize) != PLErrors::kNone) // resize house handle (shrink)
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(16, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
}
|
||||
(*thisHouse)->nRooms -= count;
|
||||
numberRooms = (*thisHouse)->nRooms;
|
||||
@@ -772,21 +773,17 @@ void ValidateRoomNumbers (void)
|
||||
((*thisHouse)->rooms[i].floor < -7))
|
||||
{
|
||||
(*thisHouse)->rooms[i].suite = kRoomIsEmpty;
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(17, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
houseErrors++;
|
||||
ForeColor(blackColor);
|
||||
}
|
||||
if (((*thisHouse)->rooms[i].suite >= 128) ||
|
||||
((*thisHouse)->rooms[i].suite < 0))
|
||||
{
|
||||
(*thisHouse)->rooms[i].suite = kRoomIsEmpty;
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(18, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
houseErrors++;
|
||||
ForeColor(blackColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -885,11 +882,9 @@ void KeepAllObjectsLegal (void)
|
||||
{
|
||||
if (!KeepObjectLegal())
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(19, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
houseErrors++;
|
||||
ForeColor(blackColor);
|
||||
DelayTicks(60);
|
||||
}
|
||||
}
|
||||
@@ -923,10 +918,8 @@ void CheckForStaircasePairs (void)
|
||||
neighbor = GetNeighborRoomNumber(kNorthRoom);
|
||||
if (neighbor == kRoomIsEmpty)
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(20, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
else
|
||||
@@ -940,10 +933,8 @@ void CheckForStaircasePairs (void)
|
||||
}
|
||||
if (!hasStairs)
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(21, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
}
|
||||
@@ -954,10 +945,8 @@ void CheckForStaircasePairs (void)
|
||||
neighbor = GetNeighborRoomNumber(kSouthRoom);
|
||||
if (neighbor == kRoomIsEmpty)
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(22, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
else
|
||||
@@ -971,10 +960,8 @@ void CheckForStaircasePairs (void)
|
||||
}
|
||||
if (!hasStairs)
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(23, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
}
|
||||
@@ -1004,19 +991,19 @@ void CheckHouseForProblems (void)
|
||||
|
||||
SpinCursor(3);
|
||||
GetLocalizedString(25, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Black());
|
||||
WrapBannerAndTrailer();
|
||||
|
||||
if (isHouseChecks)
|
||||
{
|
||||
SpinCursor(3);
|
||||
GetLocalizedString(26, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Black());
|
||||
ValidateNumberOfRooms();
|
||||
if (houseErrors != 0)
|
||||
{
|
||||
GetLocalizedString(27, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Black());
|
||||
DelayTicks(60);
|
||||
houseErrors = 0;
|
||||
}
|
||||
@@ -1032,9 +1019,7 @@ void CheckHouseForProblems (void)
|
||||
NumToString((long)houseErrors, message);
|
||||
GetLocalizedString(28, message2);
|
||||
PasStringConcat(message, message2);
|
||||
ForeColor(redColor);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(45);
|
||||
}
|
||||
}
|
||||
@@ -1053,9 +1038,7 @@ void CheckHouseForProblems (void)
|
||||
NumToString((long)houseErrors, message);
|
||||
GetLocalizedString(29, message2);
|
||||
PasStringConcat(message, message2);
|
||||
ForeColor(redColor);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
}
|
||||
@@ -1070,9 +1053,7 @@ void CheckHouseForProblems (void)
|
||||
NumToString((long)houseErrors, message);
|
||||
GetLocalizedString(30, message2);
|
||||
PasStringConcat(message, message2);
|
||||
ForeColor(blueColor);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(45);
|
||||
}
|
||||
}
|
||||
@@ -1087,9 +1068,7 @@ void CheckHouseForProblems (void)
|
||||
NumToString((long)houseErrors, message);
|
||||
GetLocalizedString(31, message2);
|
||||
PasStringConcat(message, message2);
|
||||
ForeColor(blueColor);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(45);
|
||||
}
|
||||
}
|
||||
@@ -1104,9 +1083,7 @@ void CheckHouseForProblems (void)
|
||||
NumToString((long)houseErrors, message);
|
||||
GetLocalizedString(32, message2);
|
||||
PasStringConcat(message, message2);
|
||||
ForeColor(redColor);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
}
|
||||
@@ -1116,16 +1093,14 @@ void CheckHouseForProblems (void)
|
||||
SpinCursor(3);
|
||||
houseErrors = 0;
|
||||
GetLocalizedString(33, message);
|
||||
SetMessageWindowMessage(message);
|
||||
SetMessageWindowMessage(message, StdColors::Black());
|
||||
KeepAllObjectsLegal();
|
||||
if (houseErrors != 0)
|
||||
{
|
||||
NumToString((long)houseErrors, message);
|
||||
GetLocalizedString(34, message2);
|
||||
PasStringConcat(message, message2);
|
||||
ForeColor(redColor);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
}
|
||||
@@ -1142,10 +1117,8 @@ void CheckHouseForProblems (void)
|
||||
SpinCursor(3);
|
||||
if (CountStarsInHouse() < 1)
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(35, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Red());
|
||||
DelayTicks(60);
|
||||
}
|
||||
}
|
||||
|
@@ -769,7 +769,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kBeepsSound, kBeepsPriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddFlyingPoint(&bounds, 100, thisGlider->hVel / 2, thisGlider->vVel / 2);
|
||||
thisGlider->hVel /= 4;
|
||||
thisGlider->vVel /= 4;
|
||||
@@ -785,7 +785,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kBuzzerSound, kBuzzerPriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddFlyingPoint(&bounds, 300, thisGlider->hVel / 2, thisGlider->vVel / 2);
|
||||
thisGlider->hVel /= 4;
|
||||
thisGlider->vVel /= 4;
|
||||
@@ -801,7 +801,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kDingSound, kDingPriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddFlyingPoint(&bounds, 500, thisGlider->hVel / 2, thisGlider->vVel / 2);
|
||||
thisGlider->hVel /= 4;
|
||||
thisGlider->vVel /= 4;
|
||||
@@ -817,7 +817,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kCuckooSound, kCuckooPriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
StopPendulum(thisRoomNumber, masterObjects[whoLinked].objectNum);
|
||||
AddFlyingPoint(&bounds, 1000, thisGlider->hVel / 2, thisGlider->vVel / 2);
|
||||
thisGlider->hVel /= 4;
|
||||
@@ -834,7 +834,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddSparkle(&bounds);
|
||||
thisGlider->hVel /= 2;
|
||||
thisGlider->vVel /= 2;
|
||||
@@ -853,7 +853,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddSparkle(&bounds);
|
||||
thisGlider->hVel /= 2;
|
||||
thisGlider->vVel /= 2;
|
||||
@@ -875,7 +875,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddSparkle(&bounds);
|
||||
thisGlider->hVel /= 2;
|
||||
thisGlider->vVel /= 2;
|
||||
@@ -903,7 +903,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddSparkle(&bounds);
|
||||
thisGlider->hVel /= 2;
|
||||
thisGlider->vVel /= 2;
|
||||
@@ -936,7 +936,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddSparkle(&bounds);
|
||||
StopStar(thisRoomNumber, masterObjects[whoLinked].objectNum);
|
||||
numStarsRemaining--;
|
||||
@@ -959,7 +959,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
|
||||
{
|
||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||
RestoreFromSavedMap(thisRoomNumber,
|
||||
masterObjects[whoLinked].objectNum, false);
|
||||
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
|
||||
AddSparkle(&bounds);
|
||||
thisGlider->hVel /= 2;
|
||||
thisGlider->vVel /= 2;
|
||||
@@ -1050,12 +1050,12 @@ void HandleSwitches (hotPtr who)
|
||||
case kFoil:
|
||||
case kStar:
|
||||
case kHelium:
|
||||
RestoreFromSavedMap(roomLinked, objectLinked, true);
|
||||
RestoreFromSavedMap(roomLinked, objectLinked, kDefaultComponent, true);
|
||||
AddSparkle(&bounds);
|
||||
break;
|
||||
|
||||
case kCuckoo:
|
||||
RestoreFromSavedMap(roomLinked, objectLinked, true);
|
||||
RestoreFromSavedMap(roomLinked, objectLinked, kDefaultComponent, true);
|
||||
StopPendulum(roomLinked, objectLinked);
|
||||
break;
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
void DrawOnSplash (DrawSurface *surface);
|
||||
void SetPaletteToGrays (void);
|
||||
void HardDrawMainWindow (void);
|
||||
|
||||
void KeepWindowInBounds(Window *window);
|
||||
|
||||
CTabHandle theCTab;
|
||||
PixMapHandle thePMap;
|
||||
@@ -207,6 +207,8 @@ void OpenMainWindow (void)
|
||||
whichRoom = GetFirstRoomNumber();
|
||||
CopyRoomToThisRoom(whichRoom);
|
||||
ReflectCurrentRoom(false);
|
||||
|
||||
KeepWindowInBounds(mainWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -35,11 +35,12 @@
|
||||
|
||||
void LoadGraphicPlus (DrawSurface *, short, const Rect &);
|
||||
void RedrawMapContents (void);
|
||||
void LiveHScrollAction (ControlHandle, short);
|
||||
void LiveVScrollAction (ControlHandle, short);
|
||||
void LiveHScrollAction (PortabilityLayer::Widget *theControl, int thePart);
|
||||
void LiveVScrollAction (PortabilityLayer::Widget *theControl, int thePart);
|
||||
Boolean QueryNewRoom (void);
|
||||
void CreateNailOffscreen (void);
|
||||
void KillNailOffscreen (void);
|
||||
void KeepWindowInBounds (Window *window);
|
||||
|
||||
Rect nailSrcRect, activeRoomRect, wasActiveRoomRect;
|
||||
Rect mapHScrollRect, mapVScrollRect, mapCenterRect;
|
||||
@@ -294,6 +295,29 @@ void RedrawMapContents (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//-------------------------------------------------------------- UpdateMapWindow
|
||||
void DrawMapResizeBox(void)
|
||||
{
|
||||
DrawSurface *surface = &mapWindow->m_surface;
|
||||
|
||||
const Rect windowRect = surface->m_port.GetRect();
|
||||
Rect growBoxRect = Rect::Create(windowRect.bottom - 14, windowRect.right - 14, windowRect.bottom, windowRect.right);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(204, 204, 204, 255));
|
||||
surface->FillRect(growBoxRect);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRect(Rect::Create(growBoxRect.top + 2, growBoxRect.left + 2, growBoxRect.top + 3, growBoxRect.left + 6));
|
||||
surface->FillRect(Rect::Create(growBoxRect.top + 3, growBoxRect.left + 2, growBoxRect.top + 6, growBoxRect.left + 3));
|
||||
|
||||
surface->FillRect(Rect::Create(growBoxRect.top + 8, growBoxRect.left + 11, growBoxRect.top + 12, growBoxRect.left + 12));
|
||||
surface->FillRect(Rect::Create(growBoxRect.top + 11, growBoxRect.left + 8, growBoxRect.top + 12, growBoxRect.left + 11));
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
surface->FillRect(Rect::Create(growBoxRect.top + 3 + i, growBoxRect.left + 3 + i, growBoxRect.top + 5 + i, growBoxRect.left + 5 + i));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- UpdateMapWindow
|
||||
|
||||
void UpdateMapWindow (void)
|
||||
@@ -310,6 +334,8 @@ void UpdateMapWindow (void)
|
||||
SetPortWindowPort(mapWindow);
|
||||
// PL_NotYetImplemented_TODO("Resize")
|
||||
RedrawMapContents();
|
||||
|
||||
DrawMapResizeBox();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -338,12 +364,12 @@ void ResizeMapWindow (short newH, short newV)
|
||||
SizeWindow(mapWindow, mapWindowRect.right, mapWindowRect.bottom, true);
|
||||
|
||||
mapHScroll->SetMax(kMaxNumRoomsH - mapRoomsWide);
|
||||
mapHScroll->SetPosition(Point::Create(0, mapWindowRect.bottom - kMapScrollBarWidth + 1));
|
||||
mapHScroll->SetPosition(Point::Create(-1, mapWindowRect.bottom - kMapScrollBarWidth + 1));
|
||||
mapHScroll->Resize(mapWindowRect.right - kMapScrollBarWidth + 3, kMapScrollBarWidth);
|
||||
mapLeftRoom = mapHScroll->GetState();
|
||||
|
||||
mapVScroll->SetMax(kMaxNumRoomsV - mapRoomsHigh);
|
||||
mapVScroll->SetPosition(Point::Create(mapWindowRect.right - kMapScrollBarWidth + 1, 0));
|
||||
mapVScroll->SetPosition(Point::Create(mapWindowRect.right - kMapScrollBarWidth + 1, -1));
|
||||
mapVScroll->Resize(kMapScrollBarWidth, mapWindowRect.bottom - kMapScrollBarWidth + 3);
|
||||
mapTopRoom = mapVScroll->GetState();
|
||||
|
||||
@@ -365,7 +391,7 @@ void OpenMapWindow (void)
|
||||
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 1,
|
||||
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 1);
|
||||
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kResizable | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;;
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kResizable | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;
|
||||
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mapWindowRect, windowStyle, false, 0, 0, PSTR("Map"));
|
||||
|
||||
@@ -430,6 +456,8 @@ void OpenMapWindow (void)
|
||||
CenterMapOnRoom(thisRoom->suite, thisRoom->floor);
|
||||
|
||||
UpdateMapWindow();
|
||||
|
||||
KeepWindowInBounds(mapWindow);
|
||||
}
|
||||
|
||||
UpdateMapCheckmark(true);
|
||||
|
@@ -301,9 +301,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
if (SectRect(&itsRect, &testRect, &whoCares))
|
||||
{
|
||||
if (redraw)
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
else
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
if (legit != -1)
|
||||
DrawRedClock(&itsRect);
|
||||
}
|
||||
@@ -315,9 +315,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
if (SectRect(&itsRect, &testRect, &whoCares))
|
||||
{
|
||||
if (redraw)
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
else
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
if (legit != -1)
|
||||
DrawBlueClock(&itsRect);
|
||||
}
|
||||
@@ -329,9 +329,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
if (SectRect(&itsRect, &testRect, &whoCares))
|
||||
{
|
||||
if (redraw)
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
else
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
if (legit != -1)
|
||||
DrawYellowClock(&itsRect);
|
||||
}
|
||||
@@ -343,9 +343,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
if (SectRect(&itsRect, &testRect, &whoCares))
|
||||
{
|
||||
if (redraw)
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
else
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
if (legit != -1)
|
||||
{
|
||||
DrawCuckoo(&itsRect);
|
||||
@@ -369,9 +369,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
if (SectRect(&itsRect, &testRect, &whoCares))
|
||||
{
|
||||
if (redraw)
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
else
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
if (legit != -1)
|
||||
DrawSimplePrizes(thisObject.what, &itsRect);
|
||||
}
|
||||
@@ -435,9 +435,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
if (SectRect(&itsRect, &testRect, &whoCares))
|
||||
{
|
||||
if (redraw)
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
else
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
if (legit != -1)
|
||||
DrawFoil(&itsRect);
|
||||
}
|
||||
@@ -453,9 +453,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
if (SectRect(&itsRect, &testRect, &whoCares))
|
||||
{
|
||||
if (redraw)
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
else
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
|
||||
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
|
||||
if (legit != -1)
|
||||
{
|
||||
if (redraw)
|
||||
@@ -953,15 +953,12 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!redraw) // set up links
|
||||
|
||||
for (n = 0; n < numMasterObjects; n++)
|
||||
{
|
||||
for (n = 0; n < numMasterObjects; n++)
|
||||
{
|
||||
if ((masterObjects[n].objectNum == i) &&
|
||||
(masterObjects[n].roomNum == localNumbers[neighbor]))
|
||||
masterObjects[n].dynaNum = dynamicNum;
|
||||
}
|
||||
if ((masterObjects[n].objectNum == i) &&
|
||||
(masterObjects[n].roomNum == localNumbers[neighbor]))
|
||||
masterObjects[n].dynaNum = dynamicNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "ObjectEdit.h"
|
||||
#include "Objects.h"
|
||||
#include "Play.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "RectUtils.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "Room.h"
|
||||
@@ -812,10 +813,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(46, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -843,10 +842,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(46, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -874,10 +871,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(47, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -905,10 +900,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(47, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -936,10 +929,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(48, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -967,10 +958,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(48, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -998,10 +987,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(49, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -1029,10 +1016,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(49, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -1061,10 +1046,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(50, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
@@ -1093,10 +1076,8 @@ void AddObjectPairing (void)
|
||||
|
||||
GetLocalizedString(45, message);
|
||||
OpenMessageWindow(message);
|
||||
ForeColor(blueColor);
|
||||
GetLocalizedString(51, message);
|
||||
SetMessageWindowMessage(message);
|
||||
ForeColor(blackColor);
|
||||
SetMessageWindowMessage(message, StdColors::Blue());
|
||||
DelayTicks(60);
|
||||
CloseMessageWindow();
|
||||
}
|
||||
|
@@ -50,6 +50,10 @@ void ResetLocale (Boolean soft)
|
||||
{
|
||||
RemoveSavedMapsNotInRoom(localNumbers[kCentralRoom]);
|
||||
ZeroDinahsNotInRoom(localNumbers[kCentralRoom]);
|
||||
|
||||
// Clear all dinah indexes, they'll be remapped
|
||||
for (int i = 0; i < numMasterObjects; i++)
|
||||
masterObjects[i].dynaNum = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -428,9 +432,10 @@ void RedrawRoomLighting (void)
|
||||
{
|
||||
DrawRoomBackground(localNumbers[kCentralRoom], kCentralRoom, roomV);
|
||||
DrawARoomsObjects(kCentralRoom, true);
|
||||
RedrawAllGrease();
|
||||
DrawLighting();
|
||||
UpdateOutletsLighting(localNumbers[kCentralRoom], numLights);
|
||||
|
||||
|
||||
if (numNeighbors > 3)
|
||||
DrawFloorSupport();
|
||||
RestoreWorkMap();
|
||||
|
@@ -888,6 +888,8 @@ void FrameDisplayIcon (Dialog *theDialog, const PortabilityLayer::RGBAColor &col
|
||||
surface->FrameRect(theRect);
|
||||
InsetRect(&theRect, 1, 1);
|
||||
surface->FrameRect(theRect);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DisplayUpdate
|
||||
@@ -898,9 +900,7 @@ void DisplayUpdate (Dialog *theDialog)
|
||||
|
||||
SetDialogItemValue(theDialog, kDoColorFadeItem, (short)wasFade);
|
||||
|
||||
ForeColor(redColor);
|
||||
FrameDisplayIcon(theDialog, StdColors::Red());
|
||||
ForeColor(blackColor);
|
||||
FrameDialogItemC(theDialog, kBorder1Item, kRedOrangeColor8);
|
||||
FrameDialogItemC(theDialog, kBorder2Item, kRedOrangeColor8);
|
||||
FrameDialogItemC(theDialog, kBorder3Item, kRedOrangeColor8);
|
||||
@@ -1055,7 +1055,6 @@ void DoDisplayPrefs (void)
|
||||
|
||||
case kDispDefault:
|
||||
FrameDisplayIcon(prefDlg, StdColors::White());
|
||||
ForeColor(blackColor);
|
||||
DisplayDefaults();
|
||||
DisplayUpdate(prefDlg);
|
||||
break;
|
||||
|
@@ -61,6 +61,7 @@ void FrameSelectedTool (DrawSurface *);
|
||||
void DrawToolName (DrawSurface *);
|
||||
void DrawToolTiles (DrawSurface *);
|
||||
void SwitchToolModes (short);
|
||||
void KeepWindowInBounds (Window *window);
|
||||
|
||||
|
||||
Rect toolsWindowRect, toolSrcRect, toolTextRect;
|
||||
@@ -134,7 +135,7 @@ void FrameSelectedTool (DrawSurface *surface)
|
||||
InsetRect(&theRect, 1, 1);
|
||||
surface->FrameRect(theRect);
|
||||
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -350,6 +351,8 @@ void OpenToolsWindow (void)
|
||||
|
||||
SwitchToolModes(toolMode);
|
||||
toolSelected = kSelectTool;
|
||||
|
||||
KeepWindowInBounds(toolsWindow);
|
||||
}
|
||||
|
||||
UpdateToolsCheckmark(true);
|
||||
|
@@ -136,7 +136,7 @@ void OpenMessageWindow (const PLPasStr &title)
|
||||
// For the above message window, this function displays a string of text<78>
|
||||
// in the center of the window.
|
||||
|
||||
void SetMessageWindowMessage (StringPtr message)
|
||||
void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBAColor &color)
|
||||
{
|
||||
Rect mssgWindowRect;
|
||||
|
||||
@@ -150,7 +150,7 @@ void SetMessageWindowMessage (StringPtr message)
|
||||
surface->FillRect(mssgWindowRect);
|
||||
|
||||
const Point textPoint = Point::Create(mssgWindowRect.left, mssgWindowRect.bottom - 6);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->SetForeColor(color);
|
||||
surface->DrawString(textPoint, message, true);
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@
|
||||
#include "EGpDisplayDriverType.h"
|
||||
#include "GpDisplayDriverTickStatus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct IGpDisplayDriver;
|
||||
struct IGpFiber;
|
||||
struct IGpVOSEventQueue;
|
||||
@@ -11,7 +13,7 @@ struct GpDisplayDriverProperties
|
||||
{
|
||||
typedef GpDisplayDriverTickStatus_t (*TickFunc_t)(void *context, IGpFiber *vosFiber);
|
||||
typedef void(*RenderFunc_t)(void *context);
|
||||
typedef void(*AdjustRequestedResolutionFunc_t)(void *context, unsigned int &width, unsigned int &height);
|
||||
typedef bool(*AdjustRequestedResolutionFunc_t)(void *context, uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY);
|
||||
|
||||
EGpDisplayDriverType m_type;
|
||||
|
||||
|
@@ -251,6 +251,7 @@ namespace GpVOSEventTypes
|
||||
kMouseInput,
|
||||
kGamepadInput,
|
||||
kVideoResolutionChanged,
|
||||
kQuit
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -21,9 +21,10 @@ struct GpWindowsGlobals
|
||||
HINSTANCE m_hPrevInstance;
|
||||
LPCSTR m_cmdLine;
|
||||
LPCWSTR m_baseDir;
|
||||
HWND m_hwnd;
|
||||
int m_nCmdShow;
|
||||
|
||||
IGpFiber *(*m_createFiberFunc)(LPVOID fiber);
|
||||
IGpCursor_Win32 *(*m_loadCursorFunc)(const wchar_t *path);
|
||||
void (*m_translateWindowsMessageFunc)(const MSG *msg, IGpVOSEventQueue *eventQueue);
|
||||
void (*m_translateWindowsMessageFunc)(const MSG *msg, IGpVOSEventQueue *eventQueue, float pixelScaleX, float pixelScaleY);
|
||||
};
|
||||
|
@@ -25,4 +25,6 @@ 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 RequestToggleFullScreen(uint32_t timestamp) = 0;
|
||||
};
|
||||
|
@@ -1,8 +1,8 @@
|
||||
static unsigned char gs_shaderData[] = {
|
||||
68, 88, 66, 67, 96, 46, 192, 91, 73, 216, 92, 145, 77, 166, 215,
|
||||
215, 59, 255, 4, 67, 1, 0, 0, 0, 240, 2, 0, 0, 5, 0,
|
||||
68, 88, 66, 67, 75, 29, 59, 91, 67, 226, 130, 211, 218, 1, 246,
|
||||
35, 4, 77, 147, 90, 1, 0, 0, 0, 4, 3, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0, 224, 0, 0, 0, 56, 1, 0, 0, 108,
|
||||
1, 0, 0, 116, 2, 0, 0, 82, 68, 69, 70, 164, 0, 0, 0,
|
||||
1, 0, 0, 136, 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, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
|
||||
@@ -23,33 +23,34 @@ static unsigned char gs_shaderData[] = {
|
||||
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, 0, 1, 0, 0, 64, 0, 0,
|
||||
0, 64, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0,
|
||||
84, 0, 171, 171, 83, 72, 68, 82, 20, 1, 0, 0, 64, 0, 0,
|
||||
0, 69, 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, 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, 104, 0, 0, 2, 1, 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, 0,
|
||||
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, 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,
|
||||
1, 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, 9, 0, 0, 0,
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 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, 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, 8, 226, 0, 16, 0, 0, 0, 0, 0, 2, 64, 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, 0, 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, 45, 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14,
|
||||
16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 1, 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, 8, 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, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 4, 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, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
|
@@ -1,49 +1,46 @@
|
||||
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,
|
||||
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,
|
||||
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, 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,
|
||||
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,
|
||||
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,
|
||||
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, 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, 0,
|
||||
};
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
|
101
GpDisplayDriver_D3D11/CompiledShaders/ScaleQuadP_D3D11.cpp
Normal file
101
GpDisplayDriver_D3D11/CompiledShaders/ScaleQuadP_D3D11.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
static unsigned char gs_shaderData[] = {
|
||||
68, 88, 66, 67, 232, 177, 184, 42, 191, 44, 237, 186, 185, 1, 42,
|
||||
67, 157, 207, 200, 70, 1, 0, 0, 0, 116, 5, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0, 52, 1, 0, 0, 140, 1, 0, 0, 192,
|
||||
1, 0, 0, 248, 4, 0, 0, 82, 68, 69, 70, 248, 0, 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, 208, 0, 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, 83, 99, 97, 108, 101, 81, 117, 97, 100, 80, 105, 120,
|
||||
101, 108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 107, 0, 0,
|
||||
0, 1, 0, 0, 0, 156, 0, 0, 0, 16, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, 0, 16,
|
||||
0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0,
|
||||
100, 120, 100, 121, 95, 85, 110, 117, 115, 101, 100, 0, 1, 0, 3,
|
||||
0, 1, 0, 4, 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, 48, 3, 0, 0, 64, 0, 0, 0, 204, 0, 0, 0, 89,
|
||||
0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 1, 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, 5,
|
||||
0, 0, 0, 51, 0, 0, 11, 50, 0, 16, 0, 0, 0, 0, 0,
|
||||
70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0,
|
||||
0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 50, 0, 0, 14, 194, 0, 16, 0, 0, 0, 0, 0, 6,
|
||||
132, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
63, 0, 0, 0, 63, 6, 20, 16, 0, 1, 0, 0, 0, 52, 0,
|
||||
0, 10, 194, 0, 16, 0, 0, 0, 0, 0, 166, 14, 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, 0, 0, 0, 7, 50, 0, 16,
|
||||
0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 230, 10,
|
||||
16, 0, 0, 0, 0, 0, 65, 0, 0, 5, 194, 0, 16, 0, 0,
|
||||
0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5,
|
||||
50, 0, 16, 0, 1, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0,
|
||||
0, 65, 0, 0, 5, 194, 0, 16, 0, 0, 0, 0, 0, 6, 4,
|
||||
16, 0, 0, 0, 0, 0, 0, 0, 0, 8, 50, 0, 16, 0, 0,
|
||||
0, 0, 0, 230, 10, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0,
|
||||
70, 0, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16,
|
||||
0, 2, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0, 0, 14, 32,
|
||||
0, 8, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
54, 0, 0, 5, 66, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0,
|
||||
0, 0, 0, 0, 0, 54, 0, 0, 5, 194, 0, 16, 0, 2, 0,
|
||||
0, 0, 86, 9, 16, 0, 1, 0, 0, 0, 45, 0, 0, 7, 242,
|
||||
0, 16, 0, 3, 0, 0, 0, 70, 15, 16, 0, 2, 0, 0, 0,
|
||||
70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0, 16,
|
||||
0, 4, 0, 0, 0, 134, 15, 16, 0, 2, 0, 0, 0, 70, 126,
|
||||
16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1,
|
||||
0, 0, 0, 26, 0, 16, 0, 2, 0, 0, 0, 45, 0, 0, 7,
|
||||
242, 0, 16, 0, 2, 0, 0, 0, 198, 10, 16, 0, 1, 0, 0,
|
||||
0, 70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0,
|
||||
16, 0, 1, 0, 0, 0, 70, 10, 16, 0, 1, 0, 0, 0, 70,
|
||||
126, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
|
||||
4, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
|
||||
0, 4, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 3, 0,
|
||||
0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 3,
|
||||
0, 0, 0, 0, 0, 0, 11, 82, 0, 16, 0, 0, 0, 0, 0,
|
||||
6, 1, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0,
|
||||
0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0,
|
||||
0, 0, 50, 0, 0, 9, 114, 0, 16, 0, 2, 0, 0, 0, 6,
|
||||
0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0,
|
||||
70, 2, 16, 0, 3, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16,
|
||||
0, 2, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 2, 0, 0, 0, 50, 0, 0, 9, 178, 0, 16, 0, 0,
|
||||
0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 8, 16, 0,
|
||||
1, 0, 0, 0, 70, 8, 16, 0, 4, 0, 0, 0, 50, 0, 0,
|
||||
9, 114, 32, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 0, 0,
|
||||
0, 0, 70, 3, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2,
|
||||
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, 26, 0, 0, 0, 5, 0, 0, 0, 0, 0,
|
||||
0, 0, 2, 0, 0, 0, 15, 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, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4,
|
||||
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_scaleQuadP_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
|
||||
};
|
@@ -1,4 +1,3 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include "GpApplicationName.h"
|
||||
#include "GpDisplayDriverD3D11.h"
|
||||
#include "GpDisplayDriverSurfaceD3D11.h"
|
||||
@@ -23,6 +22,7 @@ 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];
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
switch (message)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
case WM_CLOSE:
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
@@ -173,7 +174,10 @@ bool ResizeD3DWindow(HWND hWnd, DWORD &windowWidth, DWORD &windowHeight, LONG de
|
||||
GetClientRect(hWnd, &windowRect);
|
||||
windowRect.right = windowRect.left + desiredWidth;
|
||||
windowRect.bottom = windowRect.top + desiredHeight;
|
||||
if (!AdjustWindowRect(&windowRect, windowStyle, menus != nullptr))
|
||||
|
||||
LONG_PTR style = GetWindowLongPtrA(hWnd, GWL_STYLE);
|
||||
|
||||
if (!AdjustWindowRect(&windowRect, static_cast<DWORD>(style), menus != nullptr))
|
||||
return false;
|
||||
|
||||
SetWindowPos(hWnd, HWND_TOP, windowRect.left, windowRect.top, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOZORDER | SWP_NOMOVE);
|
||||
@@ -196,7 +200,7 @@ bool GpDisplayDriverD3D11::DetachSwapChain()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GpDisplayDriverD3D11::InitBackBuffer()
|
||||
bool GpDisplayDriverD3D11::InitBackBuffer(uint32_t virtualWidth, uint32_t virtualHeight)
|
||||
{
|
||||
m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<LPVOID*>(m_backBufferTexture.GetMutablePtr()));
|
||||
|
||||
@@ -209,16 +213,61 @@ bool GpDisplayDriverD3D11::InitBackBuffer()
|
||||
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
rtvDesc.Texture2D.MipSlice = 0;
|
||||
|
||||
m_backBufferRTV = nullptr;
|
||||
if (m_device->CreateRenderTargetView(m_backBufferTexture, &rtvDesc, m_backBufferRTV.GetMutablePtr()) != S_OK)
|
||||
return false;
|
||||
}
|
||||
|
||||
DXGI_FORMAT vbbFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC vbbTextureDesc;
|
||||
vbbTextureDesc.Width = static_cast<UINT>(virtualWidth);
|
||||
vbbTextureDesc.Height = static_cast<UINT>(virtualHeight);
|
||||
vbbTextureDesc.MipLevels = 1;
|
||||
vbbTextureDesc.ArraySize = 1;
|
||||
vbbTextureDesc.Format = vbbFormat;
|
||||
vbbTextureDesc.SampleDesc.Count = 1;
|
||||
vbbTextureDesc.SampleDesc.Quality = 0;
|
||||
vbbTextureDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
vbbTextureDesc.BindFlags = (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
|
||||
vbbTextureDesc.CPUAccessFlags = 0;
|
||||
vbbTextureDesc.MiscFlags = 0;
|
||||
|
||||
m_virtualScreenTexture = nullptr;
|
||||
if (m_device->CreateTexture2D(&vbbTextureDesc, nullptr, m_virtualScreenTexture.GetMutablePtr()) != S_OK)
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
|
||||
rtvDesc.Format = vbbFormat;
|
||||
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
rtvDesc.Texture2D.MipSlice = 0;
|
||||
|
||||
m_virtualScreenTextureRTV = nullptr;
|
||||
if (m_device->CreateRenderTargetView(m_virtualScreenTexture, &rtvDesc, m_virtualScreenTextureRTV.GetMutablePtr()) != S_OK)
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
||||
srvDesc.Format = vbbFormat;
|
||||
srvDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D;
|
||||
srvDesc.Texture2D.MipLevels = 1;
|
||||
srvDesc.Texture2D.MostDetailedMip = 0;
|
||||
|
||||
m_virtualScreenTextureSRV = nullptr;
|
||||
if (m_device->CreateShaderResourceView(m_virtualScreenTexture, &srvDesc, m_virtualScreenTextureSRV.GetMutablePtr()) != S_OK)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GpDisplayDriverD3D11::InitResources()
|
||||
bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtualHeight)
|
||||
{
|
||||
if (!InitBackBuffer())
|
||||
if (!InitBackBuffer(virtualWidth, virtualHeight))
|
||||
return false;
|
||||
|
||||
// Quad vertex constant buffer
|
||||
@@ -283,15 +332,30 @@ bool GpDisplayDriverD3D11::InitResources()
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
D3D11_BUFFER_DESC bufferDesc;
|
||||
bufferDesc.ByteWidth = sizeof(ScaleQuadPixelConstants);
|
||||
bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
bufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
bufferDesc.MiscFlags = 0;
|
||||
bufferDesc.StructureByteStride = 0;
|
||||
|
||||
if (m_device->CreateBuffer(&bufferDesc, nullptr, m_scaleQuadPixelConstantBuffer.GetMutablePtr()) != S_OK)
|
||||
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 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(scaleQuadPBlob.m_data, scaleQuadPBlob.m_size, nullptr, m_scaleQuadPixelShader.GetMutablePtr());
|
||||
|
||||
// Quad input layout
|
||||
{
|
||||
@@ -399,17 +463,18 @@ GpDisplayDriverTickStatus_t GpDisplayDriverD3D11::PresentFrameAndSync()
|
||||
{
|
||||
SynchronizeCursors();
|
||||
|
||||
m_deviceContext->ClearRenderTargetView(m_backBufferRTV, m_bgColor);
|
||||
m_deviceContext->ClearRenderTargetView(m_virtualScreenTextureRTV, m_bgColor);
|
||||
|
||||
ID3D11RenderTargetView *const rtv = m_backBufferRTV;
|
||||
m_deviceContext->OMSetRenderTargets(1, &rtv, nullptr);
|
||||
//ID3D11RenderTargetView *const rtv = m_backBufferRTV;
|
||||
ID3D11RenderTargetView *const vsRTV = m_virtualScreenTextureRTV;
|
||||
m_deviceContext->OMSetRenderTargets(1, &vsRTV, nullptr);
|
||||
|
||||
{
|
||||
D3D11_VIEWPORT viewport;
|
||||
viewport.TopLeftX = 0;
|
||||
viewport.TopLeftY = 0;
|
||||
viewport.Width = static_cast<FLOAT>(m_windowWidth);
|
||||
viewport.Height = static_cast<FLOAT>(m_windowHeight);
|
||||
viewport.Width = static_cast<FLOAT>(m_windowWidthVirtual);
|
||||
viewport.Height = static_cast<FLOAT>(m_windowHeightVirtual);
|
||||
viewport.MinDepth = 0.0f;
|
||||
viewport.MaxDepth = 1.0f;
|
||||
|
||||
@@ -418,6 +483,8 @@ GpDisplayDriverTickStatus_t GpDisplayDriverD3D11::PresentFrameAndSync()
|
||||
|
||||
m_properties.m_renderFunc(m_properties.m_renderFuncContext);
|
||||
|
||||
ScaleVirtualScreen();
|
||||
|
||||
DXGI_PRESENT_PARAMETERS presentParams;
|
||||
|
||||
ZeroMemory(&presentParams, sizeof(presentParams));
|
||||
@@ -535,6 +602,105 @@ GpDisplayDriverTickStatus_t GpDisplayDriverD3D11::PresentFrameAndSync()
|
||||
return GpDisplayDriverTickStatuses::kOK;
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::ScaleVirtualScreen()
|
||||
{
|
||||
{
|
||||
D3D11_VIEWPORT viewport;
|
||||
viewport.TopLeftX = 0;
|
||||
viewport.TopLeftY = 0;
|
||||
viewport.Width = static_cast<FLOAT>(m_windowWidthPhysical);
|
||||
viewport.Height = static_cast<FLOAT>(m_windowHeightPhysical);
|
||||
viewport.MinDepth = 0.0f;
|
||||
viewport.MaxDepth = 1.0f;
|
||||
|
||||
m_deviceContext->RSSetViewports(1, &viewport);
|
||||
}
|
||||
|
||||
|
||||
ID3D11Buffer *vbPtr = m_quadVertexBuffer;
|
||||
UINT vbStride = sizeof(float) * 2;
|
||||
UINT zero = 0;
|
||||
|
||||
ID3D11RenderTargetView *const rtv = m_backBufferRTV;
|
||||
m_deviceContext->OMSetRenderTargets(1, &rtv, nullptr);
|
||||
|
||||
//m_deviceContext->OMSetDepthStencilState(m_drawQuadDepthStencilState, 0);
|
||||
|
||||
{
|
||||
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthPhysical);
|
||||
const float negativeTwoDivHeight = -2.0f / static_cast<float>(m_windowHeightPhysical);
|
||||
|
||||
// Use the scaled virtual width instead of the physical width to correctly handle cases where the window boundary is in the middle of a pixel
|
||||
float fWidth = static_cast<float>(m_windowWidthVirtual) * m_pixelScaleX;
|
||||
float fHeight = static_cast<float>(m_windowHeightVirtual) * m_pixelScaleY;
|
||||
|
||||
DrawQuadVertexConstants vConstantsData;
|
||||
vConstantsData.m_ndcOriginX = twoDivWidth - 1.0f;
|
||||
vConstantsData.m_ndcOriginY = negativeTwoDivHeight + 1.0f;
|
||||
vConstantsData.m_ndcWidth = fWidth * twoDivWidth;
|
||||
vConstantsData.m_ndcHeight = fHeight * negativeTwoDivHeight;
|
||||
|
||||
vConstantsData.m_surfaceDimensionX = static_cast<float>(m_windowWidthVirtual);
|
||||
vConstantsData.m_surfaceDimensionY = static_cast<float>(m_windowHeightVirtual);
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE mappedVConstants;
|
||||
if (m_deviceContext->Map(m_drawQuadVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedVConstants) == S_OK)
|
||||
{
|
||||
memcpy(mappedVConstants.pData, &vConstantsData, sizeof(vConstantsData));
|
||||
m_deviceContext->Unmap(m_drawQuadVertexConstantBuffer, 0);
|
||||
}
|
||||
|
||||
ScaleQuadPixelConstants pConstantsData;
|
||||
pConstantsData.m_dx = static_cast<float>(static_cast<double>(m_windowWidthVirtual) / static_cast<double>(m_windowWidthPhysical));
|
||||
pConstantsData.m_dy = static_cast<float>(static_cast<double>(m_windowHeightVirtual) / static_cast<double>(m_windowHeightPhysical));
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE mappedPConstants;
|
||||
if (m_deviceContext->Map(m_scaleQuadPixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedPConstants) == S_OK)
|
||||
{
|
||||
memcpy(mappedPConstants.pData, &pConstantsData, sizeof(pConstantsData));
|
||||
m_deviceContext->Unmap(m_scaleQuadPixelConstantBuffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
m_deviceContext->IASetVertexBuffers(0, 1, &vbPtr, &vbStride, &zero);
|
||||
m_deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
|
||||
m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
m_deviceContext->IASetInputLayout(m_drawQuadInputLayout);
|
||||
|
||||
ID3D11Buffer *vsConstants = m_drawQuadVertexConstantBuffer;
|
||||
m_deviceContext->VSSetShader(m_drawQuadVertexShader, nullptr, 0);
|
||||
m_deviceContext->VSSetConstantBuffers(0, 1, &vsConstants);
|
||||
|
||||
ID3D11SamplerState *samplerStates[] =
|
||||
{
|
||||
m_nearestNeighborSamplerState,
|
||||
};
|
||||
m_deviceContext->PSSetSamplers(0, sizeof(samplerStates) / sizeof(samplerStates[0]), samplerStates);
|
||||
|
||||
|
||||
ID3D11ShaderResourceView *psResourceViews[] =
|
||||
{
|
||||
m_virtualScreenTextureSRV,
|
||||
};
|
||||
|
||||
ID3D11Buffer *psConstants = m_scaleQuadPixelConstantBuffer;
|
||||
|
||||
m_deviceContext->PSSetShader(m_scaleQuadPixelShader, nullptr, 0);
|
||||
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
|
||||
m_deviceContext->PSSetConstantBuffers(0, 1, &psConstants);
|
||||
|
||||
m_deviceContext->DrawIndexed(6, 0, 0);
|
||||
|
||||
ID3D11ShaderResourceView *unbindPSResourceViews[] =
|
||||
{
|
||||
0,
|
||||
};
|
||||
m_deviceContext->PSSetShaderResources(0, sizeof(unbindPSResourceViews) / sizeof(unbindPSResourceViews[0]), unbindPSResourceViews);
|
||||
|
||||
ID3D11Buffer *clearBuffer = nullptr;
|
||||
m_deviceContext->PSSetConstantBuffers(0, 1, &clearBuffer);
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::SynchronizeCursors()
|
||||
{
|
||||
HCURSOR replacementCursor = nullptr;
|
||||
@@ -587,7 +753,7 @@ void GpDisplayDriverD3D11::ChangeToCursor(HCURSOR cursor)
|
||||
if (m_mouseIsInClientArea)
|
||||
::SetCursor(cursor);
|
||||
|
||||
SetClassLongPtrW(m_hwnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(cursor));
|
||||
SetClassLongPtrW(m_osGlobals->m_hwnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(cursor));
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::ChangeToStandardCursor(EGpStandardCursor_t cursor)
|
||||
@@ -607,6 +773,105 @@ void GpDisplayDriverD3D11::ChangeToStandardCursor(EGpStandardCursor_t cursor)
|
||||
}
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::BecomeFullScreen(LONG &windowStyle)
|
||||
{
|
||||
assert(!m_isFullScreen);
|
||||
|
||||
RECT windowRect;
|
||||
if (!GetWindowRect(m_osGlobals->m_hwnd, &windowRect))
|
||||
return; // ???
|
||||
|
||||
HMONITOR monitor = MonitorFromRect(&windowRect, MONITOR_DEFAULTTONULL);
|
||||
if (!monitor)
|
||||
{
|
||||
// If the window is off-screen, use the primary monitor
|
||||
monitor = MonitorFromRect(&windowRect, MONITOR_DEFAULTTOPRIMARY);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, use the nearest
|
||||
monitor = MonitorFromRect(&windowRect, MONITOR_DEFAULTTONEAREST);
|
||||
}
|
||||
|
||||
if (!monitor)
|
||||
return; // No monitor?
|
||||
|
||||
MONITORINFO monitorInfo;
|
||||
monitorInfo.cbSize = sizeof(monitorInfo);
|
||||
if (!GetMonitorInfoA(monitor, &monitorInfo))
|
||||
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);
|
||||
|
||||
m_isFullScreen = true;
|
||||
windowStyle = (WS_VISIBLE | WS_POPUP);
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::BecomeWindowed(LONG &windowStyle)
|
||||
{
|
||||
assert(m_isFullScreen);
|
||||
|
||||
RECT revertRect = m_windowModeRevertRect;
|
||||
|
||||
HMONITOR monitor = MonitorFromRect(&m_windowModeRevertRect, MONITOR_DEFAULTTONULL);
|
||||
if (!monitor)
|
||||
{
|
||||
// If the window is off-screen, use the primary monitor
|
||||
monitor = MonitorFromRect(&revertRect, MONITOR_DEFAULTTOPRIMARY);
|
||||
if (!monitor)
|
||||
return;
|
||||
|
||||
MONITORINFO monitorInfo;
|
||||
monitorInfo.cbSize = sizeof(monitorInfo);
|
||||
if (!GetMonitorInfoA(monitor, &monitorInfo))
|
||||
return;
|
||||
|
||||
RECT monitorRect = monitorInfo.rcWork;
|
||||
LONG monitorWidth = monitorRect.right - monitorRect.left;
|
||||
LONG monitorHeight = monitorRect.bottom - monitorRect.top;
|
||||
|
||||
LONG revertHeight = revertRect.bottom - revertRect.top;
|
||||
LONG revertWidth = revertRect.right - revertRect.left;
|
||||
|
||||
if (revertWidth > monitorWidth)
|
||||
revertWidth = monitorWidth;
|
||||
|
||||
if (revertHeight > monitorHeight)
|
||||
revertHeight = monitorHeight;
|
||||
|
||||
revertRect.bottom = revertRect.top + revertHeight;
|
||||
revertRect.right = revertRect.right + revertWidth;
|
||||
|
||||
LONG xDelta = 0;
|
||||
if (revertRect.right > monitorRect.right)
|
||||
xDelta = monitorRect.right - revertRect.right;
|
||||
else if (revertRect.left < monitorRect.left)
|
||||
xDelta = monitorRect.left - revertRect.left;
|
||||
|
||||
LONG yDelta = 0;
|
||||
if (revertRect.bottom > monitorRect.bottom)
|
||||
yDelta = monitorRect.bottom - revertRect.bottom;
|
||||
else if (revertRect.top < monitorRect.top)
|
||||
yDelta = monitorRect.top - revertRect.top;
|
||||
|
||||
|
||||
revertRect.left = revertRect.left + xDelta;
|
||||
revertRect.top = revertRect.top + yDelta;
|
||||
revertRect.bottom = revertRect.top + revertHeight;
|
||||
revertRect.right = revertRect.right + revertWidth;
|
||||
}
|
||||
|
||||
SetWindowLongPtr(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);
|
||||
|
||||
m_isFullScreen = false;
|
||||
windowStyle = (WS_VISIBLE | WS_OVERLAPPEDWINDOW);
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::Run()
|
||||
{
|
||||
WNDCLASSEX wc;
|
||||
@@ -633,16 +898,16 @@ void GpDisplayDriverD3D11::Run()
|
||||
HMENU menus = NULL;
|
||||
|
||||
// TODO: Fix the resolution here
|
||||
RECT wr = { 0, 0, m_windowWidth, m_windowHeight };
|
||||
RECT wr = { 0, 0, m_windowWidthPhysical, m_windowHeightPhysical };
|
||||
AdjustWindowRect(&wr, windowStyle, menus != NULL);
|
||||
|
||||
m_hwnd = CreateWindowExW(NULL, L"GPD3D11WindowClass", GP_APPLICATION_NAME_W L" (Direct3D 11)", WS_OVERLAPPEDWINDOW, 300, 300, wr.right - wr.left, wr.bottom - wr.top, NULL, menus, m_osGlobals->m_hInstance, NULL);
|
||||
m_osGlobals->m_hwnd = CreateWindowExW(NULL, L"GPD3D11WindowClass", GP_APPLICATION_NAME_W L" (Direct3D 11)", WS_OVERLAPPEDWINDOW, 300, 300, wr.right - wr.left, wr.bottom - wr.top, NULL, menus, m_osGlobals->m_hInstance, NULL);
|
||||
|
||||
ShowWindow(m_hwnd, m_osGlobals->m_nCmdShow);
|
||||
ShowWindow(m_osGlobals->m_hwnd, m_osGlobals->m_nCmdShow);
|
||||
|
||||
StartD3DForWindow(m_hwnd, m_swapChain, m_device, m_deviceContext);
|
||||
StartD3DForWindow(m_osGlobals->m_hwnd, m_swapChain, m_device, m_deviceContext);
|
||||
|
||||
InitResources();
|
||||
InitResources(m_windowWidthVirtual, m_windowHeightVirtual);
|
||||
|
||||
LARGE_INTEGER lastTimestamp;
|
||||
memset(&lastTimestamp, 0, sizeof(lastTimestamp));
|
||||
@@ -654,9 +919,6 @@ void GpDisplayDriverD3D11::Run()
|
||||
{
|
||||
DispatchMessage(&msg);
|
||||
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
else
|
||||
{
|
||||
if (msg.message == WM_MOUSEMOVE)
|
||||
{
|
||||
@@ -669,7 +931,7 @@ void GpDisplayDriverD3D11::Run()
|
||||
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = m_hwnd;
|
||||
tme.hwndTrack = m_osGlobals->m_hwnd;
|
||||
tme.dwHoverTime = HOVER_DEFAULT;
|
||||
TrackMouseEvent(&tme);
|
||||
}
|
||||
@@ -677,38 +939,56 @@ void GpDisplayDriverD3D11::Run()
|
||||
else if (msg.message == WM_MOUSELEAVE)
|
||||
m_mouseIsInClientArea = false;
|
||||
|
||||
m_osGlobals->m_translateWindowsMessageFunc(&msg, m_properties.m_eventQueue);
|
||||
m_osGlobals->m_translateWindowsMessageFunc(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_isFullScreen != m_isFullScreenDesired)
|
||||
{
|
||||
if (m_isFullScreenDesired)
|
||||
BecomeFullScreen(windowStyle);
|
||||
else
|
||||
BecomeWindowed(windowStyle);
|
||||
}
|
||||
|
||||
RECT clientRect;
|
||||
GetClientRect(m_hwnd, &clientRect);
|
||||
GetClientRect(m_osGlobals->m_hwnd, &clientRect);
|
||||
|
||||
unsigned int desiredWidth = clientRect.right - clientRect.left;
|
||||
unsigned int desiredHeight = clientRect.bottom - clientRect.top;
|
||||
if (clientRect.right - clientRect.left != m_windowWidth || clientRect.bottom - clientRect.top != m_windowHeight)
|
||||
if (clientRect.right - clientRect.left != m_windowWidthPhysical || clientRect.bottom - clientRect.top != m_windowHeightPhysical)
|
||||
{
|
||||
uint32_t prevWidth = m_windowWidth;
|
||||
uint32_t prevHeight = m_windowHeight;
|
||||
uint32_t prevWidth = m_windowWidthPhysical;
|
||||
uint32_t prevHeight = m_windowHeightPhysical;
|
||||
uint32_t virtualWidth = m_windowWidthVirtual;
|
||||
uint32_t virtualHeight = m_windowHeightVirtual;
|
||||
float pixelScaleX = 1.0f;
|
||||
float pixelScaleY = 1.0f;
|
||||
|
||||
m_properties.m_adjustRequestedResolutionFunc(m_properties.m_adjustRequestedResolutionFuncContext, desiredWidth, desiredHeight);
|
||||
|
||||
bool resizedOK = ResizeD3DWindow(m_hwnd, m_windowWidth, m_windowHeight, desiredWidth, desiredHeight, windowStyle, menus);
|
||||
resizedOK = resizedOK && DetachSwapChain();
|
||||
resizedOK = resizedOK && ResizeSwapChain(m_swapChain, m_windowWidth, m_windowHeight);
|
||||
resizedOK = resizedOK && InitBackBuffer();
|
||||
|
||||
if (!resizedOK)
|
||||
break; // Critical video driver error, exit
|
||||
|
||||
if (GpVOSEvent *resizeEvent = m_properties.m_eventQueue->QueueEvent())
|
||||
if (m_properties.m_adjustRequestedResolutionFunc(m_properties.m_adjustRequestedResolutionFuncContext, desiredWidth, desiredHeight, virtualWidth, virtualHeight, pixelScaleX, pixelScaleY))
|
||||
{
|
||||
resizeEvent->m_eventType = GpVOSEventTypes::kVideoResolutionChanged;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_prevWidth = prevWidth;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_prevHeight = prevHeight;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_newWidth = m_windowWidth;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_newHeight = m_windowHeight;
|
||||
bool resizedOK = ResizeD3DWindow(m_osGlobals->m_hwnd, m_windowWidthPhysical, m_windowHeightPhysical, desiredWidth, desiredHeight, windowStyle, menus);
|
||||
resizedOK = resizedOK && DetachSwapChain();
|
||||
resizedOK = resizedOK && ResizeSwapChain(m_swapChain, m_windowWidthPhysical, m_windowHeightPhysical);
|
||||
resizedOK = resizedOK && InitBackBuffer(virtualWidth, virtualHeight);
|
||||
|
||||
if (!resizedOK)
|
||||
break; // Critical video driver error, exit
|
||||
|
||||
m_windowWidthVirtual = virtualWidth;
|
||||
m_windowHeightVirtual = virtualHeight;
|
||||
m_pixelScaleX = pixelScaleX;
|
||||
m_pixelScaleY = pixelScaleY;
|
||||
|
||||
if (GpVOSEvent *resizeEvent = m_properties.m_eventQueue->QueueEvent())
|
||||
{
|
||||
resizeEvent->m_eventType = GpVOSEventTypes::kVideoResolutionChanged;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_prevWidth = prevWidth;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_prevHeight = prevHeight;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_newWidth = m_windowWidthVirtual;
|
||||
resizeEvent->m_event.m_resolutionChangedEvent.m_newHeight = m_windowHeightVirtual;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,9 +1011,9 @@ void GpDisplayDriverD3D11::Shutdown()
|
||||
void GpDisplayDriverD3D11::GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *pixelFormat)
|
||||
{
|
||||
if (width)
|
||||
*width = m_windowWidth;
|
||||
*width = m_windowWidthVirtual;
|
||||
if (height)
|
||||
*height = m_windowHeight;
|
||||
*height = m_windowHeightVirtual;
|
||||
if (pixelFormat)
|
||||
*pixelFormat = GpPixelFormats::k8BitStandard;
|
||||
}
|
||||
@@ -754,8 +1034,8 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
|
||||
//m_deviceContext->OMSetDepthStencilState(m_drawQuadDepthStencilState, 0);
|
||||
|
||||
{
|
||||
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidth);
|
||||
const float negativeTwoDivHeight = -2.0f / static_cast<float>(m_windowHeight);
|
||||
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthVirtual);
|
||||
const float negativeTwoDivHeight = -2.0f / static_cast<float>(m_windowHeightVirtual);
|
||||
|
||||
DrawQuadVertexConstants constantsData;
|
||||
constantsData.m_ndcOriginX = static_cast<float>(x) * twoDivWidth - 1.0f;
|
||||
@@ -900,6 +1180,16 @@ void GpDisplayDriverD3D11::SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, u
|
||||
m_bgColor[3] = static_cast<float>(a) / 255.0f;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
m_isFullScreenDesired = !m_isFullScreenDesired;
|
||||
m_lastFullScreenToggleTimeStamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
GpDisplayDriverD3D11 *GpDisplayDriverD3D11::Create(const GpDisplayDriverProperties &properties)
|
||||
{
|
||||
void *storage = malloc(sizeof(GpDisplayDriverD3D11));
|
||||
@@ -912,8 +1202,12 @@ GpDisplayDriverD3D11 *GpDisplayDriverD3D11::Create(const GpDisplayDriverProperti
|
||||
GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &properties)
|
||||
: m_properties(properties)
|
||||
, m_frameTimeAccumulated(0)
|
||||
, m_windowWidth(640)
|
||||
, m_windowHeight(480)
|
||||
, m_windowWidthPhysical(640)
|
||||
, m_windowHeightPhysical(480)
|
||||
, m_windowWidthVirtual(640)
|
||||
, m_windowHeightVirtual(480)
|
||||
, m_pixelScaleX(1.0f)
|
||||
, m_pixelScaleY(1.0f)
|
||||
, m_vosFiber(nullptr)
|
||||
, m_osGlobals(static_cast<GpWindowsGlobals*>(properties.m_osGlobals))
|
||||
, m_pendingCursor(nullptr)
|
||||
@@ -921,8 +1215,12 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
|
||||
, m_currentStandardCursor(EGpStandardCursors::kArrow)
|
||||
, m_pendingStandardCursor(EGpStandardCursors::kArrow)
|
||||
, m_mouseIsInClientArea(false)
|
||||
, m_isFullScreen(false)
|
||||
, m_isFullScreenDesired(false)
|
||||
, m_lastFullScreenToggleTimeStamp(0)
|
||||
{
|
||||
memset(&m_syncTimeBase, 0, sizeof(m_syncTimeBase));
|
||||
memset(&m_windowModeRevertRect, 0, sizeof(m_windowModeRevertRect));
|
||||
|
||||
QueryPerformanceFrequency(&m_QPFrequency);
|
||||
|
||||
|
@@ -48,6 +48,8 @@ public:
|
||||
|
||||
void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) override;
|
||||
|
||||
void RequestToggleFullScreen(uint32_t timestamp) override;
|
||||
|
||||
static GpDisplayDriverD3D11 *Create(const GpDisplayDriverProperties &properties);
|
||||
|
||||
private:
|
||||
@@ -63,6 +65,13 @@ private:
|
||||
float m_unused[2];
|
||||
};
|
||||
|
||||
struct ScaleQuadPixelConstants
|
||||
{
|
||||
float m_dx;
|
||||
float m_dy;
|
||||
float m_unused[2];
|
||||
};
|
||||
|
||||
struct CompactedPresentHistoryItem
|
||||
{
|
||||
LARGE_INTEGER m_timestamp;
|
||||
@@ -73,14 +82,18 @@ private:
|
||||
~GpDisplayDriverD3D11();
|
||||
|
||||
bool DetachSwapChain();
|
||||
bool InitBackBuffer();
|
||||
bool InitResources();
|
||||
bool InitBackBuffer(uint32_t virtualWidth, uint32_t virtualHeight);
|
||||
bool InitResources(uint32_t virtualWidth, uint32_t virtualHeight);
|
||||
GpDisplayDriverTickStatus_t PresentFrameAndSync();
|
||||
void ScaleVirtualScreen();
|
||||
|
||||
void SynchronizeCursors();
|
||||
void ChangeToCursor(HCURSOR cursor);
|
||||
void ChangeToStandardCursor(EGpStandardCursor_t cursor);
|
||||
|
||||
void BecomeFullScreen(LONG &windowStyle);
|
||||
void BecomeWindowed(LONG &windowStyle);
|
||||
|
||||
GpComPtr<IDXGISwapChain1> m_swapChain;
|
||||
GpComPtr<ID3D11Device> m_device;
|
||||
GpComPtr<ID3D11DeviceContext> m_deviceContext;
|
||||
@@ -91,7 +104,9 @@ private:
|
||||
GpComPtr<ID3D11PixelShader> m_drawQuadPalettePixelShader;
|
||||
GpComPtr<ID3D11PixelShader> m_drawQuad15BitPixelShader;
|
||||
GpComPtr<ID3D11PixelShader> m_drawQuadRGBPixelShader;
|
||||
GpComPtr<ID3D11PixelShader> m_scaleQuadPixelShader;
|
||||
GpComPtr<ID3D11Buffer> m_drawQuadVertexConstantBuffer;
|
||||
GpComPtr<ID3D11Buffer> m_scaleQuadPixelConstantBuffer;
|
||||
GpComPtr<ID3D11DepthStencilState> m_drawQuadDepthStencilState;
|
||||
GpComPtr<ID3D11SamplerState> m_nearestNeighborSamplerState;
|
||||
GpComPtr<ID3D11Texture1D> m_paletteTexture;
|
||||
@@ -100,6 +115,10 @@ private:
|
||||
GpComPtr<ID3D11Texture2D> m_backBufferTexture;
|
||||
GpComPtr<ID3D11RenderTargetView> m_backBufferRTV;
|
||||
|
||||
GpComPtr<ID3D11Texture2D> m_virtualScreenTexture;
|
||||
GpComPtr<ID3D11RenderTargetView> m_virtualScreenTextureRTV;
|
||||
GpComPtr<ID3D11ShaderResourceView> m_virtualScreenTextureSRV;
|
||||
|
||||
GpRingBuffer<CompactedPresentHistoryItem, 60> m_presentHistory;
|
||||
GpDisplayDriverProperties m_properties;
|
||||
|
||||
@@ -108,11 +127,20 @@ private:
|
||||
UINT m_expectedSyncDelta;
|
||||
bool m_isResettingSwapChain;
|
||||
|
||||
bool m_isFullScreen;
|
||||
bool m_isFullScreenDesired;
|
||||
RECT m_windowModeRevertRect;
|
||||
uint32_t m_lastFullScreenToggleTimeStamp;
|
||||
|
||||
LONGLONG m_frameTimeAccumulated;
|
||||
LONGLONG m_frameTimeSliceSize;
|
||||
|
||||
DWORD m_windowWidth;
|
||||
DWORD m_windowHeight;
|
||||
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_windowHeightVirtual;
|
||||
float m_pixelScaleX;
|
||||
float m_pixelScaleY;
|
||||
|
||||
IGpCursor_Win32 *m_activeCursor;
|
||||
IGpCursor_Win32 *m_pendingCursor;
|
||||
@@ -126,7 +154,6 @@ private:
|
||||
HCURSOR m_arrowCursor;
|
||||
HCURSOR m_waitCursor;
|
||||
HCURSOR m_ibeamCursor;
|
||||
HWND m_hwnd;
|
||||
|
||||
float m_bgColor[4];
|
||||
};
|
||||
|
@@ -127,6 +127,7 @@
|
||||
<ClCompile Include="CompiledShaders\DrawQuadPaletteP_D3D11.cpp" />
|
||||
<ClCompile Include="CompiledShaders\DrawQuadRGBP_D3D11.cpp" />
|
||||
<ClCompile Include="CompiledShaders\DrawQuadV_D3D11.cpp" />
|
||||
<ClCompile Include="CompiledShaders\ScaleQuadP_D3D11.cpp" />
|
||||
<ClCompile Include="GpDisplayDriverD3D11.cpp" />
|
||||
<ClCompile Include="GpDisplayDriverFactoryD3D11.cpp" />
|
||||
<ClCompile Include="GpDisplayDriverSurfaceD3D11.cpp" />
|
||||
|
@@ -39,6 +39,9 @@
|
||||
<ClCompile Include="CompiledShaders\DrawQuadV_D3D11.cpp">
|
||||
<Filter>Source Files\CompiledShaders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CompiledShaders\ScaleQuadP_D3D11.cpp">
|
||||
<Filter>Source Files\CompiledShaders</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="GpDisplayDriverD3D11.h">
|
||||
|
@@ -1,19 +0,0 @@
|
||||
GlidePort copyright (c)2019 Eric Lasota
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
356
LICENSE.txt
356
LICENSE.txt
@@ -1,17 +1,339 @@
|
||||
Aerofoil is (c)2019-2020 Eric Lasota
|
||||
|
||||
Based on Glider PRO by John Calhoun
|
||||
|
||||
Aerofoil is made available under the following dual-license terms:
|
||||
|
||||
- You may use any portion of the Aerofoil project's source code under the
|
||||
conditions of the GNU General Public License version 2, as published in the
|
||||
included LICENSE-GPL2.txt file.
|
||||
|
||||
- If you obtain a license to use the Glider PRO source code under terms other
|
||||
than the terms of the GNU General Public License version 2, or if you do not
|
||||
require a license (i.e. because you hold the copyright), or if you are are
|
||||
permitted to use Glider PRO's source code under different terms for any
|
||||
other reason, you may use any new source code and modifications in the
|
||||
Aerofoil source code under the conditions of the MIT license, as published
|
||||
in the included LICENSE-MIT.txt file.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
@@ -49,7 +49,7 @@ static const uint16_t mac_roman_2uni[128] = {
|
||||
};
|
||||
|
||||
namespace MacRoman
|
||||
{
|
||||
{
|
||||
uint16_t ToUnicode(uint8_t character)
|
||||
{
|
||||
if (character < 0x80)
|
||||
@@ -57,7 +57,7 @@ namespace MacRoman
|
||||
else
|
||||
return mac_roman_2uni[character - 0x80];
|
||||
}
|
||||
|
||||
|
||||
bool FromUnicode(uint8_t &outChar, uint16_t codePoint)
|
||||
{
|
||||
if (codePoint < 0x80)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
mkdir ReleasePkg\Aerofoil
|
||||
mkdir ReleasePkg\Aerofoil\Packaged
|
||||
mkdir ReleasePkg\Aerofoil\Resources
|
||||
mkdir ReleasePkg\Aerofoil\Tools
|
||||
|
||||
copy /Y x64\Release\Aerofoil.exe ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\GpAudioDriver_XAudio2.dll ReleasePkg\Aerofoil
|
||||
@@ -9,6 +10,14 @@ copy /Y x64\Release\GpInputDriver_XInput.dll ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\FreeType.dll ReleasePkg\Aerofoil
|
||||
copy /Y x64\Release\GpApp.dll ReleasePkg\Aerofoil
|
||||
|
||||
copy /Y x64\Release\flattenmov.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\bin2gp.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\hqx2bin.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\hqx2gp.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\MakeTimestamp.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\FTagData.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\gpr2gpa.exe ReleasePkg\Aerofoil\Tools
|
||||
copy /Y x64\Release\unpacktool.exe ReleasePkg\Aerofoil\Tools
|
||||
|
||||
xcopy /I /E /Y /K Packaged ReleasePkg\Aerofoil\Packaged
|
||||
xcopy /I /E /Y /K Resources ReleasePkg\Aerofoil\Resources
|
||||
|
16
PortabilityLayer/AppEventHandler.cpp
Normal file
16
PortabilityLayer/AppEventHandler.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "AppEventHandler.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
IAppEventHandler *AppEventHandler::ms_instance;
|
||||
|
||||
IAppEventHandler *AppEventHandler::GetInstance()
|
||||
{
|
||||
return ms_instance;
|
||||
}
|
||||
|
||||
void AppEventHandler::SetInstance(IAppEventHandler *instance)
|
||||
{
|
||||
ms_instance = instance;
|
||||
}
|
||||
}
|
19
PortabilityLayer/AppEventHandler.h
Normal file
19
PortabilityLayer/AppEventHandler.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct IAppEventHandler
|
||||
{
|
||||
virtual void OnQuit() = 0;
|
||||
};
|
||||
|
||||
class AppEventHandler
|
||||
{
|
||||
public:
|
||||
static IAppEventHandler *GetInstance();
|
||||
static void SetInstance(IAppEventHandler *instance);
|
||||
|
||||
private:
|
||||
static IAppEventHandler *ms_instance;
|
||||
};
|
||||
}
|
@@ -15,7 +15,7 @@ namespace PortabilityLayer
|
||||
struct IResolutionChangeHandler
|
||||
{
|
||||
virtual void OnResolutionChanged(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) = 0;
|
||||
virtual void AdjustRequestedResolution(uint32_t &width, uint32_t &height) = 0;
|
||||
virtual void AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) = 0;
|
||||
};
|
||||
|
||||
virtual void Init() = 0;
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include "MacFileMem.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLErrorCodes.h"
|
||||
#include "PLSysCalls.h"
|
||||
#include "ResTypeID.h"
|
||||
#include "HostSystemServices.h"
|
||||
|
||||
@@ -184,7 +185,7 @@ namespace PortabilityLayer
|
||||
|
||||
bool FileManagerImpl::PromptOpenFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity)
|
||||
{
|
||||
return PortabilityLayer::HostFileSystem::GetInstance()->PromptOpenFile(dirID, path, outPathLength, pathCapacity);
|
||||
return PLSysCalls::PromptOpenFile(dirID, path, outPathLength, pathCapacity);
|
||||
}
|
||||
|
||||
FileManagerImpl *FileManagerImpl::GetInstance()
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
||||
|
||||
virtual void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) = 0;
|
||||
virtual void PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) = 0;
|
||||
virtual bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) = 0;
|
||||
};
|
||||
|
||||
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get();
|
||||
|
@@ -12,6 +12,7 @@ namespace PortabilityLayer
|
||||
int32_t m_int;
|
||||
size_t m_size;
|
||||
void *m_pointer;
|
||||
const void *m_constPointer;
|
||||
const void *m_constPointer;
|
||||
void (*m_functionPtr)(const HostSuspendCallArgument *args, HostSuspendCallArgument *returnValue);
|
||||
};
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ namespace PortabilityLayer
|
||||
HostSuspendCallID_Unknown,
|
||||
|
||||
HostSuspendCallID_Delay,
|
||||
HostSuspendCallID_CallOnVOSThread,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -110,20 +110,57 @@ short FindWindow(Point point, WindowPtr *window)
|
||||
|
||||
bool TrackGoAway(WindowPtr window, Point point)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return false;
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
return wm->HandleCloseBoxClick(window, point);
|
||||
}
|
||||
|
||||
Int32 GrowWindow(WindowPtr window, Point start, Rect *size)
|
||||
PortabilityLayer::Vec2i TrackResize(WindowPtr window, Point start, uint16_t minWidth, uint16_t minHeight, Rect *size)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return 0;
|
||||
}
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
bool TrackBox(WindowPtr window, Point point, int part)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return false;
|
||||
const Rect baseRect = window->m_surface.m_port.GetRect();
|
||||
|
||||
const PortabilityLayer::Vec2i baseSize = PortabilityLayer::Vec2i(baseRect.Width(), baseRect.Height());
|
||||
const PortabilityLayer::Vec2i basePoint = PortabilityLayer::Vec2i(start.h, start.v);
|
||||
PortabilityLayer::Vec2i currentTarget = baseSize;
|
||||
|
||||
wm->SetResizeInProgress(window, baseSize);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
TimeTaggedVOSEvent evt;
|
||||
if (WaitForEvent(&evt, 1))
|
||||
{
|
||||
if (evt.m_vosEvent.m_eventType == GpVOSEventTypes::kMouseInput)
|
||||
{
|
||||
const GpMouseInputEvent &mouseEvt = evt.m_vosEvent.m_event.m_mouseInputEvent;
|
||||
|
||||
const PortabilityLayer::Vec2i nextPoint = PortabilityLayer::Vec2i(mouseEvt.m_x, mouseEvt.m_y);
|
||||
PortabilityLayer::Vec2i requestedSize = baseSize + nextPoint - basePoint;
|
||||
|
||||
if (requestedSize.m_x < static_cast<int32_t>(minWidth))
|
||||
requestedSize.m_x = minWidth;
|
||||
|
||||
if (requestedSize.m_y < static_cast<int32_t>(minHeight))
|
||||
requestedSize.m_y = minHeight;
|
||||
|
||||
if (requestedSize != currentTarget)
|
||||
{
|
||||
currentTarget = requestedSize;
|
||||
wm->SetResizeInProgress(window, currentTarget);
|
||||
}
|
||||
|
||||
if (mouseEvt.m_button == GpMouseButtons::kLeft && mouseEvt.m_eventType == GpMouseEventTypes::kUp)
|
||||
{
|
||||
wm->ClearResizeInProgress();
|
||||
return requestedSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PortabilityLayer::Vec2i(0, 0);
|
||||
}
|
||||
|
||||
WindowPtr GetNewCWindow(int resID, void *storage, WindowPtr behind)
|
||||
|
@@ -26,6 +26,7 @@ namespace PortabilityLayer
|
||||
struct MMHandleBlock;
|
||||
class IOStream;
|
||||
class Widget;
|
||||
struct Vec2i;
|
||||
}
|
||||
|
||||
typedef uint8_t Boolean;
|
||||
@@ -208,7 +209,7 @@ namespace RegionIDs
|
||||
kContent,
|
||||
kTitleBar,
|
||||
kClose,
|
||||
kExpand,
|
||||
kResize,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -235,8 +236,7 @@ void Delay(int ticks, UInt32 *endTickCount);
|
||||
|
||||
short FindWindow(Point point, WindowPtr *window); // Translates global coordinates to window coordinates, returns a region ID
|
||||
bool TrackGoAway(WindowPtr window, Point point); // Returns true if the close box was actually clicked (?)
|
||||
Int32 GrowWindow(WindowPtr window, Point start, Rect *size);
|
||||
bool TrackBox(WindowPtr window, Point point, int part); // Returns true if grow/shrink box was clicked (part corresponds to type)
|
||||
PortabilityLayer::Vec2i TrackResize(WindowPtr window, Point start, uint16_t minWidth, uint16_t minHeight, Rect *size);
|
||||
|
||||
WindowPtr GetNewCWindow(int resID, void *storage, WindowPtr behind);
|
||||
void SizeWindow(WindowPtr window, int width, int height, Boolean addToUpdateRegion);
|
||||
|
@@ -54,18 +54,6 @@ void EndUpdate(WindowPtr graf)
|
||||
graf->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
}
|
||||
|
||||
PLError_t GetIconSuite(Handle *suite, short resID, IconSuiteFlags flags)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
PLError_t PlotIconSuite(Rect *rect, Handle iconSuite)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
void SetRect(Rect *rect, short left, short top, short right, short bottom)
|
||||
{
|
||||
rect->left = left;
|
||||
@@ -218,71 +206,6 @@ static void PlotLine(PortabilityLayer::QDState *qdState, DrawSurface *surface, c
|
||||
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
static bool SystemColorToRGBAColor(SystemColorID color, PortabilityLayer::RGBAColor &rgbaColor)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
default:
|
||||
return false;
|
||||
case whiteColor:
|
||||
rgbaColor.r = rgbaColor.g = rgbaColor.b = 255;
|
||||
break;
|
||||
case blackColor:
|
||||
rgbaColor.r = rgbaColor.g = rgbaColor.b = 0;
|
||||
break;
|
||||
case yellowColor:
|
||||
rgbaColor.r = rgbaColor.g = 255;
|
||||
rgbaColor.b = 0;
|
||||
break;
|
||||
case magentaColor:
|
||||
rgbaColor.r = rgbaColor.b = 255;
|
||||
rgbaColor.g = 0;
|
||||
break;
|
||||
case redColor:
|
||||
rgbaColor.r = 255;
|
||||
rgbaColor.g = rgbaColor.b = 0;
|
||||
break;
|
||||
case cyanColor:
|
||||
rgbaColor.g = rgbaColor.b = 255;
|
||||
rgbaColor.r = 0;
|
||||
break;
|
||||
case greenColor:
|
||||
rgbaColor.g = 255;
|
||||
rgbaColor.r = rgbaColor.b = 0;
|
||||
break;
|
||||
case blueColor:
|
||||
rgbaColor.b = 255;
|
||||
rgbaColor.r = rgbaColor.g = 0;
|
||||
break;
|
||||
}
|
||||
rgbaColor.a = 255;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void ForeColor(SystemColorID color)
|
||||
{
|
||||
PortabilityLayer::RGBAColor rgbaColor;
|
||||
if (SystemColorToRGBAColor(color, rgbaColor))
|
||||
{
|
||||
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||
qdState->SetForeColor(rgbaColor);
|
||||
}
|
||||
}
|
||||
|
||||
void BackColor(SystemColorID color)
|
||||
{
|
||||
PortabilityLayer::RGBAColor rgbaColor;
|
||||
if (SystemColorToRGBAColor(color, rgbaColor))
|
||||
{
|
||||
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||
qdState->SetBackColor(rgbaColor);
|
||||
}
|
||||
}
|
||||
|
||||
void GetForeColor(RGBColor *color)
|
||||
{
|
||||
const PortabilityLayer::RGBAColor foreColor = PortabilityLayer::QDManager::GetInstance()->GetState()->GetForeColor();
|
||||
|
@@ -11,35 +11,6 @@ namespace PortabilityLayer
|
||||
|
||||
struct Dialog;
|
||||
|
||||
|
||||
enum IconSuiteFlags
|
||||
{
|
||||
svAllLargeData = 1,
|
||||
};
|
||||
|
||||
enum TextFlags
|
||||
{
|
||||
bold = 1,
|
||||
};
|
||||
|
||||
enum SystemFontID
|
||||
{
|
||||
systemFont = 0, // System font
|
||||
applFont = 1, // Application font
|
||||
};
|
||||
|
||||
enum SystemColorID
|
||||
{
|
||||
whiteColor = 1,
|
||||
blackColor,
|
||||
yellowColor,
|
||||
magentaColor,
|
||||
redColor,
|
||||
cyanColor,
|
||||
greenColor,
|
||||
blueColor,
|
||||
};
|
||||
|
||||
enum CopyBitsMode
|
||||
{
|
||||
srcCopy,
|
||||
@@ -99,14 +70,9 @@ void SetPortDialogPort(Dialog *dialog);
|
||||
|
||||
void EndUpdate(WindowPtr graf);
|
||||
|
||||
PLError_t GetIconSuite(Handle *suite, short resID, IconSuiteFlags flags);
|
||||
PLError_t PlotIconSuite(Rect *rect, Handle iconSuite);
|
||||
|
||||
void SetRect(Rect *rect, short left, short top, short right, short bottom);
|
||||
|
||||
int TextWidth(const PLPasStr &str, int firstChar1Based, int length);
|
||||
void ForeColor(SystemColorID color);
|
||||
void BackColor(SystemColorID color);
|
||||
void GetForeColor(RGBColor *color);
|
||||
|
||||
void ClipRect(const Rect *rect);
|
||||
|
@@ -213,6 +213,30 @@ namespace PortabilityLayer
|
||||
DrawControl(m_window->GetDrawSurface());
|
||||
}
|
||||
|
||||
void ScrollBarWidget::SetMin(int32_t v)
|
||||
{
|
||||
m_min = v;
|
||||
if (m_state < m_min)
|
||||
SetState(m_min);
|
||||
else
|
||||
{
|
||||
RefreshGrip();
|
||||
DrawControl(m_window->GetDrawSurface());
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollBarWidget::SetMax(int32_t v)
|
||||
{
|
||||
m_max = v;
|
||||
if (m_state > m_max)
|
||||
SetState(m_max);
|
||||
else
|
||||
{
|
||||
RefreshGrip();
|
||||
DrawControl(m_window->GetDrawSurface());
|
||||
}
|
||||
}
|
||||
|
||||
int16_t ScrollBarWidget::Capture(const Point &pos, WidgetUpdateCallback_t callback)
|
||||
{
|
||||
int part = ResolvePart(pos);
|
||||
|
@@ -21,6 +21,9 @@ namespace PortabilityLayer
|
||||
void SetState(int16_t state) override;
|
||||
void OnStateChanged() override;
|
||||
|
||||
void SetMin(int32_t v) override;
|
||||
void SetMax(int32_t v) override;
|
||||
|
||||
int16_t Capture(const Point &pos, WidgetUpdateCallback_t callback) override;
|
||||
|
||||
int ResolvePart(const Point &point) const override;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include "PLCore.h"
|
||||
#include "AppEventHandler.h"
|
||||
#include "PLEventQueue.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLMovies.h"
|
||||
@@ -6,7 +7,10 @@
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "DisplayDeviceManager.h"
|
||||
#include "GpVOSEvent.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "InputManager.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostSuspendCallArgument.h"
|
||||
#include "HostSuspendHook.h"
|
||||
#include "HostVOSEventQueue.h"
|
||||
@@ -66,6 +70,20 @@ static void TranslateKeyboardInputEvent(const GpVOSEvent &vosEventBase, uint32_t
|
||||
if (vosEvent.m_eventType == GpKeyboardInputEventTypes::kUp || vosEvent.m_eventType == GpKeyboardInputEventTypes::kDown)
|
||||
inputManager->ApplyKeyboardEvent(vosEvent);
|
||||
|
||||
// Special handling of alt-enter, redirect to display driver
|
||||
if (vosEventBase.m_eventType == GpKeyboardInputEventTypes::kDown &&
|
||||
vosEventBase.m_event.m_keyboardInputEvent.m_keyIDSubset == GpKeyIDSubsets::kSpecial &&
|
||||
vosEventBase.m_event.m_keyboardInputEvent.m_key.m_specialKey == GpKeySpecials::kEnter)
|
||||
{
|
||||
const KeyDownStates *keyStates = inputManager->GetKeys();
|
||||
if (keyStates->m_special.Get(GpKeySpecials::kLeftAlt) || keyStates->m_special.Get(GpKeySpecials::kRightAlt))
|
||||
{
|
||||
IGpDisplayDriver *dd = PortabilityLayer::HostDisplayDriver::GetInstance();
|
||||
if (dd)
|
||||
dd->RequestToggleFullScreen(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (TimeTaggedVOSEvent *evt = queue->Enqueue())
|
||||
*evt = TimeTaggedVOSEvent::Create(vosEventBase, timestamp);
|
||||
}
|
||||
@@ -118,6 +136,14 @@ static void TranslateVOSEvent(const GpVOSEvent *vosEvent, uint32_t timestamp, Po
|
||||
case GpVOSEventTypes::kVideoResolutionChanged:
|
||||
TranslateVideoResolutionChangedEvent(vosEvent->m_event.m_resolutionChangedEvent);
|
||||
break;
|
||||
case GpVOSEventTypes::kQuit:
|
||||
if (TimeTaggedVOSEvent *evt = queue->Enqueue())
|
||||
*evt = TimeTaggedVOSEvent::Create(*vosEvent, timestamp);
|
||||
|
||||
if (PortabilityLayer::IAppEventHandler *appHandler = PortabilityLayer::AppEventHandler::GetInstance())
|
||||
appHandler->OnQuit();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,4 +175,63 @@ namespace PLSysCalls
|
||||
AnimationManager::GetInstance()->TickPlayers(ticks);
|
||||
}
|
||||
}
|
||||
|
||||
static void PromptOpenFileCallback(const PortabilityLayer::HostSuspendCallArgument *args, PortabilityLayer::HostSuspendCallArgument *returnValue)
|
||||
{
|
||||
bool result = PortabilityLayer::HostFileSystem::GetInstance()->PromptOpenFile(static_cast<PortabilityLayer::VirtualDirectory_t>(args[0].m_int), static_cast<char*>(args[1].m_pointer), *static_cast<size_t*>(args[2].m_pointer), args[3].m_uint);
|
||||
returnValue->m_uint = (result ? 1 : 0);
|
||||
}
|
||||
|
||||
bool PromptOpenFile(PortabilityLayer::VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity)
|
||||
{
|
||||
PortabilityLayer::HostSuspendCallArgument cbArgs[4];
|
||||
cbArgs[0].m_int = static_cast<int32_t>(dirID);
|
||||
cbArgs[1].m_pointer = path;
|
||||
cbArgs[2].m_pointer = &outPathLength;
|
||||
cbArgs[3].m_size = pathCapacity;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument cbReturnValue;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument dispatchArgs[3];
|
||||
dispatchArgs[0].m_functionPtr = PromptOpenFileCallback;
|
||||
dispatchArgs[1].m_constPointer = cbArgs;
|
||||
dispatchArgs[2].m_pointer = &cbReturnValue;
|
||||
|
||||
PortabilityLayer::SuspendApplication(PortabilityLayer::HostSuspendCallID_CallOnVOSThread, dispatchArgs, nullptr);
|
||||
|
||||
return cbReturnValue.m_uint != 0;
|
||||
}
|
||||
|
||||
static void PromptSaveFileCallback(const PortabilityLayer::HostSuspendCallArgument *args, PortabilityLayer::HostSuspendCallArgument *returnValue)
|
||||
{
|
||||
bool result = PortabilityLayer::HostFileSystem::GetInstance()->PromptSaveFile(
|
||||
static_cast<PortabilityLayer::VirtualDirectory_t>(args[0].m_int),
|
||||
static_cast<char*>(args[1].m_pointer),
|
||||
*static_cast<size_t*>(args[2].m_pointer),
|
||||
args[3].m_uint,
|
||||
static_cast<const char*>(args[4].m_constPointer));
|
||||
|
||||
returnValue->m_uint = (result ? 1 : 0);
|
||||
}
|
||||
|
||||
bool PromptSaveFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, char *path, size_t &outPathLength, size_t pathCapacity, const char *initialFileName)
|
||||
{
|
||||
PortabilityLayer::HostSuspendCallArgument cbArgs[5];
|
||||
cbArgs[0].m_int = static_cast<int32_t>(virtualDirectory);
|
||||
cbArgs[1].m_pointer = path;
|
||||
cbArgs[2].m_pointer = &outPathLength;
|
||||
cbArgs[3].m_size = pathCapacity;
|
||||
cbArgs[3].m_constPointer = initialFileName;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument cbReturnValue;
|
||||
|
||||
PortabilityLayer::HostSuspendCallArgument dispatchArgs[3];
|
||||
dispatchArgs[0].m_functionPtr = PromptSaveFileCallback;
|
||||
dispatchArgs[1].m_constPointer = cbArgs;
|
||||
dispatchArgs[2].m_pointer = &cbReturnValue;
|
||||
|
||||
PortabilityLayer::SuspendApplication(PortabilityLayer::HostSuspendCallID_CallOnVOSThread, dispatchArgs, nullptr);
|
||||
|
||||
return cbReturnValue.m_uint != 0;
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "VirtualDirectory.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PLSysCalls
|
||||
{
|
||||
{
|
||||
void Sleep(uint32_t ticks);
|
||||
bool PromptOpenFile(PortabilityLayer::VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity);
|
||||
bool PromptSaveFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, char *path, size_t &outPathLength, size_t pathCapacity, const char *initialFileName);
|
||||
}
|
||||
|
@@ -146,6 +146,7 @@
|
||||
<ClInclude Include="AEHandlerDesc.h" />
|
||||
<ClInclude Include="AEManager.h" />
|
||||
<ClInclude Include="AntiAliasTable.h" />
|
||||
<ClInclude Include="AppEventHandler.h" />
|
||||
<ClInclude Include="ArrayTools.h" />
|
||||
<ClInclude Include="BinarySearch.h" />
|
||||
<ClInclude Include="BinHex4.h" />
|
||||
@@ -230,6 +231,7 @@
|
||||
<ClInclude Include="PLUnalignedPtr.h" />
|
||||
<ClInclude Include="PLWidgets.h" />
|
||||
<ClInclude Include="TextPlacer.h" />
|
||||
<ClInclude Include="UTF16.h" />
|
||||
<ClInclude Include="UTF8.h" />
|
||||
<ClInclude Include="ZipFileProxy.h" />
|
||||
<ClInclude Include="SimpleImage.h" />
|
||||
@@ -303,6 +305,7 @@
|
||||
<ClCompile Include="..\stb\stb_image_write.c" />
|
||||
<ClCompile Include="AEManager.cpp" />
|
||||
<ClCompile Include="AntiAliasTable.cpp" />
|
||||
<ClCompile Include="AppEventHandler.cpp" />
|
||||
<ClCompile Include="BinHex4.cpp" />
|
||||
<ClCompile Include="BitmapImage.cpp" />
|
||||
<ClCompile Include="ByteSwap.cpp" />
|
||||
@@ -386,6 +389,7 @@
|
||||
<ClCompile Include="SimpleGraphic.cpp" />
|
||||
<ClCompile Include="PLHandle.cpp" />
|
||||
<ClCompile Include="TextPlacer.cpp" />
|
||||
<ClCompile Include="UTF16.cpp" />
|
||||
<ClCompile Include="UTF8.cpp" />
|
||||
<ClCompile Include="WindowDef.cpp" />
|
||||
<ClCompile Include="WindowManager.cpp" />
|
||||
|
@@ -483,6 +483,12 @@
|
||||
<ClInclude Include="ArrayTools.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AppEventHandler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UTF16.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CFileStream.cpp">
|
||||
@@ -758,5 +764,11 @@
|
||||
<ClCompile Include="TextPlacer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AppEventHandler.cpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UTF16.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
57
PortabilityLayer/UTF16.cpp
Normal file
57
PortabilityLayer/UTF16.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "UTF16.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
bool UTF16Processor::DecodeCodePoint(const uint16_t *characters, size_t availableCharacters, size_t &outCharactersDigested, uint32_t &outCodePoint)
|
||||
{
|
||||
if (availableCharacters <= 0)
|
||||
return false;
|
||||
|
||||
if ((characters[0] & 0xff80) == 0x00)
|
||||
{
|
||||
outCharactersDigested = 1;
|
||||
outCodePoint = characters[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
if (characters[0] <= 0xd7ff || characters[0] >= 0xe000)
|
||||
{
|
||||
outCharactersDigested = 1;
|
||||
outCodePoint = characters[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
// Surrogate pair
|
||||
if (characters[0] >= 0xdc00 || availableCharacters < 2)
|
||||
return false;
|
||||
|
||||
if (characters[1] < 0xdc00 || characters[1] >= 0xe000)
|
||||
return false;
|
||||
|
||||
uint16_t highBits = (characters[0] & 0x3ff);
|
||||
uint16_t lowBits = (characters[1] & 0x3ff);
|
||||
|
||||
outCharactersDigested = 2;
|
||||
outCodePoint = (highBits << 10) + lowBits + 0x10000;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UTF16Processor::EncodeCodePoint(uint16_t *characters, size_t &outCharactersEmitted, uint32_t codePoint)
|
||||
{
|
||||
if (codePoint <= 0xd7ff || codePoint >= 0xe000)
|
||||
{
|
||||
outCharactersEmitted = 1;
|
||||
characters[0] = static_cast<uint16_t>(codePoint);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t codePointBits = (codePoint - 0x10000) & 0xfffff;
|
||||
uint16_t lowBits = (codePointBits & 0x3ff);
|
||||
uint16_t highBits = ((codePointBits >> 10) & 0x3ff);
|
||||
|
||||
outCharactersEmitted = 2;
|
||||
characters[0] = (0xd800 + highBits);
|
||||
characters[1] = (0xdc00 + lowBits);
|
||||
}
|
||||
}
|
13
PortabilityLayer/UTF16.h
Normal file
13
PortabilityLayer/UTF16.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class UTF16Processor
|
||||
{
|
||||
public:
|
||||
static bool DecodeCodePoint(const uint16_t *characters, size_t availableCharacters, size_t &outCharactersDigested, uint32_t &outCodePoint);
|
||||
static void EncodeCodePoint(uint16_t *characters, size_t &outCharactersEmitted, uint32_t codePoint);
|
||||
};
|
||||
}
|
@@ -14,6 +14,7 @@
|
||||
#include "QDManager.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "Rect2i.h"
|
||||
#include "Vec2i.h"
|
||||
#include "WindowDef.h"
|
||||
|
||||
@@ -31,6 +32,8 @@ namespace PortabilityLayer
|
||||
virtual void GetChromePadding(const WindowImpl *window, uint16_t padding[WindowChromeSides::kCount]) const = 0;
|
||||
virtual void RenderChrome(WindowImpl *window, DrawSurface *surface, WindowChromeSide_t chromeSide) const = 0;
|
||||
virtual bool GetChromeInteractionZone(const WindowImpl *window, const Vec2i &point, RegionID_t &outRegion) const = 0;
|
||||
virtual bool GetChromeRegionRect(const WindowImpl *window, RegionID_t region, Rect2i &outRect) const = 0;
|
||||
virtual void UpdateRegionChromeState(const WindowImpl *window, RegionID_t region, const void *data) const = 0;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -49,6 +52,8 @@ namespace PortabilityLayer
|
||||
void GetChromePadding(const WindowImpl *window, uint16_t padding[WindowChromeSides::kCount]) const override;
|
||||
void RenderChrome(WindowImpl *window, DrawSurface *surface, WindowChromeSide_t chromeSide) const override;
|
||||
bool GetChromeInteractionZone(const WindowImpl *window, const Vec2i &point, RegionID_t &outRegion) const override;
|
||||
bool GetChromeRegionRect(const WindowImpl *window, RegionID_t region, Rect2i &outRect) const override;
|
||||
void UpdateRegionChromeState(const WindowImpl *window, RegionID_t region, const void *data) const override;
|
||||
};
|
||||
|
||||
class GenericWindowChromeTheme final : public WindowChromeThemeSingleton<GenericWindowChromeTheme>
|
||||
@@ -57,6 +62,8 @@ namespace PortabilityLayer
|
||||
void GetChromePadding(const WindowImpl *window, uint16_t padding[WindowChromeSides::kCount]) const override;
|
||||
void RenderChrome(WindowImpl *window, DrawSurface *surface, WindowChromeSide_t chromeSide) const override;
|
||||
bool GetChromeInteractionZone(const WindowImpl *window, const Vec2i &point, RegionID_t &outRegion) const override;
|
||||
bool GetChromeRegionRect(const WindowImpl *window, RegionID_t region, Rect2i &outRect) const override;
|
||||
void UpdateRegionChromeState(const WindowImpl *window, RegionID_t region, const void *data) const override;
|
||||
|
||||
private:
|
||||
void RenderChromeTop(WindowImpl *window, DrawSurface *surface) const;
|
||||
@@ -69,6 +76,10 @@ namespace PortabilityLayer
|
||||
void RenderChromeBottomMini(WindowImpl *window, DrawSurface *surface) const;
|
||||
void RenderChromeRightMini(WindowImpl *window, DrawSurface *surface) const;
|
||||
|
||||
static Rect GetCloseBoxRectInTopChrome();
|
||||
static Rect GetCloseBoxRectInTopChromeMini();
|
||||
|
||||
void RenderChromeCloseBox(DrawSurface *surface, const Rect &windowRect, bool isClicked) const;
|
||||
|
||||
static const int kDarkGray = 85;
|
||||
static const int kMidGray = 187;
|
||||
@@ -96,6 +107,8 @@ namespace PortabilityLayer
|
||||
void GetChromePadding(uint16_t padding[WindowChromeSides::kCount]) const;
|
||||
void GetChromeDimensions(int width, int height, Rect dimensions[WindowChromeSides::kCount]) const;
|
||||
bool GetChromeInteractionZone(const Vec2i &point, RegionID_t &outRegion) const;
|
||||
bool GetChromeRegionRect(RegionID_t region, Rect2i &outRect) const;
|
||||
void UpdateRegionChromeState(RegionID_t region, const void *data) const;
|
||||
|
||||
bool IsBorderless() const;
|
||||
uint16_t GetStyleFlags() const;
|
||||
@@ -118,6 +131,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
public:
|
||||
WindowManagerImpl();
|
||||
~WindowManagerImpl();
|
||||
|
||||
Window *CreateWindow(const WindowDef &windowDef) override;
|
||||
void ResizeWindow(Window *window, int width, int height) override;
|
||||
@@ -128,7 +142,12 @@ namespace PortabilityLayer
|
||||
void FindWindow(const Point &point, Window **outWindow, short *outRegion) const override;
|
||||
void DestroyWindow(Window *window) override;
|
||||
void DragWindow(Window *window, const Point &startPoint, const Rect &constraintRect) override;
|
||||
bool HandleCloseBoxClick(Window *window, const Point &startPoint) override;
|
||||
void SetWindowTitle(Window *window, const PLPasStr &title) override;
|
||||
Rect2i GetWindowFullRect(Window *window) const override;
|
||||
|
||||
void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) override;
|
||||
void ClearResizeInProgress() override;
|
||||
|
||||
void RenderFrame(IGpDisplayDriver *displayDriver) override;
|
||||
|
||||
@@ -142,9 +161,16 @@ namespace PortabilityLayer
|
||||
void RenderWindow(WindowImpl *window, IGpDisplayDriver *displayDriver);
|
||||
void DetachWindow(Window *window);
|
||||
|
||||
void ResetResizeInProgressSurfaces();
|
||||
|
||||
WindowImpl *m_windowStackTop;
|
||||
WindowImpl *m_windowStackBottom;
|
||||
|
||||
Rect2i m_resizeInProgressRect;
|
||||
DrawSurface m_resizeInProgressHorizontalBar;
|
||||
DrawSurface m_resizeInProgressVerticalBar;
|
||||
bool m_isResizeInProgress;
|
||||
|
||||
static WindowManagerImpl ms_instance;
|
||||
|
||||
static uint8_t ms_putInFrontSentinel;
|
||||
@@ -175,6 +201,15 @@ namespace PortabilityLayer
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SimpleBoxChromeTheme::GetChromeRegionRect(const WindowImpl *window, RegionID_t region, Rect2i &outRect) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimpleBoxChromeTheme::UpdateRegionChromeState(const WindowImpl *window, RegionID_t region, const void *data) const
|
||||
{
|
||||
}
|
||||
|
||||
void SimpleBoxChromeTheme::RenderChrome(WindowImpl *window, DrawSurface *surface, WindowChromeSide_t chromeSide) const
|
||||
{
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
@@ -217,26 +252,92 @@ namespace PortabilityLayer
|
||||
const DrawSurface *surface = window->GetDrawSurface();
|
||||
const Rect rect = (*surface->m_port.GetPixMap())->m_rect;
|
||||
|
||||
const int32_t w = rect.Width();
|
||||
const int32_t h = rect.Height();
|
||||
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kMiniBar)
|
||||
{
|
||||
if (point.m_x >= 0 && point.m_x < rect.Width() && point.m_y < 0 && point.m_y >= -13)
|
||||
if (point.m_x >= 0 && point.m_x < w && point.m_y < 0 && point.m_y >= -13)
|
||||
{
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
||||
{
|
||||
uint16_t padding[WindowChromeSides::kCount];
|
||||
GetChromePadding(window, padding);
|
||||
|
||||
const Rect closeBoxRect = GetCloseBoxRectInTopChromeMini();
|
||||
const Vec2i topChromePos = Vec2i(point.m_x + padding[WindowChromeSides::kLeft], point.m_y + padding[WindowChromeSides::kTop]);
|
||||
|
||||
if (closeBoxRect.Contains(Point::Create(topChromePos.m_x, topChromePos.m_y)))
|
||||
{
|
||||
outRegion = RegionIDs::kClose;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
outRegion = RegionIDs::kTitleBar;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (point.m_x >= 0 && point.m_x < rect.Width() && point.m_y < 0 && point.m_y >= -17)
|
||||
if (point.m_x >= 0 && point.m_x < w && point.m_y < 0 && point.m_y >= -17)
|
||||
{
|
||||
outRegion = RegionIDs::kTitleBar;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kResizable)
|
||||
{
|
||||
if (point.m_x >= w - 14 && point.m_x < w && point.m_y >= h - 14 && point.m_y < h)
|
||||
{
|
||||
outRegion = RegionIDs::kResize;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GenericWindowChromeTheme::GetChromeRegionRect(const WindowImpl *window, RegionID_t region, Rect2i &outRect) const
|
||||
{
|
||||
if (region == RegionIDs::kClose)
|
||||
{
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
||||
{
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kMiniBar)
|
||||
{
|
||||
uint16_t padding[WindowChromeSides::kCount];
|
||||
GetChromePadding(window, padding);
|
||||
|
||||
const Rect closeBoxRect = GetCloseBoxRectInTopChromeMini();
|
||||
outRect = Rect2i(closeBoxRect.top - padding[WindowChromeSides::kTop], closeBoxRect.left - padding[WindowChromeSides::kLeft],
|
||||
closeBoxRect.bottom - padding[WindowChromeSides::kTop], closeBoxRect.right - padding[WindowChromeSides::kLeft]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GenericWindowChromeTheme::UpdateRegionChromeState(const WindowImpl *window, RegionID_t region, const void *data) const
|
||||
{
|
||||
if (region == RegionIDs::kClose)
|
||||
{
|
||||
const bool state = *static_cast<const bool*>(data);
|
||||
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
||||
{
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kMiniBar)
|
||||
{
|
||||
DrawSurface *topChromeSurface = window->GetChromeSurface(WindowChromeSides::kTop);
|
||||
RenderChromeCloseBox(topChromeSurface, GetCloseBoxRectInTopChromeMini(), state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GenericWindowChromeTheme::RenderChrome(WindowImpl *window, DrawSurface *surface, WindowChromeSide_t chromeSide) const
|
||||
{
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kMiniBar)
|
||||
@@ -304,6 +405,9 @@ namespace PortabilityLayer
|
||||
surface->FillRect(Rect::Create(rect.top + 1, rect.left + 1, rect.top + 2, rect.right - 2));
|
||||
surface->FillRect(Rect::Create(rect.bottom - 1, rect.right - 5, rect.bottom, rect.right - 4));
|
||||
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
||||
RenderChromeCloseBox(surface, rect, false);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold);
|
||||
int32_t ascender = surface->MeasureFontAscender();
|
||||
@@ -402,6 +506,9 @@ namespace PortabilityLayer
|
||||
surface->FillRect(Rect::Create(rect.top + 1, rect.left + 1, rect.bottom - 2, rect.left + 2));
|
||||
surface->FillRect(Rect::Create(rect.top + 1, rect.left + 1, rect.top + 2, rect.right - 2));
|
||||
|
||||
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
||||
RenderChromeCloseBox(surface, rect, false);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->SetApplicationFont(10, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold);
|
||||
int32_t ascender = surface->MeasureFontAscender();
|
||||
@@ -439,6 +546,45 @@ namespace PortabilityLayer
|
||||
surface->FillRect(rect);
|
||||
}
|
||||
|
||||
Rect GenericWindowChromeTheme::GetCloseBoxRectInTopChrome()
|
||||
{
|
||||
return GetCloseBoxRectInTopChromeMini(); // Temp, maybe... I don't think this is ever actually used
|
||||
}
|
||||
|
||||
Rect GenericWindowChromeTheme::GetCloseBoxRectInTopChromeMini()
|
||||
{
|
||||
int boxDimensions = 8;
|
||||
return Rect::Create(2, 2, 2 + boxDimensions, 2 + boxDimensions);
|
||||
}
|
||||
|
||||
void GenericWindowChromeTheme::RenderChromeCloseBox(DrawSurface *surface, const Rect &chromeRect, bool isClicked) const
|
||||
{
|
||||
const Rect closeBoxRect = GetCloseBoxRectInTopChromeMini();
|
||||
|
||||
if (isClicked)
|
||||
{
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRect(closeBoxRect);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(kDarkGray, kDarkGray, kDarkGray, 255));
|
||||
surface->FillRect(Rect::Create(closeBoxRect.top + 1, closeBoxRect.left + 1, closeBoxRect.bottom - 1, closeBoxRect.right - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(kDarkGray, kDarkGray, kDarkGray, 255));
|
||||
surface->FillRect(closeBoxRect);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(kMidGray, kMidGray, kMidGray, 255));
|
||||
surface->FillRect(Rect::Create(closeBoxRect.top + 1, closeBoxRect.left + 1, closeBoxRect.bottom, closeBoxRect.right));
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(kDarkGray, kDarkGray, kDarkGray, 255));
|
||||
surface->FillRect(Rect::Create(closeBoxRect.top + 2, closeBoxRect.left + 2, closeBoxRect.bottom - 1, closeBoxRect.right - 1));
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(kLightGray, kLightGray, kLightGray, 255));
|
||||
surface->FillRect(Rect::Create(closeBoxRect.top + 2, closeBoxRect.left + 2, closeBoxRect.bottom - 2, closeBoxRect.right - 2));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
WindowImpl::WindowImpl()
|
||||
: m_windowAbove(nullptr)
|
||||
@@ -588,6 +734,22 @@ namespace PortabilityLayer
|
||||
return m_chromeTheme->GetChromeInteractionZone(this, point, outRegion);
|
||||
}
|
||||
|
||||
bool WindowImpl::GetChromeRegionRect(RegionID_t region, Rect2i &outRect) const
|
||||
{
|
||||
if (!m_chromeTheme)
|
||||
return false;
|
||||
|
||||
return m_chromeTheme->GetChromeRegionRect(this, region, outRect);
|
||||
}
|
||||
|
||||
void WindowImpl::UpdateRegionChromeState(RegionID_t region, const void *data) const
|
||||
{
|
||||
if (!m_chromeTheme)
|
||||
return;
|
||||
|
||||
m_chromeTheme->UpdateRegionChromeState(this, region, data);
|
||||
}
|
||||
|
||||
bool WindowImpl::IsBorderless() const
|
||||
{
|
||||
return (m_styleFlags & WindowStyleFlags::kBorderless) != 0;
|
||||
@@ -612,6 +774,12 @@ namespace PortabilityLayer
|
||||
WindowManagerImpl::WindowManagerImpl()
|
||||
: m_windowStackTop(nullptr)
|
||||
, m_windowStackBottom(nullptr)
|
||||
, m_resizeInProgressRect(Rect2i(0, 0, 0, 0))
|
||||
, m_isResizeInProgress(false)
|
||||
{
|
||||
}
|
||||
|
||||
WindowManagerImpl::~WindowManagerImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -792,11 +960,123 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowManagerImpl::HandleCloseBoxClick(Window *window, const Point &startPoint)
|
||||
{
|
||||
bool isInBounds = false;
|
||||
|
||||
const Vec2i windowCoord = Vec2i(window->m_wmX, window->m_wmY);
|
||||
|
||||
Rect2i closeBoxRect;
|
||||
if (!static_cast<WindowImpl*>(window)->GetChromeRegionRect(RegionIDs::kClose, closeBoxRect))
|
||||
return false;
|
||||
|
||||
{
|
||||
const Vec2i relativeCoord = Vec2i(startPoint.h, startPoint.v) - windowCoord;
|
||||
const bool coordIsInBounds = closeBoxRect.Contains(relativeCoord);
|
||||
|
||||
if (coordIsInBounds != isInBounds)
|
||||
{
|
||||
const bool state = coordIsInBounds;
|
||||
isInBounds = coordIsInBounds;
|
||||
|
||||
static_cast<WindowImpl*>(window)->UpdateRegionChromeState(RegionIDs::kClose, &state);
|
||||
}
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
TimeTaggedVOSEvent evt;
|
||||
if (WaitForEvent(&evt, 1))
|
||||
{
|
||||
if (evt.m_vosEvent.m_eventType == GpVOSEventTypes::kMouseInput)
|
||||
{
|
||||
const GpMouseInputEvent &mouseEvent = evt.m_vosEvent.m_event.m_mouseInputEvent;
|
||||
|
||||
const Vec2i relativeCoord = Vec2i(mouseEvent.m_x, mouseEvent.m_y) - windowCoord;
|
||||
const bool coordIsInBounds = closeBoxRect.Contains(relativeCoord);
|
||||
|
||||
if (coordIsInBounds != isInBounds)
|
||||
{
|
||||
const bool state = coordIsInBounds;
|
||||
isInBounds = coordIsInBounds;
|
||||
|
||||
static_cast<WindowImpl*>(window)->UpdateRegionChromeState(RegionIDs::kClose, &state);
|
||||
}
|
||||
|
||||
if (mouseEvent.m_eventType == GpMouseEventTypes::kUp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isInBounds)
|
||||
{
|
||||
const bool state = false;
|
||||
static_cast<WindowImpl*>(window)->UpdateRegionChromeState(RegionIDs::kClose, &state);
|
||||
}
|
||||
|
||||
return isInBounds;
|
||||
}
|
||||
|
||||
void WindowManagerImpl::SetWindowTitle(Window *window, const PLPasStr &title)
|
||||
{
|
||||
static_cast<WindowImpl*>(window)->SetTitle(title);
|
||||
}
|
||||
|
||||
Rect2i WindowManagerImpl::GetWindowFullRect(Window *window) const
|
||||
{
|
||||
WindowImpl *windowImpl = static_cast<WindowImpl*>(window);
|
||||
|
||||
uint16_t padding[WindowChromeSides::kCount];
|
||||
windowImpl->GetChromePadding(padding);
|
||||
|
||||
const Rect portRect = windowImpl->m_surface.m_port.GetRect();
|
||||
|
||||
return Rect2i(window->m_wmY - padding[WindowChromeSides::kTop], window->m_wmX - padding[WindowChromeSides::kLeft], window->m_wmY + portRect.Height() + padding[WindowChromeSides::kBottom], window->m_wmX + portRect.Width() + padding[WindowChromeSides::kRight]);
|
||||
}
|
||||
|
||||
void WindowManagerImpl::SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size)
|
||||
{
|
||||
ResetResizeInProgressSurfaces();
|
||||
|
||||
m_isResizeInProgress = true;
|
||||
if (!m_resizeInProgressHorizontalBar.Init(Rect::Create(0, 0, 3, size.m_x + 4), GpPixelFormats::k8BitStandard))
|
||||
{
|
||||
m_resizeInProgressHorizontalBar.SetForeColor(StdColors::Black());
|
||||
m_resizeInProgressHorizontalBar.FillRect(Rect::Create(0, 0, 3, size.m_x + 4));
|
||||
m_resizeInProgressHorizontalBar.SetForeColor(StdColors::White());
|
||||
m_resizeInProgressHorizontalBar.FillRect(Rect::Create(1, 1, 2, size.m_x + 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isResizeInProgress = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_resizeInProgressVerticalBar.Init(Rect::Create(0, 0, size.m_y, 3), GpPixelFormats::k8BitStandard))
|
||||
{
|
||||
m_resizeInProgressVerticalBar.SetForeColor(StdColors::Black());
|
||||
m_resizeInProgressVerticalBar.FillRect(Rect::Create(0, 0, size.m_y, 1));
|
||||
m_resizeInProgressVerticalBar.FillRect(Rect::Create(0, 2, size.m_y, 3));
|
||||
m_resizeInProgressVerticalBar.SetForeColor(StdColors::White());
|
||||
m_resizeInProgressVerticalBar.FillRect(Rect::Create(0, 1, size.m_y, 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isResizeInProgress = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const PortabilityLayer::Vec2i topLeft = PortabilityLayer::Vec2i(window->m_wmX, window->m_wmY);
|
||||
m_resizeInProgressRect = PortabilityLayer::Rect2i(topLeft, topLeft + size);
|
||||
}
|
||||
|
||||
void WindowManagerImpl::ClearResizeInProgress()
|
||||
{
|
||||
ResetResizeInProgressSurfaces();
|
||||
m_isResizeInProgress = false;
|
||||
}
|
||||
|
||||
void WindowManagerImpl::RenderFrame(IGpDisplayDriver *displayDriver)
|
||||
{
|
||||
PortabilityLayer::DisplayDeviceManager *dd = PortabilityLayer::DisplayDeviceManager::GetInstance();
|
||||
@@ -809,6 +1089,17 @@ namespace PortabilityLayer
|
||||
RenderWindow(window, displayDriver);
|
||||
window = window->GetWindowAbove();
|
||||
}
|
||||
|
||||
if (m_isResizeInProgress)
|
||||
{
|
||||
m_resizeInProgressHorizontalBar.PushToDDSurface(displayDriver);
|
||||
m_resizeInProgressVerticalBar.PushToDDSurface(displayDriver);
|
||||
|
||||
displayDriver->DrawSurface(m_resizeInProgressHorizontalBar.m_ddSurface, m_resizeInProgressRect.m_topLeft.m_x - 2, m_resizeInProgressRect.m_topLeft.m_y - 2, m_resizeInProgressRect.Right() - m_resizeInProgressRect.Left() + 4, 3);
|
||||
displayDriver->DrawSurface(m_resizeInProgressHorizontalBar.m_ddSurface, m_resizeInProgressRect.m_topLeft.m_x - 2, m_resizeInProgressRect.m_bottomRight.m_y - 1, m_resizeInProgressRect.Right() - m_resizeInProgressRect.Left() + 4, 3);
|
||||
displayDriver->DrawSurface(m_resizeInProgressVerticalBar.m_ddSurface, m_resizeInProgressRect.m_topLeft.m_x - 2, m_resizeInProgressRect.m_topLeft.m_y, 3, m_resizeInProgressRect.Bottom() - m_resizeInProgressRect.Top());
|
||||
displayDriver->DrawSurface(m_resizeInProgressVerticalBar.m_ddSurface, m_resizeInProgressRect.m_bottomRight.m_x - 1, m_resizeInProgressRect.m_topLeft.m_y, 3, m_resizeInProgressRect.Bottom() - m_resizeInProgressRect.Top());
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManagerImpl::HandleScreenResolutionChange(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight)
|
||||
@@ -888,6 +1179,15 @@ namespace PortabilityLayer
|
||||
impl->SetWindowBelow(nullptr);
|
||||
}
|
||||
|
||||
void WindowManagerImpl::ResetResizeInProgressSurfaces()
|
||||
{
|
||||
m_resizeInProgressHorizontalBar.~DrawSurface();
|
||||
m_resizeInProgressVerticalBar.~DrawSurface();
|
||||
|
||||
new (&m_resizeInProgressHorizontalBar) DrawSurface();
|
||||
new (&m_resizeInProgressVerticalBar) DrawSurface();
|
||||
}
|
||||
|
||||
Window *WindowManagerImpl::GetPutInFrontSentinel() const
|
||||
{
|
||||
return reinterpret_cast<Window*>(&ms_putInFrontSentinel);
|
||||
|
@@ -14,6 +14,8 @@ struct Window;
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct WindowDef;
|
||||
struct Rect2i;
|
||||
struct Vec2i;
|
||||
|
||||
class WindowManager
|
||||
{
|
||||
@@ -28,7 +30,12 @@ namespace PortabilityLayer
|
||||
virtual void FindWindow(const Point &point, Window **outWindow, short *outRegion) const = 0;
|
||||
virtual void DestroyWindow(Window *window) = 0;
|
||||
virtual void DragWindow(Window *window, const Point &startPoint, const Rect &constraintRect) = 0;
|
||||
virtual bool HandleCloseBoxClick(Window *window, const Point &startPoint) = 0;
|
||||
virtual void SetWindowTitle(Window *window, const PLPasStr &title) = 0;
|
||||
virtual Rect2i GetWindowFullRect(Window *window) const = 0;
|
||||
|
||||
virtual void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) = 0;
|
||||
virtual void ClearResizeInProgress() = 0;
|
||||
|
||||
virtual void RenderFrame(IGpDisplayDriver *displayDriver) = 0;
|
||||
|
||||
|
14
README.txt
14
README.txt
@@ -1,10 +1,11 @@
|
||||
Aerofoil is a collection of porting infrastructure to run Glider PRO.
|
||||
Aerofoil is a project to port Glider PRO to other systems.
|
||||
|
||||
It's divided into a few parts:
|
||||
- PortabilityLayer: A static library that supports interaction with various vintage Mac-specific formats and API calls. Some parts are capable of running by themselves, others require the support of drivers.
|
||||
- Aerofoil: This is the base application. It loads drivers and loads the application.
|
||||
- GpDisplayDriver_D3D11: Direct3D 11 display driver.
|
||||
- GpAudioDriver_XAudio2: XAudio2 audio driver.
|
||||
- GpInputDriver_XInput: XInput gamepad driver.
|
||||
- GpApp: Glider PRO application DLL.
|
||||
|
||||
|
||||
@@ -12,16 +13,11 @@ Other parts:
|
||||
- CompileShadersD3D11: Compiles D3D11 shaders into C++ files containing the compiled shader data.
|
||||
- ConvertColorCursors: Extracts color cursors and icons from the application resources and dumps them to .CUR and .ICO files. Required because Windows has no API for creating color cursors at runtime.
|
||||
- GliderProData: Glider PRO resource sources.
|
||||
- ApplicationResourcePatches: Modified resources (used to change config dialogs).
|
||||
- hqx2bin: Converts BinHex to MacBinary (not really used any more)
|
||||
- hqx2gp: Converts BinHex to .gpr, .gpd, and .gpf (resource fork data, data fork data, and Finder data, respectively)
|
||||
- gpr2gpa: Converts Macintosh resource files to a .gpa (a ZIP archive containing the resources in more common formats)
|
||||
- FTagData: Copies a data-only file to a .gpd and creates a .gpf for it
|
||||
- PictChecker: Experimental app that extracts all of the PICT resources from all of the houses and dumps them to PNG. Used to verify that the PICT loader works.
|
||||
- MacRomanConverter: Micro-library that converts the Mac Roman character set to Unicode.
|
||||
|
||||
Aerofoil is intended to be primarily a straight port, retaining most of the look and feel of the original.
|
||||
|
||||
Planned additions:
|
||||
- 32-bit color support (mainly matters for houses that have higher-resolution PICT resources)
|
||||
- Resolution changes while the game is running
|
||||
- Bring back the gray-to-color intro fade that was removed in later versions
|
||||
- Gamepad support
|
||||
- unpacktool: A utility for extracting vintage StuffIt and Compact Pro archives.
|
@@ -1,339 +1,346 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
{\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Lucida Console;}}
|
||||
{\*\generator Riched20 10.0.18362}\viewkind4\uc1
|
||||
\pard\f0\fs14\lang1033 GNU GENERAL PUBLIC LICENSE\par
|
||||
Version 2, June 1991\par
|
||||
\par
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\par
|
||||
|
||||
\pard\tx6210 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\par
|
||||
|
||||
\pard Everyone is permitted to copy and distribute verbatim copies\par
|
||||
of this license document, but changing it is not allowed.\par
|
||||
\par
|
||||
Preamble\par
|
||||
\par
|
||||
The licenses for most software are designed to take away your\par
|
||||
freedom to share and change it. By contrast, the GNU General Public\par
|
||||
License is intended to guarantee your freedom to share and change free\par
|
||||
software--to make sure the software is free for all its users. This\par
|
||||
General Public License applies to most of the Free Software\par
|
||||
Foundation's software and to any other program whose authors commit to\par
|
||||
using it. (Some other Free Software Foundation software is covered by\par
|
||||
the GNU Lesser General Public License instead.) You can apply it to\par
|
||||
your programs, too.\par
|
||||
\par
|
||||
When we speak of free software, we are referring to freedom, not\par
|
||||
price. Our General Public Licenses are designed to make sure that you\par
|
||||
have the freedom to distribute copies of free software (and charge for\par
|
||||
this service if you wish), that you receive source code or can get it\par
|
||||
if you want it, that you can change the software or use pieces of it\par
|
||||
in new free programs; and that you know you can do these things.\par
|
||||
\par
|
||||
To protect your rights, we need to make restrictions that forbid\par
|
||||
anyone to deny you these rights or to ask you to surrender the rights.\par
|
||||
These restrictions translate to certain responsibilities for you if you\par
|
||||
distribute copies of the software, or if you modify it.\par
|
||||
\par
|
||||
For example, if you distribute copies of such a program, whether\par
|
||||
gratis or for a fee, you must give the recipients all the rights that\par
|
||||
you have. You must make sure that they, too, receive or can get the\par
|
||||
source code. And you must show them these terms so they know their\par
|
||||
rights.\par
|
||||
\par
|
||||
We protect your rights with two steps: (1) copyright the software, and\par
|
||||
(2) offer you this license which gives you legal permission to copy,\par
|
||||
distribute and/or modify the software.\par
|
||||
\par
|
||||
Also, for each author's protection and ours, we want to make certain\par
|
||||
that everyone understands that there is no warranty for this free\par
|
||||
software. If the software is modified by someone else and passed on, we\par
|
||||
want its recipients to know that what they have is not the original, so\par
|
||||
that any problems introduced by others will not reflect on the original\par
|
||||
authors' reputations.\par
|
||||
\par
|
||||
Finally, any free program is threatened constantly by software\par
|
||||
patents. We wish to avoid the danger that redistributors of a free\par
|
||||
program will individually obtain patent licenses, in effect making the\par
|
||||
program proprietary. To prevent this, we have made it clear that any\par
|
||||
patent must be licensed for everyone's free use or not licensed at all.\par
|
||||
\par
|
||||
The precise terms and conditions for copying, distribution and\par
|
||||
modification follow.\par
|
||||
\par
|
||||
GNU GENERAL PUBLIC LICENSE\par
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par
|
||||
\par
|
||||
0. This License applies to any program or other work which contains\par
|
||||
a notice placed by the copyright holder saying it may be distributed\par
|
||||
under the terms of this General Public License. The "Program", below,\par
|
||||
refers to any such program or work, and a "work based on the Program"\par
|
||||
means either the Program or any derivative work under copyright law:\par
|
||||
that is to say, a work containing the Program or a portion of it,\par
|
||||
either verbatim or with modifications and/or translated into another\par
|
||||
language. (Hereinafter, translation is included without limitation in\par
|
||||
the term "modification".) Each licensee is addressed as "you".\par
|
||||
\par
|
||||
Activities other than copying, distribution and modification are not\par
|
||||
covered by this License; they are outside its scope. The act of\par
|
||||
running the Program is not restricted, and the output from the Program\par
|
||||
is covered only if its contents constitute a work based on the\par
|
||||
Program (independent of having been made by running the Program).\par
|
||||
Whether that is true depends on what the Program does.\par
|
||||
\par
|
||||
1. You may copy and distribute verbatim copies of the Program's\par
|
||||
source code as you receive it, in any medium, provided that you\par
|
||||
conspicuously and appropriately publish on each copy an appropriate\par
|
||||
copyright notice and disclaimer of warranty; keep intact all the\par
|
||||
notices that refer to this License and to the absence of any warranty;\par
|
||||
and give any other recipients of the Program a copy of this License\par
|
||||
along with the Program.\par
|
||||
\par
|
||||
You may charge a fee for the physical act of transferring a copy, and\par
|
||||
you may at your option offer warranty protection in exchange for a fee.\par
|
||||
\par
|
||||
2. You may modify your copy or copies of the Program or any portion\par
|
||||
of it, thus forming a work based on the Program, and copy and\par
|
||||
distribute such modifications or work under the terms of Section 1\par
|
||||
above, provided that you also meet all of these conditions:\par
|
||||
\par
|
||||
a) You must cause the modified files to carry prominent notices\par
|
||||
stating that you changed the files and the date of any change.\par
|
||||
\par
|
||||
b) You must cause any work that you distribute or publish, that in\par
|
||||
whole or in part contains or is derived from the Program or any\par
|
||||
part thereof, to be licensed as a whole at no charge to all third\par
|
||||
parties under the terms of this License.\par
|
||||
\par
|
||||
c) If the modified program normally reads commands interactively\par
|
||||
when run, you must cause it, when started running for such\par
|
||||
interactive use in the most ordinary way, to print or display an\par
|
||||
announcement including an appropriate copyright notice and a\par
|
||||
notice that there is no warranty (or else, saying that you provide\par
|
||||
a warranty) and that users may redistribute the program under\par
|
||||
these conditions, and telling the user how to view a copy of this\par
|
||||
License. (Exception: if the Program itself is interactive but\par
|
||||
does not normally print such an announcement, your work based on\par
|
||||
the Program is not required to print an announcement.)\par
|
||||
\par
|
||||
These requirements apply to the modified work as a whole. If\par
|
||||
identifiable sections of that work are not derived from the Program,\par
|
||||
and can be reasonably considered independent and separate works in\par
|
||||
themselves, then this License, and its terms, do not apply to those\par
|
||||
sections when you distribute them as separate works. But when you\par
|
||||
distribute the same sections as part of a whole which is a work based\par
|
||||
on the Program, the distribution of the whole must be on the terms of\par
|
||||
this License, whose permissions for other licensees extend to the\par
|
||||
entire whole, and thus to each and every part regardless of who wrote it.\par
|
||||
\par
|
||||
Thus, it is not the intent of this section to claim rights or contest\par
|
||||
your rights to work written entirely by you; rather, the intent is to\par
|
||||
exercise the right to control the distribution of derivative or\par
|
||||
collective works based on the Program.\par
|
||||
\par
|
||||
In addition, mere aggregation of another work not based on the Program\par
|
||||
with the Program (or with a work based on the Program) on a volume of\par
|
||||
a storage or distribution medium does not bring the other work under\par
|
||||
the scope of this License.\par
|
||||
\par
|
||||
3. You may copy and distribute the Program (or a work based on it,\par
|
||||
under Section 2) in object code or executable form under the terms of\par
|
||||
Sections 1 and 2 above provided that you also do one of the following:\par
|
||||
\par
|
||||
a) Accompany it with the complete corresponding machine-readable\par
|
||||
source code, which must be distributed under the terms of Sections\par
|
||||
1 and 2 above on a medium customarily used for software interchange; or,\par
|
||||
\par
|
||||
b) Accompany it with a written offer, valid for at least three\par
|
||||
years, to give any third party, for a charge no more than your\par
|
||||
cost of physically performing source distribution, a complete\par
|
||||
machine-readable copy of the corresponding source code, to be\par
|
||||
distributed under the terms of Sections 1 and 2 above on a medium\par
|
||||
customarily used for software interchange; or,\par
|
||||
\par
|
||||
c) Accompany it with the information you received as to the offer\par
|
||||
to distribute corresponding source code. (This alternative is\par
|
||||
allowed only for noncommercial distribution and only if you\par
|
||||
received the program in object code or executable form with such\par
|
||||
an offer, in accord with Subsection b above.)\par
|
||||
\par
|
||||
The source code for a work means the preferred form of the work for\par
|
||||
making modifications to it. For an executable work, complete source\par
|
||||
code means all the source code for all modules it contains, plus any\par
|
||||
associated interface definition files, plus the scripts used to\par
|
||||
control compilation and installation of the executable. However, as a\par
|
||||
special exception, the source code distributed need not include\par
|
||||
anything that is normally distributed (in either source or binary\par
|
||||
form) with the major components (compiler, kernel, and so on) of the\par
|
||||
operating system on which the executable runs, unless that component\par
|
||||
itself accompanies the executable.\par
|
||||
\par
|
||||
If distribution of executable or object code is made by offering\par
|
||||
access to copy from a designated place, then offering equivalent\par
|
||||
access to copy the source code from the same place counts as\par
|
||||
distribution of the source code, even though third parties are not\par
|
||||
compelled to copy the source along with the object code.\par
|
||||
\par
|
||||
4. You may not copy, modify, sublicense, or distribute the Program\par
|
||||
except as expressly provided under this License. Any attempt\par
|
||||
otherwise to copy, modify, sublicense or distribute the Program is\par
|
||||
void, and will automatically terminate your rights under this License.\par
|
||||
However, parties who have received copies, or rights, from you under\par
|
||||
this License will not have their licenses terminated so long as such\par
|
||||
parties remain in full compliance.\par
|
||||
\par
|
||||
5. You are not required to accept this License, since you have not\par
|
||||
signed it. However, nothing else grants you permission to modify or\par
|
||||
distribute the Program or its derivative works. These actions are\par
|
||||
prohibited by law if you do not accept this License. Therefore, by\par
|
||||
modifying or distributing the Program (or any work based on the\par
|
||||
Program), you indicate your acceptance of this License to do so, and\par
|
||||
all its terms and conditions for copying, distributing or modifying\par
|
||||
the Program or works based on it.\par
|
||||
\par
|
||||
6. Each time you redistribute the Program (or any work based on the\par
|
||||
Program), the recipient automatically receives a license from the\par
|
||||
original licensor to copy, distribute or modify the Program subject to\par
|
||||
these terms and conditions. You may not impose any further\par
|
||||
restrictions on the recipients' exercise of the rights granted herein.\par
|
||||
You are not responsible for enforcing compliance by third parties to\par
|
||||
this License.\par
|
||||
\par
|
||||
7. If, as a consequence of a court judgment or allegation of patent\par
|
||||
infringement or for any other reason (not limited to patent issues),\par
|
||||
conditions are imposed on you (whether by court order, agreement or\par
|
||||
otherwise) that contradict the conditions of this License, they do not\par
|
||||
excuse you from the conditions of this License. If you cannot\par
|
||||
distribute so as to satisfy simultaneously your obligations under this\par
|
||||
License and any other pertinent obligations, then as a consequence you\par
|
||||
may not distribute the Program at all. For example, if a patent\par
|
||||
license would not permit royalty-free redistribution of the Program by\par
|
||||
all those who receive copies directly or indirectly through you, then\par
|
||||
the only way you could satisfy both it and this License would be to\par
|
||||
refrain entirely from distribution of the Program.\par
|
||||
\par
|
||||
If any portion of this section is held invalid or unenforceable under\par
|
||||
any particular circumstance, the balance of the section is intended to\par
|
||||
apply and the section as a whole is intended to apply in other\par
|
||||
circumstances.\par
|
||||
\par
|
||||
It is not the purpose of this section to induce you to infringe any\par
|
||||
patents or other property right claims or to contest validity of any\par
|
||||
such claims; this section has the sole purpose of protecting the\par
|
||||
integrity of the free software distribution system, which is\par
|
||||
implemented by public license practices. Many people have made\par
|
||||
generous contributions to the wide range of software distributed\par
|
||||
through that system in reliance on consistent application of that\par
|
||||
system; it is up to the author/donor to decide if he or she is willing\par
|
||||
to distribute software through any other system and a licensee cannot\par
|
||||
impose that choice.\par
|
||||
\par
|
||||
This section is intended to make thoroughly clear what is believed to\par
|
||||
be a consequence of the rest of this License.\par
|
||||
\par
|
||||
8. If the distribution and/or use of the Program is restricted in\par
|
||||
certain countries either by patents or by copyrighted interfaces, the\par
|
||||
original copyright holder who places the Program under this License\par
|
||||
may add an explicit geographical distribution limitation excluding\par
|
||||
those countries, so that distribution is permitted only in or among\par
|
||||
countries not thus excluded. In such case, this License incorporates\par
|
||||
the limitation as if written in the body of this License.\par
|
||||
\par
|
||||
9. The Free Software Foundation may publish revised and/or new versions\par
|
||||
of the General Public License from time to time. Such new versions will\par
|
||||
be similar in spirit to the present version, but may differ in detail to\par
|
||||
address new problems or concerns.\par
|
||||
\par
|
||||
Each version is given a distinguishing version number. If the Program\par
|
||||
specifies a version number of this License which applies to it and "any\par
|
||||
later version", you have the option of following the terms and conditions\par
|
||||
either of that version or of any later version published by the Free\par
|
||||
Software Foundation. If the Program does not specify a version number of\par
|
||||
this License, you may choose any version ever published by the Free Software\par
|
||||
Foundation.\par
|
||||
\par
|
||||
10. If you wish to incorporate parts of the Program into other free\par
|
||||
programs whose distribution conditions are different, write to the author\par
|
||||
to ask for permission. For software which is copyrighted by the Free\par
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes\par
|
||||
make exceptions for this. Our decision will be guided by the two goals\par
|
||||
of preserving the free status of all derivatives of our free software and\par
|
||||
of promoting the sharing and reuse of software generally.\par
|
||||
\par
|
||||
NO WARRANTY\par
|
||||
\par
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\par
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\par
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\par
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\par
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\par
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\par
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\par
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\par
|
||||
REPAIR OR CORRECTION.\par
|
||||
\par
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\par
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\par
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\par
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\par
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\par
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\par
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\par
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\par
|
||||
POSSIBILITY OF SUCH DAMAGES.\par
|
||||
\par
|
||||
END OF TERMS AND CONDITIONS\par
|
||||
\par
|
||||
How to Apply These Terms to Your New Programs\par
|
||||
\par
|
||||
If you develop a new program, and you want it to be of the greatest\par
|
||||
possible use to the public, the best way to achieve this is to make it\par
|
||||
free software which everyone can redistribute and change under these terms.\par
|
||||
\par
|
||||
To do so, attach the following notices to the program. It is safest\par
|
||||
to attach them to the start of each source file to most effectively\par
|
||||
convey the exclusion of warranty; and each file should have at least\par
|
||||
the "copyright" line and a pointer to where the full notice is found.\par
|
||||
\par
|
||||
<one line to give the program's name and a brief idea of what it does.>\par
|
||||
Copyright (C) <year> <name of author>\par
|
||||
\par
|
||||
This program is free software; you can redistribute it and/or modify\par
|
||||
it under the terms of the GNU General Public License as published by\par
|
||||
the Free Software Foundation; either version 2 of the License, or\par
|
||||
(at your option) any later version.\par
|
||||
\par
|
||||
This program is distributed in the hope that it will be useful,\par
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of\par
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\par
|
||||
GNU General Public License for more details.\par
|
||||
\par
|
||||
You should have received a copy of the GNU General Public License along\par
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,\par
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\par
|
||||
\par
|
||||
Also add information on how to contact you by electronic and paper mail.\par
|
||||
\par
|
||||
If the program is interactive, make it output a short notice like this\par
|
||||
when it starts in an interactive mode:\par
|
||||
\par
|
||||
Gnomovision version 69, Copyright (C) year name of author\par
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\par
|
||||
This is free software, and you are welcome to redistribute it\par
|
||||
under certain conditions; type `show c' for details.\par
|
||||
\par
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate\par
|
||||
parts of the General Public License. Of course, the commands you use may\par
|
||||
be called something other than `show w' and `show c'; they could even be\par
|
||||
mouse-clicks or menu items--whatever suits your program.\par
|
||||
\par
|
||||
You should also get your employer (if you work as a programmer) or your\par
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if\par
|
||||
necessary. Here is a sample; alter the names:\par
|
||||
\par
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program\par
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.\par
|
||||
\par
|
||||
<signature of Ty Coon>, 1 April 1989\par
|
||||
Ty Coon, President of Vice\par
|
||||
\par
|
||||
This General Public License does not permit incorporating your program into\par
|
||||
proprietary programs. If your program is a subroutine library, you may\par
|
||||
consider it more useful to permit linking proprietary applications with the\par
|
||||
library. If this is what you want to do, use the GNU Lesser General\par
|
||||
Public License instead of this License.\par
|
||||
\par
|
||||
}
|
||||
|