Compare commits

...

23 Commits
1.0.3 ... 1.0.5

Author SHA1 Message Date
elasota
ec275fcefd Bump version to 1.0.5 2020-07-04 00:35:18 -04:00
elasota
550465088e Remove architecture string code that doesn't work 2020-07-04 00:34:46 -04:00
elasota
68444a7240 Add transitions 2020-07-04 00:26:28 -04:00
elasota
7db0f8d7eb Fix loading empty house in the editor not working correctly 2020-07-03 19:40:26 -04:00
elasota
1fc846f7d8 Fix menu shortcuts activating disabled menu items 2020-07-03 19:31:30 -04:00
elasota
d978267c3e Remove selection scroll timer (which doesn't work anyway) 2020-07-03 18:06:30 -04:00
elasota
e05f37a28d Fix oval frames not drawing in 32-bit color mode 2020-07-03 17:32:26 -04:00
elasota
7069f4bf82 Add package release script 2020-07-03 14:04:54 -04:00
elasota
b197a9fb4b Fix copyright 2020-07-03 13:53:19 -04:00
elasota
62427de092 Add ICC profile option 2020-07-03 13:53:10 -04:00
elasota
037994d0f7 Add additional credits 2020-07-03 13:48:48 -04:00
elasota
7cdfc40ad9 Clarified ambiguous language 2020-07-03 13:48:33 -04:00
elasota
c53275d3fb Bump version to 1.0.4 2020-07-03 05:08:52 -04:00
elasota
8d58d22731 Add build version 2020-07-03 05:05:12 -04:00
elasota
58ad634085 Re-add clipboard functions 2020-07-03 04:59:40 -04:00
elasota
00ea1b2982 Fix invert image draw not working correctly if the image is partially out of bounds (happens when moving a tiki torch in the editor) 2020-07-03 04:18:08 -04:00
elasota
87bab26d47 Add home/end key support to edit box 2020-07-03 04:08:09 -04:00
elasota
3dbb231c5a Add edit box automatic scrolling 2020-07-03 04:00:25 -04:00
elasota
a2e8d414e8 Fix typing sound not working with forward delete 2020-07-03 03:16:42 -04:00
elasota
137f00b657 Fixed selection drawing out of bounds in multi-line editbox 2020-07-03 03:05:25 -04:00
elasota
7fec622e51 Add forward delete to editbox 2020-07-03 03:02:43 -04:00
elasota
05604e5604 Add API for saving driver prefs. Save fullscreen state in D3D11 driver. 2020-07-03 02:46:43 -04:00
elasota
ed9e0fec97 Update readme 2020-07-03 02:45:41 -04:00
59 changed files with 2093 additions and 239 deletions

View File

@@ -170,6 +170,7 @@
<ClInclude Include="..\GpCommon\EGpInputDriverType.h" />
<ClInclude Include="..\GpCommon\EGpStandardCursor.h" />
<ClInclude Include="..\GpCommon\GpApplicationName.h" />
<ClInclude Include="..\GpCommon\GpBuildVersion.h" />
<ClInclude Include="..\GpCommon\GpDisplayDriverTickStatus.h" />
<ClInclude Include="..\GpCommon\GpFileCreationDisposition.h" />
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h" />
@@ -177,6 +178,7 @@
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h" />
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h" />
<ClInclude Include="..\GpCommon\IGpLogDriver.h" />
<ClInclude Include="..\GpCommon\IGpPrefsHandler.h" />
<ClInclude Include="GpAppEnvironment.h" />
<ClInclude Include="GpAudioDriverFactory.h" />
<ClInclude Include="GpDisplayDriverFactory.h" />

View File

@@ -150,6 +150,12 @@
<ClInclude Include="GpLogDriver_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\IGpPrefsHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\GpBuildVersion.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="ConvertedResources\Large128.ico">

View File

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

View File

@@ -65,18 +65,10 @@
"id" : 0,
"enabled" : false
},
{
"name" : "Beautiful opening color fade",
"itemType" : "CheckBox",
"pos" : [ 8, 142 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "32-bit color (Requires restart)",
"itemType" : "CheckBox",
"pos" : [ 8, 162 ],
"pos" : [ 8, 85 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
@@ -84,7 +76,23 @@
{
"name" : "Adjust resolution to fit window",
"itemType" : "CheckBox",
"pos" : [ 8, 182 ],
"pos" : [ 8, 105 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Simulate Apple RGB monitor",
"itemType" : "CheckBox",
"pos" : [ 8, 125 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Beautiful opening color fade",
"itemType" : "CheckBox",
"pos" : [ 8, 152 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
@@ -92,7 +100,7 @@
{
"name" : "",
"itemType" : "UserItem",
"pos" : [ 8, 137 ],
"pos" : [ 8, 147 ],
"size" : [ 317, 1 ],
"id" : 0,
"enabled" : false

View File

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

View File

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

View File

@@ -31,7 +31,7 @@
#define kDisplay12Inch 2
#define kDisplay13Inch 3
extern Boolean isAutoScale;
extern Boolean isAutoScale, isUseICCProfile;
typedef struct
@@ -412,6 +412,8 @@ void HandleDepthSwitching (void)
}
thisMac.isDepth = isDepthPref;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetUseICCProfile(isUseICCProfile != 0);
}
//-------------------------------------------------------------- CheckMemorySize

View File

@@ -96,7 +96,6 @@ typedef struct
long wasGPFlipMap;
long wasGPFaceLeftMap, wasGPFaceRightMap;
short wasVolume;
short prefVersion;
short wasMaxFiles;
short wasEditH, wasEditV;
short wasMapH, wasMapV;
@@ -119,6 +118,7 @@ typedef struct
Boolean wasDoAutoDemo, wasAutoScale;
Boolean wasDoBackground, wasHouseChecks;
Boolean wasPrettyMap, wasBitchDialogs;
Boolean wasUseICCProfile;
} prefsInfo;
//-------------------------------------------------------------- Prototypes
@@ -175,8 +175,10 @@ Boolean CheckFileError (short, const PLPasStr &); // --- File Error.c
THandle<void> LoadHouseResource(const PortabilityLayer::ResTypeID &resTypeID, int16_t resID); // --- HouseIO.c
Boolean SavePrefs (prefsInfo *, short); // --- Prefs.c
Boolean LoadPrefs (prefsInfo *, short);
Boolean SavePrefs (prefsInfo *, THandle<void> *modulePrefs, short); // --- Prefs.c
Boolean LoadPrefs (prefsInfo *, THandle<void> *modulePrefs, short);
Boolean SaveModulePrefs (THandle<void> currentModulePrefs, THandle<void> *outModulePrefs);
Boolean ApplyModulePrefs (THandle<void> *modulePrefs);
void PasStringCopy (StringPtr, StringPtr); // --- StringUtils.c
short WhichStringFirst (StringPtr, StringPtr);
@@ -230,6 +232,8 @@ void CloseThisWindow (WindowPtr *);
#endif
extern Boolean hasScrap, scrapIsARoom;
#include "GliderDefines.h"
#include "GliderStructs.h"
#include "GliderVars.h"

View File

@@ -435,8 +435,8 @@ void QuickBandsRefresh (Boolean);
void QuickFoilRefresh (Boolean);
void HandleScore (void);
//void PutRoomScrap (void); // --- Scrap.c
//void PutObjectScrap (void);
void PutRoomScrap (void); // --- Scrap.c
void PutObjectScrap (void);
void GetRoomScrap (void);
void GetObjectScrap (void);
//void SeeIfValidScrapAvailable (Boolean);

View File

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

View File

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

View File

@@ -7,6 +7,7 @@
#include "HostDisplayDriver.h"
#include "HostLogDriver.h"
#include "HostSystemServices.h"
#include "HostInputDriver.h"
#include "HostVOSEventQueue.h"
#include "MenuManager.h"
#include "WindowManager.h"
@@ -21,6 +22,7 @@ public:
void PL_Render(IGpDisplayDriver *displayDriver) override;
void PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance) override;
void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) override;
void PL_HostInputDriver_SetInstances(IGpInputDriver *const* instances, size_t numInstances) override;
void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) override;
void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) override;
void PL_HostLogDriver_SetInstance(IGpLogDriver *instance) override;
@@ -72,6 +74,11 @@ void GpAppInterfaceImpl::PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance
PortabilityLayer::HostAudioDriver::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostInputDriver_SetInstances(IGpInputDriver *const* instances, size_t numInstances)
{
PortabilityLayer::HostInputDriver::SetInstances(instances, numInstances);
}
void GpAppInterfaceImpl::PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance)
{
PortabilityLayer::HostFontHandler::SetInstance(instance);

View File

@@ -432,6 +432,32 @@ void UpdateNameDialog (Dialog *theDialog)
SetDialogNumToStr(theDialog, kNameNCharsItem, (long)nChars);
}
//-------------------------------------------------------------- EventIsTyping
// Checks if a keyboard event should make a typing sound
static bool EventIsTyping(const GpKeyboardInputEvent &kbEvent)
{
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
{
// Duplicate backspace event
if (kbEvent.m_keyIDSubset == GpKeyIDSubsets::kASCII && kbEvent.m_key.m_asciiChar == '\b')
return false;
return true;
}
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDown || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAuto)
{
if (kbEvent.m_keyIDSubset == GpKeyIDSubsets::kSpecial)
{
if (kbEvent.m_key.m_specialKey == GpKeySpecials::kBackspace || kbEvent.m_key.m_specialKey == GpKeySpecials::kDelete)
return true;
}
}
return false;
}
//-------------------------------------------------------------- NameFilter
// Dialog filter for the "Enter High Score Name" dialog.
@@ -453,7 +479,7 @@ int16_t NameFilter (Dialog *dial, const TimeTaggedVOSEvent *evt)
{
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
if (EventIsTyping(kbEvent))
{
PlayPrioritySound(kTypingSound, kTypingPriority);
keyStroke = true;
@@ -568,7 +594,7 @@ int16_t BannerFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
{
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
if (EventIsTyping(kbEvent))
{
PlayPrioritySound(kTypingSound, kTypingPriority);
keyStroke = true;

View File

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

View File

@@ -157,7 +157,7 @@ void VariableInit (void)
paused = false;
hasMirror = false;
demoGoing = false;
// scrapIsARoom = true;
scrapIsARoom = true;
splashDrawn = false;
#ifndef COMPILEDEMO

View File

@@ -15,7 +15,7 @@
#include "WindowManager.h"
#define kPrefsVersion 0x0036
#define kPrefsVersion 0x0038
void ReadInPrefs (void);
@@ -25,7 +25,7 @@ int main(int argc, const char **argv);
short isVolume, wasVolume;
short isDepthPref, dataResFile, numSMWarnings;
Boolean quitting, doZooms, quickerTransitions, isAutoScale;
Boolean quitting, doZooms, quickerTransitions, isAutoScale, isUseICCProfile;
extern Str31 highBanner;
@@ -45,6 +45,8 @@ extern Boolean isMapOpen, isToolsOpen, isCoordOpen;
extern Boolean doPrettyMap, doBitchDialogs;
//extern Boolean didValidation;
THandle<void> globalModulePrefs;
//============================================================== Functions
//-------------------------------------------------------------- ReadInPrefs
@@ -55,8 +57,10 @@ extern Boolean doPrettyMap, doBitchDialogs;
void ReadInPrefs (void)
{
prefsInfo thePrefs;
THandle<void> modulePrefs;
if (LoadPrefs(&thePrefs, kPrefsVersion))
if (LoadPrefs(&thePrefs, &modulePrefs, kPrefsVersion))
{
#ifdef COMPILEDEMO
PasStringCopy("\pDemo House", thisHouseName);
@@ -123,9 +127,17 @@ void ReadInPrefs (void)
doAutoDemo = thePrefs.wasDoAutoDemo;
isEscPauseKey = thePrefs.wasEscPauseKey;
isAutoScale = thePrefs.wasAutoScale;
isUseICCProfile = thePrefs.wasUseICCProfile;
doBackground = thePrefs.wasDoBackground;
doPrettyMap = thePrefs.wasPrettyMap;
doBitchDialogs = thePrefs.wasBitchDialogs;
if (modulePrefs)
ApplyModulePrefs(&modulePrefs);
globalModulePrefs.Dispose();
globalModulePrefs = modulePrefs;
modulePrefs = nullptr;
}
else
{
@@ -198,9 +210,12 @@ void ReadInPrefs (void)
doAutoDemo = true;
isEscPauseKey = false;
isAutoScale = true;
isUseICCProfile = true;
doBackground = false;
doPrettyMap = false;
doBitchDialogs = true;
modulePrefs.Dispose();
}
if ((numNeighbors > 1) && (thisMac.constrainedScreen.right <= 512))
@@ -290,12 +305,17 @@ void WriteOutPrefs (void)
thePrefs.wasDoAutoDemo = doAutoDemo;
thePrefs.wasEscPauseKey = isEscPauseKey;
thePrefs.wasAutoScale = isAutoScale;
thePrefs.wasUseICCProfile = isUseICCProfile;
thePrefs.wasDoBackground = doBackground;
thePrefs.wasPrettyMap = doPrettyMap;
thePrefs.wasBitchDialogs = doBitchDialogs;
if (!SavePrefs(&thePrefs, kPrefsVersion))
THandle<void> modulePrefs;
if (!SaveModulePrefs(globalModulePrefs, &modulePrefs) || !SavePrefs(&thePrefs, &modulePrefs, kPrefsVersion))
SysBeep(1);
modulePrefs.Dispose();
UnivSetSoundVolume(wasVolume, thisMac.hasSM3);
}
@@ -325,6 +345,9 @@ int gpAppMain()
SetUpAppleEvents();
LoadCursors();
ReadInPrefs();
SpinCursor(2); // Tick once to let the display driver flush any resolution changes from prefs
FlushResolutionChange();
#if defined COMPILEDEMO
copyGood = true;
@@ -339,7 +362,7 @@ int gpAppMain()
else if (didValidation)
WriteOutPrefs(); SpinCursor(3);
#endif
// if ((thisMac.numScreens > 1) && (isUseSecondScreen))
// ReflectSecondMonitorEnvirons(false, true, true);
HandleDepthSwitching();

View File

@@ -83,19 +83,6 @@ void DrawOnSplash(DrawSurface *surface)
else
ColorText(surface, textPoint, houseLoadedStr, 28L, appFont);
}
#if defined(powerc) || defined(__powerc)
TextSize(12);
TextFace(0);
TextFont(systemFont);
ForeColor(blackColor);
MoveTo(splashOriginH + 5, splashOriginV + 457);
DrawString("\pPowerPC Native!");
ForeColor(whiteColor);
MoveTo(splashOriginH + 4, splashOriginV + 456);
DrawString("\pPowerPC Native!");
ForeColor(blackColor);
#endif
}
//-------------------------------------------------------------- RedrawSplashScreen

View File

@@ -198,21 +198,21 @@ void UpdateClipboardMenus (void)
mm->SetItemEnabled(houseMenu, iCut - 1, true);
mm->SetItemEnabled(houseMenu, iCopy - 1, true);
// if (hasScrap)
// {
// EnableMenuItem(houseMenu, iPaste);
// if (scrapIsARoom)
// {
// GetLocalizedString(42, title);
// SetMenuItemText(houseMenu, iPaste, title);
// }
// else
// {
// GetLocalizedString(43, title);
// SetMenuItemText(houseMenu, iPaste, title);
// }
// }
// else
if (hasScrap)
{
EnableMenuItem(houseMenu, iPaste);
if (scrapIsARoom)
{
GetLocalizedString(42, title);
SetMenuItemText(houseMenu, iPaste, title);
}
else
{
GetLocalizedString(43, title);
SetMenuItemText(houseMenu, iPaste, title);
}
}
else
{
mm->SetItemEnabled(houseMenu, iPaste - 1, false);
GetLocalizedString(44, title);
@@ -516,12 +516,12 @@ void DoHouseMenu (short theItem)
{
if (objActive > kNoObjectSelected)
{
// PutObjectScrap();
PutObjectScrap();
DeleteObject();
}
else
{
// PutRoomScrap();
PutRoomScrap();
DeleteRoom(false);
}
UpdateClipboardMenus();
@@ -531,10 +531,10 @@ void DoHouseMenu (short theItem)
case iCopy:
if (houseUnlocked)
{
// if (objActive > kNoObjectSelected)
// PutObjectScrap();
// else
// PutRoomScrap();
if (objActive > kNoObjectSelected)
PutObjectScrap();
else
PutRoomScrap();
UpdateClipboardMenus();
}
break;
@@ -542,12 +542,11 @@ void DoHouseMenu (short theItem)
case iPaste:
if (houseUnlocked)
{
/* if (scrapIsARoom)
if (scrapIsARoom)
GetRoomScrap();
else
GetObjectScrap();
UpdateClipboardMenus();
*/
}
break;

View File

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

File diff suppressed because one or more lines are too long

547
GpApp/Scrap.cpp Normal file
View File

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

View File

@@ -27,6 +27,8 @@
#define kSoundPrefsDialID 1018
#define kControlPrefsDialID 1023
#define kBrainsPrefsDialID 1024
// Display dialog
#define kDisplayButton 3
#define kSoundButton 4
#define kControlsButton 5
@@ -35,18 +37,23 @@
#define kDisplay3Item 4
#define kDisplay9Item 5
#define kBorder1Item 8
#define kDoColorFadeItem 9
#define k32BitColorItem 10
#define kScaleResolutionItem 11
#define kBorder2Item 12
#define kBorder3Item 13
#define kDispDefault 14
#define k32BitColorItem 9
#define kScaleResolutionItem 10
#define kUseICCProfileItem 11
#define kDoColorFadeItem 12
#define kBorder2Item 13
#define kBorder3Item 14
#define kDispDefault 15
// Sound dialog
#define kSofterItem 4
#define kLouderItem 5
#define kVolNumberItem 7
#define kIdleMusicItem 8
#define kPlayMusicItem 9
#define kSoundDefault 13
// Controls dialog
#define kRightControl 5
#define kLeftControl 6
#define kBattControl 7
@@ -54,6 +61,8 @@
#define kControlDefaults 13
#define kESCPausesRadio 14
#define kTABPausesRadio 15
// Brains dialog
#define kMaxFilesItem 5
#define kQuickTransitCheck 7
#define kDoZoomsCheck 8
@@ -97,11 +106,11 @@ Str15 tempLeftStr, tempRightStr, tempBattStr, tempBandStr;
long tempLeftMap, tempRightMap, tempBattMap, tempBandMap;
short whichCtrl, wasDepthPref;
Boolean wasFade, wasIdle, wasPlay, wasTransit, wasZooms, wasBackground;
Boolean wasEscPauseKey, wasDemos, wasAutoScale, nextRestartChange, wasErrorCheck, needResolutionReset;
Boolean wasEscPauseKey, wasDemos, wasAutoScale, wasUseICCProfile, nextRestartChange, wasErrorCheck, needResolutionReset;
Boolean wasPrettyMap, wasBitchDialogs;
extern short numNeighbors, isDepthPref, maxFiles, willMaxFiles;
extern Boolean isDoColorFade, isPlayMusicIdle, isAutoScale;
extern Boolean isDoColorFade, isPlayMusicIdle, isAutoScale, isUseICCProfile;
extern Boolean isHouseChecks, doBitchDialogs;
extern Boolean isEscPauseKey, failedMusic, isSoundOn, doBackground;
extern Boolean isMusicOn, quickerTransitions, doAutoDemo;
@@ -861,6 +870,7 @@ void DisplayDefaults (void)
wasDepthPref = kSwitchIfNeeded;
wasFade = true;
wasAutoScale = true;
wasUseICCProfile = true;
}
//-------------------------------------------------------------- FrameDisplayIcon
@@ -906,6 +916,7 @@ void DisplayUpdate (Dialog *theDialog)
SetDialogItemValue(theDialog, kDoColorFadeItem, (short)wasFade);
SetDialogItemValue(theDialog, k32BitColorItem, wasDepthPref == 32);
SetDialogItemValue(theDialog, kScaleResolutionItem, (short)isAutoScale);
SetDialogItemValue(theDialog, kUseICCProfileItem, (short)isUseICCProfile);
FrameDisplayIcon(theDialog, StdColors::Red());
FrameDialogItemC(theDialog, kBorder1Item, kRedOrangeColor8);
@@ -1005,6 +1016,7 @@ void DoDisplayPrefs (void)
wasFade = isDoColorFade;
wasDepthPref = isDepthPref;
wasAutoScale = isAutoScale;
wasUseICCProfile = isUseICCProfile;
leaving = false;
DisplayUpdate(prefDlg);
@@ -1022,6 +1034,7 @@ void DoDisplayPrefs (void)
needResolutionReset = true;
isDepthPref = wasDepthPref;
isAutoScale = wasAutoScale;
isUseICCProfile = wasUseICCProfile;
leaving = true;
break;
@@ -1072,6 +1085,11 @@ void DoDisplayPrefs (void)
SetDialogItemValue(prefDlg, kScaleResolutionItem, (short)wasAutoScale);
break;
case kUseICCProfileItem:
wasUseICCProfile = !wasUseICCProfile;
SetDialogItemValue(prefDlg, kUseICCProfileItem, (short)wasUseICCProfile);
break;
case kDispDefault:
FrameDisplayIcon(prefDlg, StdColors::White());
DisplayDefaults();
@@ -1321,6 +1339,8 @@ void DoSettingsMain (void)
PortabilityLayer::HostDisplayDriver::GetInstance()->RequestResetVirtualResolution();
needResolutionReset = false;
}
PortabilityLayer::HostDisplayDriver::GetInstance()->SetUseICCProfile(isUseICCProfile);
}
//-------------------------------------------------------------- BitchAboutChanges

View File

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

View File

@@ -10,6 +10,11 @@ void GpAudioDriverXAudio2::Shutdown()
delete this;
}
IGpPrefsHandler *GpAudioDriverXAudio2::GetPrefsHandler() const
{
return nullptr;
}
const GpAudioDriverProperties &GpAudioDriverXAudio2::GetProperties() const
{
return m_properties;

View File

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

View File

@@ -2,8 +2,8 @@
#define GP_BUILD_VERSION_MAJOR 1
#define GP_BUILD_VERSION_MINOR 0
#define GP_BUILD_VERSION_UPDATE 3
#define GP_BUILD_VERSION_UPDATE 5
#define GP_APPLICATION_VERSION_STRING "1.0.3"
#define GP_APPLICATION_COPYRIGHT_STRING "2020 Eric Lasota"
#define GP_APPLICATION_VERSION_STRING "1.0.5"
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2020 Eric Lasota"
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"

View File

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

View File

@@ -5,6 +5,7 @@
struct IGpDisplayDriverSurface;
struct IGpCursor;
struct IGpPrefsHandler;
struct GpDisplayDriverProperties;
struct GpDisplayDriverSurfaceEffects
@@ -41,10 +42,13 @@ public:
virtual void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) = 0;
virtual void SetBackgroundDarkenEffect(bool isDark) = 0;
virtual void SetUseICCProfile(bool useICCProfile) = 0;
virtual void RequestToggleFullScreen(uint32_t timestamp) = 0;
virtual void RequestResetVirtualResolution() = 0;
virtual const GpDisplayDriverProperties &GetProperties() const = 0;
virtual IGpPrefsHandler *GetPrefsHandler() const = 0;
};
inline GpDisplayDriverSurfaceEffects::GpDisplayDriverSurfaceEffects()

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 22, 132, 178, 62, 124, 31, 180, 122, 2, 1, 47,
236, 0, 128, 56, 7, 1, 0, 0, 0, 240, 7, 0, 0, 5, 0,
68, 88, 66, 67, 167, 218, 15, 90, 211, 69, 240, 219, 76, 79, 17,
242, 61, 175, 125, 206, 1, 0, 0, 0, 44, 8, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 172, 2, 0, 0, 4, 3, 0, 0, 56,
3, 0, 0, 116, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
3, 0, 0, 176, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 72, 2, 0, 0, 124, 0,
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
@@ -54,7 +54,7 @@ static unsigned char gs_shaderData[] = {
1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
72, 68, 82, 52, 4, 0, 0, 64, 0, 0, 0, 13, 1, 0, 0,
72, 68, 82, 112, 4, 0, 0, 64, 0, 0, 0, 28, 1, 0, 0,
89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0,
0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68,
0, 0, 88, 16, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85,
@@ -107,32 +107,36 @@ static unsigned char gs_shaderData[] = {
0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0,
0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1,
0, 0, 0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0,
1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 32, 0,
1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 0, 0,
9, 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0,
0, 0, 150, 7, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 47, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16,
0, 0, 0, 29, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0,
2, 64, 0, 0, 230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37,
61, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0,
0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 2, 64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61,
145, 131, 158, 61, 0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16,
0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64,
0, 0, 102, 102, 230, 63, 102, 102, 230, 63, 102, 102, 230, 63, 0,
0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16,
0, 1, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 2, 64,
0, 0, 150, 246, 160, 189, 43, 199, 117, 63, 40, 177, 243, 60, 0,
0, 0, 0, 50, 0, 0, 12, 114, 0, 16, 0, 1, 0, 0, 0,
6, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 87, 203, 136,
63, 86, 131, 197, 60, 225, 104, 227, 58, 0, 0, 0, 0, 70, 2,
16, 0, 1, 0, 0, 0, 50, 0, 0, 12, 114, 32, 16, 0, 0,
0, 0, 0, 166, 10, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
5, 9, 34, 60, 158, 151, 129, 60, 194, 240, 119, 63, 0, 0, 0,
0, 70, 2, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32,
0, 0, 174, 71, 97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0,
0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114,
63, 110, 167, 114, 63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0,
0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25,
64, 154, 153, 25, 64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0,
0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 55, 0, 0, 9, 114, 32, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32,
16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62,
0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 32, 0, 0, 0,
3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0,
0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 34, 0, 0, 0,
3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 16, 0, 0,
0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};

View File

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

View File

@@ -1,8 +1,8 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 79, 173, 176, 182, 205, 217, 61, 84, 80, 209, 33,
250, 135, 89, 76, 198, 1, 0, 0, 0, 116, 7, 0, 0, 5, 0,
68, 88, 66, 67, 55, 11, 130, 121, 223, 86, 90, 24, 177, 20, 124,
204, 5, 205, 68, 19, 1, 0, 0, 0, 176, 7, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 124, 2, 0, 0, 212, 2, 0, 0, 8,
3, 0, 0, 248, 6, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
3, 0, 0, 52, 7, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 24, 2, 0, 0, 92, 0,
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
@@ -51,7 +51,7 @@ static unsigned char gs_shaderData[] = {
0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83,
86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82,
232, 3, 0, 0, 64, 0, 0, 0, 250, 0, 0, 0, 89, 0, 0,
36, 4, 0, 0, 64, 0, 0, 0, 9, 1, 0, 0, 89, 0, 0,
4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 88, 24,
0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98,
16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3,
@@ -99,31 +99,35 @@ static unsigned char gs_shaderData[] = {
0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 2, 0,
0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0, 0, 6,
9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0, 0, 0,
86, 5, 16, 0, 1, 0, 0, 0, 55, 32, 0, 9, 114, 0, 16,
86, 5, 16, 0, 1, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16,
0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7,
16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 47,
0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 102, 102,
230, 63, 102, 102, 230, 63, 102, 102, 230, 63, 0, 0, 0, 0, 25,
0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0,
0, 86, 5, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 150, 246,
160, 189, 43, 199, 117, 63, 40, 177, 243, 60, 0, 0, 0, 0, 50,
0, 0, 12, 114, 0, 16, 0, 1, 0, 0, 0, 6, 0, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 87, 203, 136, 63, 86, 131, 197,
60, 225, 104, 227, 58, 0, 0, 0, 0, 70, 2, 16, 0, 1, 0,
0, 0, 50, 0, 0, 12, 114, 32, 16, 0, 0, 0, 0, 0, 166,
10, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 5, 9, 34, 60,
158, 151, 129, 60, 194, 240, 119, 63, 0, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 29,
0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0,
230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37, 61, 0, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0,
16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2,
64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61, 145, 131, 158, 61,
0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0,
0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 174, 71,
97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0, 0, 0, 0, 56,
0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114, 63, 110, 167, 114,
63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0, 0, 5, 114, 0,
16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56,
0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25, 64, 154, 153, 25,
64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114, 0,
16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 55,
0, 0, 9, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2, 16,
0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
84, 65, 84, 116, 0, 0, 0, 30, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 4, 0, 0,
84, 65, 84, 116, 0, 0, 0, 32, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,

View File

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

View File

@@ -21,13 +21,27 @@
static GpDisplayDriverSurfaceEffects gs_defaultEffects;
static const char *kPrefsIdentifier = "GpDisplayDriverD3D11";
static uint32_t kPrefsVersion = 1;
struct GpDisplayDriverD3D11_Prefs
{
bool m_isFullScreen;
};
namespace GpBinarizedShaders
{
extern const unsigned char *g_drawQuadV_D3D11[2];
extern const unsigned char *g_drawQuadPaletteP_D3D11[2];
extern const unsigned char *g_drawQuadRGBP_D3D11[2];
extern const unsigned char *g_scaleQuadP_D3D11[2];
extern const unsigned char *g_drawQuad15BitP_D3D11[2];
extern const unsigned char *g_drawQuadPaletteICCP_D3D11[2];
extern const unsigned char *g_drawQuadRGBICCP_D3D11[2];
extern const unsigned char *g_drawQuad15BitICCP_D3D11[2];
extern const unsigned char *g_scaleQuadP_D3D11[2];
}
struct GpShaderCodeBlob
@@ -461,12 +475,18 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
const GpShaderCodeBlob drawQuadPalettePBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadPaletteP_D3D11);
const GpShaderCodeBlob drawQuadRGBPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadRGBP_D3D11);
const GpShaderCodeBlob drawQuad15BitPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuad15BitP_D3D11);
const GpShaderCodeBlob drawQuadPaletteICCPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadPaletteICCP_D3D11);
const GpShaderCodeBlob drawQuadRGBICCPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadRGBICCP_D3D11);
const GpShaderCodeBlob drawQuad15BitICCPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuad15BitICCP_D3D11);
const GpShaderCodeBlob scaleQuadPBlob = GetBinarizedShader(GpBinarizedShaders::g_scaleQuadP_D3D11);
m_device->CreateVertexShader(drawQuadVBlob.m_data, drawQuadVBlob.m_size, nullptr, m_drawQuadVertexShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadPalettePBlob.m_data, drawQuadPalettePBlob.m_size, nullptr, m_drawQuadPalettePixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadRGBPBlob.m_data, drawQuadRGBPBlob.m_size, nullptr, m_drawQuadRGBPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuad15BitPBlob.m_data, drawQuad15BitPBlob.m_size, nullptr, m_drawQuad15BitPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadPaletteICCPBlob.m_data, drawQuadPaletteICCPBlob.m_size, nullptr, m_drawQuadPaletteICCPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadRGBICCPBlob.m_data, drawQuadRGBICCPBlob.m_size, nullptr, m_drawQuadRGBICCPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuad15BitICCPBlob.m_data, drawQuad15BitICCPBlob.m_size, nullptr, m_drawQuad15BitICCPixelShader.GetMutablePtr());
m_device->CreatePixelShader(scaleQuadPBlob.m_data, scaleQuadPBlob.m_size, nullptr, m_scaleQuadPixelShader.GetMutablePtr());
// Quad input layout
@@ -1322,7 +1342,7 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
m_paletteTextureSRV
};
m_deviceContext->PSSetShader(m_drawQuadPalettePixelShader, nullptr, 0);
m_deviceContext->PSSetShader(m_useICCProfile ? m_drawQuadPaletteICCPixelShader : m_drawQuadPalettePixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else if (pixelFormat == GpPixelFormats::kRGB555)
@@ -1332,7 +1352,7 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
d3d11Surface->GetSRV(),
};
m_deviceContext->PSSetShader(m_drawQuad15BitPixelShader, nullptr, 0);
m_deviceContext->PSSetShader(m_useICCProfile ? m_drawQuad15BitICCPixelShader : m_drawQuad15BitPixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else if (pixelFormat == GpPixelFormats::kRGB32)
@@ -1342,7 +1362,7 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
d3d11Surface->GetSRV(),
};
m_deviceContext->PSSetShader(m_drawQuadRGBPixelShader, nullptr, 0);
m_deviceContext->PSSetShader(m_useICCProfile ? m_drawQuadRGBICCPixelShader : m_drawQuadRGBPixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else
@@ -1429,6 +1449,12 @@ void GpDisplayDriverD3D11::SetBackgroundDarkenEffect(bool isDark)
m_bgIsDark = isDark;
}
void GpDisplayDriverD3D11::SetUseICCProfile(bool useICCProfile)
{
m_useICCProfile = useICCProfile;
}
void GpDisplayDriverD3D11::RequestToggleFullScreen(uint32_t timestamp)
{
// Alt-Enter gets re-sent after a full-screen toggle, so we ignore toggle requests until half a second has elapsed
@@ -1449,6 +1475,29 @@ const GpDisplayDriverProperties &GpDisplayDriverD3D11::GetProperties() const
return m_properties;
}
IGpPrefsHandler *GpDisplayDriverD3D11::GetPrefsHandler() const
{
const IGpPrefsHandler *cPrefsHandler = this;
return const_cast<IGpPrefsHandler*>(cPrefsHandler);
}
void GpDisplayDriverD3D11::ApplyPrefs(const void *identifier, size_t identifierSize, const void *contents, size_t contentsSize, uint32_t version)
{
if (version == kPrefsVersion && identifierSize == strlen(kPrefsIdentifier) && !memcmp(identifier, kPrefsIdentifier, identifierSize))
{
const GpDisplayDriverD3D11_Prefs *prefs = static_cast<const GpDisplayDriverD3D11_Prefs *>(contents);
m_isFullScreenDesired = prefs->m_isFullScreen;
}
}
bool GpDisplayDriverD3D11::SavePrefs(void *context, IGpPrefsHandler::WritePrefsFunc_t writeFunc)
{
GpDisplayDriverD3D11_Prefs prefs;
prefs.m_isFullScreen = m_isFullScreenDesired;
return writeFunc(context, kPrefsIdentifier, strlen(kPrefsIdentifier), &prefs, sizeof(prefs), kPrefsVersion);
}
GpDisplayDriverD3D11 *GpDisplayDriverD3D11::Create(const GpDisplayDriverProperties &properties)
{
void *storage = malloc(sizeof(GpDisplayDriverD3D11));
@@ -1479,6 +1528,7 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
, m_isResolutionResetDesired(false)
, m_lastFullScreenToggleTimeStamp(0)
, m_bgIsDark(false)
, m_useICCProfile(false)
{
memset(&m_syncTimeBase, 0, sizeof(m_syncTimeBase));
memset(&m_windowModeRevertRect, 0, sizeof(m_windowModeRevertRect));

View File

@@ -4,12 +4,15 @@
#include "GpRingBuffer.h"
#include "IGpDisplayDriver.h"
#include "IGpPrefsHandler.h"
#include "GpCoreDefs.h"
#include "GpDisplayDriverProperties.h"
#include "GpComPtr.h"
#include "GpPixelFormat.h"
#include "IGpPrefsHandler.h"
struct GpWindowsGlobals;
struct IGpCursor_Win32;
struct IGpCursor;
@@ -30,7 +33,7 @@ struct ID3D11Texture2D;
struct ID3D11VertexShader;
class GpDisplayDriverD3D11 : public IGpDisplayDriver
class GpDisplayDriverD3D11 : public IGpDisplayDriver, public IGpPrefsHandler
{
public:
void Run() override;
@@ -50,10 +53,16 @@ public:
void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) override;
void SetBackgroundDarkenEffect(bool isDark) override;
void SetUseICCProfile(bool useICCProfile) override;
void RequestToggleFullScreen(uint32_t timestamp) override;
void RequestResetVirtualResolution() override;
const GpDisplayDriverProperties &GetProperties() const override;
IGpPrefsHandler *GetPrefsHandler() const override;
void ApplyPrefs(const void *identifier, size_t identifierSize, const void *contents, size_t contentsSize, uint32_t version) override;
bool SavePrefs(void *context, IGpPrefsHandler::WritePrefsFunc_t writeFunc) override;
static GpDisplayDriverD3D11 *Create(const GpDisplayDriverProperties &properties);
@@ -122,6 +131,9 @@ private:
GpComPtr<ID3D11PixelShader> m_drawQuadPalettePixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuad15BitPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuadRGBPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuadPaletteICCPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuad15BitICCPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuadRGBICCPixelShader;
GpComPtr<ID3D11PixelShader> m_scaleQuadPixelShader;
GpComPtr<ID3D11Buffer> m_drawQuadVertexConstantBuffer;
GpComPtr<ID3D11Buffer> m_drawQuadPixelConstantBuffer;
@@ -177,4 +189,6 @@ private:
float m_bgColor[4];
bool m_bgIsDark;
bool m_useICCProfile;
};

View File

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

View File

@@ -42,6 +42,15 @@
<ClCompile Include="CompiledShaders\ScaleQuadP_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
<ClCompile Include="CompiledShaders\DrawQuad15BitP_ICC_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
<ClCompile Include="CompiledShaders\DrawQuadPaletteP_ICC_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
<ClCompile Include="CompiledShaders\DrawQuadRGBP_ICC_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GpDisplayDriverD3D11.h">

View File

@@ -76,6 +76,11 @@ void GpInputDriverXInput::Shutdown()
free(this);
}
IGpPrefsHandler *GpInputDriverXInput::GetPrefsHandler() const
{
return nullptr;
}
GpInputDriverXInput *GpInputDriverXInput::Create(const GpInputDriverProperties &props)
{
void *storage = malloc(sizeof(GpInputDriverXInput));

View File

@@ -13,6 +13,8 @@ public:
void ProcessInput() override;
void Shutdown() override;
IGpPrefsHandler *GetPrefsHandler() const override;
static GpInputDriverXInput *Create(const GpInputDriverProperties &props);
private:

View File

@@ -0,0 +1,6 @@
move ReleasePkg\en-us\Aerofoil-installpkg.msi ReleasePkg\Aerofoil-installpkg.msi
Tools\7z.exe a -bd -r -mx=9 ReleasePkg\Aerofoil.zip ReleasePkg\Aerofoil
Tools\7z.exe a -bd -r -mx=9 ReleasePkg\Aerofoil-PDBs.7z ReleasePkg\PDBs
rmdir /S /Q ReleasePkg\Aerofoil
rmdir /S /Q ReleasePkg\en-us
rmdir /S /Q ReleasePkg\PDBs

View File

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

View File

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

View File

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

View File

@@ -122,8 +122,18 @@ namespace PortabilityLayer
bool MemoryManagerImpl::ResizeHandle(MMHandleBlock *hdl, size_t newSize)
{
if (hdl->m_contents == nullptr)
return false;
if (hdl->m_contents == nullptr)
{
if (newSize != 0)
{
void *newBuf = Alloc(newSize);
if (!newBuf)
return false;
hdl->m_contents = newBuf;
hdl->m_size = newSize;
}
}
if (newSize != hdl->m_size)
{

View File

@@ -654,7 +654,7 @@ namespace PortabilityLayer
for (size_t i = 0; i < numItems; i++)
{
if (items[i].key == shortcutChar)
if (items[i].key == shortcutChar && items[i].enabled)
{
menuID = menu->menuID;
itemID = static_cast<uint16_t>(i);

View File

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

View File

@@ -13,6 +13,7 @@
#include "PLTimeTaggedVOSEvent.h"
#include "ResolveCachingColor.h"
#include "TextPlacer.h"
#include "Rect2i.h"
#include <algorithm>
@@ -33,6 +34,7 @@ namespace PortabilityLayer
, m_isMultiLine(false)
, m_isDraggingSelection(false)
, m_dragSelectionStartChar(false)
, m_scrollOffset(0, 0)
{
}
@@ -99,7 +101,7 @@ namespace PortabilityLayer
if (m_hasFocus && m_selEndChar == m_selStartChar && m_caratTimer < kCaratBlinkRate)
{
PortabilityLayer::Vec2i caratPos = ResolveCaratPos(basePoint, sysFont);
PortabilityLayer::Vec2i caratPos = ResolveCaratPos(sysFont) + basePoint;
int32_t caratTop = caratPos.m_y;
int32_t caratBottom = caratTop + lineGap;
@@ -240,12 +242,21 @@ namespace PortabilityLayer
HandleDownArrow(keyEvent.m_repeatCount, isShiftHeld);
return WidgetHandleStates::kDigested;
}
#if 0
else if (keyEvent.m_key.m_specialKey == GpKeySpecials::kDelete)
{
HandleForwardDelete(keyEvent.m_repeatCount);
return WidgetHandleStates::kDigested;
}
else if (keyEvent.m_key.m_specialKey == GpKeySpecials::kHome)
{
HandleHome(isShiftHeld);
return WidgetHandleStates::kDigested;
}
else if (keyEvent.m_key.m_specialKey == GpKeySpecials::kEnd)
{
HandleEnd(isShiftHeld);
return WidgetHandleStates::kDigested;
}
#endif
}
}
}
@@ -356,6 +367,8 @@ namespace PortabilityLayer
// Reset length;
m_length = numPreSelChars + numInsertions + numPostSelChars;
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
@@ -390,6 +403,46 @@ namespace PortabilityLayer
m_length = prefixKeep + suffixKeep;
m_selStartChar = m_selEndChar = prefixKeep;
AdjustScrollToCarat();
AdjustScrollToTextBounds();
m_caratTimer = 0;
Redraw();
m_caratScrollLocked = false;
}
void EditboxWidget::HandleForwardDelete(const uint32_t numRepeatsRequested)
{
const size_t numPostSelChars = m_length - m_selEndChar;
const size_t numSelChars = m_selEndChar - m_selStartChar;
const size_t numPreSelChars = m_selStartChar;
size_t suffixTrim = numRepeatsRequested;
if (numSelChars != 0)
suffixTrim--;
if (suffixTrim > numPostSelChars)
suffixTrim = numPostSelChars;
const size_t prefixKeep = numPreSelChars;
const size_t suffixKeep = numPostSelChars - suffixTrim;
if (suffixKeep > 0)
{
uint8_t *moveSrc = m_chars + m_length - suffixKeep;
uint8_t *moveDest = m_chars + m_selStartChar;
if (moveSrc != moveDest)
memmove(moveDest, moveSrc, suffixKeep);
}
m_length = prefixKeep + suffixKeep;
m_selStartChar = m_selEndChar = prefixKeep;
AdjustScrollToCarat();
AdjustScrollToTextBounds();
m_caratTimer = 0;
Redraw();
@@ -411,7 +464,7 @@ namespace PortabilityLayer
if (!m_caratScrollLocked)
{
m_caratScrollPosition = ResolveCaratPos(Vec2i(0, 0), rfont);
m_caratScrollPosition = ResolveCaratPos(rfont);
m_caratScrollLocked = true;
}
@@ -431,6 +484,8 @@ namespace PortabilityLayer
}
}
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
}
@@ -450,7 +505,7 @@ namespace PortabilityLayer
if (!m_caratScrollLocked)
{
m_caratScrollPosition = ResolveCaratPos(Vec2i(0, 0), rfont);
m_caratScrollPosition = ResolveCaratPos(rfont);
m_caratScrollLocked = true;
}
@@ -470,6 +525,8 @@ namespace PortabilityLayer
}
}
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
}
@@ -488,10 +545,67 @@ namespace PortabilityLayer
m_caratScrollLocked = false;
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
}
void EditboxWidget::HandleHome(bool shiftHeld)
{
const size_t originalCaratChar = ResolveCaratChar();
size_t caratChar = originalCaratChar;
while (caratChar > 0)
{
uint8_t prevChar = m_chars[caratChar - 1];
if (prevChar == '\r')
break;
else
caratChar--;
}
if (originalCaratChar != caratChar)
{
HandleKeyMoveCarat(caratChar, shiftHeld);
m_caratScrollLocked = false;
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
}
}
void EditboxWidget::HandleEnd(bool shiftHeld)
{
const size_t originalCaratChar = ResolveCaratChar();
size_t caratChar = originalCaratChar;
while (caratChar < m_length)
{
uint8_t nextChar = m_chars[caratChar];
if (nextChar == '\r')
break;
else
caratChar++;
}
if (originalCaratChar != caratChar)
{
HandleKeyMoveCarat(caratChar, shiftHeld);
m_caratScrollLocked = false;
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
}
}
void EditboxWidget::HandleRightArrow(const uint32_t numRepeatsRequested, bool shiftHeld)
{
size_t caratChar = ResolveCaratChar();
@@ -506,6 +620,8 @@ namespace PortabilityLayer
m_caratScrollLocked = false;
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
}
@@ -568,6 +684,7 @@ namespace PortabilityLayer
return m_length;
}
// Handles adjustment of the selection range and anchor when the carat is moved with shift held
void EditboxWidget::HandleKeyMoveCarat(size_t newPos, bool shiftHeld)
{
if (shiftHeld)
@@ -640,6 +757,8 @@ namespace PortabilityLayer
m_selStartChar = m_dragSelectionStartChar;
}
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();
@@ -659,34 +778,6 @@ namespace PortabilityLayer
{
PortabilityLayer::TextPlacer placer(basePoint, m_isMultiLine ? m_rect.Width() : -1, rfont, GetString());
#if 0
if (m_selStartChar == m_selEndChar)
{
PortabilityLayer::GlyphPlacementCharacteristics characteristics;
for (;;)
{
const bool placedGlyph = placer.PlaceGlyph(characteristics);
if (!placedGlyph)
break;
if (characteristics.m_characterIndex == m_selStartChar)
{
caratPos = characteristics.m_glyphStartPos;
break;
}
else if (characteristics.m_characterIndex < m_selStartChar)
caratPos = characteristics.m_glyphEndPos;
else
break;
}
outCaratPos = Point::Create(caratPos.m_x, caratPos.m_y);
return;
}
#endif
PortabilityLayer::Vec2i globalSelStart;
PortabilityLayer::Vec2i globalSelEnd;
bool endIsLineBreak = false;
@@ -747,7 +838,7 @@ namespace PortabilityLayer
const Rect midLinesRect = Rect::Create(globalSelStart.m_y + lineGap, m_rect.left, globalSelEnd.m_y, m_rect.right).Intersect(m_rect);
surface->FillRect(midLinesRect, focusColor);
Rect lastLineRect = Rect::Create(globalSelEnd.m_y, m_rect.left, globalSelEnd.m_y + lineGap, globalSelEnd.m_x);
Rect lastLineRect = Rect::Create(globalSelEnd.m_y, m_rect.left, globalSelEnd.m_y + lineGap, globalSelEnd.m_x).Intersect(m_rect);
if (endIsLineBreak || (m_isMultiLine == false && m_selEndChar == m_length))
lastLineRect.right = m_rect.right;
@@ -755,19 +846,20 @@ namespace PortabilityLayer
}
}
Vec2i EditboxWidget::ResolveCaratPos(const Vec2i &basePoint, PortabilityLayer::RenderedFont *rfont) const
// This function returns the actual coordinate of the carat relative to the top-left corner of the text
Vec2i EditboxWidget::ResolveCaratPos(PortabilityLayer::RenderedFont *rfont) const
{
int32_t lineGap = rfont->GetMetrics().m_linegap;
bool failed = false;
PortabilityLayer::Vec2i caratPos = basePoint;
PortabilityLayer::Vec2i caratPos = Vec2i(0, 0);
const size_t caratChar = ResolveCaratChar();
if (caratChar > 0)
{
PortabilityLayer::RenderedFont *rfont = GetRenderedFont();
PortabilityLayer::TextPlacer placer(basePoint, m_isMultiLine ? m_rect.Width() : -1, rfont, GetString());
PortabilityLayer::TextPlacer placer(Vec2i(0, 0), m_isMultiLine ? m_rect.Width() : -1, rfont, GetString());
PortabilityLayer::GlyphPlacementCharacteristics characteristics;
for (size_t i = 0; i < caratChar; i++)
@@ -782,7 +874,7 @@ namespace PortabilityLayer
if (!failed)
{
if (characteristics.m_character == '\r')
caratPos = PortabilityLayer::Vec2i(basePoint.m_x, characteristics.m_glyphStartPos.m_y + lineGap);
caratPos = PortabilityLayer::Vec2i(0, characteristics.m_glyphStartPos.m_y + lineGap);
else
caratPos = characteristics.m_glyphEndPos;
}
@@ -793,7 +885,7 @@ namespace PortabilityLayer
Vec2i EditboxWidget::ResolveBasePoint() const
{
return Vec2i(m_rect.left, m_rect.top);
return Vec2i(m_rect.left, m_rect.top) + m_scrollOffset;
}
size_t EditboxWidget::ResolveCaratChar() const
@@ -804,6 +896,71 @@ namespace PortabilityLayer
return m_selStartChar;
}
void EditboxWidget::AdjustScrollToCarat()
{
PortabilityLayer::RenderedFont *rfont = GetRenderedFont();
int32_t lineGap = rfont->GetMetrics().m_linegap;
Vec2i caratRelativePos = m_scrollOffset + ResolveCaratPos(rfont);
int32_t w = m_rect.Width();
int32_t h = m_rect.Height();
Rect2i caratRect = Rect2i(caratRelativePos, caratRelativePos + Vec2i(1, lineGap));
Vec2i nudge = Vec2i(0, 0);
if (caratRect.Right() > w)
nudge.m_x = w - caratRect.Right();
if (caratRect.Bottom() > h)
nudge.m_y = h - caratRect.Bottom();
if (caratRect.Left() < 0)
nudge.m_x = -caratRect.Left();
if (caratRect.Top() < 0)
nudge.m_y = -caratRect.Top();
m_scrollOffset += nudge;
}
void EditboxWidget::AdjustScrollToTextBounds()
{
if (!m_isMultiLine)
return;
PortabilityLayer::RenderedFont *rfont = GetRenderedFont();
int32_t lineGap = rfont->GetMetrics().m_linegap;
bool failed = false;
PortabilityLayer::Vec2i caratPos = Vec2i(0, 0);
PortabilityLayer::TextPlacer placer(Vec2i(0, 0), m_isMultiLine ? m_rect.Width() : -1, rfont, GetString());
PortabilityLayer::GlyphPlacementCharacteristics characteristics;
for (size_t i = 0; i < m_length; i++)
{
if (!placer.PlaceGlyph(characteristics))
{
failed = true;
break;
}
}
if (!failed)
{
int32_t lowerY = 0;
if (characteristics.m_character == '\r')
lowerY = characteristics.m_glyphStartPos.m_y + lineGap;
else
lowerY = characteristics.m_glyphEndPos.m_y;
lowerY = lowerY + lineGap + m_scrollOffset.m_y;
int32_t h = m_rect.Height();
if (lowerY < h)
m_scrollOffset.m_y -= lowerY - h;
}
}
FontFamily *EditboxWidget::GetFontFamily() const
{
return PortabilityLayer::FontManager::GetInstance()->GetSystemFont(12, FontFamilyFlag_None);

View File

@@ -35,6 +35,7 @@ namespace PortabilityLayer
private:
static const unsigned int kCaratBlinkRate = 20;
static const unsigned int kMouseScrollRate = 20;
enum CaratSelectionAnchor
{
@@ -54,6 +55,9 @@ namespace PortabilityLayer
void HandleLeftArrow(const uint32_t numRepeatsRequested, bool shiftHeld);
void HandleRightArrow(const uint32_t numRepeatsRequested, bool shiftHeld);
void HandleHome(bool shiftHeld);
void HandleEnd(bool shiftHeld);
size_t FindVerticalMovementCaratPos(const Vec2i &desiredPos, bool &isOutOfRange) const;
void HandleKeyMoveCarat(size_t newPos, bool shiftHeld);
@@ -61,9 +65,11 @@ namespace PortabilityLayer
void DrawSelection(DrawSurface *surface, const Vec2i &basePoint, PortabilityLayer::RenderedFont *font) const;
Vec2i ResolveCaratPos(const Vec2i &basePoint, PortabilityLayer::RenderedFont *rfont) const;
Vec2i ResolveCaratPos(PortabilityLayer::RenderedFont *rfont) const;
Vec2i ResolveBasePoint() const;
size_t ResolveCaratChar() const;
void AdjustScrollToCarat();
void AdjustScrollToTextBounds();
PortabilityLayer::FontFamily *GetFontFamily() const;
PortabilityLayer::RenderedFont *GetRenderedFont() const;
@@ -73,10 +79,12 @@ namespace PortabilityLayer
size_t m_length;
size_t m_selStartChar;
size_t m_selEndChar;
CaratSelectionAnchor m_caratSelectionAnchor;
CaratSelectionAnchor m_caratSelectionAnchor; // Where the carat is attached to the selection range
Vec2i m_caratScrollPosition;
bool m_caratScrollLocked;
Vec2i m_caratScrollPosition; // Ideal position of the carat in the editbox, but not necessarily its actual location (i.e. may be in the middle of a glyph)
bool m_caratScrollLocked; // If true, the vertical position
Vec2i m_scrollOffset;
bool m_hasFocus;
bool m_isMultiLine;

View File

@@ -4,6 +4,6 @@
void THandleBase::Dispose() const
{
if (m_hdl)
if (m_hdl)
PortabilityLayer::MemoryManager::GetInstance()->ReleaseHandle(m_hdl);
}

View File

@@ -82,5 +82,6 @@ void AppendMenuItem(MenuHandle menu, int8_t iconResID, uint8_t key, uint8_t subm
void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text)
{
PL_NotYetImplemented();
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
mm->SetItemText(menu, index - 1, text);
}

View File

@@ -1224,6 +1224,25 @@ void DrawSurface::FrameEllipse(const Rect &rect, PortabilityLayer::ResolveCachin
}
}
break;
case GpPixelFormats::kRGB32:
{
const uint32_t color32 = cacheColor.GetRGBAColor().AsUInt32();
for (;;)
{
const PortabilityLayer::Vec2i pt = plotter.GetPoint();
if (constraintRect32.Contains(pt))
{
const size_t pixelIndex = static_cast<size_t>(pt.m_y - portRect.top) * pitch + static_cast<size_t>(pt.m_x - portRect.left) * 4;
*reinterpret_cast<uint32_t*>(pixData + pixelIndex) = color32;
}
if (plotter.PlotNext() == PortabilityLayer::PlotDirection_Exhausted)
break;
}
}
break;
default:
PL_NotYetImplemented();
return;
@@ -1911,8 +1930,8 @@ void ImageInvert(const PixMap *invertMask, PixMap *targetBitmap, const Rect &src
const int32_t firstDestRow = destRect.top - targetBitmapRect.top + topInset;
const int32_t firstDestCol = destRect.left - targetBitmapRect.left + leftInset;
const uint16_t numRows = destRect.Height();
const uint16_t numCols = destRect.Width();
const uint16_t numRows = constrainedDestRect.Height();
const uint16_t numCols = constrainedDestRect.Width();
const size_t invertPitch = invertMask->m_pitch;
const uint8_t *invertPixelDataFirstRow = static_cast<const uint8_t*>(invertMask->m_data) + firstSrcRow * invertPitch;

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
Aerofoil is a port of Glider PRO by John Calhoun.
Aerofoil is a port of John Calhoun's Glider PRO
Currently, only Windows is supported, but the code has been significantly
rewritten to keep the OS-specific code to a minimum and isolated to a few
@@ -20,6 +20,11 @@ Core application binaries:
- GpInputDriver_XInput: XInput gamepad driver.
- ReleasePackageInstaller: WiX project that builds the Windows Installer package.
Building ReleasePackageInstaller will also automatically run all of the data
import and packaging scripts. Doing a clean Rebuild on ReleasePackageInstaller
should give you a complete game installation in the "ReleasePkg" directory.
Libraries:
- Common: Common core definitions used by all projects
- GpCommon: Common types usable by any project.

View File

@@ -29,7 +29,7 @@ SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
if (result.color.a <= 0.0)
discard;
result.color.rgb = AppleRGBToSRGBLinear(result.color.rgb);
result.color.rgb = ApplyColorSpaceTransform(result.color.rgb);
return result;
}

View File

@@ -27,7 +27,7 @@ SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
if (result.color.a <= 0.0)
discard;
result.color.rgb = AppleRGBToSRGBLinear(result.color.rgb);
result.color.rgb = ApplyColorSpaceTransform(result.color.rgb);
return result;
}

View File

@@ -68,3 +68,12 @@ float3 AppleRGBToSRGBLinear(float3 color)
return result;
}
float3 ApplyColorSpaceTransform(float3 color)
{
#ifdef USE_ICC_PROFILE
return saturate(AppleRGBToSRGBLinear(color));
#else
return SRGBToLinear(color);
#endif
}