Compare commits

...

65 Commits

Author SHA1 Message Date
elasota
032e44d981 Fix some missing dependencies of ReleasePackageInstaller necessary to import resources. 2020-11-30 23:32:50 -05:00
elasota
7961ca3af7 Fixed some more cases where the screen resolution could become desynced during startup. 2020-11-30 19:02:42 -05:00
elasota
6851025147 Preload entire font file if the font file isn't efficiently seekable, which should fix very slow startup times on Android. 2020-11-30 18:43:17 -05:00
elasota
f0b1d6fff9 Add memory buffer stream 2020-11-30 18:42:35 -05:00
elasota
70e0948847 Log initial resolution 2020-11-30 18:42:22 -05:00
elasota
a698286087 Adjust disclaimer 2020-11-30 10:27:01 -05:00
elasota
b75313fd7b Commit resolution changes 2020-11-30 03:50:57 -05:00
elasota
cab862ed8b Fix exit to shell not working 2020-11-30 03:18:09 -05:00
elasota
553e343abe Fix display resolution desynchronizing with auto-position 2020-11-30 02:59:02 -05:00
elasota
0aa36b27a9 Remove Bluetooth and vibrate permissions 2020-11-30 00:24:58 -05:00
elasota
f6185b1c78 Bump version to 1.0.11 2020-11-30 00:24:23 -05:00
elasota
ff29d5b92c Updated disclaimer 2020-11-30 00:11:21 -05:00
elasota
964c9b8858 Reduce load ring images to grayscale 2020-11-28 11:46:07 -05:00
elasota
8a48726b2e Compress cached fonts 2020-11-28 11:45:51 -05:00
elasota
de06669239 Fix read overrun 2020-11-28 11:45:29 -05:00
elasota
c0abd77dc4 Add source package to PackageReleaseArchives (for itch.io distro) 2020-11-25 18:42:08 -05:00
elasota
754b988f09 Fix initial launch disclaimer always displaying 2020-11-25 18:12:31 -05:00
elasota
1c57a51316 Fix wrong house name displaying after quitting demo 2020-11-25 18:12:00 -05:00
elasota
80abb498af Add first-time launch disclaimer 2020-11-25 18:09:09 -05:00
elasota
29cc376438 Remove trademark symbols since there does not appear to be, or have ever been, a registered trademark. 2020-11-25 15:57:11 -05:00
elasota
ef12c471a7 Fix missing directory entries for resource additions that have no existing directory (i.e. LICS) 2020-11-25 15:51:12 -05:00
elasota
8f4ecfafe1 Speed up load screen 2020-11-25 15:35:12 -05:00
elasota
3c3f9e3675 Add 2-stage startup for mobile init so there's less black screen 2020-11-25 15:09:31 -05:00
elasota
5c640b72eb Code cleanup, move a lot of "Host" APIs to GpCommon 2020-11-25 12:05:59 -05:00
elasota
9d0f2c35b3 Bump version to 1.0.10 2020-11-24 09:42:25 -05:00
elasota
7df624d9b1 Remove "Empty House" (which is locked) and "Sampler" from distribution. 2020-11-24 09:39:43 -05:00
elasota
29fbe83e8d Remove sounds with questionable license status 2020-11-24 09:35:25 -05:00
elasota
ad3a878a16 Added pause to Android source copy script to check if it fails 2020-11-24 09:34:27 -05:00
elasota
f0e7379db6 Increase Android build number 2020-11-13 21:04:34 -05:00
elasota
e34fec38a2 Update readme with new platforms 2020-11-13 16:32:20 -05:00
elasota
76db422456 Fix define collision 2020-11-13 00:57:59 -05:00
elasota
396d107608 Bump Gradle to 4.1.1 2020-11-13 00:55:07 -05:00
elasota
30b39c6991 Add AA table caching 2020-11-13 00:52:10 -05:00
elasota
9dafba1092 Add cancel option to save game prompt 2020-11-12 19:16:47 -05:00
elasota
801408077a Use SV_POSITION instead to compute pixel coordinates instead of fiddling with the polygon. This should fix the image being offset by 1 pixel. 2020-11-12 19:15:50 -05:00
elasota
2c073937c3 Fix houses not being read-only in itch.io release 2020-11-12 19:13:22 -05:00
elasota
bbd147e1ab Fix broken shader compiler 2020-11-12 19:12:53 -05:00
elasota
66a111dd23 Restrict file browser UI by file type 2020-11-12 02:35:07 -05:00
elasota
2febed5d2a Remove "Export Source Code..." menu item 2020-11-12 01:50:36 -05:00
elasota
b47813330a EOL fixes 2020-11-10 20:05:11 -05:00
elasota
0f630a74a2 Add file details 2020-11-10 20:04:29 -05:00
elasota
edc43e0bed Remove crtdbg.h 2020-11-10 20:04:08 -05:00
elasota
2aca0b6b28 Move high scores up to fix overlap on some mobile resolutions 2020-11-10 19:02:18 -05:00
elasota
f9a101486c Add delete to resume game UI 2020-11-09 01:57:49 -05:00
elasota
dbf3303145 Preload AA tables to speed up high scores screen on mobile. 2020-11-09 00:05:01 -05:00
elasota
a28a4cd73d Clean up warnings 2020-11-08 13:40:47 -05:00
elasota
4c6e646133 Clean up language so we can bundle source without getting dinged on age rating. 2020-11-06 17:51:58 -05:00
elasota
a13f90bd71 Fix upscale filter crash 2020-11-04 17:44:22 -05:00
elasota
3d0e457008 Increase version to 1.0.9b2 2020-11-04 17:05:38 -05:00
elasota
1bded36339 Reduce size of file browser UI even more when using OSK to fix obscuring on newer Android 2020-11-04 17:05:24 -05:00
elasota
14b0afbdd2 Increase Android build version to 1.0.9b1 2020-11-03 20:33:52 -05:00
elasota
6986dd5528 Remove WinCursors directory from installation 2020-11-03 20:06:02 -05:00
elasota
3a327a27e7 Add stop demo button 2020-11-03 19:59:26 -05:00
elasota
0d304e8a96 Disallow menu shortcuts when the menu is visible. Fixes unintended feature access when using OTG keyboards on Android. 2020-11-03 19:08:53 -05:00
elasota
43cfb7ea6b Write out scores and prefs immediately upon change instead of when app exits, since Android doesn't really exit normally. 2020-11-03 19:02:22 -05:00
elasota
3b5f222d98 Remove unused function 2020-11-03 18:53:30 -05:00
elasota
02bccda8a0 Re-enable text input when selecting a text box if OSK was dismissed 2020-11-03 18:37:31 -05:00
elasota
e727e462d8 Move save dialog to top of screen when using OSK. 2020-11-03 18:37:08 -05:00
elasota
47e23fbc71 Fix bad window reposition math when using touchscreen menu style 2020-11-02 22:45:44 -05:00
elasota
98c217d0bb Adjust progress bar color scheme, nicer wording 2020-11-02 22:36:39 -05:00
elasota
3b91d0492e Fix downward scroll when deleting a character in a multi-line edit box when all of the lines fit inside of the edit box 2020-11-02 22:22:31 -05:00
elasota
2b3a9f1669 Fix compile failure on Windows 2020-11-02 22:09:39 -05:00
elasota
0d5db76492 Add text input on mobile 2020-11-02 22:06:38 -05:00
elasota
2ab1416eef Improve upscale filter quality on mobile 2020-11-02 19:04:49 -05:00
elasota
c0f71ca1af EOL fix 2020-11-02 18:19:31 -05:00
175 changed files with 3292 additions and 2172 deletions

View File

@@ -46,6 +46,8 @@ EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "ReleasePackageInstaller", "ReleasePackageInstaller\ReleasePackageInstaller.wixproj", "{D26BD501-28A7-4849-8130-FB5EA0A2B82F}"
ProjectSection(ProjectDependencies) = postProject
{7EFF1E21-C375-45EA-A069-4E2232C8A72B} = {7EFF1E21-C375-45EA-A069-4E2232C8A72B}
{B852D549-4020-4477-8BFB-E199FF78B047} = {B852D549-4020-4477-8BFB-E199FF78B047}
{2FF15659-5C72-48B8-B55B-3C658E4125B5} = {2FF15659-5C72-48B8-B55B-3C658E4125B5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsUnicodeToolShim", "WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj", "{15009625-1120-405E-8BBA-69A16CD6713D}"

View File

@@ -28,7 +28,7 @@ namespace GpFiberStarter_Win32
}
}
IGpFiber *GpFiberStarter::StartFiber(PortabilityLayer::HostSystemServices *systemServices, ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber)
IGpFiber *GpFiberStarter::StartFiber(IGpSystemServices *systemServices, ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber)
{
ULONG_PTR lowLimit;
ULONG_PTR highLimit;

View File

@@ -3,8 +3,7 @@
#include "GpApplicationName.h"
#include "GpFileStream_Win32.h"
#include "GpWindows.h"
#include "GpMemoryBuffer.h"
#include "HostDirectoryCursor.h"
#include "IGpDirectoryCursor.h"
#include <string>
#include <Shlwapi.h>
@@ -15,7 +14,7 @@
extern GpWindowsGlobals g_gpWindowsGlobals;
class GpDirectoryCursor_Win32 final : public PortabilityLayer::HostDirectoryCursor
class GpDirectoryCursor_Win32 final : public IGpDirectoryCursor
{
public:
static GpDirectoryCursor_Win32 *Create(const HANDLE &handle, const WIN32_FIND_DATAW &findData);
@@ -273,7 +272,7 @@ bool GpFileSystem_Win32::DeleteFile(PortabilityLayer::VirtualDirectory_t virtual
return false;
}
PortabilityLayer::HostDirectoryCursor *GpFileSystem_Win32::ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths)
IGpDirectoryCursor *GpFileSystem_Win32::ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths)
{
wchar_t winPath[MAX_PATH + 2];

View File

@@ -1,13 +1,13 @@
#pragma once
#include "HostFileSystem.h"
#include "IGpFileSystem.h"
#include "GpCoreDefs.h"
#include "GpWindows.h"
#include <string>
class GpFileSystem_Win32 final : public PortabilityLayer::HostFileSystem
class GpFileSystem_Win32 final : public IGpFileSystem
{
public:
GpFileSystem_Win32();
@@ -16,7 +16,7 @@ public:
bool FileLocked(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool *exists) override;
GpIOStream *OpenFileNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, bool writeAccess, GpFileCreationDisposition_t createDisposition) override;
bool DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed) override;
PortabilityLayer::HostDirectoryCursor *ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths) override;
IGpDirectoryCursor *ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths) override;
bool ValidateFilePath(const char *path, size_t sz) const override;
bool ValidateFilePathUnicodeChar(uint32_t ch) const override;

View File

@@ -12,10 +12,9 @@
#include "GpAppInterface.h"
#include "GpSystemServices_Win32.h"
#include "GpVOSEvent.h"
#include "IGpFileSystem.h"
#include "IGpVOSEventQueue.h"
#include "HostFileSystem.h"
#include "GpWindows.h"
#include "resource.h"
@@ -399,6 +398,8 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
(void)lpCmdLine;
LPWSTR cmdLine = GetCommandLineW();
int nArgs;
@@ -412,9 +413,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
IGpLogDriver *logger = GpLogDriver_Win32::GetInstance();
GpAppInterface_Get()->PL_HostFileSystem_SetInstance(GpFileSystem_Win32::GetInstance());
GpAppInterface_Get()->PL_HostSystemServices_SetInstance(GpSystemServices_Win32::GetInstance());
GpAppInterface_Get()->PL_HostLogDriver_SetInstance(GpLogDriver_Win32::GetInstance());
GpDriverCollection *drivers = GpAppInterface_Get()->PL_GetDriverCollection();
drivers->SetDriver<GpDriverIDs::kFileSystem>(GpFileSystem_Win32::GetInstance());
drivers->SetDriver<GpDriverIDs::kSystemServices>(GpSystemServices_Win32::GetInstance());
drivers->SetDriver<GpDriverIDs::kLog>(GpLogDriver_Win32::GetInstance());
g_gpWindowsGlobals.m_hInstance = hInstance;
g_gpWindowsGlobals.m_hPrevInstance = hPrevInstance;

View File

@@ -1,10 +1,10 @@
#pragma once
#include "HostMutex.h"
#include "IGpMutex.h"
#include "GpWindows.h"
class GpMutex_Win32 final : public PortabilityLayer::HostMutex
class GpMutex_Win32 final : public IGpMutex
{
public:
void Destroy() override;

View File

@@ -13,7 +13,7 @@ struct GpSystemServices_Win32_ThreadStartParams
{
GpSystemServices_Win32::ThreadFunc_t m_threadFunc;
void *m_threadContext;
PortabilityLayer::HostThreadEvent *m_threadStartEvent;
IGpThreadEvent *m_threadStartEvent;
};
static DWORD WINAPI StaticStartThread(LPVOID lpThreadParameter)
@@ -22,7 +22,7 @@ static DWORD WINAPI StaticStartThread(LPVOID lpThreadParameter)
GpSystemServices_Win32::ThreadFunc_t threadFunc = threadParams->m_threadFunc;
void *threadContext = threadParams->m_threadContext;
PortabilityLayer::HostThreadEvent *threadStartEvent = threadParams->m_threadStartEvent;
IGpThreadEvent *threadStartEvent = threadParams->m_threadStartEvent;
threadStartEvent->Signal();
@@ -72,24 +72,24 @@ void GpSystemServices_Win32::GetLocalDateTime(unsigned int &year, unsigned int &
second = localTime.wSecond;
}
PortabilityLayer::HostMutex *GpSystemServices_Win32::CreateMutex()
IGpMutex *GpSystemServices_Win32::CreateMutex()
{
return GpMutex_Win32::Create();
}
PortabilityLayer::HostMutex *GpSystemServices_Win32::CreateRecursiveMutex()
IGpMutex *GpSystemServices_Win32::CreateRecursiveMutex()
{
return GpMutex_Win32::Create();
}
PortabilityLayer::HostThreadEvent *GpSystemServices_Win32::CreateThreadEvent(bool autoReset, bool startSignaled)
IGpThreadEvent *GpSystemServices_Win32::CreateThreadEvent(bool autoReset, bool startSignaled)
{
return GpThreadEvent_Win32::Create(autoReset, startSignaled);
}
void *GpSystemServices_Win32::CreateThread(ThreadFunc_t threadFunc, void *context)
{
PortabilityLayer::HostThreadEvent *evt = CreateThreadEvent(true, false);
IGpThreadEvent *evt = CreateThreadEvent(true, false);
if (!evt)
return nullptr;
@@ -144,6 +144,11 @@ bool GpSystemServices_Win32::IsTextInputObstructive() const
return false;
}
bool GpSystemServices_Win32::IsFullscreenPreferred() const
{
return !m_isTouchscreenSimulation;
}
unsigned int GpSystemServices_Win32::GetCPUCount() const
{
SYSTEM_INFO sysInfo;
@@ -151,6 +156,22 @@ unsigned int GpSystemServices_Win32::GetCPUCount() const
return sysInfo.dwNumberOfProcessors;
}
void GpSystemServices_Win32::SetTextInputEnabled(bool isEnabled)
{
(void)isEnabled;
}
bool GpSystemServices_Win32::IsTextInputEnabled() const
{
return true;
}
bool GpSystemServices_Win32::AreFontResourcesSeekable() const
{
return true;
}
void GpSystemServices_Win32::SetTouchscreenSimulation(bool isTouchscreenSimulation)
{
m_isTouchscreenSimulation = isTouchscreenSimulation;

View File

@@ -1,6 +1,6 @@
#pragma once
#include "HostSystemServices.h"
#include "IGpSystemServices.h"
#include "GpCoreDefs.h"
#include "GpWindows.h"
@@ -15,23 +15,27 @@
#endif
class GpSystemServices_Win32 final : public PortabilityLayer::HostSystemServices
class GpSystemServices_Win32 final : public IGpSystemServices
{
public:
GpSystemServices_Win32();
int64_t GetTime() const override;
void GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const override;
PortabilityLayer::HostMutex *CreateMutex() override;
PortabilityLayer::HostMutex *CreateRecursiveMutex() override;
IGpMutex *CreateMutex() override;
IGpMutex *CreateRecursiveMutex() override;
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
PortabilityLayer::HostThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) override;
IGpThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) override;
uint64_t GetFreeMemoryCosmetic() const override;
void Beep() const override;
bool IsTouchscreen() const override;
bool IsUsingMouseAsTouch() const override;
bool IsTextInputObstructive() const override;
bool IsFullscreenPreferred() const override;
unsigned int GetCPUCount() const override;
void SetTextInputEnabled(bool isEnabled) override;
bool IsTextInputEnabled() const override;
bool AreFontResourcesSeekable() const override;
void SetTouchscreenSimulation(bool isTouchscreenSimulation);

View File

@@ -1,10 +1,10 @@
#pragma once
#include "HostThreadEvent.h"
#include "IGpThreadEvent.h"
#include "GpWindows.h"
class GpThreadEvent_Win32 final : public PortabilityLayer::HostThreadEvent
class GpThreadEvent_Win32 final : public IGpThreadEvent
{
public:
void Wait() override;

View File

@@ -15,8 +15,8 @@ android {
}
minSdkVersion 16
targetSdkVersion 29
versionCode 2
versionName "1.0.9pre2"
versionCode 7
versionName "1.0.11"
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-16"

View File

@@ -1,12 +1,14 @@
#define _LARGEFILE64_SOURCE
#include "GpFileSystem_Android.h"
#include "GpIOStream.h"
#include "HostDirectoryCursor.h"
#include "HostSystemServices.h"
#include "HostMutex.h"
#include "IGpDirectoryCursor.h"
#include "IGpSystemServices.h"
#include "IGpMutex.h"
#include "IGpThreadRelay.h"
#include "VirtualDirectory.h"
#include "PLDrivers.h"
#include "SDL.h"
#include "SDL_rwops.h"
@@ -380,7 +382,7 @@ void GpFileStream_Android_File::Flush()
bool GpFileSystem_Android::OpenSourceExportFD(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *const *paths, size_t numPaths, int &fd, jobject &pfd)
{
if (!m_sourceExportMutex)
m_sourceExportMutex = PortabilityLayer::HostSystemServices::GetInstance()->CreateMutex();
m_sourceExportMutex = PLDrivers::GetSystemServices()->CreateMutex();
m_sourceExportWaiting = true;
m_sourceExportCancelled = false;
@@ -696,7 +698,7 @@ bool GpFileSystem_Android::DeleteFile(PortabilityLayer::VirtualDirectory_t virtu
return true;
}
PortabilityLayer::HostDirectoryCursor *GpFileSystem_Android::ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *const *paths, size_t numPaths)
IGpDirectoryCursor *GpFileSystem_Android::ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *const *paths, size_t numPaths)
{
ScanDirectoryNestedContext ctx;
ctx.m_this = this;
@@ -715,7 +717,7 @@ void GpFileSystem_Android::ScanDirectoryNestedThunk(void *context)
ctx->m_returnValue = ctx->m_this->ScanDirectoryNestedInternal(ctx->m_virtualDirectory, ctx->m_paths, ctx->m_numPaths);
}
PortabilityLayer::HostDirectoryCursor *GpFileSystem_Android::ScanDirectoryNestedInternal(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *const *paths, size_t numPaths)
IGpDirectoryCursor *GpFileSystem_Android::ScanDirectoryNestedInternal(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *const *paths, size_t numPaths)
{
if (virtualDirectory == PortabilityLayer::VirtualDirectories::kGameData || virtualDirectory == PortabilityLayer::VirtualDirectories::kApplicationData)
return ScanAssetDirectory(virtualDirectory, paths, numPaths);
@@ -809,7 +811,7 @@ GpFileSystem_Android *GpFileSystem_Android::GetInstance()
return &ms_instance;
}
class GpDirectoryCursor_StringList final : public PortabilityLayer::HostDirectoryCursor
class GpDirectoryCursor_StringList final : public IGpDirectoryCursor
{
public:
explicit GpDirectoryCursor_StringList(std::vector<std::string> &paths);
@@ -847,7 +849,7 @@ void GpDirectoryCursor_StringList::Destroy()
delete this;
}
class GpDirectoryCursor_POSIX final : public PortabilityLayer::HostDirectoryCursor
class GpDirectoryCursor_POSIX final : public IGpDirectoryCursor
{
public:
explicit GpDirectoryCursor_POSIX(DIR *dir);
@@ -885,7 +887,7 @@ void GpDirectoryCursor_POSIX::Destroy()
delete this;
}
PortabilityLayer::HostDirectoryCursor *GpFileSystem_Android::ScanAssetDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths)
IGpDirectoryCursor *GpFileSystem_Android::ScanAssetDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths)
{
std::string resolvedPath;
@@ -919,7 +921,7 @@ PortabilityLayer::HostDirectoryCursor *GpFileSystem_Android::ScanAssetDirectory(
return new GpDirectoryCursor_StringList(subPaths);
}
PortabilityLayer::HostDirectoryCursor *GpFileSystem_Android::ScanStorageDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths)
IGpDirectoryCursor *GpFileSystem_Android::ScanStorageDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths)
{
std::string resolvedPath;
std::vector<std::string> subPaths;

View File

@@ -1,18 +1,15 @@
#pragma once
#include "HostFileSystem.h"
#include "IGpFileSystem.h"
#include "GpCoreDefs.h"
#include <jni.h>
#include <string>
namespace PortabilityLayer
{
class HostMutex;
}
struct IGpMutex;
class GpFileSystem_Android final : public PortabilityLayer::HostFileSystem
class GpFileSystem_Android final : public IGpFileSystem
{
public:
GpFileSystem_Android();
@@ -25,7 +22,7 @@ public:
bool FileLocked(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool *exists) override;
GpIOStream *OpenFileNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* subPaths, size_t numSubPaths, bool writeAccess, GpFileCreationDisposition_t createDisposition) override;
bool DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed) override;
PortabilityLayer::HostDirectoryCursor *ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths) override;
IGpDirectoryCursor *ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths) override;
bool ValidateFilePath(const char *path, size_t pathLen) const override;
bool ValidateFilePathUnicodeChar(uint32_t ch) const override;
@@ -45,17 +42,17 @@ private:
{
GpFileSystem_Android *m_this;
PortabilityLayer::HostDirectoryCursor *m_returnValue;
IGpDirectoryCursor *m_returnValue;
PortabilityLayer::VirtualDirectory_t m_virtualDirectory;
char const *const *m_paths;
size_t m_numPaths;
};
static void ScanDirectoryNestedThunk(void *context);
PortabilityLayer::HostDirectoryCursor *ScanDirectoryNestedInternal(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
IGpDirectoryCursor *ScanDirectoryNestedInternal(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
PortabilityLayer::HostDirectoryCursor *ScanAssetDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
PortabilityLayer::HostDirectoryCursor *ScanStorageDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
IGpDirectoryCursor *ScanAssetDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
IGpDirectoryCursor *ScanStorageDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
bool OpenSourceExportFD(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, int &fd, jobject &pfd);
bool ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, std::string &resolution, bool &isAsset);
@@ -68,7 +65,7 @@ private:
jmethodID m_selectSourceExportPathMID;
jmethodID m_closeSourceExportPFDMID;
PortabilityLayer::HostMutex *m_sourceExportMutex;
IGpMutex *m_sourceExportMutex;
int m_sourceExportFD;
bool m_sourceExportWaiting;
bool m_sourceExportCancelled;

View File

@@ -14,8 +14,8 @@
#include "IGpVOSEventQueue.h"
#include "IGpLogDriver.h"
#include "HostFileSystem.h"
#include "HostThreadEvent.h"
#include "IGpFileSystem.h"
#include "IGpThreadEvent.h"
#include "GpAndroid.h"
@@ -81,9 +81,10 @@ int main(int argc, char* argv[])
GpFileSystem_Android::GetInstance()->InitJNI();
GpAppInterface_Get()->PL_HostFileSystem_SetInstance(GpFileSystem_Android::GetInstance());
GpAppInterface_Get()->PL_HostSystemServices_SetInstance(GpSystemServices_Android::GetInstance());
GpAppInterface_Get()->PL_HostLogDriver_SetInstance(GpLogDriver_Android::GetInstance());
GpDriverCollection *drivers = GpAppInterface_Get()->PL_GetDriverCollection();
drivers->SetDriver<GpDriverIDs::kFileSystem>(GpFileSystem_Android::GetInstance());
drivers->SetDriver<GpDriverIDs::kSystemServices>(GpSystemServices_Android::GetInstance());
drivers->SetDriver<GpDriverIDs::kLog>(GpLogDriver_Android::GetInstance());
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_SDL_GL2;

View File

@@ -1,6 +1,6 @@
#include "GpSystemServices_Android.h"
#include "HostMutex.h"
#include "HostThreadEvent.h"
#include "IGpMutex.h"
#include "IGpThreadEvent.h"
#include "SDL.h"
#include <time.h>
@@ -12,7 +12,7 @@ struct GpSystemServices_Android_ThreadStartParams
{
GpSystemServices_Android::ThreadFunc_t m_threadFunc;
void *m_threadContext;
PortabilityLayer::HostThreadEvent *m_threadStartEvent;
IGpThreadEvent *m_threadStartEvent;
};
static int SDLCALL StaticStartThread(void *lpThreadParameter)
@@ -21,7 +21,7 @@ static int SDLCALL StaticStartThread(void *lpThreadParameter)
GpSystemServices_Android::ThreadFunc_t threadFunc = threadParams->m_threadFunc;
void *threadContext = threadParams->m_threadContext;
PortabilityLayer::HostThreadEvent *threadStartEvent = threadParams->m_threadStartEvent;
IGpThreadEvent *threadStartEvent = threadParams->m_threadStartEvent;
threadStartEvent->Signal();
@@ -29,7 +29,7 @@ static int SDLCALL StaticStartThread(void *lpThreadParameter)
}
template<class TMutex>
class GpMutex_Cpp11 final : public PortabilityLayer::HostMutex
class GpMutex_Cpp11 final : public IGpMutex
{
public:
GpMutex_Cpp11();
@@ -77,7 +77,7 @@ typedef GpMutex_Cpp11<std::mutex> GpMutex_Cpp11_Vanilla;
typedef GpMutex_Cpp11<std::recursive_mutex> GpMutex_Cpp11_Recursive;
class GpThreadEvent_Cpp11 final : public PortabilityLayer::HostThreadEvent
class GpThreadEvent_Cpp11 final : public IGpThreadEvent
{
public:
GpThreadEvent_Cpp11(bool autoReset, bool startSignaled);
@@ -166,6 +166,7 @@ void GpThreadEvent_Cpp11::Destroy()
}
GpSystemServices_Android::GpSystemServices_Android()
: m_textInputEnabled(false)
{
}
@@ -186,7 +187,7 @@ void GpSystemServices_Android::GetLocalDateTime(unsigned int &year, unsigned int
second = static_cast<unsigned int>(tmObject->tm_sec);
}
PortabilityLayer::HostMutex *GpSystemServices_Android::CreateMutex()
IGpMutex *GpSystemServices_Android::CreateMutex()
{
GpMutex_Cpp11_Vanilla *mutex = static_cast<GpMutex_Cpp11_Vanilla*>(malloc(sizeof(GpMutex_Cpp11_Vanilla)));
if (!mutex)
@@ -198,7 +199,7 @@ PortabilityLayer::HostMutex *GpSystemServices_Android::CreateMutex()
void *GpSystemServices_Android::CreateThread(ThreadFunc_t threadFunc, void *context)
{
PortabilityLayer::HostThreadEvent *evt = CreateThreadEvent(true, false);
IGpThreadEvent *evt = CreateThreadEvent(true, false);
if (!evt)
return nullptr;
@@ -220,7 +221,7 @@ void *GpSystemServices_Android::CreateThread(ThreadFunc_t threadFunc, void *cont
return thread;
}
PortabilityLayer::HostMutex *GpSystemServices_Android::CreateRecursiveMutex()
IGpMutex *GpSystemServices_Android::CreateRecursiveMutex()
{
GpMutex_Cpp11_Recursive *mutex = static_cast<GpMutex_Cpp11_Recursive*>(malloc(sizeof(GpMutex_Cpp11_Recursive)));
if (!mutex)
@@ -229,7 +230,7 @@ PortabilityLayer::HostMutex *GpSystemServices_Android::CreateRecursiveMutex()
return new (mutex) GpMutex_Cpp11_Recursive();
}
PortabilityLayer::HostThreadEvent *GpSystemServices_Android::CreateThreadEvent(bool autoReset, bool startSignaled)
IGpThreadEvent *GpSystemServices_Android::CreateThreadEvent(bool autoReset, bool startSignaled)
{
GpThreadEvent_Cpp11 *evt = static_cast<GpThreadEvent_Cpp11*>(malloc(sizeof(GpThreadEvent_Cpp11)));
if (!evt)
@@ -264,11 +265,31 @@ bool GpSystemServices_Android::IsTextInputObstructive() const
return true;
}
bool GpSystemServices_Android::IsFullscreenPreferred() const
{
return true;
}
unsigned int GpSystemServices_Android::GetCPUCount() const
{
return SDL_GetCPUCount();
}
void GpSystemServices_Android::SetTextInputEnabled(bool isEnabled)
{
m_textInputEnabled = isEnabled;
}
bool GpSystemServices_Android::IsTextInputEnabled() const
{
return m_textInputEnabled;
}
bool GpSystemServices_Android::AreFontResourcesSeekable() const
{
return false;
}
GpSystemServices_Android *GpSystemServices_Android::GetInstance()
{
return &ms_instance;

View File

@@ -1,28 +1,36 @@
#pragma once
#include "HostSystemServices.h"
#include "IGpSystemServices.h"
#include "GpCoreDefs.h"
class GpSystemServices_Android final : public PortabilityLayer::HostSystemServices
class GpSystemServices_Android final : public IGpSystemServices
{
public:
GpSystemServices_Android();
int64_t GetTime() const override;
void GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const override;
PortabilityLayer::HostMutex *CreateMutex() override;
PortabilityLayer::HostMutex *CreateRecursiveMutex() override;
IGpMutex *CreateMutex() override;
IGpMutex *CreateRecursiveMutex() override;
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
PortabilityLayer::HostThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) override;
IGpThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) override;
uint64_t GetFreeMemoryCosmetic() const override;
void Beep() const override;
bool IsTouchscreen() const override;
bool IsUsingMouseAsTouch() const override;
bool IsTextInputObstructive() const override;
bool IsFullscreenPreferred() const override;
unsigned int GetCPUCount() const override;
void SetTextInputEnabled(bool isEnabled) override;
bool IsTextInputEnabled() const override;
bool AreFontResourcesSeekable() const override;
void FlushTextInputEnabled();
static GpSystemServices_Android *GetInstance();
private:
static GpSystemServices_Android ms_instance;
bool m_textInputEnabled;
};

View File

@@ -41,9 +41,13 @@
<!-- Allow writing to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Allow access to Bluetooth devices -->
<!--
<uses-permission android:name="android.permission.BLUETOOTH" />
-->
<!-- Allow access to the vibrator -->
<!--
<uses-permission android:name="android.permission.VIBRATE" />
-->
<!-- if you want to capture audio, uncomment this. -->
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->

View File

@@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -6,3 +6,4 @@ git archive -0 --format zip -o AerofoilAndroid\app\src\main\assets\Packaged\Sour
tools\7z.exe d AerofoilAndroid\app\src\main\assets\Packaged\SourceCode.zip GliderProData\
cd AerofoilAndroid\app\src\main\assets\Packaged
rename SourceCode.zip SourceCode.pkg
pause

View File

@@ -1,12 +1,12 @@
#include "IGpAudioDriver.h"
#include "IGpAudioChannel.h"
#include "IGpAudioChannelCallbacks.h"
#include "IGpMutex.h"
#include "IGpPrefsHandler.h"
#include "IGpSystemServices.h"
#include "GpAudioDriverProperties.h"
#include "CoreDefs.h"
#include "HostMutex.h"
#include "HostSystemServices.h"
#include "SDL_audio.h"
#include "GpRingBuffer.h"
@@ -93,7 +93,7 @@ private:
bool Init(GpAudioDriver_SDL2 *driver);
IGpAudioChannelCallbacks *m_callbacks;
PortabilityLayer::HostMutex *m_mutex;
IGpMutex *m_mutex;
GpAudioDriver_SDL2 *m_owner;
SDL_atomic_t m_refCount;
@@ -131,8 +131,8 @@ private:
void RefillMixChunk(GpAudioChannel_SDL2 *const*channels, size_t numChannels);
GpAudioDriverProperties m_properties;
PortabilityLayer::HostMutex *m_mutex;
PortabilityLayer::HostMutex *m_mixState;
IGpMutex *m_mutex;
IGpMutex *m_mixState;
static const size_t kMaxChannels = 16;
static const size_t kMixChunkSize = 256;

View File

@@ -6,11 +6,11 @@
#include "GpDisplayDriverProperties.h"
#include "GpVOSEvent.h"
#include "GpRingBuffer.h"
#include "HostSystemServices.h"
#include "IGpCursor.h"
#include "IGpDisplayDriverSurface.h"
#include "IGpLogDriver.h"
#include "IGpPrefsHandler.h"
#include "IGpSystemServices.h"
#include "IGpVOSEventQueue.h"
#include "SDL_events.h"
@@ -25,6 +25,7 @@
#include <chrono>
#include <numeric>
#include <vector>
#include <algorithm>
#pragma push_macro("LoadCursor")
@@ -644,6 +645,7 @@ public:
void UploadEntire(const void *data, size_t pitch);
void Destroy();
void DestroyAll();
bool RecreateAll();
size_t GetImageWidth() const;
@@ -729,7 +731,7 @@ public:
void Run() override;
void Shutdown() override;
void GetDisplayResolution(unsigned int *width, unsigned int *height) override;
void GetInitialDisplayResolution(unsigned int *width, unsigned int *height) override;
IGpDisplayDriverSurface *CreateSurface(size_t width, size_t height, size_t pitch, GpPixelFormat_t pixelFormat, SurfaceInvalidateCallback_t invalidateCallback, void *invalidateContext) override;
void DrawSurface(IGpDisplayDriverSurface *surface, int32_t x, int32_t y, size_t width, size_t height, const GpDisplayDriverSurfaceEffects *effects) override;
IGpCursor *CreateBWCursor(size_t width, size_t height, const void *pixelData, const void *maskData, size_t hotSpotX, size_t hotSpotY) override;
@@ -777,7 +779,7 @@ private:
};
void StartOpenGLForWindow(IGpLogDriver *logger);
bool InitResources(uint32_t virtualWidth, uint32_t virtualHeight);
bool InitResources(uint32_t physicalWidth, uint32_t physicalHeight, uint32_t virtualWidth, uint32_t virtualHeight);
void BecomeFullScreen();
void BecomeWindowed();
@@ -821,7 +823,6 @@ private:
GLint m_pixelDXDYDimensionsLocation;
GLint m_vertexPosUVLocation;
GLint m_pixelSurfaceTextureLocation;
GLint m_pixelPaletteTextureLocation;
bool Link(GpDisplayDriver_SDL_GL2 *driver, const GpGLShader<GL_VERTEX_SHADER> *vertexShader, const GpGLShader<GL_FRAGMENT_SHADER> *pixelShader);
};
@@ -831,6 +832,12 @@ private:
GpComPtr<GpGLRenderTargetView> m_virtualScreenTextureRTV;
GpComPtr<GpGLTexture> m_virtualScreenTexture;
GpComPtr<GpGLRenderTargetView> m_upscaleTextureRTV;
GpComPtr<GpGLTexture> m_upscaleTexture;
uint32_t m_upscaleTextureWidth;
uint32_t m_upscaleTextureHeight;
GpComPtr<GpGLVertexArray> m_quadVertexArray;
GpComPtr<GpGLBuffer> m_quadVertexBufferKeepalive;
GpComPtr<GpGLBuffer> m_quadIndexBuffer;
@@ -879,8 +886,11 @@ private:
uint32_t m_windowHeightPhysical;
uint32_t m_windowWidthVirtual; // Virtual resolution is the resolution reported to the game
uint32_t m_windowHeightVirtual;
uint32_t m_initialWidthVirtual; // Virtual resolution is the resolution reported to the game
uint32_t m_initialHeightVirtual;
float m_pixelScaleX;
float m_pixelScaleY;
bool m_useUpscaleFilter;
GpCursor_SDL2 *m_activeCursor;
GpCursor_SDL2 *m_pendingCursor;
@@ -889,7 +899,7 @@ private:
bool m_mouseIsInClientArea;
IGpFiber *m_vosFiber;
PortabilityLayer::HostThreadEvent *m_vosEvent;
IGpThreadEvent *m_vosEvent;
float m_bgColor[4];
bool m_bgIsDark;
@@ -904,6 +914,8 @@ private:
uint8_t m_paletteStorage[256 * 4 + GP_SYSTEM_MEMORY_ALIGNMENT];
uint8_t *m_paletteData;
bool m_textInputEnabled;
};
@@ -1010,14 +1022,17 @@ void GpDisplayDriverSurface_GL2::Destroy()
free(this);
}
bool GpDisplayDriverSurface_GL2::RecreateAll()
void GpDisplayDriverSurface_GL2::DestroyAll()
{
for (GpDisplayDriverSurface_GL2 *scan = this; scan; scan = scan->m_next)
{
scan->m_invalidateCallback(scan->m_invalidateContext);
scan->m_texture = nullptr;
}
}
bool GpDisplayDriverSurface_GL2::RecreateAll()
{
for (GpDisplayDriverSurface_GL2 *scan = this; scan; scan = scan->m_next)
{
if (!scan->RecreateSingle())
@@ -1068,13 +1083,15 @@ bool GpDisplayDriverSurface_GL2::Init(GpDisplayDriverSurface_GL2 *prevSurface)
CheckGLError(*m_gl, m_driver->GetProperties().m_logger);
m_prev = prevSurface;
return true;
}
bool GpDisplayDriverSurface_GL2::RecreateSingle()
{
m_texture = GpGLTexture::Create(m_driver);
return m_texture != nullptr;
return m_texture != nullptr && this->Init(m_prev);
}
GLenum GpDisplayDriverSurface_GL2::ResolveGLFormat() const
@@ -1163,8 +1180,11 @@ GpDisplayDriver_SDL_GL2::GpDisplayDriver_SDL_GL2(const GpDisplayDriverProperties
, m_windowHeightPhysical(480)
, m_windowWidthVirtual(640)
, m_windowHeightVirtual(480)
, m_initialWidthVirtual(640)
, m_initialHeightVirtual(480)
, m_pixelScaleX(1.0f)
, m_pixelScaleY(1.0f)
, m_useUpscaleFilter(false)
, m_vosFiber(nullptr)
, m_vosEvent(nullptr)
, m_pendingCursor(nullptr)
@@ -1191,6 +1211,7 @@ GpDisplayDriver_SDL_GL2::GpDisplayDriver_SDL_GL2(const GpDisplayDriverProperties
, m_contextLost(true)
, m_lastSurface(nullptr)
, m_firstSurface(nullptr)
, m_textInputEnabled(false)
{
m_bgColor[0] = 0.f;
m_bgColor[1] = 0.f;
@@ -1198,7 +1219,7 @@ GpDisplayDriver_SDL_GL2::GpDisplayDriver_SDL_GL2(const GpDisplayDriverProperties
m_bgColor[3] = 1.f;
// Stupid hack to detect mobile...
m_isFullScreenDesired = m_properties.m_systemServices->IsTouchscreen() && !m_properties.m_systemServices->IsUsingMouseAsTouch();
m_isFullScreenDesired = m_properties.m_systemServices->IsFullscreenPreferred();
const intmax_t periodNum = std::chrono::high_resolution_clock::period::num;
const intmax_t periodDen = std::chrono::high_resolution_clock::period::den;
@@ -1880,6 +1901,9 @@ void GpDisplayDriver_SDL_GL2::Run()
if (!m_gl.LookUpFunctions())
return;
m_initialWidthVirtual = m_windowWidthVirtual;
m_initialHeightVirtual = m_windowHeightVirtual;
for (;;)
{
SDL_Event msg;
@@ -1901,7 +1925,6 @@ void GpDisplayDriver_SDL_GL2::Run()
}
TranslateSDLMessage(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY, obstructiveTextInput);
}
else
{
@@ -1923,7 +1946,6 @@ void GpDisplayDriver_SDL_GL2::Run()
int clientHeight = 0;
SDL_GetWindowSize(m_window, &clientWidth, &clientHeight);
unsigned int desiredWidth = clientWidth;
unsigned int desiredHeight = clientHeight;
if (desiredWidth != m_windowWidthPhysical || desiredHeight != m_windowHeightPhysical || m_isResolutionResetDesired)
@@ -1980,9 +2002,9 @@ void GpDisplayDriver_SDL_GL2::Run()
new (&m_res) InstancedResources();
if (m_firstSurface)
m_firstSurface->RecreateAll();
m_firstSurface->DestroyAll();
if (!InitResources(m_windowWidthVirtual, m_windowHeightVirtual))
if (!InitResources(m_windowWidthPhysical, m_windowHeightPhysical, m_windowWidthVirtual, m_windowHeightVirtual))
{
if (logger)
logger->Printf(IGpLogDriver::Category_Information, "Terminating display driver due to InitResources failing");
@@ -1990,10 +2012,28 @@ void GpDisplayDriver_SDL_GL2::Run()
break;
}
if (m_firstSurface)
m_firstSurface->RecreateAll();
m_contextLost = false;
continue;
}
bool wantTextInput = m_properties.m_systemServices->IsTextInputEnabled();
if (wantTextInput != m_textInputEnabled)
{
m_textInputEnabled = wantTextInput;
if (m_textInputEnabled)
SDL_StartTextInput();
else
SDL_StopTextInput();
}
// Handle dismissal of on-screen keyboard
const bool isTextInputActuallyActive = SDL_IsTextInputActive();
m_textInputEnabled = isTextInputActuallyActive;
m_properties.m_systemServices->SetTextInputEnabled(isTextInputActuallyActive);
GpDisplayDriverTickStatus_t tickStatus = PresentFrameAndSync();
if (tickStatus == GpDisplayDriverTickStatuses::kFatalFault || tickStatus == GpDisplayDriverTickStatuses::kApplicationTerminated)
{
@@ -2019,13 +2059,13 @@ void GpDisplayDriver_SDL_GL2::Shutdown()
free(this);
}
void GpDisplayDriver_SDL_GL2::GetDisplayResolution(unsigned int *width, unsigned int *height)
void GpDisplayDriver_SDL_GL2::GetInitialDisplayResolution(unsigned int *width, unsigned int *height)
{
if (width)
*width = m_windowWidthVirtual;
*width = m_initialWidthVirtual;
if (height)
*height = m_windowHeightVirtual;
*height = m_initialHeightVirtual;
}
IGpDisplayDriverSurface *GpDisplayDriver_SDL_GL2::CreateSurface(size_t width, size_t height, size_t pitch, GpPixelFormat_t pixelFormat, SurfaceInvalidateCallback_t invalidateCallback, void *invalidateContext)
@@ -2368,13 +2408,18 @@ void GpDisplayDriver_SDL_GL2::StartOpenGLForWindow(IGpLogDriver *logger)
SDL_GL_SetSwapInterval(1);
}
bool GpDisplayDriver_SDL_GL2::InitResources(uint32_t virtualWidth, uint32_t virtualHeight)
bool GpDisplayDriver_SDL_GL2::InitResources(uint32_t physicalWidth, uint32_t physicalHeight, uint32_t virtualWidth, uint32_t virtualHeight)
{
IGpLogDriver *logger = m_properties.m_logger;
if (logger)
logger->Printf(IGpLogDriver::Category_Information, "GpDisplayDriver_SDL_GL2::InitResources");
if ((m_pixelScaleX < 2.0f && m_pixelScaleX > 1.0f) || (m_pixelScaleY < 2.0f && m_pixelScaleY > 1.0f))
m_useUpscaleFilter = true;
else
m_useUpscaleFilter = false;
CheckGLError(m_gl, logger);
if (!InitBackBuffer(virtualWidth, virtualHeight))
@@ -2684,6 +2729,66 @@ bool GpDisplayDriver_SDL_GL2::InitBackBuffer(uint32_t width, uint32_t height)
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
}
if (m_pixelScaleX != floor(m_pixelScaleX) || m_pixelScaleY != floor(m_pixelScaleY))
{
uint32_t upscaleX = ceil(m_pixelScaleX);
uint32_t upscaleY = ceil(m_pixelScaleY);
{
m_res.m_upscaleTexture = GpGLTexture::Create(this);
if (!m_res.m_upscaleTexture)
{
if (logger)
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriver_SDL_GL2::InitBackBuffer: GpGLTexture::Create for upscale texture failed");
return false;
}
m_res.m_upscaleTextureWidth = width * upscaleX;
m_res.m_upscaleTextureHeight = height * upscaleY;
GLenum internalFormat = SupportsSizedFormats() ? GL_RGBA8 : GL_RGBA;
m_gl.BindTexture(GL_TEXTURE_2D, m_res.m_upscaleTexture->GetID());
m_gl.PixelStorei(GL_UNPACK_ALIGNMENT, 1);
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
m_gl.TexImage2D(GL_TEXTURE_2D, 0, internalFormat, m_res.m_upscaleTextureWidth, m_res.m_upscaleTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
m_gl.BindTexture(GL_TEXTURE_2D, 0);
CheckGLError(m_gl, logger);
}
{
m_res.m_upscaleTextureRTV = GpGLRenderTargetView::Create(this);
if (!m_res.m_upscaleTextureRTV)
{
if (logger)
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriver_SDL_GL2::InitBackBuffer: GpGLRenderTargetView::Create for upscale texture failed");
return false;
}
m_gl.BindFramebuffer(GL_FRAMEBUFFER, m_res.m_upscaleTextureRTV->GetID());
m_gl.FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_res.m_upscaleTexture->GetID(), 0);
GLenum status = m_gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
{
if (logger)
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriver_SDL_GL2::InitBackBuffer: Framebuffer complete check failed for upscale texture, status was %i VST ID is %i", static_cast<int>(status), static_cast<int>(m_res.m_virtualScreenTextureRTV->GetID()));
return false;
}
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
}
}
CheckGLError(m_gl, logger);
return true;
@@ -2692,28 +2797,20 @@ bool GpDisplayDriver_SDL_GL2::InitBackBuffer(uint32_t width, uint32_t height)
void GpDisplayDriver_SDL_GL2::ScaleVirtualScreen()
{
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
m_gl.Viewport(0, 0, m_windowWidthPhysical, m_windowHeightPhysical);
const bool isIntegralScale = (m_pixelScaleX == floor(m_pixelScaleX) && m_pixelScaleY == floor(m_pixelScaleY));
const BlitQuadProgram &program = isIntegralScale ? m_res.m_copyQuadProgram : m_res.m_scaleQuadProgram;
if (m_useUpscaleFilter)
{
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthPhysical);
const float twoDivHeight = 2.0f / static_cast<float>(m_windowHeightPhysical);
m_gl.BindFramebuffer(GL_FRAMEBUFFER, m_res.m_upscaleTextureRTV->GetID());
// Use the scaled virtual width instead of the physical width to correctly handle cases where the window boundary is in the middle of a pixel
float fWidth = static_cast<float>(m_windowWidthVirtual) * m_pixelScaleX;
float fHeight = static_cast<float>(m_windowHeightVirtual) * m_pixelScaleY;
m_gl.Viewport(0, 0, m_res.m_upscaleTextureWidth, m_res.m_upscaleTextureHeight);
const BlitQuadProgram &program = m_res.m_scaleQuadProgram;
float ndcOriginsAndDimensions[4] =
{
-1.0f,
-1.0f,
fWidth * twoDivWidth,
fHeight * twoDivHeight
2.0f,
2.0f,
};
float surfaceDimensions_TextureRegion[4] =
@@ -2730,8 +2827,73 @@ void GpDisplayDriver_SDL_GL2::ScaleVirtualScreen()
float dxdy_dimensions[4] =
{
static_cast<float>(static_cast<double>(m_windowWidthVirtual) / static_cast<double>(m_windowWidthPhysical)),
static_cast<float>(static_cast<double>(m_windowHeightVirtual) / static_cast<double>(m_windowHeightPhysical)),
static_cast<float>(1.0 / m_windowWidthVirtual),
static_cast<float>(1.0 / m_windowHeightVirtual),
static_cast<float>(m_windowWidthVirtual),
static_cast<float>(m_windowHeightVirtual)
};
m_gl.Uniform4fv(program.m_pixelDXDYDimensionsLocation, 1, reinterpret_cast<const GLfloat*>(dxdy_dimensions));
GLint attribLocations[] = { program.m_vertexPosUVLocation };
m_res.m_quadVertexArray->Activate(attribLocations);
m_gl.ActiveTexture(GL_TEXTURE0 + 0);
m_gl.BindTexture(GL_TEXTURE_2D, m_res.m_virtualScreenTexture->GetID());
m_gl.Uniform1i(program.m_pixelSurfaceTextureLocation, 0);
m_gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_res.m_quadIndexBuffer->GetID());
m_gl.DrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
m_gl.UseProgram(0);
m_gl.ActiveTexture(GL_TEXTURE0 + 0);
m_gl.BindTexture(GL_TEXTURE_2D, 0);
m_res.m_quadVertexArray->Deactivate(attribLocations);
m_gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
m_gl.Viewport(0, 0, m_windowWidthPhysical, m_windowHeightPhysical);
const BlitQuadProgram &program = m_res.m_copyQuadProgram;
{
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthPhysical);
const float twoDivHeight = 2.0f / static_cast<float>(m_windowHeightPhysical);
// Use the scaled virtual width instead of the physical width to correctly handle cases where the window boundary is in the middle of a pixel
float fWidth = static_cast<float>(m_windowWidthVirtual) * m_pixelScaleX;
float fHeight = static_cast<float>(m_windowHeightVirtual) * m_pixelScaleY;
float ndcOriginsAndDimensions[4] =
{
-1.0f,
-1.0f,
2.0f,
2.0f,
};
float surfaceDimensions_TextureRegion[4] =
{
static_cast<float>(m_windowWidthVirtual),
static_cast<float>(m_windowHeightVirtual),
1.f,
1.f
};
m_gl.UseProgram(program.m_program->GetID());
m_gl.Uniform4fv(program.m_vertexNDCOriginAndDimensionsLocation, 1, reinterpret_cast<const GLfloat*>(ndcOriginsAndDimensions));
m_gl.Uniform4fv(program.m_vertexSurfaceDimensionsLocation, 1, reinterpret_cast<const GLfloat*>(surfaceDimensions_TextureRegion));
float dxdy_dimensions[4] =
{
static_cast<float>(1.0 / m_windowWidthVirtual),
static_cast<float>(1.0 / m_windowHeightVirtual),
static_cast<float>(m_windowWidthVirtual),
static_cast<float>(m_windowHeightVirtual)
};
@@ -2743,8 +2905,11 @@ void GpDisplayDriver_SDL_GL2::ScaleVirtualScreen()
m_res.m_quadVertexArray->Activate(attribLocations);
GpGLTexture *inputTexture = m_useUpscaleFilter ? static_cast<GpGLTexture*>(m_res.m_upscaleTexture) : static_cast<GpGLTexture*>(m_res.m_virtualScreenTexture);
m_gl.ActiveTexture(GL_TEXTURE0 + 0);
m_gl.BindTexture(GL_TEXTURE_2D, m_res.m_virtualScreenTexture->GetID());
m_gl.BindTexture(GL_TEXTURE_2D, inputTexture->GetID());
m_gl.Uniform1i(program.m_pixelSurfaceTextureLocation, 0);
m_gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_res.m_quadIndexBuffer->GetID());

View File

@@ -1,8 +1,8 @@
#include "GpFiberStarter.h"
#include "GpFiber_SDL.h"
#include "HostSystemServices.h"
#include "HostThreadEvent.h"
#include "IGpSystemServices.h"
#include "IGpThreadEvent.h"
#include "SDL_thread.h"
@@ -13,8 +13,8 @@ namespace GpFiberStarter_SDL
struct FiberStartState
{
GpFiberStarter::ThreadFunc_t m_threadFunc;
PortabilityLayer::HostThreadEvent *m_creatingReturnEvent;
PortabilityLayer::HostThreadEvent *m_creatingWakeEvent;
IGpThreadEvent *m_creatingReturnEvent;
IGpThreadEvent *m_creatingWakeEvent;
void *m_context;
};
@@ -23,8 +23,8 @@ namespace GpFiberStarter_SDL
const FiberStartState *tss = static_cast<const FiberStartState*>(lpThreadParameter);
GpFiberStarter::ThreadFunc_t threadFunc = tss->m_threadFunc;
PortabilityLayer::HostThreadEvent *creatingReturnEvent = tss->m_creatingReturnEvent;
PortabilityLayer::HostThreadEvent *wakeEvent = tss->m_creatingWakeEvent;
IGpThreadEvent *creatingReturnEvent = tss->m_creatingReturnEvent;
IGpThreadEvent *wakeEvent = tss->m_creatingWakeEvent;
void *context = tss->m_context;
creatingReturnEvent->Signal();
@@ -36,13 +36,13 @@ namespace GpFiberStarter_SDL
}
}
IGpFiber *GpFiberStarter::StartFiber(PortabilityLayer::HostSystemServices *systemServices, ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber)
IGpFiber *GpFiberStarter::StartFiber(IGpSystemServices *systemServices, ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber)
{
PortabilityLayer::HostThreadEvent *returnEvent = systemServices->CreateThreadEvent(true, false);
IGpThreadEvent *returnEvent = systemServices->CreateThreadEvent(true, false);
if (!returnEvent)
return nullptr;
PortabilityLayer::HostThreadEvent *wakeEvent = systemServices->CreateThreadEvent(true, false);
IGpThreadEvent *wakeEvent = systemServices->CreateThreadEvent(true, false);
if (!wakeEvent)
{
returnEvent->Destroy();

View File

@@ -1,8 +1,7 @@
#include "GpFiber_SDL.h"
#include "HostSystemServices.h"
#include "HostThreadEvent.h"
#include "IGpThreadEvent.h"
GpFiber_SDL::GpFiber_SDL(SDL_Thread *thread, PortabilityLayer::HostThreadEvent *threadEvent)
GpFiber_SDL::GpFiber_SDL(SDL_Thread *thread, IGpThreadEvent *threadEvent)
: m_event(threadEvent)
, m_thread(thread)
{

View File

@@ -3,16 +3,12 @@
#include "IGpFiber.h"
#include "SDL_thread.h"
namespace PortabilityLayer
{
class HostSystemServices;
class HostThreadEvent;
}
struct IGpThreadEvent;
class GpFiber_SDL final : public IGpFiber
{
public:
explicit GpFiber_SDL(SDL_Thread *thread, PortabilityLayer::HostThreadEvent *threadEvent);
explicit GpFiber_SDL(SDL_Thread *thread, IGpThreadEvent *threadEvent);
~GpFiber_SDL();
void YieldTo(IGpFiber *fromFiber) override;
@@ -23,6 +19,6 @@ private:
static int SDLCALL InternalThreadFunction(void *data);
bool m_isDestroying;
PortabilityLayer::HostThreadEvent *m_event;
IGpThreadEvent *m_event;
SDL_Thread *m_thread;
};

View File

@@ -13,10 +13,10 @@
#include "GpAppInterface.h"
#include "GpSystemServices_Win32.h"
#include "GpVOSEvent.h"
#include "IGpVOSEventQueue.h"
#include "HostFileSystem.h"
#include "HostThreadEvent.h"
#include "IGpFileSystem.h"
#include "IGpThreadEvent.h"
#include "IGpVOSEventQueue.h"
#include "GpWindows.h"
@@ -56,10 +56,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
IGpLogDriver *logger = GpLogDriver_Win32::GetInstance();
GpDriverCollection *drivers = GpAppInterface_Get()->PL_GetDriverCollection();
GpAppInterface_Get()->PL_HostFileSystem_SetInstance(GpFileSystem_Win32::GetInstance());
GpAppInterface_Get()->PL_HostSystemServices_SetInstance(GpSystemServices_Win32::GetInstance());
GpAppInterface_Get()->PL_HostLogDriver_SetInstance(GpLogDriver_Win32::GetInstance());
drivers->SetDriver<GpDriverIDs::kFileSystem>(GpFileSystem_Win32::GetInstance());
drivers->SetDriver<GpDriverIDs::kSystemServices>(GpSystemServices_Win32::GetInstance());
drivers->SetDriver<GpDriverIDs::kLog>(GpLogDriver_Win32::GetInstance());
g_gpWindowsGlobals.m_hInstance = hInstance;
g_gpWindowsGlobals.m_hPrevInstance = hPrevInstance;

View File

@@ -5,11 +5,6 @@
"\n"\
"uniform vec4 dxdy_dimensions;\n"\
"\n"\
"vec3 SamplePixel(vec2 coord)\n"\
"{\n"\
" return texture2D(surfaceTexture, (coord + vec2(0.5, 0.5)) / dxdy_dimensions.zw).rgb;\n"\
"}\n"\
"\n"\
"void main()\n"\
"{\n"\
" gl_FragColor = vec4(LinearToSRGB(texture2D(surfaceTexture, texCoord.xy).rgb), 1.0);\n"\
@@ -17,5 +12,5 @@
namespace GpBinarizedShaders
{
const char *g_copyQuadP_GL2 = GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_COPYQUADP_GLSL;
const char *g_copyQuadP_GL2 = GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_COPYQUADP_GLSL;
}

View File

@@ -29,8 +29,8 @@
namespace GpBinarizedShaders
{
const char *g_drawQuadPalettePF_GL2 = "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
const char *g_drawQuadPalettePNF_GL2 = GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
const char *g_drawQuadPaletteICCPF_GL2 = "#define USE_ICC_PROFILE\n" "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
const char *g_drawQuadPaletteICCPNF_GL2 = "#define USE_ICC_PROFILE\n" GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
const char *g_drawQuadPalettePF_GL2 = "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
const char *g_drawQuadPalettePNF_GL2 = GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
const char *g_drawQuadPaletteICCPF_GL2 = "#define USE_ICC_PROFILE\n" "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
const char *g_drawQuadPaletteICCPNF_GL2 = "#define USE_ICC_PROFILE\n" GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
}

View File

@@ -1,4 +1,7 @@
#define GP_GL_SHADER_CODE_PRECISION_PREFIX "precision mediump float;\n"\
#define GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX "precision mediump float;\n"\
#define GP_GL_SHADER_CODE_HIGH_PRECISION_PREFIX "precision highp float;\n"\
#define GP_GL_SHADER_CODE_FUNCTIONS_H "vec3 pow3(vec3 v, float ex)\n"\
"{\n"\

View File

@@ -5,41 +5,16 @@
"\n"\
"uniform vec4 dxdy_dimensions;\n"\
"\n"\
"vec3 SamplePixel(vec2 coord)\n"\
"{\n"\
" return texture2D(surfaceTexture, (coord + vec2(0.5, 0.5)) / dxdy_dimensions.zw).rgb;\n"\
"}\n"\
"\n"\
"void main()\n"\
"{\n"\
" float dx = dxdy_dimensions.x;\n"\
" float dy = dxdy_dimensions.y;\n"\
" vec2 dimensions = dxdy_dimensions.zw;\n"\
" vec2 texCoordInteger = dxdy_dimensions.zw;\n"\
" vec2 tc = texCoord.xy;\n"\
"\n"\
" vec2 pixelTopLeftCoord = max(vec2(0.0, 0.0), texCoord.zw - vec2(dx, dy) * 0.5);\n"\
" vec2 pixelBottomRightCoord = pixelTopLeftCoord + min(vec2(1.0, 1.0), vec2(dx, dy));\n"\
"\n"\
" vec2 topLeftCoordInteger = floor(pixelTopLeftCoord);\n"\
" vec2 bottomRightCoordInteger = floor(pixelBottomRightCoord);\n"\
"\n"\
" vec2 interpolators = saturate((pixelBottomRightCoord - bottomRightCoordInteger) / vec2(dx, dy));\n"\
"\n"\
" vec3 topLeftColor = SamplePixel(topLeftCoordInteger);\n"\
" vec3 topRightColor = SamplePixel(vec2(bottomRightCoordInteger.x, topLeftCoordInteger.y));\n"\
" vec3 bottomLeftColor = SamplePixel(vec2(topLeftCoordInteger.x, bottomRightCoordInteger.y));\n"\
" vec3 bottomRightColor = SamplePixel(bottomRightCoordInteger);\n"\
"\n"\
" vec3 topColor = (1.0 - interpolators.x) * topLeftColor + interpolators.x * topRightColor;\n"\
" vec3 bottomColor = (1.0 - interpolators.x) * bottomLeftColor + interpolators.x * bottomRightColor;\n"\
" vec3 interpolatedColor = (1.0 - interpolators.y) * topColor + interpolators.y * bottomColor;\n"\
"\n"\
" gl_FragColor = vec4(LinearToSRGB(interpolatedColor), 1.0);\n"\
" gl_FragColor = vec4(texture2D(surfaceTexture, tc).rgb, 1.0);\n"\
"}\n"
namespace GpBinarizedShaders
{
const char *g_scaleQuadP_GL2 = GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_SCALEQUADP_GLSL;
const char *g_scaleQuadP_GL2 = GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_SCALEQUADP_GLSL;
extern const char *g_drawQuadRGBP_GL2;
extern const char *g_drawQuad15BitP_GL2;

View File

@@ -0,0 +1,45 @@
{
"items" :
[
{
"name" : "Save First",
"itemType" : "Button",
"pos" : [ 174, 48 ],
"size" : [ 80, 20 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Don't Save",
"itemType" : "Button",
"pos" : [ 82, 48 ],
"size" : [ 80, 20 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Cancel",
"itemType" : "Button",
"pos" : [ 20, 48 ],
"size" : [ 50, 20 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Do you want to save the state of the game before quitting?",
"itemType" : "Label",
"pos" : [ 8, 8 ],
"size" : [ 201, 32 ],
"id" : 0,
"enabled" : false
},
{
"name" : "",
"itemType" : "Icon",
"pos" : [ 222, 8 ],
"size" : [ 32, 32 ],
"id" : 1072,
"enabled" : false
}
]
}

View File

@@ -22,7 +22,7 @@
"itemType" : "CustomControl",
"pos" : [ 17, 33 ],
"size" : [ 401, 190 ],
"id" : 2,
"id" : 3,
"enabled" : true
},
{
@@ -30,9 +30,17 @@
"itemType" : "CustomControl",
"pos" : [ 418, 32 ],
"size" : [ 16, 192 ],
"id" : 3,
"id" : 4,
"enabled" : true
},
{
"name" : "Delete",
"itemType" : "Button",
"pos" : [ 228, 240 ],
"size" : [ 58, 20 ],
"id" : 5,
"enabled" : false
},
{
"name" : "^0",
"itemType" : "Label",

View File

@@ -0,0 +1,53 @@
{
"items" :
[
{
"name" : "Okay",
"itemType" : "Button",
"pos" : [ 376, 176 ],
"size" : [ 58, 20 ],
"id" : 1,
"enabled" : true
},
{
"name" : "Cancel",
"itemType" : "Button",
"pos" : [ 302, 176 ],
"size" : [ 58, 20 ],
"id" : 2,
"enabled" : true
},
{
"name" : "",
"itemType" : "CustomControl",
"pos" : [ 17, 33 ],
"size" : [ 401, 122 ],
"id" : 2,
"enabled" : true
},
{
"name" : "",
"itemType" : "CustomControl",
"pos" : [ 418, 32 ],
"size" : [ 16, 124 ],
"id" : 3,
"enabled" : true
},
{
"name" : "",
"itemType" : "EditBox",
"pos" : [ 16, 176 ],
"size" : [ 270, 16 ],
"id" : 4,
"enabled" : true
},
{
"name" : "^0",
"itemType" : "Label",
"pos" : [ 16, 16 ],
"size" : [ 418, 16 ],
"id" : 10,
"enabled" : true
}
]
}

View File

@@ -0,0 +1,29 @@
{
"items" :
[
{
"name" : "No",
"itemType" : "Button",
"pos" : [ 253, 99 ],
"size" : [ 58, 20 ],
"id" : 1,
"enabled" : true
},
{
"name" : "Yes",
"itemType" : "Button",
"pos" : [ 184, 99 ],
"size" : [ 58, 20 ],
"id" : 2,
"enabled" : true
},
{
"name" : "Are you sure that you want to delete this file?",
"itemType" : "Label",
"pos" : [ 16, 16 ],
"size" : [ 295, 74 ],
"id" : 0,
"enabled" : false
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -2,6 +2,7 @@
"add" :
{
"DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json",
"DITL/1041.json" : "ApplicationResourcePatches/DITL/1041.json",
"DITL/2000.json" : "ApplicationResourcePatches/DITL/2000.json",
"DITL/2001.json" : "ApplicationResourcePatches/DITL/2001.json",
"DITL/2002.json" : "ApplicationResourcePatches/DITL/2002.json",
@@ -9,9 +10,12 @@
"DITL/2004.json" : "ApplicationResourcePatches/DITL/2004.json",
"DITL/2005.json" : "ApplicationResourcePatches/DITL/2005.json",
"DITL/2006.json" : "ApplicationResourcePatches/DITL/2006.json",
"DITL/2007.json" : "ApplicationResourcePatches/DITL/2007.json",
"DITL/2008.json" : "ApplicationResourcePatches/DITL/2008.json",
"PICT/1300.bmp" : "ApplicationResourcePatches/PICT/1300.bmp",
"PICT/1301.bmp" : "ApplicationResourcePatches/PICT/1301.bmp",
"PICT/1302.bmp" : "ApplicationResourcePatches/PICT/1302.bmp",
"PICT/1303.bmp" : "ApplicationResourcePatches/PICT/1303.bmp",
"PICT/1971.bmp" : "ApplicationResourcePatches/PICT/1971.bmp",
"PICT/1972.bmp" : "ApplicationResourcePatches/PICT/1972.bmp",
"PICT/1973.bmp" : "ApplicationResourcePatches/PICT/1973.bmp",

View File

@@ -21,7 +21,8 @@ const D3D_SHADER_MACRO drawQuadDefs[] =
const D3D_SHADER_MACRO drawQuadICCProfileDefs[] =
{
{ "USE_ICC_PROFILE", nullptr }
{ "USE_ICC_PROFILE", nullptr },
{ nullptr }
};
const CompileJob kCompileJobs[] =
@@ -108,7 +109,7 @@ int main(int argc, const char **argv)
if (result != S_OK)
{
fprintf(stderr, "Compile failure error: %x", static_cast<int>(result));
fprintf(stderr, "Compile failure error: %x\n", static_cast<int>(result));
}
if (errorMsgs)

View File

@@ -18,7 +18,6 @@ x64\Release\hqx2gp.exe "GliderProData\Houses\Castle o' the Air.binhex" "DefaultT
x64\Release\hqx2gp.exe "GliderProData\Houses\CD Demo House.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\CD Demo House"
x64\Release\hqx2gp.exe "GliderProData\Houses\Davis Station.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Davis Station"
x64\Release\hqx2gp.exe "GliderProData\Houses\Demo House.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Demo House"
x64\Release\hqx2gp.exe "GliderProData\Houses\Empty House.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Empty House"
x64\Release\hqx2gp.exe "GliderProData\Houses\Fun House.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Fun House"
x64\Release\hqx2gp.exe "GliderProData\Houses\Grand Prix.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Grand Prix"
x64\Release\hqx2gp.exe "GliderProData\Houses\ImagineHouse PRO II.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\ImagineHouse PRO II"
@@ -28,7 +27,6 @@ x64\Release\hqx2gp.exe "GliderProData\Houses\Leviathan.binhex" "DefaultTimestamp
x64\Release\hqx2gp.exe "GliderProData\Houses\Metropolis.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Metropolis"
x64\Release\hqx2gp.exe "GliderProData\Houses\Nemo's Market.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Nemo's Market"
x64\Release\hqx2gp.exe "GliderProData\Houses\Rainbow's End.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Rainbow's End"
x64\Release\hqx2gp.exe "GliderProData\Houses\Sampler.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Sampler"
x64\Release\hqx2gp.exe "GliderProData\Houses\Slumberland.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Slumberland"
x64\Release\hqx2gp.exe "GliderProData\Houses\SpacePods.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\SpacePods"
x64\Release\hqx2gp.exe "GliderProData\Houses\Teddy World.binhex" "DefaultTimestamp.timestamp" "Packaged\Houses\Teddy World"
@@ -41,17 +39,15 @@ x64\Release\gpr2gpa.exe "Packaged\Houses\Castle o' the Air.gpr" "DefaultTimestam
x64\Release\gpr2gpa.exe "Packaged\Houses\CD Demo House.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\CD Demo House.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Davis Station.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Davis Station.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Demo House.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Demo House.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Empty House.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Empty House.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Fun House.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Fun House.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Grand Prix.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Grand Prix.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\ImagineHouse PRO II.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\ImagineHouse PRO II.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\In The Mirror.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\In The Mirror.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Grand Prix.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Grand Prix.gpa" "HousePatches\GrandPrix.json"
x64\Release\gpr2gpa.exe "Packaged\Houses\ImagineHouse PRO II.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\ImagineHouse PRO II.gpa" "HousePatches\ImagineHousePROII.json"
x64\Release\gpr2gpa.exe "Packaged\Houses\In The Mirror.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\In The Mirror.gpa" "HousePatches\InTheMirror.json"
x64\Release\gpr2gpa.exe "Packaged\Houses\Land of Illusion.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Land of Illusion.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Leviathan.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Leviathan.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Leviathan.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Leviathan.gpa" "HousePatches\Leviathan.json"
x64\Release\gpr2gpa.exe "Packaged\Houses\Metropolis.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Metropolis.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Nemo's Market.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Nemo's Market.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Rainbow's End.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Rainbow's End.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Sampler.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Sampler.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Rainbow's End.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Rainbow's End.gpa" "HousePatches\RainbowsEnd.json"
x64\Release\gpr2gpa.exe "Packaged\Houses\Slumberland.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Slumberland.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\SpacePods.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\SpacePods.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Teddy World.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Teddy World.gpa"

View File

@@ -4,7 +4,24 @@
//----------------------------------------------------------------------------
//============================================================================
#include "About.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "Environ.h"
#include "Externs.h"
#include "GpApplicationName.h"
#include "GpBuildVersion.h"
#include "IGpSystemServices.h"
#include "RenderedFont.h"
#include "GpRenderedFontMetrics.h"
#include "ResolveCachingColor.h"
#include "ResourceManager.h"
#include "ScanlineMask.h"
#include "WindowDef.h"
#include "WindowManager.h"
#include "PLArrayView.h"
#include "PLDrivers.h"
#include "PLKeyEncoding.h"
#include "PLControlDefinitions.h"
#include "FontFamily.h"
@@ -19,21 +36,6 @@
#include "PLSysCalls.h"
#include "PLTimeTaggedVOSEvent.h"
#include "PLWidgets.h"
#include "About.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "Environ.h"
#include "Externs.h"
#include "GpApplicationName.h"
#include "GpBuildVersion.h"
#include "HostSystemServices.h"
#include "RenderedFont.h"
#include "GpRenderedFontMetrics.h"
#include "ResolveCachingColor.h"
#include "ResourceManager.h"
#include "ScanlineMask.h"
#include "WindowDef.h"
#include "WindowManager.h"
static void HiLiteOkayButton (DrawSurface *surface);
@@ -333,10 +335,10 @@ void DoAboutFramework (void)
DrawSurface *surface = window->GetDrawSurface();
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 0), PSTR(GP_APPLICATION_NAME " " GP_APPLICATION_VERSION_STRING " \xa9" GP_APPLICATION_COPYRIGHT_STRING), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 2), PSTR(GP_APPLICATION_NAME " is an unoffical third-party port of Glider PRO\xaa."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 2), PSTR(GP_APPLICATION_NAME " is an unoffical third-party port of Glider PRO."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 4), PSTR("This software is not maintained by, supported by, endorsed by, or"), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 5), PSTR("otherwise associated with the authors and publishers of Glider PRO\xaa."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 5), PSTR("otherwise associated with the authors or publishers of Glider PRO."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 7), PSTR("Please do not contact any of them regarding issues that you have"), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 8), PSTR("with " GP_APPLICATION_NAME "."), blackColor, font);
@@ -418,7 +420,7 @@ static void UpdateMainPict (Dialog *theDial)
Str255 theStr, theStr2;
uint64_t freeMemory;
freeMemory = PortabilityLayer::HostSystemServices::GetInstance()->GetFreeMemoryCosmetic();
freeMemory = PLDrivers::GetSystemServices()->GetFreeMemoryCosmetic();
PasStringCopy(PSTR("Memory: "), theStr); // display free memory

View File

@@ -5,17 +5,17 @@
//----------------------------------------------------------------------------
//============================================================================
#include "PLResources.h"
#include "PLBigEndian.h"
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "IGpCursor.h"
#include "IGpDisplayDriver.h"
#include "MemoryManager.h"
#include "ResourceManager.h"
#include "PLDrivers.h"
#include "PLResources.h"
#include "PLBigEndian.h"
#include <assert.h>
@@ -219,7 +219,7 @@ IGpCursor *LoadColorCursor(int16_t resID)
mm->Release(colorValues);
IGpCursor *cursor = PortabilityLayer::HostDisplayDriver::GetInstance()->CreateColorCursor(width, height, pixelDataRGBA, cursorHeader->m_hotSpotX, cursorHeader->m_hotSpotY);
IGpCursor *cursor = PLDrivers::GetDisplayDriver()->CreateColorCursor(width, height, pixelDataRGBA, cursorHeader->m_hotSpotX, cursorHeader->m_hotSpotY);
mm->Release(pixelDataRGBA);
@@ -251,7 +251,7 @@ Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCu
else // But, if the cursor loaded ok
{ // add it to our list or cursor handles
(*compiledBallCursH)->frame[i].hwCursor = hwCursor;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(hwCursor);
PLDrivers::GetDisplayDriver()->SetCursor(hwCursor);
}
}
InitCursor(); // Show the cursor again (as arrow)
@@ -343,10 +343,10 @@ void IncrementCursor (void)
acur->index++;
acur->index %= acur->n;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
PLDrivers::GetDisplayDriver()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
}
else
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kWait);
PLDrivers::GetDisplayDriver()->SetStandardCursor(EGpStandardCursors::kWait);
}
//-------------------------------------------------------------- DecrementCursor
@@ -363,10 +363,10 @@ void DecrementCursor (void)
if (((*animCursorH)->index) < 0)
(*animCursorH)->index = ((*animCursorH)->n) - 1;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
PLDrivers::GetDisplayDriver()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
}
else
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kWait);
PLDrivers::GetDisplayDriver()->SetStandardCursor(EGpStandardCursors::kWait);
}
//-------------------------------------------------------------- SpinCursor

View File

@@ -147,8 +147,6 @@ void CenterDialog (SInt16 dialogID)
void GetDialogRect (Rect *bounds, short dialogID)
{
Byte wasState;
Handle dlogHandle = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('DLOG', dialogID).StaticCast<void>();
if (dlogHandle != nil)
{
@@ -343,10 +341,8 @@ void ZoomOutAlertRect (short alertID)
void FlashDialogButton (Dialog *theDialog, short itemNumber)
{
Rect itemRect;
ControlHandle itemHandle;
UInt32 dummyLong;
short itemType;
PortabilityLayer::Widget *widget = theDialog->GetItems()[itemNumber - 1].GetWidget();
@@ -445,9 +441,7 @@ void ToggleDialogItemValue (Dialog *theDialog, short item)
void SetDialogNumToStr (Dialog *theDialog, short item, long theNumber)
{
Str255 theString;
Rect itemRect;
ControlHandle itemHandle;
short itemType;
NumToString(theNumber, theString);
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
@@ -570,7 +564,7 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
{
ControlHandle iHandle;
Str255 stringCopy;
short iType, i, inset;
short inset;
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
@@ -622,9 +616,7 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
{
;
Str255 stringCopy;
short iType;
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);

View File

@@ -5,18 +5,19 @@
//----------------------------------------------------------------------------
//============================================================================
#include "PLResources.h"
#include "PLPasStr.h"
#include "DisplayDeviceManager.h"
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "HostSystemServices.h"
#include "MenuManager.h"
#include "IGpDisplayDriver.h"
#include "IGpSystemServices.h"
#include "Vec2i.h"
#include "WindowManager.h"
#include "PLDrivers.h"
#include "PLResources.h"
#include "PLPasStr.h"
#include <algorithm>
#define kSwitchDepthAlert 130
@@ -301,8 +302,8 @@ void CheckOurEnvirons (void)
thisMac.numScreens = HowManyUsableScreens(false, true, true);
thisMac.isResolutionDirty = true;
thisMac.isTouchscreen = PortabilityLayer::HostSystemServices::GetInstance()->IsTouchscreen();
thisMac.isMouseTouchscreen = PortabilityLayer::HostSystemServices::GetInstance()->IsUsingMouseAsTouch();
thisMac.isTouchscreen = PLDrivers::GetSystemServices()->IsTouchscreen();
thisMac.isMouseTouchscreen = PLDrivers::GetSystemServices()->IsUsingMouseAsTouch();
FlushResolutionChange();
}
@@ -415,16 +416,14 @@ void HandleDepthSwitching (void)
thisMac.isDepth = isDepthPref;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetUseICCProfile(isUseICCProfile != 0);
PLDrivers::GetDisplayDriver()->SetUseICCProfile(isUseICCProfile != 0);
}
void GetDeviceRect(Rect *rect)
{
unsigned int width;
unsigned int height;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&width, &height);
PortabilityLayer::Vec2i displayResolution = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution();
SetRect(rect, 0, 0, static_cast<short>(width), static_cast<short>(height));
SetRect(rect, 0, 0, static_cast<short>(displayResolution.m_x), static_cast<short>(displayResolution.m_y));
}
Boolean AreWeColorOrGrayscale()

View File

@@ -20,7 +20,6 @@
#include "WindowManager.h"
short BitchAboutColorDepth (void);
void HandleMouseEvent (const GpMouseInputEvent &, uint32_t);
void HandleKeyEvent (const KeyDownStates &keyStates, const GpKeyboardInputEvent &);
void HandleUpdateEvent (EventRecord *);
@@ -45,20 +44,6 @@ extern Boolean autoRoomEdit, newRoomNow, isPlayMusicIdle;
//============================================================== Functions
//-------------------------------------------------------------- BitchAboutColorDepth
// Display a dialog that alerts the user that they have switched the bit<69>
// depth of the monitor under our noses. They must return it to previous.
short BitchAboutColorDepth (void)
{
#define kColorSwitchedAlert 1042
short sheSaid;
// CenterAlert(kColorSwitchedAlert);
sheSaid = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(kColorSwitchedAlert, nullptr);
return (sheSaid);
}
//-------------------------------------------------------------- HandleMouseEvent
// Handle a mouse click event.

View File

@@ -118,7 +118,7 @@ typedef struct
Boolean wasEscPauseKey;
Boolean wasDoAutoDemo, wasAutoScale;
Boolean wasDoBackground, wasHouseChecks;
Boolean wasPrettyMap, wasBitchDialogs;
Boolean wasPrettyMap, wasComplainDialogs;
Boolean wasUseICCProfile;
} prefsInfo;
@@ -201,6 +201,7 @@ short RandomInt (short);
long RandomLong (long);
void RedAlert (short);
void LoadGraphic (DrawSurface *surface, short resID); // Only loads from app resources
void LoadGraphicNoDither (DrawSurface *surface, short resID);
void LoadGraphicCustom (DrawSurface *surface, short resID); // Supports custom graphics
void LoadScaledGraphic (DrawSurface *, short, Rect *); // Only loads from app resources
void LoadScaledGraphicCustom (DrawSurface *, short, Rect *); // Supports custom graphics

View File

@@ -99,6 +99,7 @@ void SortHighScores (void);
void ZeroHighScores (void);
void ZeroAllButHighestScore (void);
Boolean TestHighScore (void);
void WriteScores (void); // Either saves the house or saves scores, depending on if it's read-only
Boolean WriteScoresToDisk (void);
Boolean ReadScoresFromDisk (void);
@@ -424,7 +425,7 @@ void HandleBands (void); // --- RubberBands.c
Boolean AddBand (gliderPtr, SInt16, SInt16, Boolean);
void KillAllBands (void);
void SaveGame2 (void); // --- SavedGames.c
Boolean SaveGame2 (void); // --- SavedGames.c
Boolean OpenSavedGame (void);
//void SaveGame (Boolean);
@@ -460,7 +461,6 @@ void DumpTriggerSound (void);
void InitSound (void);
void KillSound (void);
void TellHerNoSounds (void);
void BitchAboutSM3 (void);
void InitScoreboardMap (void); // --- StructuresInit.c
void InitGliderMap (void);

View File

@@ -439,8 +439,8 @@ namespace touchScreenControlGraphics
BandsDisabled,
BandsActive,
BandsIdle,
FlipActive,
FlipIdle,
StopActive,
StopIdle,
MoveRightActive,
MoveRightIdle,
MoveLeftActive,

View File

@@ -55,5 +55,5 @@ extern long theScore;
extern short playOriginH, playOriginV;
extern short thisRoomNumber, theMode, batteryTotal, bandsTotal;
extern short foilTotal, mortals, numMasterObjects, previousRoom;
extern Boolean fileDirty, gameDirty, showFoil, doZooms, isPlayMusicGame;
extern Boolean fileDirty, showFoil, doZooms, isPlayMusicGame;

View File

@@ -1,20 +1,16 @@
#include "GpAppInterface.h"
#include "DisplayDeviceManager.h"
#include "HostAudioDriver.h"
#include "HostFileSystem.h"
#include "HostFontHandler.h"
#include "HostDisplayDriver.h"
#include "HostLogDriver.h"
#include "HostSystemServices.h"
#include "HostInputDriver.h"
#include "HostVOSEventQueue.h"
#include "MenuManager.h"
#include "WindowManager.h"
#include "PLDrivers.h"
#include "PLSysCalls.h"
int gpAppMain();
void gpAppInit();
class GpAppInterfaceImpl final : public GpAppInterface
{
public:
@@ -23,14 +19,7 @@ public:
void PL_IncrementTickCounter(uint32_t count) override;
void PL_Render(IGpDisplayDriver *displayDriver) override;
void PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance) override;
void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) override;
void PL_HostInputDriver_SetInstances(IGpInputDriver *const* instances, size_t numInstances) override;
void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) override;
void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) override;
void PL_HostLogDriver_SetInstance(IGpLogDriver *instance) override;
void PL_HostFontHandler_SetInstance(IGpFontHandler *instance) override;
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
GpDriverCollection *PL_GetDriverCollection() override;
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
};
@@ -42,7 +31,7 @@ void GpAppInterfaceImpl::ApplicationInit()
int GpAppInterfaceImpl::ApplicationMain()
{
return gpAppMain();
return PLSysCalls::MainExitWrapper(gpAppMain);
}
void GpAppInterfaceImpl::PL_IncrementTickCounter(uint32_t count)
@@ -56,44 +45,9 @@ void GpAppInterfaceImpl::PL_Render(IGpDisplayDriver *displayDriver)
PortabilityLayer::MenuManager::GetInstance()->RenderFrame(displayDriver);
}
void GpAppInterfaceImpl::PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance)
GpDriverCollection *GpAppInterfaceImpl::PL_GetDriverCollection()
{
PortabilityLayer::HostFileSystem::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance)
{
PortabilityLayer::HostDisplayDriver::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostLogDriver_SetInstance(IGpLogDriver *instance)
{
PortabilityLayer::HostLogDriver::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance)
{
PortabilityLayer::HostSystemServices::SetInstance(instance);
}
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(IGpFontHandler *instance)
{
PortabilityLayer::HostFontHandler::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance)
{
PortabilityLayer::HostVOSEventQueue::SetInstance(instance);
return PLDrivers::GetDriverCollection();
}
void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context)

View File

@@ -17,18 +17,22 @@
#include "FileManager.h"
#include "FontFamily.h"
#include "FontManager.h"
#include "HostSystemServices.h"
#include "House.h"
#include "IGpDisplayDriver.h"
#include "IGpSystemServices.h"
#include "GpIOStream.h"
#include "MainWindow.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
#include "Vec2i.h"
#include "WindowManager.h"
#include "PLDrivers.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#define kHighScoresPictID 1994
#define kHighScoresMaskID 1998
#define kHighNameDialogID 1020
@@ -55,7 +59,7 @@ short lastHighScore;
Boolean keyStroke;
extern short splashOriginH, splashOriginV;
extern Boolean quickerTransitions, resumedSavedGame;
extern Boolean quickerTransitions, resumedSavedGame, houseIsReadOnly;
//============================================================== Functions
@@ -108,13 +112,12 @@ void DoHighScores (void)
void DrawHighScores (DrawSurface *surface)
{
DrawSurface *tempMap, *tempMask;
DrawSurface *wasCPort;
PLError_t theErr;
houseType *thisHousePtr;
Rect tempRect, tempRect2;
Str255 tempStr;
short scoreLeft, bannerWidth, i, dropIt;
char wasState;
PortabilityLayer::ResolveCachingColor blackColor = PortabilityLayer::RGBAColor::Create(0, 0, 0, 255);
PortabilityLayer::ResolveCachingColor yellowColor = PortabilityLayer::RGBAColor::Create(255, 255, 0, 255);
PortabilityLayer::ResolveCachingColor cyanColor = PortabilityLayer::RGBAColor::Create(0, 255, 255, 255);
@@ -277,7 +280,6 @@ void SortHighScores (void)
houseType *thisHousePtr;
long greatest;
short i, h, which;
char wasState;
thisHousePtr = *thisHouse;
@@ -313,7 +315,6 @@ void ZeroHighScores (void)
{
houseType *thisHousePtr;
short i;
char wasState;
thisHousePtr = *thisHouse;
@@ -356,7 +357,6 @@ Boolean TestHighScore (void)
{
houseType *thisHousePtr;
short placing, i;
char wasState;
if (resumedSavedGame)
return (false);
@@ -384,7 +384,7 @@ Boolean TestHighScore (void)
if (placing != -1)
{
int64_t scoreTimestamp = PortabilityLayer::HostSystemServices::GetInstance()->GetTime();
int64_t scoreTimestamp = PLDrivers::GetSystemServices()->GetTime();
if (scoreTimestamp < 0)
scoreTimestamp = 0;
else if (scoreTimestamp > 0xffffffff)
@@ -402,7 +402,8 @@ Boolean TestHighScore (void)
thisHousePtr->highScores.timeStamps[kMaxScores - 1] = static_cast<uint32_t>(scoreTimestamp);
thisHousePtr->highScores.levels[kMaxScores - 1] = CountRoomsVisited();
SortHighScores();
gameDirty = true;
WriteScores();
}
if (placing != -1)
@@ -502,6 +503,18 @@ int16_t NameFilter (void *context, Dialog *dial, const TimeTaggedVOSEvent *evt)
return -1;
}
void MoveDialogToTopOfScreen(Dialog *dial)
{
Window *window = dial->GetWindow();
PortabilityLayer::Vec2i pos = window->GetPosition();
unsigned int height = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
pos.m_y = (height - window->GetDrawSurface()->m_port.GetRect().Height()) / 8;
dial->GetWindow()->SetPosition(pos);
}
//-------------------------------------------------------------- GetHighScoreName
// Brings up a dialog to get player's name (due to a high score).
@@ -529,6 +542,9 @@ void GetHighScoreName (short place)
UpdateNameDialog(theDial);
if (PLDrivers::GetSystemServices()->IsTextInputObstructive())
MoveDialogToTopOfScreen(theDial);
Window *exclStack = theDial->GetWindow();
wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms
@@ -639,6 +655,9 @@ void GetHighScoreBanner (void)
UpdateBannerDialog(theDial);
if (PLDrivers::GetSystemServices()->IsTextInputObstructive())
MoveDialogToTopOfScreen(theDial);
Window *exclStack = theDial->GetWindow();
wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms
@@ -734,11 +753,20 @@ Boolean WriteScoresToDisk (void)
scoresStream->Close();
gameDirty = false;
return (true);
}
void WriteScores (void)
{
if (houseIsReadOnly)
{
if (!WriteScoresToDisk())
YellowAlert(kYellowFailedWrite, 0);
}
else if (!WriteHouse(theMode == kEditMode))
YellowAlert(kYellowFailedWrite, 0);
}
//-------------------------------------------------------------- ReadScoresFromDisk
Boolean ReadScoresFromDisk (void)

View File

@@ -12,8 +12,9 @@
#include "PLSysCalls.h"
#include "DialogUtils.h"
#include "Externs.h"
#include "FileBrowserUI.h"
#include "FileManager.h"
#include "HostFileSystem.h"
#include "FontFamily.h"
#include "House.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
@@ -24,6 +25,7 @@
#define kGoToDialogID 1043
void WriteOutPrefs(void);
void UpdateGoToDialog (Dialog *);
int16_t GoToFilter (void *context, Dialog *dial, const TimeTaggedVOSEvent *evt);
@@ -47,6 +49,35 @@ extern Boolean houseOpen, noRoomAtAll;
extern Boolean twoPlayerGame, wardBitSet, phoneBitSet;
static void FBUI_DrawLabels(DrawSurface *surface, const Point &basePoint)
{
}
static void FBUI_DrawFileDetails(DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails)
{
}
static void *FBUI_LoadFileDetails(PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
{
return nullptr;
}
static void FBUI_FreeFileDetails(void *fileDetails)
{
}
static PortabilityLayer::FileBrowserUI_DetailsCallbackAPI GetHouseDetailsAPI()
{
PortabilityLayer::FileBrowserUI_DetailsCallbackAPI api;
api.m_drawLabelsCallback = FBUI_DrawLabels;
api.m_drawFileDetailsCallback = FBUI_DrawFileDetails;
api.m_loadFileDetailsCallback = FBUI_LoadFileDetails;
api.m_freeFileDetailsCallback = FBUI_FreeFileDetails;
return api;
}
//============================================================== Functions
//-------------------------------------------------------------- CreateNewHouse
// Called to create a new house file.
@@ -67,7 +98,7 @@ Boolean CreateNewHouse (void)
char savePath[sizeof(theSpec.m_name) + 1];
size_t savePathLength = 0;
if (!fm->PromptSaveFile(theSpec.m_dir, savePath, savePathLength, sizeof(theSpec.m_name), PSTR("My House"), PSTR("Create House")))
if (!fm->PromptSaveFile(theSpec.m_dir, 'gliH', savePath, savePathLength, sizeof(theSpec.m_name), PSTR("My House"), PSTR("Create House"), GetHouseDetailsAPI()))
return false;
assert(savePathLength < sizeof(theSpec.m_name) - 1);
@@ -104,6 +135,8 @@ Boolean CreateNewHouse (void)
InitCursor();
if (!OpenHouse())
return (false);
WriteOutPrefs();
return (true);
}

View File

@@ -5,23 +5,23 @@
//----------------------------------------------------------------------------
//============================================================================
#include "PLDialogs.h"
#include "PLMovies.h"
#include "PLResources.h"
#include "PLStringCompare.h"
#include "PLPasStr.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "Externs.h"
#include "Environ.h"
#include "FileManager.h"
#include "HostFileSystem.h"
#include "HostSystemServices.h"
#include "House.h"
#include "GpIOStream.h"
#include "House.h"
#include "IGpSystemServices.h"
#include "ObjectEdit.h"
#include "ResourceManager.h"
#include "PLDialogs.h"
#include "PLDrivers.h"
#include "PLMovies.h"
#include "PLResources.h"
#include "PLStringCompare.h"
#include "PLPasStr.h"
#define kSaveChangesAlert 1002
#define kSaveChanges 1
@@ -39,7 +39,7 @@ Rect movieRect;
PortabilityLayer::IResourceArchive *houseResFork;
short wasHouseVersion;
GpIOStream *houseStream;
Boolean houseOpen, fileDirty, gameDirty;
Boolean houseOpen, fileDirty;
Boolean changeLockStateOfHouse, saveHouseLocked, houseIsReadOnly;
Boolean hasMovie, tvInRoom;
@@ -185,78 +185,6 @@ Boolean OpenSpecificHouse (const VFileSpec &specs)
}
#endif
//-------------------------------------------------------------- SaveHouseAs
#ifndef COMPILEDEMO
Boolean SaveHouseAs (void)
{
// TEMP - fix this later -- use NavServices (see House.c)
/*
StandardFileReply theReply;
FSSpec oldHouse;
PLError_t theErr;
Boolean noProblems;
Str255 tempStr;
noProblems = true;
GetLocalizedString(15, tempStr);
StandardPutFile(tempStr, thisHouseName, &theReply);
if (theReply.sfGood)
{
oldHouse = theHousesSpecs[thisHouseIndex];
CloseHouseResFork(); // close this house file
theErr = FSClose(houseRefNum);
if (theErr != PLErrors::kNone)
{
CheckFileError(theErr, "\pPreferences");
return(false);
}
// create new house file
theErr = FSpCreate(&theReply.sfFile, 'ozm5', 'gliH', theReply.sfScript);
if (!CheckFileError(theErr, theReply.sfFile.name))
return (false);
HCreateResFile(theReply.sfFile.vRefNum, theReply.sfFile.parID,
theReply.sfFile.name);
if (ResError() != PLErrors::kNone)
YellowAlert(kYellowFailedResCreate, ResError());
PasStringCopy(theReply.sfFile.name, thisHouseName);
// open new house data fork
theErr = FSpOpenDF(&theReply.sfFile, fsRdWrPerm, &houseRefNum);
if (!CheckFileError(theErr, thisHouseName))
return (false);
houseOpen = true;
noProblems = WriteHouse(false); // write out house data
if (!noProblems)
return(false);
BuildHouseList();
if (OpenSpecificHouse(&theReply.sfFile)) // open new house again
{
}
else
{
if (OpenSpecificHouse(&oldHouse))
{
YellowAlert(kYellowOpenedOldHouse, 0);
}
else
{
YellowAlert(kYellowLostAllHouses, 0);
noProblems = false;
}
}
}
return (noProblems);
*/
return false;
}
#endif
//-------------------------------------------------------------- ReadHouse
// With a house open, this function reads in the actual bits of data<74>
@@ -711,7 +639,6 @@ Boolean ReadHouse (void)
objActive = kNoObjectSelected;
ReflectCurrentRoom(true);
gameDirty = false;
fileDirty = false;
UpdateMenus(false);
@@ -748,7 +675,7 @@ Boolean WriteHouse (Boolean checkIt)
if (fileDirty)
{
int64_t currentTime = PortabilityLayer::HostSystemServices::GetInstance()->GetTime();
int64_t currentTime = PLDrivers::GetSystemServices()->GetTime();
if (currentTime > 0x7fffffff)
currentTime = 0x7fffffff;
@@ -796,7 +723,6 @@ Boolean WriteHouse (Boolean checkIt)
ReflectCurrentRoom(true);
}
gameDirty = false;
fileDirty = false;
UpdateMenus(false);
return (true);
@@ -812,17 +738,7 @@ Boolean CloseHouse (void)
if (!houseOpen)
return (true);
if (gameDirty)
{
if (houseIsReadOnly)
{
if (!WriteScoresToDisk())
YellowAlert(kYellowFailedWrite, 0);
}
else if (!WriteHouse(theMode == kEditMode))
YellowAlert(kYellowFailedWrite, 0);
}
else if (fileDirty)
if (fileDirty)
{
#ifndef COMPILEDEMO
if (!QuerySaveChanges()) // false signifies user canceled
@@ -938,6 +854,10 @@ void YellowAlert (short whichAlert, short identifier)
Boolean IsFileReadOnly (const VFileSpec &spec)
{
// Kind of annoying, but itch.io doesn't preserve read-only flags and there doesn't seem to be any way around that.
if (spec.m_dir == PortabilityLayer::VirtualDirectories::kApplicationData || spec.m_dir == PortabilityLayer::VirtualDirectories::kGameData)
return true;
return PortabilityLayer::FileManager::GetInstance()->FileLocked(spec.m_dir, spec.m_name);
}

View File

@@ -6,16 +6,17 @@
//============================================================================
#include "PLNumberFormatting.h"
#include "PLKeyEncoding.h"
#include "PLPasStr.h"
#include "Externs.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "PLArrayView.h"
#include "PLDrivers.h"
#include "PLEditboxWidget.h"
#include "PLNumberFormatting.h"
#include "PLKeyEncoding.h"
#include "PLPasStr.h"
#include "PLTimeTaggedVOSEvent.h"
@@ -179,7 +180,7 @@ int16_t HouseFilter(void *context, Dialog *dial, const TimeTaggedVOSEvent *evt)
{
if (houseCursorIs != kBeamCursor)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
PLDrivers::GetDisplayDriver()->SetStandardCursor(EGpStandardCursors::kIBeam);
houseCursorIs = kBeamCursor;
}
}

View File

@@ -602,8 +602,6 @@ Boolean KeepObjectLegal (void)
#ifndef COMPILEDEMO
void WrapBannerAndTrailer (void)
{
char wasState;
WrapText((*thisHouse)->banner, 40);
WrapText((*thisHouse)->trailer, 64);
}
@@ -615,7 +613,6 @@ void WrapBannerAndTrailer (void)
void ValidateNumberOfRooms (void)
{
long countedRooms, reportsRooms;
char wasState;
reportsRooms = (long)(*thisHouse)->nRooms;
countedRooms = (GetHandleSize(thisHouse.StaticCast<void>()) -
@@ -637,7 +634,6 @@ void CheckDuplicateFloorSuite (void)
#define kRoomsTimesSuites 8192
short i, numRooms, bitPlace;
char *pidgeonHoles;
char wasState;
pidgeonHoles = (char *)NewPtrClear(sizeof(char) * kRoomsTimesSuites);
if (pidgeonHoles == nil)
@@ -672,7 +668,6 @@ void CheckDuplicateFloorSuite (void)
void CompressHouse (void)
{
short wasFirstRoom, roomNumber, probe;
char wasState;
Boolean compressing, probing;
wasFirstRoom = (*thisHouse)->firstRoom;
@@ -720,7 +715,6 @@ void LopOffExtraRooms (void)
{
long newSize;
short r, count;
char wasState;
Str255 message;
count = 0;
@@ -756,7 +750,6 @@ void LopOffExtraRooms (void)
void ValidateRoomNumbers (void)
{
short i, numRooms;
char wasState;
Str255 message;
numRooms = (*thisHouse)->nRooms;
@@ -796,7 +789,6 @@ void ValidateRoomNumbers (void)
void CountUntitledRooms (void)
{
short i, numRooms;
char wasState;
numRooms = (*thisHouse)->nRooms;
for (i = 0; i < numRooms; i++)
@@ -814,7 +806,6 @@ void CountUntitledRooms (void)
void CheckRoomNameLength (void)
{
short i, numRooms;
char wasState;
numRooms = (*thisHouse)->nRooms;
for (i = 0; i < numRooms; i++)
@@ -837,7 +828,6 @@ void CheckRoomNameLength (void)
void MakeSureNumObjectsJives (void)
{
short i, h, numRooms, count;
char wasState;
numRooms = (*thisHouse)->nRooms;
for (i = 0; i < numRooms; i++)
@@ -866,7 +856,6 @@ void MakeSureNumObjectsJives (void)
void KeepAllObjectsLegal (void)
{
short i, h, numRooms;
char wasState;
Str255 message;
numRooms = (*thisHouse)->nRooms;
@@ -901,7 +890,6 @@ void KeepAllObjectsLegal (void)
void CheckForStaircasePairs (void)
{
short i, h, g, numRooms, neighbor;
char wasState;
Boolean hasStairs;
Str255 message;

View File

@@ -42,7 +42,7 @@ void DoPause (void);
void DoTouchScreenMenu (void);
void DoBatteryEngaged (gliderPtr);
void DoHeliumEngaged (gliderPtr);
Boolean QuerySaveGame (void);
void QuerySaveGame (Boolean &save, Boolean &cancel);
demoPtr demoData;
@@ -75,13 +75,24 @@ void DoCommandKey (void)
if (theKeys->IsSet(PL_KEY_ASCII('Q')))
{
Boolean wantCancel = false;
playing = false;
paused = false;
if ((!twoPlayerGame) && (!demoGoing))
{
if (QuerySaveGame())
SaveGame2(); // New save game.
Boolean wantSave = false;
QuerySaveGame(wantSave, wantCancel);
if (wantSave)
{
// New save game.
if (!SaveGame2())
wantCancel = true;
}
}
if (wantCancel)
playing = true;
}
else if ((theKeys->IsSet(PL_KEY_ASCII('S'))) && (!twoPlayerGame))
{
@@ -326,12 +337,23 @@ void DoTouchScreenMenu(void)
switch (highlightedItem)
{
case TouchScreenMenuItems::kQuit:
playing = false;
paused = false;
if ((!twoPlayerGame) && (!demoGoing))
{
if (QuerySaveGame())
SaveGame2(); // New save game.
Boolean wantCancel = false;
playing = false;
paused = false;
if ((!twoPlayerGame) && (!demoGoing))
{
Boolean wantSave = false;
QuerySaveGame(wantSave, wantCancel);
if (wantSave)
{
if (!SaveGame2()) // New save game.
wantCancel = true;
}
}
if (wantCancel)
playing = true;
}
break;
case TouchScreenMenuItems::kSave:
@@ -494,6 +516,12 @@ void DoHeliumEngaged (gliderPtr thisGlider)
if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl)))
DoCommandKey();
// Cheesy - Use touchscreen menu as quit
if (pendingTouchScreenMenu)
{
playing = false;
paused = false;
}
#endif
}
@@ -787,19 +815,19 @@ void GetInput (gliderPtr thisGlider)
//-------------------------------------------------------------- QuerySaveGame
Boolean QuerySaveGame (void)
void QuerySaveGame (Boolean &save, Boolean &cancel)
{
#define kSaveGameAlert 1041
#define kYesSaveGameButton 1
#define kNoSaveGameButton 2
#define kCancelSaveGameButton 3
short hitWhat;
InitCursor();
FlushEvents();
// CenterAlert(kSaveGameAlert);
hitWhat = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(kSaveGameAlert, nullptr);
if (hitWhat == kYesSaveGameButton)
return (true);
else
return (false);
save = (hitWhat == kYesSaveGameButton);
cancel = (hitWhat == kCancelSaveGameButton);
}

View File

@@ -8,17 +8,17 @@
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "GpApplicationName.h"
#include "Map.h"
#include "MenuManager.h"
#include "PLKeyEncoding.h"
#include "PLPasStr.h"
#include "RectUtils.h"
#include "ResourceManager.h"
#include "Tools.h"
#include "PLDrivers.h"
#include "PLKeyEncoding.h"
#include "PLPasStr.h"
#define kHandCursorID 128
#define kVertCursorID 129
@@ -55,7 +55,6 @@ void InitializeMenus (void)
RedAlert(kErrFailedResourceLoad);
//AppendResMenu(appleMenu, 'DRVR'); // GP: We don't support this
AppendMenuItem(appleMenu, 0, 0, 0, 0, true, false, PSTR("About " GP_APPLICATION_NAME "\xc9"));
AppendMenuItem(appleMenu, 0, 0, 0, 0, true, false, PSTR("Export Source Code\xc9"));
InsertMenu(appleMenu, 0);
gameMenu = GetMenu(kGameMenuID);
@@ -102,7 +101,7 @@ IGpCursor *LoadBWCursor(int resID)
const BWCursor *cursorData = static_cast<const BWCursor *>(*resHdl);
IGpCursor *cursor = PortabilityLayer::HostDisplayDriver::GetInstance()->CreateBWCursor(16, 16, cursorData->m_pixels, cursorData->m_mask, cursorData->m_hotSpotX, cursorData->m_hotSpotY);
IGpCursor *cursor = PLDrivers::GetDisplayDriver()->CreateBWCursor(16, 16, cursorData->m_pixels, cursorData->m_mask, cursorData->m_hotSpotX, cursorData->m_hotSpotY);
resHdl.Dispose();
return cursor;
@@ -176,8 +175,6 @@ void RecomputeInterfaceRects (void)
void VariableInit (void)
{
short i;
menusUp = false;
quitting = false;
houseOpen = false;

View File

@@ -8,34 +8,41 @@
#include "WindowDef.h"
#include "BitmapImage.h"
#include "PLApplication.h"
#include "PLKeyEncoding.h"
#include "PLStandardColors.h"
#include "PLSysCalls.h"
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "FontManager.h"
#include "GpApplicationName.h"
#include "GpRenderedFontMetrics.h"
#include "HostDisplayDriver.h"
#include "HostSystemServices.h"
#include "HostThreadEvent.h"
#include "IGpMutex.h"
#include "IGpThreadEvent.h"
#include "IGpDisplayDriver.h"
#include "IGpSystemServices.h"
#include "GpIOStream.h"
#include "House.h"
#include "MainMenuUI.h"
#include "MemoryManager.h"
#include "MenuManager.h"
#include "QDPixMap.h"
#include "QDStandardPalette.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "ResourceManager.h"
#include "PLTimeTaggedVOSEvent.h"
#include "Utilities.h"
#include "Vec2i.h"
#include "WindowManager.h"
#include "WorkerThread.h"
#include "PLApplication.h"
#include "PLDrivers.h"
#include "PLKeyEncoding.h"
#include "PLStandardColors.h"
#include "PLSysCalls.h"
#include <atomic>
int loadScreenWindowPhase;
int loadScreenRingStep;
WindowPtr loadScreenWindow;
Rect loadScreenProgressBarRect;
@@ -43,7 +50,7 @@ int loadScreenProgress;
DrawSurface *loadScreenRingSurface;
#define kPrefsVersion 0x0038
#define kPrefsVersion 0x0039
void ReadInPrefs (void);
@@ -71,7 +78,7 @@ extern Boolean isMusicOn, isSoundOn, isPlayMusicIdle, isHouseChecks;
extern Boolean houseOpen, isDoColorFade, isEscPauseKey;
extern Boolean autoRoomEdit, doAutoDemo, doBackground;
extern Boolean isMapOpen, isToolsOpen, isCoordOpen;
extern Boolean doPrettyMap, doBitchDialogs;
extern Boolean doPrettyMap, doComplainDialogs;
//extern Boolean didValidation;
THandle<void> globalModulePrefs;
@@ -159,7 +166,7 @@ void ReadInPrefs (void)
isUseICCProfile = thePrefs.wasUseICCProfile;
doBackground = thePrefs.wasDoBackground;
doPrettyMap = thePrefs.wasPrettyMap;
doBitchDialogs = thePrefs.wasBitchDialogs;
doComplainDialogs = thePrefs.wasComplainDialogs;
if (modulePrefs)
ApplyModulePrefs(&modulePrefs);
@@ -244,10 +251,10 @@ void ReadInPrefs (void)
isUseICCProfile = true;
doBackground = false;
doPrettyMap = false;
doBitchDialogs = true;
doComplainDialogs = true;
IGpDisplayDriver *displayDriver = PortabilityLayer::HostDisplayDriver::GetInstance();
if (!displayDriver->IsFullScreen())
IGpDisplayDriver *displayDriver = PLDrivers::GetDisplayDriver();
if (PLDrivers::GetSystemServices()->IsFullscreenPreferred() != displayDriver->IsFullScreen())
displayDriver->RequestToggleFullScreen(0);
modulePrefs.Dispose();
@@ -345,7 +352,7 @@ void WriteOutPrefs (void)
thePrefs.wasUseICCProfile = isUseICCProfile;
thePrefs.wasDoBackground = doBackground;
thePrefs.wasPrettyMap = doPrettyMap;
thePrefs.wasBitchDialogs = doBitchDialogs;
thePrefs.wasComplainDialogs = doComplainDialogs;
THandle<void> modulePrefs;
@@ -369,30 +376,186 @@ void StepLoadScreenRing()
Rect ringDestRect = Rect::Create(8, 8, 24, 24);
Rect ringSrcRect = Rect::Create(0, 0, 16, 16) + Point::Create((loadScreenRingStep / loadScreenStepGranularity) * 16, 0);
if (loadScreenWindowPhase == 0)
{
ringDestRect = Rect::Create(0, 0, 64, 64);
const int progression = (loadScreenRingStep / loadScreenStepGranularity);
ringSrcRect = Rect::Create(0, 0, 64, 64) + Point::Create((progression % 6) * 64, (progression / 6) * 64);
}
CopyBits(*loadScreenRingSurface->m_port.GetPixMap(), *loadScreenWindow->GetDrawSurface()->m_port.GetPixMap(), &ringSrcRect, &ringDestRect, srcCopy);
loadScreenWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}
}
void StepLoadScreen(int steps)
void CreateLoadScreenWindow(int phase)
{
FlushResolutionChange();
if (loadScreenRingSurface)
{
DisposeGWorld(loadScreenRingSurface);
loadScreenRingSurface = nullptr;
}
if (loadScreenWindow)
{
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(loadScreenWindow);
loadScreenWindow = nullptr;
}
if (phase == 0)
{
static const int kLoadScreenHeight = 64;
static const int kLoadScreenWidth = 64;
static const int kLoadRingResource = 1303;
ForceSyncFrame();
PLSysCalls::Sleep(1);
THandle<BitmapImage> loadRingImageH = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', kLoadRingResource).StaticCast<BitmapImage>();
BitmapImage *loadRingImage = *loadRingImageH;
DrawSurface *loadRingSurface = nullptr;
Rect loadRingRect = loadRingImage->GetRect();
loadRingRect.right *= 2;
loadRingRect.bottom *= 2;
CreateOffScreenGWorld(&loadRingSurface, &loadRingRect);
loadRingSurface->DrawPicture(loadRingImageH, loadRingRect, false);
int32_t lsX = (thisMac.fullScreen.Width() - kLoadScreenWidth) / 2;
int32_t lsY = (thisMac.fullScreen.Height() - kLoadScreenHeight) / 2;
const Rect loadScreenRect = Rect::Create(lsY, lsX, lsY + kLoadScreenHeight, lsX + kLoadScreenWidth);
const Rect loadScreenLocalRect = Rect::Create(0, 0, loadScreenRect.Height(), loadScreenRect.Width());
PortabilityLayer::WindowDef def = PortabilityLayer::WindowDef::Create(loadScreenRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, 0, 0, PSTR(""));
loadScreenWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(def);
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(loadScreenWindow, PL_GetPutInFrontWindowPtr());
DrawSurface *surface = loadScreenWindow->GetDrawSurface();
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
surface->FillRect(loadScreenLocalRect, blackColor);
loadScreenProgressBarRect = Rect::Create(0, 0, 0, 0);
loadScreenProgress = 0;
Rect ringDestRect = Rect::Create(0, 0, 64, 64);
Rect ringSrcRect = Rect::Create(0, 0, 64, 64);
CopyBits(*loadRingSurface->m_port.GetPixMap(), *surface->m_port.GetPixMap(), &ringSrcRect, &ringDestRect, srcCopy);
loadRingImageH.Dispose();
loadScreenRingSurface = loadRingSurface;
}
else if (phase == 1)
{
static const int kLoadScreenHeight = 32;
static const int kLoadRingResource = 1302;
int kLoadScreenWidth = 296;
PLPasStr loadingText = PSTR("Loading...");
if (!isPrefsLoaded)
{
loadingText = PSTR("Getting some things ready...");
kLoadScreenWidth = 440;
}
ForceSyncFrame();
PLSysCalls::Sleep(1);
THandle<BitmapImage> loadRingImageH = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', kLoadRingResource).StaticCast<BitmapImage>();
BitmapImage *loadRingImage = *loadRingImageH;
DrawSurface *loadRingSurface = nullptr;
Rect loadRingRect = loadRingImage->GetRect();
CreateOffScreenGWorld(&loadRingSurface, &loadRingRect);
loadRingSurface->DrawPicture(loadRingImageH, loadRingRect, false);
int32_t lsX = (thisMac.fullScreen.Width() - kLoadScreenWidth) / 2;
int32_t lsY = (thisMac.fullScreen.Height() - kLoadScreenHeight) / 2;
const Rect loadScreenRect = Rect::Create(lsY, lsX, lsY + kLoadScreenHeight, lsX + kLoadScreenWidth);
const Rect loadScreenLocalRect = Rect::Create(0, 0, loadScreenRect.Height(), loadScreenRect.Width());
PortabilityLayer::WindowDef def = PortabilityLayer::WindowDef::Create(loadScreenRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
loadScreenWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(def);
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(loadScreenWindow, PL_GetPutInFrontWindowPtr());
DrawSurface *surface = loadScreenWindow->GetDrawSurface();
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor whiteColor(StdColors::White());
surface->FillRect(loadScreenLocalRect, whiteColor);
PortabilityLayer::WindowManager::GetInstance()->FlickerWindowIn(loadScreenWindow, 32);
PortabilityLayer::RenderedFont *font = GetApplicationFont(18, PortabilityLayer::FontFamilyFlag_None, true);
int32_t textY = (kLoadScreenHeight + font->GetMetrics().m_ascent) / 2;
surface->DrawString(Point::Create(4 + 16 + 8, textY), loadingText, blackColor, font);
static const int32_t loadBarPadding = 16;
static const int32_t loadBarHeight = 10;
int32_t loadBarStartX = static_cast<int32_t>(font->MeasureString(loadingText.UChars(), loadingText.Length())) + 4 + 16 + 8 + loadBarPadding;
int32_t loadBarEndX = loadScreenLocalRect.right - loadBarPadding;
loadScreenProgressBarRect = Rect::Create((loadScreenLocalRect.Height() - loadBarHeight) / 2, loadBarStartX, (loadScreenLocalRect.Height() + loadBarHeight) / 2, loadBarEndX);
PortabilityLayer::ResolveCachingColor partialFillColor(PortabilityLayer::RGBAColor::Create(255, 255, 204, 255));
surface->FrameRect(loadScreenProgressBarRect, blackColor);
surface->FillRect(loadScreenProgressBarRect.Inset(1, 1), partialFillColor);
Rect ringDestRect = Rect::Create(8, 8, 24, 24);
Rect ringSrcRect = Rect::Create(0, 0, 16, 16);
CopyBits(*loadRingSurface->m_port.GetPixMap(), *surface->m_port.GetPixMap(), &ringSrcRect, &ringDestRect, srcCopy);
loadRingImageH.Dispose();
loadScreenRingSurface = loadRingSurface;
}
}
void StepLoadScreen(int steps, bool insertDelay)
{
if (loadScreenWindow)
{
static const int kLoadScreenPhaseSwitchBreakpoint = 20;
int oldProgress = loadScreenProgress;
int loadScreenMax = 25;
if (loadScreenProgress + steps >= kLoadScreenPhaseSwitchBreakpoint && loadScreenWindowPhase == 0)
{
loadScreenWindowPhase = 1;
CreateLoadScreenWindow(loadScreenWindowPhase);
// Reset old progress since the progress bar was redrawn
oldProgress = 0;
}
const Rect loadScreenProgressBarFillRect = loadScreenProgressBarRect.Inset(1, 1);
int loadScreenMax = 43;
loadScreenProgress = loadScreenProgress + steps;
if (loadScreenProgress > loadScreenMax)
loadScreenProgress = loadScreenMax;
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor fillColor(PortabilityLayer::RGBAColor::Create(51, 51, 51, 255));
int prevStep = oldProgress * loadScreenProgressBarRect.Width() / loadScreenMax;
int thisStep = loadScreenProgress * loadScreenProgressBarRect.Width() / loadScreenMax;
int prevStep = oldProgress * loadScreenProgressBarFillRect.Width() / loadScreenMax;
int thisStep = loadScreenProgress * loadScreenProgressBarFillRect.Width() / loadScreenMax;
loadScreenWindow->GetDrawSurface()->FillRect(Rect::Create(loadScreenProgressBarRect.top, loadScreenProgressBarRect.left + prevStep, loadScreenProgressBarRect.bottom, loadScreenProgressBarRect.left + thisStep), blackColor);
loadScreenWindow->GetDrawSurface()->FillRect(Rect::Create(loadScreenProgressBarFillRect.top, loadScreenProgressBarFillRect.left + prevStep, loadScreenProgressBarFillRect.bottom, loadScreenProgressBarFillRect.left + thisStep), fillColor);
ForceSyncFrame();
for (int i = 0; i < steps; i++)
if (insertDelay)
{
StepLoadScreenRing();
Delay(1, nullptr);
@@ -408,69 +571,12 @@ void InitLoadingWindow()
if (!thisMac.isTouchscreen)
return;
static const int kLoadScreenHeight = 32;
static const int kLoadRingResource = 1302;
if (isPrefsLoaded)
loadScreenWindowPhase = 1;
else
loadScreenWindowPhase = 0;
int kLoadScreenWidth = 296;
PLPasStr loadingText = PSTR("Loading...");
if (!isPrefsLoaded)
{
loadingText = PSTR("Performing First-Time Setup...");
kLoadScreenWidth = 440;
}
ForceSyncFrame();
PLSysCalls::Sleep(1);
THandle<BitmapImage> loadRingImageH = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', kLoadRingResource).StaticCast<BitmapImage>();
BitmapImage *loadRingImage = *loadRingImageH;
DrawSurface *loadRingSurface = nullptr;
Rect loadRingRect = loadRingImage->GetRect();
CreateOffScreenGWorld(&loadRingSurface, &loadRingRect);
loadRingSurface->DrawPicture(loadRingImageH, loadRingRect);
int32_t lsX = (thisMac.fullScreen.Width() - kLoadScreenWidth) / 2;
int32_t lsY = (thisMac.fullScreen.Height() - kLoadScreenHeight) / 2;
const Rect loadScreenRect = Rect::Create(lsY, lsX, lsY + kLoadScreenHeight, lsX + kLoadScreenWidth);
const Rect loadScreenLocalRect = Rect::Create(0, 0, loadScreenRect.Height(), loadScreenRect.Width());
PortabilityLayer::WindowDef def = PortabilityLayer::WindowDef::Create(loadScreenRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
loadScreenWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(def);
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(loadScreenWindow, PL_GetPutInFrontWindowPtr());
DrawSurface *surface = loadScreenWindow->GetDrawSurface();
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor whiteColor(StdColors::White());
surface->FillRect(loadScreenLocalRect, whiteColor);
PortabilityLayer::WindowManager::GetInstance()->FlickerWindowIn(loadScreenWindow, 32);
PortabilityLayer::RenderedFont *font = GetApplicationFont(18, PortabilityLayer::FontFamilyFlag_None, true);
int32_t textY = (kLoadScreenHeight + font->GetMetrics().m_ascent) / 2;
surface->DrawString(Point::Create(4+16+8, textY), loadingText, blackColor, font);
static const int32_t loadBarPadding = 16;
int32_t loadBarStartX = static_cast<int32_t>(font->MeasureString(loadingText.UChars(), loadingText.Length())) + 4 + 16 + 8 + loadBarPadding;
int32_t loadBarEndX = loadScreenLocalRect.right - loadBarPadding;
loadScreenProgressBarRect = Rect::Create((loadScreenLocalRect.Height() - 8) / 2, loadBarStartX, (loadScreenLocalRect.Height() + 8) / 2, loadBarEndX);
loadScreenProgress = 0;
surface->FrameRect(loadScreenProgressBarRect, blackColor);
Rect ringDestRect = Rect::Create(8, 8, 24, 24);
Rect ringSrcRect = Rect::Create(0, 0, 16, 16);
CopyBits(*loadRingSurface->m_port.GetPixMap(), *surface->m_port.GetPixMap(), &ringSrcRect, &ringDestRect, srcCopy);
loadRingImageH.Dispose();
loadScreenRingSurface = loadRingSurface;
CreateLoadScreenWindow(loadScreenWindowPhase);
}
enum PreloadFontCategory
@@ -491,7 +597,7 @@ struct PreloadFontSpec
struct PreloadFontWorkSlot
{
PortabilityLayer::HostThreadEvent *m_completedEvent;
IGpThreadEvent *m_completedEvent;
PortabilityLayer::WorkerThread *m_workerThread;
std::atomic<int> m_singleJobCompleted;
const PreloadFontSpec *m_spec;
@@ -536,12 +642,12 @@ void PreloadSingleFont (const PreloadFontSpec &spec)
}
}
void PreloadThreadFunc(void *context)
void PreloadFontThreadFunc(void *context)
{
PreloadFontWorkSlot *wSlot = static_cast<PreloadFontWorkSlot*>(context);
PreloadSingleFont(*wSlot->m_spec);
++wSlot->m_singleJobCompleted;
wSlot->m_singleJobCompleted.fetch_add(1, std::memory_order_release);
wSlot->m_completedEvent->Signal();
}
@@ -549,6 +655,9 @@ void PreloadFonts()
{
static PreloadFontSpec specs[] =
{
// First entry should be the one needed to show the load screen
{ FontCategory_Application, 18, PortabilityLayer::FontFamilyFlag_None, true },
{ FontCategory_System, 9, PortabilityLayer::FontFamilyFlag_Bold, true },
{ FontCategory_System, 10, PortabilityLayer::FontFamilyFlag_Bold, true },
{ FontCategory_System, 12, PortabilityLayer::FontFamilyFlag_None, true },
@@ -557,7 +666,7 @@ void PreloadFonts()
{ FontCategory_Application, 9, PortabilityLayer::FontFamilyFlag_None, true },
{ FontCategory_Application, 12, PortabilityLayer::FontFamilyFlag_Bold, true },
{ FontCategory_Application, 14, PortabilityLayer::FontFamilyFlag_Bold, true },
{ FontCategory_Application, 18, PortabilityLayer::FontFamilyFlag_None, true },
{ FontCategory_Application, 14, PortabilityLayer::FontFamilyFlag_None, true },
{ FontCategory_Application, 40, PortabilityLayer::FontFamilyFlag_None, true },
{ FontCategory_Handwriting, 24, PortabilityLayer::FontFamilyFlag_None, true },
{ FontCategory_Handwriting, 48, PortabilityLayer::FontFamilyFlag_None, true },
@@ -566,7 +675,6 @@ void PreloadFonts()
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
const int numFontSpecs = sizeof(specs) / sizeof(specs[0]);
int queuedSpecs = 0;
@@ -576,19 +684,19 @@ void PreloadFonts()
// but we can do this to unclog the render thread.
PreloadFontWorkSlot slot;
slot.m_workerThread = PortabilityLayer::WorkerThread::Create();
slot.m_completedEvent = PortabilityLayer::HostSystemServices::GetInstance()->CreateThreadEvent(true, false);
slot.m_completedEvent = PLDrivers::GetSystemServices()->CreateThreadEvent(true, false);
while (completedSpecs < numFontSpecs)
{
if (slot.m_queued)
{
if (slot.m_singleJobCompleted.load(std::memory_order_relaxed) != 0)
if (slot.m_singleJobCompleted.load(std::memory_order_acquire) != 0)
{
slot.m_completedEvent->Wait();
slot.m_queued = false;
completedSpecs++;
StepLoadScreen(1);
StepLoadScreen(1, false);
}
}
@@ -597,9 +705,9 @@ void PreloadFonts()
if (queuedSpecs < numFontSpecs)
{
slot.m_queued = true;
slot.m_singleJobCompleted.store(0);
slot.m_spec = specs + queuedSpecs;
slot.m_workerThread->AsyncExecuteTask(PreloadThreadFunc, &slot);
slot.m_singleJobCompleted.store(0, std::memory_order_release);
slot.m_workerThread->AsyncExecuteTask(PreloadFontThreadFunc, &slot);
queuedSpecs++;
}
@@ -609,6 +717,344 @@ void PreloadFonts()
Delay(1, nullptr);
}
PortabilityLayer::FontManager::GetInstance()->PurgeCache();
}
struct PreloadAATableSpec
{
PortabilityLayer::RGBAColor m_color;
bool m_isTone;
};
struct PreloadAATableWorkSlot
{
IGpThreadEvent *m_completedEvent;
IGpMutex *m_mutex;
PortabilityLayer::WorkerThread *m_workerThread;
std::atomic<int> m_singleJobCompleted;
const PreloadAATableSpec *m_spec;
bool m_queued;
PreloadAATableWorkSlot();
~PreloadAATableWorkSlot();
};
PreloadAATableWorkSlot::PreloadAATableWorkSlot()
: m_completedEvent(nullptr)
, m_workerThread(nullptr)
, m_spec(nullptr)
, m_queued(false)
{
}
PreloadAATableWorkSlot::~PreloadAATableWorkSlot()
{
if (m_workerThread)
m_workerThread->Destroy();
}
void PreloadAATableThreadFunc(void *context)
{
PreloadAATableWorkSlot *wSlot = static_cast<PreloadAATableWorkSlot*>(context);
PortabilityLayer::StandardPalette *sp = PortabilityLayer::StandardPalette::GetInstance();
if (wSlot->m_spec->m_isTone)
sp->GetCachedToneAATable(wSlot->m_spec->m_color.r, wSlot->m_mutex);
else
sp->GetCachedPaletteAATable(wSlot->m_spec->m_color, wSlot->m_mutex);
wSlot->m_singleJobCompleted.fetch_add(1, std::memory_order_release);
wSlot->m_completedEvent->Signal();
}
void PreloadAATables()
{
PortabilityLayer::StandardPalette *sp = PortabilityLayer::StandardPalette::GetInstance();
PortabilityLayer::RGBAColor preloadColors[] =
{
PortabilityLayer::RGBAColor::Create(255, 255, 255, 255),
PortabilityLayer::RGBAColor::Create(255, 51, 51, 255),
PortabilityLayer::RGBAColor::Create(255, 0, 0, 255),
PortabilityLayer::RGBAColor::Create(255, 255, 0, 255),
PortabilityLayer::RGBAColor::Create(0, 255, 255, 255),
PortabilityLayer::RGBAColor::Create(0, 0, 255, 255),
PortabilityLayer::RGBAColor::Create(204, 102, 51, 255),
};
const size_t numPalettePreloads = sizeof(preloadColors) / sizeof(preloadColors[0]);
const size_t maxTonePreloads = numPalettePreloads * 3;
PreloadAATableSpec specs[numPalettePreloads + maxTonePreloads];
for (size_t i = 0; i < numPalettePreloads; i++)
{
specs[i].m_color = preloadColors[i];
specs[i].m_isTone = false;
}
size_t numTonePreloads = 0;
for (size_t i = 0; i < numPalettePreloads; i++)
{
const uint8_t rgb[3] = { preloadColors[i].r, preloadColors[i].g, preloadColors[i].b };
for (int ch = 0; ch < 3; ch++)
{
uint8_t tone = rgb[ch];
bool toneAlreadyQueued = false;
for (size_t j = 0; j < numTonePreloads; j++)
{
if (specs[numPalettePreloads + j].m_color.r == tone)
{
toneAlreadyQueued = true;
break;
}
}
if (!toneAlreadyQueued)
{
PreloadAATableSpec &spec = specs[i + numTonePreloads];
numTonePreloads++;
spec.m_color = PortabilityLayer::RGBAColor::Create(tone, tone, tone, 255);
spec.m_isTone = true;
}
}
}
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
const int numAASpecs = numPalettePreloads + numTonePreloads;
unsigned int cpus = PLDrivers::GetSystemServices()->GetCPUCount();
if (cpus < 2)
{
for (size_t i = 0; i < numAASpecs; i++)
{
PreloadAATableThreadFunc(specs + i);
StepLoadScreen(1, false);
}
}
else
{
cpus -= 1;
int queuedSpecs = 0;
int completedSpecs = 0;
PreloadAATableWorkSlot *slots = static_cast<PreloadAATableWorkSlot*>(mm->Alloc(sizeof(PreloadAATableWorkSlot) * cpus));
IGpMutex *mutex = PLDrivers::GetSystemServices()->CreateMutex();
for (unsigned int i = 0; i < cpus; i++)
{
PreloadAATableWorkSlot *slot = new (slots + i) PreloadAATableWorkSlot();
slot->m_workerThread = PortabilityLayer::WorkerThread::Create();
slot->m_completedEvent = PLDrivers::GetSystemServices()->CreateThreadEvent(true, false);
slot->m_mutex = mutex;
}
while (completedSpecs < numAASpecs)
{
int completedThisStep = 0;
for (unsigned int i = 0; i < cpus; i++)
{
PreloadAATableWorkSlot &slot = slots[i];
if (slot.m_queued)
{
if (slot.m_singleJobCompleted.load(std::memory_order_acquire) != 0)
{
slot.m_completedEvent->Wait();
slot.m_queued = false;
completedSpecs++;
completedThisStep++;
}
}
if (!slot.m_queued)
{
if (queuedSpecs < numAASpecs)
{
slot.m_queued = true;
slot.m_spec = specs + queuedSpecs;
slot.m_singleJobCompleted.store(0, std::memory_order_release);
slot.m_workerThread->AsyncExecuteTask(PreloadAATableThreadFunc, &slot);
queuedSpecs++;
}
}
}
if (completedThisStep > 0)
StepLoadScreen(completedThisStep, false);
StepLoadScreenRing();
Delay(1, nullptr);
}
for (unsigned int i = 0; i < cpus; i++)
slots[i].~PreloadAATableWorkSlot();
mm->Release(slots);
mutex->Destroy();
}
}
void ShowInitialLaunchDisclaimer()
{
const char *disclaimerLines[] =
{
GP_APPLICATION_NAME " is a port of John Calhoun\xd5s Glider PRO, based",
"on the 2016 release of the game\xd5s source code and assets.",
"",
"Glider PRO, a sequel to the original Glider, was released in 1994",
"for the Apple Macintosh, and is widely recognized as one of",
"of the most iconic Macintosh-exclusive games of the 1990\xd5s.",
"",
"I hope that by adapting it to be playable on modern systems, more",
"people can appreciate this important piece of video game history.",
"",
"This software is an adaptation that attempts to restore the original work",
"as accurately as possible, but some fonts, graphics, and sounds have been",
"substituted or removed for copyright reasons, and some user interface",
"components have been added or changed to improve compatibility.",
"",
"This software is not developed by, maintained by, supported by, endorsed by,",
"or otherwise associated with the authors or publishers of Glider PRO.",
"Any references to Glider PRO in this software are for historical accuracy",
"and should not be interpreted as implying any form of endorsement."
};
const size_t numLines = sizeof(disclaimerLines) / sizeof(disclaimerLines[0]);
PortabilityLayer::RenderedFont *rfont = GetApplicationFont(14, PortabilityLayer::FontFamilyFlag_None, true);
PortabilityLayer::RenderedFont *buttonFont = GetApplicationFont(18, PortabilityLayer::FontFamilyFlag_None, true);
const int kButtonSpacing = 16;
const int kButtonHeight = 32;
const PLPasStr buttonText = PLDrivers::GetSystemServices()->IsTouchscreen() ? PLPasStr(PSTR("Tap to Continue...")) : PLPasStr(PSTR("Click to Continue..."));
const int32_t buttonTextWidth = buttonFont->MeasureString(buttonText.UChars(), buttonText.Length());
const int32_t buttonWidth = buttonTextWidth + 16;
const int32_t linegap = rfont->GetMetrics().m_linegap;
const int32_t ascent = rfont->GetMetrics().m_ascent;
int32_t windowHeight = linegap * numLines + kButtonSpacing + kButtonHeight;
size_t widestLine = 0;
for (size_t i = 0; i < numLines; i++)
{
const size_t lineWidth = rfont->MeasureCharStr(disclaimerLines[i], strlen(disclaimerLines[i]));
if (lineWidth > widestLine)
widestLine = lineWidth;
}
if (widestLine > 640)
widestLine = 640;
Rect windowRect = Rect::Create(0, 0, windowHeight, widestLine);
PortabilityLayer::WindowDef def = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, 0, 0, PSTR(""));
Window *disclaimerWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(def);
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(disclaimerWindow, PL_GetPutInFrontWindowPtr());
DrawSurface *surface = disclaimerWindow->GetDrawSurface();
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor whiteColor(StdColors::White());
surface->FillRect(windowRect, blackColor);
int32_t wx = (static_cast<int32_t>(thisMac.fullScreen.Width()) - static_cast<int32_t>(surface->m_port.GetRect().Width())) / 2;
int32_t wy = (static_cast<int32_t>(thisMac.fullScreen.Height()) - static_cast<int32_t>(surface->m_port.GetRect().Height())) / 2;
disclaimerWindow->SetPosition(PortabilityLayer::Vec2i(wx, wy));
for (size_t i = 0; i < numLines; i++)
{
const size_t lineWidth = rfont->MeasureCharStr(disclaimerLines[i], strlen(disclaimerLines[i]));
if (lineWidth > widestLine)
widestLine = lineWidth;
int32_t xOffset = static_cast<int32_t>((widestLine - lineWidth) / 2);
Point drawPt = Point::Create(xOffset, linegap * i + (linegap + ascent) / 2);
surface->DrawString(drawPt, PLPasStr(strlen(disclaimerLines[i]), disclaimerLines[i]), whiteColor, rfont);
}
const int numTicksToEnable = 10 * 60;
const int borderThickness = 2;
Rect buttonRect = Rect::Create(windowRect.bottom - kButtonHeight, windowRect.right - buttonWidth, windowRect.bottom, windowRect.right);
{
int topYOffset = (buttonRect.Height() - borderThickness) / 2;
surface->FillRect(Rect::Create(buttonRect.top + topYOffset, buttonRect.left, buttonRect.top + topYOffset + borderThickness, buttonRect.left + borderThickness), whiteColor);
surface->FillRect(Rect::Create(buttonRect.top + topYOffset, buttonRect.right - borderThickness, buttonRect.top + topYOffset + borderThickness, buttonRect.right), whiteColor);
}
for (int i = 0; i < numTicksToEnable; i++)
{
int bar = (buttonWidth - borderThickness * 6) * i / numTicksToEnable;
int topYOffset = (buttonRect.Height() - borderThickness) / 2;
surface->FillRect(Rect::Create(buttonRect.top + topYOffset, buttonRect.left + borderThickness * 3, buttonRect.top + topYOffset + borderThickness, buttonRect.left + borderThickness * 3 + bar), whiteColor);
Delay(1, nullptr);
}
const int numTicksToExpand = 15;
for (int i = 0; i < numTicksToExpand; i++)
{
int height = buttonRect.Height() * i / numTicksToExpand;
int topYOffset = (buttonRect.Height() - height) / 2;
surface->FillRect(Rect::Create(buttonRect.top + topYOffset, buttonRect.left, buttonRect.top + topYOffset + height, buttonRect.right), whiteColor);
Delay(1, nullptr);
}
Point textPoint;
textPoint.h = (buttonRect.left + buttonRect.right - buttonTextWidth) / 2;
textPoint.v = (buttonRect.top + buttonRect.bottom + ascent) / 2;
const int numTicksToFade = 15;
for (int i = 0; i <= numTicksToFade; i++)
{
int intensity = 255 - (i * 255 / numTicksToFade);
PortabilityLayer::ResolveCachingColor backgroundColor(PortabilityLayer::RGBAColor::Create(intensity, intensity, intensity, 255));
surface->FillRect(buttonRect, whiteColor);
surface->FillRect(buttonRect.Inset(borderThickness, borderThickness), backgroundColor);
surface->DrawString(textPoint, buttonText, whiteColor, buttonFont);
Delay(1, nullptr);
}
bool dismiss = false;
FlushEvents();
while (!dismiss)
{
TimeTaggedVOSEvent evt;
while (WaitForEvent(&evt, 1))
{
if (evt.IsLMouseDownEvent())
dismiss = true;
}
}
Delay(1, nullptr);
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(disclaimerWindow);
Delay(60, nullptr);
}
void gpAppInit()
@@ -649,8 +1095,10 @@ int gpAppMain()
SpinCursor(2); // Tick once to let the display driver flush any resolution changes from prefs
FlushResolutionChange();
InitLoadingWindow(); StepLoadScreen(2);
PreloadFonts(); StepLoadScreen(2);
InitLoadingWindow(); StepLoadScreen(2, true);
PreloadAATables();
assert(isPrefsLoaded || loadScreenWindowPhase == 0);
PreloadFonts(); StepLoadScreen(2, true);
#if defined COMPILEDEMO
copyGood = true;
@@ -669,12 +1117,12 @@ int gpAppMain()
// if ((thisMac.numScreens > 1) && (isUseSecondScreen))
// ReflectSecondMonitorEnvirons(false, true, true);
HandleDepthSwitching();
VariableInit(); StepLoadScreen(2);
GetExtraCursors(); StepLoadScreen(2);
VariableInit(); StepLoadScreen(2, true);
GetExtraCursors(); StepLoadScreen(2, true);
InitMarquee();
CreatePointers(); StepLoadScreen(2);
CreatePointers(); StepLoadScreen(2, true);
InitSrcRects();
CreateOffscreens(); StepLoadScreen(2);
CreateOffscreens(); StepLoadScreen(2, true);
if (loadScreenWindow)
{
@@ -692,8 +1140,13 @@ int gpAppMain()
if (!isPrefsLoaded)
{
WriteOutPrefs();
FlushResolutionChange();
ShowInitialLaunchDisclaimer();
}
FlushResolutionChange();
OpenMainWindow();
if (isDoColorFade)

View File

@@ -2,14 +2,9 @@
#include "FontFamily.h"
#include "GpApplicationName.h"
#include "HostDisplayDriver.h"
#include "GliderProtos.h"
#include "Externs.h"
#include "IGpDisplayDriver.h"
#include "PLCore.h"
#include "PLQDraw.h"
#include "PLStandardColors.h"
#include "PLSysCalls.h"
#include "RenderedFont.h"
#include "GpRenderedFontMetrics.h"
#include "MainMenuUI.h"
@@ -19,6 +14,12 @@
#include "WindowManager.h"
#include "Vec2i.h"
#include "PLCore.h"
#include "PLDrivers.h"
#include "PLQDraw.h"
#include "PLStandardColors.h"
#include "PLSysCalls.h"
struct MainMenuControlState
{
Window *m_window;
@@ -168,8 +169,7 @@ static void DrawMainMenuControl(DrawSurface *surface, MainMenuUIState::ControlID
void StartScrollForPage()
{
unsigned int displayHeight = 0;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
DismissMainMenuUI();
@@ -262,8 +262,7 @@ void StartMainMenuUI()
static void DismissMainMenuUIPage()
{
unsigned int displayHeight = 0;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
@@ -292,8 +291,7 @@ void TickMainMenuUI()
{
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
unsigned int displayHeight = 0;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
mainMenu.m_scrollInStep -= MainMenuUIState::kControlScrollInDecay;
mainMenu.m_scrollInOffset -= (mainMenu.m_scrollInStep >> MainMenuUIState::kControlScrollInDecayFalloffBits);
@@ -327,8 +325,7 @@ void HandleMainMenuUIResolutionChange()
{
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
unsigned int displayHeight = 0;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
unsigned int displayHeight = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution().m_y;
for (int i = 0; i < MainMenuUIState::Control_Count; i++)
{

View File

@@ -5,12 +5,9 @@
//============================================================================
#include "PLNumberFormatting.h"
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "HostDisplayDriver.h"
#include "House.h"
#include "IGpDisplayDriver.h"
#include "InputManager.h"
@@ -23,6 +20,9 @@
#include "WindowDef.h"
#include "WindowManager.h"
#include "PLDrivers.h"
#include "PLNumberFormatting.h"
#include "PLPasStr.h"
#define kMainWindowID 128
#define kEditWindowID 129

View File

@@ -53,7 +53,7 @@ short isMapH, isMapV, mapRoomsHigh, mapRoomsWide;
short mapLeftRoom, mapTopRoom;
Boolean isMapOpen, doPrettyMap;
extern Boolean doBitchDialogs;
extern Boolean doComplainDialogs;
//============================================================== Functions
@@ -651,7 +651,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
}
else
{
if (doBitchDialogs)
if (doComplainDialogs)
{
if (QueryNewRoom())
{

View File

@@ -6,7 +6,6 @@
#include "Externs.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "InputManager.h"
#include "Marquee.h"
@@ -14,6 +13,8 @@
#include "ObjectEdit.h"
#include "RectUtils.h"
#include "PLDrivers.h"
#include <assert.h>
#include <algorithm>
@@ -222,7 +223,7 @@ void DragMarqueeRect (Window *window, DrawSurface *surface, Point start, Rect *t
Point wasPt, newPt;
short deltaH, deltaV;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(handCursor);
PLDrivers::GetDisplayDriver()->SetCursor(handCursor);
StopMarquee();
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
@@ -265,9 +266,9 @@ void DragMarqueeHandle (Window *window, DrawSurface *surface, Point start, short
short deltaH, deltaV;
if ((theMarquee.direction == kAbove) || (theMarquee.direction == kBelow))
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(vertCursor);
PLDrivers::GetDisplayDriver()->SetCursor(vertCursor);
else
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(horiCursor);
PLDrivers::GetDisplayDriver()->SetCursor(horiCursor);
StopMarquee();
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
@@ -349,7 +350,7 @@ void DragMarqueeCorner (Window *window, DrawSurface *surface, Point start, short
Point wasPt, newPt;
short deltaH, deltaV;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(diagCursor);
PLDrivers::GetDisplayDriver()->SetCursor(diagCursor);
StopMarquee();
const uint8_t *pattern = theMarquee.pats[theMarquee.index];

View File

@@ -4,18 +4,18 @@
//----------------------------------------------------------------------------
//============================================================================
#include "PLResources.h"
#include "PLSound.h"
#include "DialogManager.h"
#include "Environ.h"
#include "Externs.h"
#include "SoundSync.h"
#include "HostMutex.h"
#include "HostSystemServices.h"
#include "IGpMutex.h"
#include "IGpSystemServices.h"
#include "MemoryManager.h"
#include "ResourceManager.h"
#include "PLDrivers.h"
#include "PLResources.h"
#include "PLSound.h"
#define kBaseBufferMusicID 2000
#define kMaxMusic 7
@@ -47,7 +47,7 @@ struct MusicState
};
MusicState musicState;
PortabilityLayer::HostMutex *musicMutex;
IGpMutex *musicMutex;
extern Boolean isSoundOn;
@@ -337,7 +337,7 @@ void InitMusic (void)
musicState.musicSoundID = musicScore[musicState.musicCursor];
musicState.musicMode = kPlayWholeScoreMode;
musicMutex = PortabilityLayer::HostSystemServices::GetInstance()->CreateMutex();
musicMutex = PLDrivers::GetSystemServices()->CreateMutex();
PL_NotYetImplemented_TODO("MusicSync");

View File

@@ -296,6 +296,7 @@ void DoDemoGame (void)
if (OpenHouse())
whoCares = ReadHouse();
incrementModeTime = TickCount() + kIdleSplashTicks;
RedrawSplashScreen();
}
//-------------------------------------------------------------- InitGlider
@@ -581,7 +582,11 @@ void ResetTouchScreenControlBounds (void)
points[TouchScreenCtrlIDs::Movement] = Point::Create(mainWindowRect.left, mainWindowRect.top);
points[TouchScreenCtrlIDs::BatteryHelium] = Point::Create(mainWindowRect.left + touchScreenControlEdgeSpacing, mainWindowRect.top + touchScreenControlEdgeSpacing);
points[TouchScreenCtrlIDs::Bands] = Point::Create(mainWindowRect.right - touchScreenControlEdgeSpacing - touchScreenControlSize, mainWindowRect.top + touchScreenControlEdgeSpacing);
points[TouchScreenCtrlIDs::Menu] = Point::Create(points[TouchScreenCtrlIDs::Bands].h - touchScreenControlInterSpacing - touchScreenControlSize, points[TouchScreenCtrlIDs::BatteryHelium].v);
if (demoGoing)
points[TouchScreenCtrlIDs::Menu] = Point::Create(mainWindowRect.right - touchScreenControlEdgeSpacing - touchScreenControlSize, mainWindowRect.top + touchScreenControlEdgeSpacing);
else
points[TouchScreenCtrlIDs::Menu] = Point::Create(points[TouchScreenCtrlIDs::Bands].h - touchScreenControlInterSpacing - touchScreenControlSize, points[TouchScreenCtrlIDs::BatteryHelium].v);
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
sizes[i] = Point::Create(touchScreenControlSize, touchScreenControlSize);
@@ -622,7 +627,7 @@ void InitTouchScreenControlState(void)
Rect resRect = Rect::Create(0, 0, touchScreenControlSize, touchScreenControlSize);
(void)CreateOffScreenGWorld(&touchScreen.graphics[i], &resRect);
LoadGraphic(touchScreen.graphics[i], resID);
LoadGraphicNoDither(touchScreen.graphics[i], resID);
}
pendingTouchScreenMenu = false;

View File

@@ -16,9 +16,8 @@
#include "IGpPrefsHandler.h"
#include "GpIOStream.h"
#include "MemoryManager.h"
#include "HostAudioDriver.h"
#include "HostDisplayDriver.h"
#include "HostInputDriver.h"
#include "PLDrivers.h"
#define kPrefCreatorType 'ozm5'
@@ -333,23 +332,23 @@ Boolean DeletePrefs ()
//-------------------------------------------------------------- RunFunctionOnAllPrefsHandlers
bool RunFunctionOnAllPrefsHandlers (void *context, bool (*func) (void *context, IGpPrefsHandler *handler))
{
IGpPrefsHandler *ddHandler = PortabilityLayer::HostDisplayDriver::GetInstance()->GetPrefsHandler();
IGpPrefsHandler *ddHandler = PLDrivers::GetDisplayDriver()->GetPrefsHandler();
if (ddHandler && !func(context, ddHandler))
return false;
if (IGpAudioDriver *audioDriver = PortabilityLayer::HostAudioDriver::GetInstance())
if (IGpAudioDriver *audioDriver = PLDrivers::GetAudioDriver())
{
IGpPrefsHandler *adHandler = audioDriver->GetPrefsHandler();
if (adHandler && !func(context, adHandler))
return false;
}
size_t numInputDrivers = PortabilityLayer::HostInputDriver::NumInstances();
size_t numInputDrivers = PLDrivers::GetNumInputDrivers();
for (size_t i = 0; i < numInputDrivers; i++)
{
IGpPrefsHandler *idHandler = PortabilityLayer::HostInputDriver::GetInstance(i)->GetPrefsHandler();
IGpPrefsHandler *idHandler = PLDrivers::GetInputDriver(i)->GetPrefsHandler();
if (idHandler && !func(context, idHandler))
return false;
}

View File

@@ -611,43 +611,62 @@ void RenderShreds (void)
void RenderTouchScreenControls (void)
{
if (demoGoing)
return;
DrawSurface *ctrlGraphics[TouchScreenCtrlIDs::Count];
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
ctrlGraphics[i] = nullptr;
ctrlGraphics[TouchScreenCtrlIDs::Movement] = nullptr;
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsDisabled];
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryDisabled];
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuIdle];
if (batteryTotal < 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumIdle];
else if (batteryTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryIdle];
if (demoGoing)
{
ctrlGraphics[TouchScreenCtrlIDs::Bands] = nullptr;
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = nullptr;
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::StopIdle];
}
else
{
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsDisabled];
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryDisabled];
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuIdle];
if (bandsTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsIdle];
if (batteryTotal < 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumIdle];
else if (batteryTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryIdle];
if (bandsTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsIdle];
}
for (int i = 0; i < touchScreenControlState::kMaxFingers; i++)
{
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::BatteryHelium)
if (demoGoing)
{
if (batteryTotal < 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumActive];
else if (batteryTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryActive];
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
{
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::StopActive];
}
}
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Bands)
else
{
if (bandsTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsActive];
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::BatteryHelium)
{
if (batteryTotal < 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumActive];
else if (batteryTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryActive];
}
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Bands)
{
if (bandsTotal > 0)
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsActive];
}
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
{
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuActive];
}
}
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuActive];
}
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)

View File

@@ -35,7 +35,7 @@ short numberRooms, thisRoomNumber, previousRoom;
short leftThresh, rightThresh, lastBackground;
Boolean autoRoomEdit, newRoomNow, noRoomAtAll;
Boolean leftOpen, rightOpen, topOpen, bottomOpen;
Boolean doBitchDialogs;
Boolean doComplainDialogs;
extern short tempTiles[];

View File

@@ -5,16 +5,9 @@
//----------------------------------------------------------------------------
//============================================================================
#include "PLKeyEncoding.h"
#include "PLNumberFormatting.h"
#include "PLResources.h"
#include "PLSound.h"
#include "PLPasStr.h"
#include "PLStandardColors.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "Externs.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "RectUtils.h"
#include "PLPopupMenuWidget.h"
@@ -25,6 +18,13 @@
#include "ResourceManager.h"
#include "Utilities.h"
#include "PLDrivers.h"
#include "PLKeyEncoding.h"
#include "PLNumberFormatting.h"
#include "PLResources.h"
#include "PLSound.h"
#include "PLPasStr.h"
#include "PLStandardColors.h"
#define kRoomInfoDialogID 1003
#define kOriginalArtDialogID 1016
@@ -54,7 +54,7 @@ void UpdateOriginalArt (Dialog *);
int16_t OriginalArtFilter (void *context, Dialog *dialog, const TimeTaggedVOSEvent *evt);
Boolean PictIDExists (short);
short GetFirstPICT (void);
void BitchAboutPICTNotFound (void);
void ComplainAboutPICTNotFound (void);
Rect tileSrc, tileDest, tileSrcRect, editTETextBox;
@@ -271,7 +271,7 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
{
if (cursorIs != kHandCursor)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(handCursor);
PLDrivers::GetDisplayDriver()->SetCursor(handCursor);
cursorIs = kHandCursor;
}
@@ -325,7 +325,7 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
{
if (cursorIs != kBeamCursor)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
PLDrivers::GetDisplayDriver()->SetStandardCursor(EGpStandardCursors::kIBeam);
cursorIs = kBeamCursor;
}
}
@@ -441,7 +441,7 @@ void DoRoomInfo(void)
// SetPort((GrafPtr)tileSrcMap);
if ((tempBack > kStars) && (!PictIDExists(tempBack)))
{
BitchAboutPICTNotFound();
ComplainAboutPICTNotFound();
tempBack = kSimpleRoom;
}
if ((tempBack == 2002) || (tempBack == 2011) ||
@@ -869,10 +869,10 @@ short GetFirstPICT (void)
return resID;
}
//-------------------------------------------------------------- BitchAboutPICTNotFound
//-------------------------------------------------------------- ComplainAboutPICTNotFound
#ifndef COMPILEDEMO
void BitchAboutPICTNotFound (void)
void ComplainAboutPICTNotFound (void)
{
short hitWhat;

View File

@@ -9,16 +9,19 @@
#include "PLStringCompare.h"
#include "DialogManager.h"
#include "Externs.h"
#include "FileBrowserUI.h"
#include "FileManager.h"
#include "FontFamily.h"
#include "House.h"
#include "GpIOStream.h"
#include "InputManager.h"
#include "MacFileInfo.h"
#include "MemoryManager.h"
#include "PLStandardColors.h"
#include "ResolveCachingColor.h"
#include <assert.h>
#define kSavedGameVersion 0x0200
@@ -33,9 +36,87 @@ extern Boolean twoPlayerGame;
//============================================================== Functions
static const int kStarsOffset = 180;
static const int kGlidersOffset = 260;
static const int kScoreOffset = 320;
static void FBUI_DrawLabels(DrawSurface *surface, const Point &basePoint)
{
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
PortabilityLayer::RenderedFont *rfont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
surface->DrawString(basePoint + Point::Create(kStarsOffset, 0), PSTR("Stars Left"), blackColor, rfont);
surface->DrawString(basePoint + Point::Create(kGlidersOffset, 0), PSTR("Gliders"), blackColor, rfont);
surface->DrawString(basePoint + Point::Create(kScoreOffset, 0), PSTR("Score"), blackColor, rfont);
}
static void FBUI_DrawFileDetails(DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails)
{
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
PortabilityLayer::RenderedFont *rfont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
const game2Type *gameData = static_cast<const game2Type*>(fileDetails);
Str255 numStr;
NumToString(gameData->wasStarsLeft, numStr);
surface->DrawString(basePoint + Point::Create(kStarsOffset, 0), numStr, blackColor, rfont);
NumToString(gameData->numGliders, numStr);
surface->DrawString(basePoint + Point::Create(kGlidersOffset, 0), numStr, blackColor, rfont);
NumToString(gameData->score, numStr);
surface->DrawString(basePoint + Point::Create(kScoreOffset, 0), numStr, blackColor, rfont);
}
static void *FBUI_LoadFileDetails(PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
{
GpIOStream *stream = nullptr;
if (PortabilityLayer::FileManager::GetInstance()->OpenFileData(dirID, filename, PortabilityLayer::EFilePermission_Read, stream) != PLErrors::kNone)
return nullptr;
const size_t kPrefixSize = sizeof(game2Type) - sizeof(savedRoom);
game2Type *gameData = static_cast<game2Type*>(PortabilityLayer::MemoryManager::GetInstance()->Alloc(kPrefixSize));
if (!gameData)
{
stream->Close();
return nullptr;
}
if (stream->Read(gameData, kPrefixSize) != kPrefixSize)
{
PortabilityLayer::MemoryManager::GetInstance()->Release(gameData);
stream->Close();
return nullptr;
}
stream->Close();
return gameData;
}
static void FBUI_FreeFileDetails(void *fileDetails)
{
PortabilityLayer::MemoryManager::GetInstance()->Release(fileDetails);
}
static PortabilityLayer::FileBrowserUI_DetailsCallbackAPI GetSavedGameDetailsAPI()
{
PortabilityLayer::FileBrowserUI_DetailsCallbackAPI api;
api.m_drawLabelsCallback = FBUI_DrawLabels;
api.m_drawFileDetailsCallback = FBUI_DrawFileDetails;
api.m_loadFileDetailsCallback = FBUI_LoadFileDetails;
api.m_freeFileDetailsCallback = FBUI_FreeFileDetails;
return api;
}
//-------------------------------------------------------------- SaveGame2
void SaveGame2 (void)
Boolean SaveGame2 (void)
{
// Bringing up the save file UI can cause key/mouse events to be missed, resulting in state being stuck when this comes back.
// To avoid that, clear all state here.
@@ -65,7 +146,7 @@ void SaveGame2 (void)
if (savedGame == nil)
{
YellowAlert(kYellowFailedSaveGame, PLErrors::kOutOfMemory);
return;
return false;
}
memset(savedGame, 0, byteCount);
@@ -82,10 +163,10 @@ void SaveGame2 (void)
char savePath[sizeof(spec.m_name) + 1];
size_t savePathLength = 0;
if (!fm->PromptSaveFile(spec.m_dir, savePath, savePathLength, sizeof(spec.m_name), PLPasStr(gameNameStr), PSTR("Save Game")))
if (!fm->PromptSaveFile(spec.m_dir, 'gliG', savePath, savePathLength, sizeof(spec.m_name), PLPasStr(gameNameStr), PSTR("Save Game"), GetSavedGameDetailsAPI()))
{
mm->Release(savedGame);
return;
return false;
}
assert(savePathLength < sizeof(spec.m_name) - 1);
@@ -98,7 +179,7 @@ void SaveGame2 (void)
if (!fm->DeleteFile(spec.m_dir, spec.m_name))
{
CheckFileError(PLErrors::kAccessDenied, PSTR("Saved Game"));
return;
return false;
}
}
@@ -152,6 +233,8 @@ void SaveGame2 (void)
}
mm->Release(savedGame);
return true;
}
//-------------------------------------------------------------- SavedGameMismatchError
@@ -191,7 +274,7 @@ Boolean OpenSavedGame (void)
char savePath[sizeof(spec.m_name) + 1];
size_t savePathLength = 0;
if (!fm->PromptOpenFile(spec.m_dir, savePath, savePathLength, sizeof(spec.m_name), PSTR("Open Saved Game")))
if (!fm->PromptOpenFile(spec.m_dir, 'gliG', savePath, savePathLength, sizeof(spec.m_name), PSTR("Open Saved Game"), GetSavedGameDetailsAPI()))
return false;
assert(savePathLength < sizeof(spec.m_name) - 1);

View File

@@ -42,7 +42,7 @@
#define kGrayedOutDownArrow 1053
#define kMaxExtraHouses 8
void WriteOutPrefs (void);
void UpdateLoadDialog (Dialog *);
void PageUpHouses (Dialog *);
void PageDownHouses (Dialog *);
@@ -343,6 +343,7 @@ void DoLoadHouse (void)
Dialog *theDial;
short i, wasIndex, screenCount;
Boolean leaving, whoCares;
bool houseNameDirty = false;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
@@ -411,7 +412,10 @@ void DoLoadHouse (void)
PasStringCopy(theHousesSpecs[thisHouseIndex].m_name,
thisHouseName);
if (OpenHouse())
{
whoCares = ReadHouse();
houseNameDirty = true;
}
}
leaving = true;
}
@@ -449,7 +453,10 @@ void DoLoadHouse (void)
PasStringCopy(theHousesSpecs[thisHouseIndex].m_name,
thisHouseName);
if (OpenHouse())
{
whoCares = ReadHouse();
houseNameDirty = true;
}
}
leaving = true;
}
@@ -483,7 +490,10 @@ void DoLoadHouse (void)
PasStringCopy(theHousesSpecs[thisHouseIndex].m_name,
thisHouseName);
if (OpenHouse())
{
whoCares = ReadHouse();
houseNameDirty = true;
}
}
leaving = true;
}
@@ -501,6 +511,9 @@ void DoLoadHouse (void)
UpdateLoadDialog(theDial);
}
if (houseNameDirty)
WriteOutPrefs();
wm->SwapExclusiveWindow(exclWindow); // Pop exclusive window
theDial->Destroy();

View File

@@ -5,22 +5,22 @@
//----------------------------------------------------------------------------
//============================================================================
#include "PLArrayView.h"
#include "PLKeyEncoding.h"
#include "PLSound.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "PLWidgets.h"
#include "ResolveCachingColor.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "House.h"
#include "IGpDisplayDriver.h"
#include "WindowManager.h"
#include "PLArrayView.h"
#include "PLDrivers.h"
#include "PLKeyEncoding.h"
#include "PLSound.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "PLWidgets.h"
#define kMainPrefsDialID 1012
#define kDisplayPrefsDialID 1017
@@ -72,7 +72,7 @@
#define kDoBackgroundCheck 11
#define kDoErrorCheck 12
#define kDoPrettyMapCheck 13
#define kDoBitchDlgsCheck 14
#define kDoComplainDlgsCheck 14
void SetBrainsToDefaults (Dialog *);
@@ -98,7 +98,8 @@ void SetAllDefaults (void);
void FlashSettingsButton (DrawSurface *, short);
void UpdateSettingsMain (Dialog *);
int16_t PrefsFilter(void *context, Dialog *dialog, const TimeTaggedVOSEvent *evt);
void BitchAboutChanges (void);
void ComplainAboutChanges (void);
void WriteOutPrefs (void);
Rect prefButton[4], controlRects[4];
@@ -108,11 +109,11 @@ long tempLeftMap, tempRightMap, tempBattMap, tempBandMap;
short whichCtrl, wasDepthPref;
Boolean wasFade, wasIdle, wasPlay, wasTransit, wasZooms, wasBackground;
Boolean wasEscPauseKey, wasDemos, wasAutoScale, wasUseICCProfile, nextRestartChange, wasErrorCheck, wasFullscreenPref, needResolutionReset;
Boolean wasPrettyMap, wasBitchDialogs;
Boolean wasPrettyMap, wasComplainDialogs;
extern short numNeighbors, isDepthPref, maxFiles, willMaxFiles;
extern Boolean isDoColorFade, isPlayMusicIdle, isAutoScale, isUseICCProfile;
extern Boolean isHouseChecks, doBitchDialogs;
extern Boolean isHouseChecks, doComplainDialogs;
extern Boolean isEscPauseKey, failedMusic, isSoundOn, doBackground;
extern Boolean isMusicOn, quickerTransitions, doAutoDemo;
extern Boolean changeLockStateOfHouse, saveHouseLocked, doPrettyMap;
@@ -134,14 +135,14 @@ void SetBrainsToDefaults (Dialog *theDialog)
wasBackground = false;
wasErrorCheck = true;
wasPrettyMap = true;
wasBitchDialogs = true;
wasComplainDialogs = true;
SetDialogItemValue(theDialog, kQuickTransitCheck, (short)wasTransit);
SetDialogItemValue(theDialog, kDoZoomsCheck, (short)wasZooms);
SetDialogItemValue(theDialog, kDoDemoCheck, (short)wasDemos);
SetDialogItemValue(theDialog, kDoBackgroundCheck, (short)wasBackground);
SetDialogItemValue(theDialog, kDoErrorCheck, (short)wasErrorCheck);
SetDialogItemValue(theDialog, kDoPrettyMapCheck, (short)wasPrettyMap);
SetDialogItemValue(theDialog, kDoBitchDlgsCheck, (short)wasBitchDialogs);
SetDialogItemValue(theDialog, kDoComplainDlgsCheck, (short)wasComplainDialogs);
}
//-------------------------------------------------------------- UpdateSettingsBrains
@@ -237,7 +238,7 @@ void DoBrainsPrefs (void)
wasBackground = doBackground;
wasErrorCheck = isHouseChecks;
wasPrettyMap = doPrettyMap;
wasBitchDialogs = doBitchDialogs;
wasComplainDialogs = doComplainDialogs;
SetDialogItemValue(prefDlg, kQuickTransitCheck, (short)wasTransit);
SetDialogItemValue(prefDlg, kDoZoomsCheck, (short)wasZooms);
@@ -245,7 +246,7 @@ void DoBrainsPrefs (void)
SetDialogItemValue(prefDlg, kDoBackgroundCheck, (short)wasBackground);
SetDialogItemValue(prefDlg, kDoErrorCheck, (short)wasErrorCheck);
SetDialogItemValue(prefDlg, kDoPrettyMapCheck, (short)wasPrettyMap);
SetDialogItemValue(prefDlg, kDoBitchDlgsCheck, (short)wasBitchDialogs);
SetDialogItemValue(prefDlg, kDoComplainDlgsCheck, (short)wasComplainDialogs);
UpdateSettingsBrains(prefDlg);
@@ -271,7 +272,7 @@ void DoBrainsPrefs (void)
doBackground = wasBackground;
isHouseChecks = wasErrorCheck;
doPrettyMap = wasPrettyMap;
doBitchDialogs = wasBitchDialogs;
doComplainDialogs = wasComplainDialogs;
leaving = true;
break;
@@ -314,9 +315,9 @@ void DoBrainsPrefs (void)
SetDialogItemValue(prefDlg, kDoPrettyMapCheck, (short)wasPrettyMap);
break;
case kDoBitchDlgsCheck:
wasBitchDialogs = !wasBitchDialogs;
SetDialogItemValue(prefDlg, kDoBitchDlgsCheck, (short)wasBitchDialogs);
case kDoComplainDlgsCheck:
wasComplainDialogs = !wasComplainDialogs;
SetDialogItemValue(prefDlg, kDoComplainDlgsCheck, (short)wasComplainDialogs);
break;
}
}
@@ -1120,7 +1121,7 @@ void SetAllDefaults (void)
doBackground = false;
isHouseChecks = true;
doPrettyMap = true;
doBitchDialogs = true;
doComplainDialogs = true;
// Default control settings
PasStringCopy(PSTR("lf arrow"), leftName);
PasStringCopy(PSTR("rt arrow"), rightName);
@@ -1284,7 +1285,7 @@ void DoSettingsMain (void)
leaving = false;
nextRestartChange = false;
wasFullscreenPref = PortabilityLayer::HostDisplayDriver::GetInstance()->IsFullScreen();
wasFullscreenPref = PLDrivers::GetDisplayDriver()->IsFullScreen();
Window* exclWindow = prefDlg->GetWindow();
@@ -1339,11 +1340,11 @@ void DoSettingsMain (void)
if (nextRestartChange)
{
BitchAboutChanges();
ComplainAboutChanges();
nextRestartChange = false;
}
IGpDisplayDriver *displayDriver = PortabilityLayer::HostDisplayDriver::GetInstance();
IGpDisplayDriver *displayDriver = PLDrivers::GetDisplayDriver();
if (displayDriver->IsFullScreen() != (wasFullscreenPref != 0))
{
@@ -1353,16 +1354,18 @@ void DoSettingsMain (void)
if (needResolutionReset)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->RequestResetVirtualResolution();
displayDriver->RequestResetVirtualResolution();
needResolutionReset = false;
}
PortabilityLayer::HostDisplayDriver::GetInstance()->SetUseICCProfile(isUseICCProfile);
displayDriver->SetUseICCProfile(isUseICCProfile);
WriteOutPrefs();
}
//-------------------------------------------------------------- BitchAboutChanges
//-------------------------------------------------------------- ComplainAboutChanges
void BitchAboutChanges (void)
void ComplainAboutChanges (void)
{
#define kChangesEffectAlert 1040
short hitWhat;

View File

@@ -378,17 +378,6 @@ void TellHerNoSounds (void)
hitWhat = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(kNoMemForSoundsAlert, nullptr);
}
//-------------------------------------------------------------- BitchAboutSM3
void BitchAboutSM3 (void)
{
#define kNoSoundManager3Alert 1030
short hitWhat;
// CenterAlert(kNoSoundManager3Alert);
hitWhat = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(kNoSoundManager3Alert, nullptr);
}
//-------------------------------------------------------------- ParseAndConvertSound

View File

@@ -1,24 +1,27 @@
#include "CombinedTimestamp.h"
#include "DeflateCodec.h"
#include "Environ.h"
#include "FontFamily.h"
#include "GpBuildVersion.h"
#include "GpIOStream.h"
#include "HostDirectoryCursor.h"
#include "HostDisplayDriver.h"
#include "HostFileSystem.h"
#include "GpFileCreationDisposition.h"
#include "IGpDirectoryCursor.h"
#include "IGpDisplayDriver.h"
#include "IGpFileSystem.h"
#include "MemoryManager.h"
#include "PLCore.h"
#include "PLStandardColors.h"
#include "PLSysCalls.h"
#include "RenderedFont.h"
#include "GpApplicationName.h"
#include "GpRenderedFontMetrics.h"
#include "ResolveCachingColor.h"
#include "ZipFile.h"
#include "Vec2i.h"
#include "WindowDef.h"
#include "WindowManager.h"
#include "FontFamily.h"
#include "ZipFile.h"
#include "PLCore.h"
#include "PLDrivers.h"
#include "PLStandardColors.h"
#include "PLSysCalls.h"
#include <vector>
#include <string>
@@ -138,9 +141,9 @@ static void InitSourceExportWindow(SourceExportState *state)
// We have to use this instead of thisMac.fullScreen because the resolution may change during the sleep call, especially on Android displays where
// the status bar dismissal causes a major change in the virtual resolution.
unsigned int displayWidth = 0;
unsigned int displayHeight = 0;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&displayWidth, &displayHeight);
PortabilityLayer::Vec2i displaySize = PortabilityLayer::WindowManager::GetInstance()->GetDisplayResolution();
unsigned int displayWidth = displaySize.m_x;
unsigned int displayHeight = displaySize.m_y;
int32_t lsX = (static_cast<int32_t>(displayWidth) - kLoadScreenWidth) / 2;
int32_t lsY = (static_cast<int32_t>(displayHeight) - kLoadScreenHeight) / 2;
@@ -183,7 +186,7 @@ static void InitSourceExportWindow(SourceExportState *state)
static bool RetrieveSingleFileSize(PortabilityLayer::VirtualDirectory_t virtualDir, char const* const* paths, size_t numPaths, size_t &outSize)
{
GpIOStream *stream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFileNested(virtualDir, paths, numPaths, false, GpFileCreationDispositions::kOpenExisting);
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFileNested(virtualDir, paths, numPaths, false, GpFileCreationDispositions::kOpenExisting);
if (!stream)
return false;
@@ -199,7 +202,7 @@ static bool RetrieveCompositeDirSize(PortabilityLayer::VirtualDirectory_t virtua
size_t totalSize = 0;
totalSizeOut = 0;
PortabilityLayer::HostDirectoryCursor *dirCursor = PortabilityLayer::HostFileSystem::GetInstance()->ScanDirectory(virtualDir);
IGpDirectoryCursor *dirCursor = PLDrivers::GetFileSystem()->ScanDirectory(virtualDir);
if (!dirCursor)
return false;
@@ -402,7 +405,7 @@ static bool RepackDirectory(SourceExportState &state, GpIOStream *outStream, std
uint16_t dosTime = 0;
ConvertToMSDOSTimestamp(state.m_ts, dosDate, dosTime);
PortabilityLayer::HostDirectoryCursor *dirCursor = PortabilityLayer::HostFileSystem::GetInstance()->ScanDirectory(virtualDir);
IGpDirectoryCursor *dirCursor = PLDrivers::GetFileSystem()->ScanDirectory(virtualDir);
if (!dirCursor)
return false;
@@ -425,7 +428,7 @@ static bool RepackDirectory(SourceExportState &state, GpIOStream *outStream, std
const bool shouldStore = (extension[3] == 'a');
state.m_fStream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(virtualDir, fpath, false, GpFileCreationDispositions::kOpenExisting);
state.m_fStream = PLDrivers::GetFileSystem()->OpenFile(virtualDir, fpath, false, GpFileCreationDispositions::kOpenExisting);
if (!state.m_fStream)
return false;
@@ -664,7 +667,7 @@ bool ExportSourceToStream (GpIOStream *stream)
SourceExportState state;
InitSourceExportWindow(&state);
state.m_tsStream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kApplicationData, "DefaultTimestamp.timestamp", false, GpFileCreationDispositions::kOpenExisting);
state.m_tsStream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kApplicationData, "DefaultTimestamp.timestamp", false, GpFileCreationDispositions::kOpenExisting);
if (!state.m_tsStream)
return false;
@@ -673,7 +676,7 @@ bool ExportSourceToStream (GpIOStream *stream)
state.m_tsStream->Close();
state.m_tsStream = nullptr;
state.m_sourcePkgStream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kApplicationData, "SourceCode.pkg", false, GpFileCreationDispositions::kOpenExisting);
state.m_sourcePkgStream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kApplicationData, "SourceCode.pkg", false, GpFileCreationDispositions::kOpenExisting);
if (!state.m_sourcePkgStream)
return false;
@@ -730,7 +733,7 @@ bool ExportSourceToStream (GpIOStream *stream)
void DoExportSourceCode (void)
{
GpIOStream *stream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kSourceExport, GP_APPLICATION_NAME "-" GP_APPLICATION_VERSION_STRING "-SourceCode.zip", true, GpFileCreationDispositions::kCreateOrOverwrite);
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kSourceExport, GP_APPLICATION_NAME "-" GP_APPLICATION_VERSION_STRING "-SourceCode.zip", true, GpFileCreationDispositions::kCreateOrOverwrite);
if (!stream)
return;

View File

@@ -11,13 +11,13 @@
#include "PLPasStr.h"
#include "PLResources.h"
#include "PLSound.h"
#include "PLSysCalls.h"
#include "PLTimeTaggedVOSEvent.h"
#include "QDPixMap.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "DisplayDeviceManager.h"
#include "Externs.h"
#include "HostSystemServices.h"
#include "IconLoader.h"
#include "InputManager.h"
#include "ResourceManager.h"
@@ -115,9 +115,7 @@ void RedAlert (short errorNumber)
// CenterAlert(rDeathAlertID);
dummyInt = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(rDeathAlertID, &substitutions);
//ExitToShell();
PL_NotYetImplemented_TODO("Exit");
PLSysCalls::Exit(-1);
}
//-------------------------------------------------------------- CreateOffScreenBitMap
@@ -277,6 +275,22 @@ void LoadGraphic (DrawSurface *surface, short resID)
thePicture.Dispose();
}
void LoadGraphicNoDither(DrawSurface *surface, short resID)
{
Rect bounds;
THandle<BitmapImage> thePicture;
thePicture = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', resID).StaticCast<BitmapImage>();
if (thePicture == nil)
RedAlert(kErrFailedGraphicLoad);
bounds = (*thePicture)->GetRect();
OffsetRect(&bounds, -bounds.left, -bounds.top);
surface->DrawPicture(thePicture, bounds, false);
thePicture.Dispose();
}
//-------------------------------------------------------------- LoadGraphicCustom
// Same as LoadGraphic but supports custom graphics
void LoadGraphicCustom(DrawSurface *surface, short resID)

View File

@@ -2,11 +2,7 @@
#include "EGpAudioDriverType.h"
namespace PortabilityLayer
{
class HostSystemServices;
}
struct IGpSystemServices;
struct IGpAudioDriver;
struct IGpLogDriver;
@@ -18,5 +14,5 @@ struct GpAudioDriverProperties
bool m_debug;
IGpLogDriver *m_logger;
PortabilityLayer::HostSystemServices *m_systemServices;
IGpSystemServices *m_systemServices;
};

View File

@@ -2,8 +2,8 @@
#define GP_BUILD_VERSION_MAJOR 1
#define GP_BUILD_VERSION_MINOR 0
#define GP_BUILD_VERSION_UPDATE 9
#define GP_BUILD_VERSION_UPDATE 11
#define GP_APPLICATION_VERSION_STRING "1.0.9"
#define GP_APPLICATION_VERSION_STRING "1.0.11"
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2020 Eric Lasota"
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"

View File

@@ -9,11 +9,7 @@ struct IGpDisplayDriver;
struct IGpFiber;
struct IGpVOSEventQueue;
struct IGpLogDriver;
namespace PortabilityLayer
{
class HostSystemServices;
}
struct IGpSystemServices;
struct GpDisplayDriverProperties
{
@@ -46,5 +42,5 @@ struct GpDisplayDriverProperties
IGpVOSEventQueue *m_eventQueue;
IGpLogDriver *m_logger;
PortabilityLayer::HostSystemServices *m_systemServices;
IGpSystemServices *m_systemServices;
};

132
GpCommon/GpDriverIndex.h Normal file
View File

@@ -0,0 +1,132 @@
#pragma once
#include "CoreDefs.h"
#include <stdint.h>
namespace GpDriverIDs
{
enum GpDriverID
{
kAudio,
kFileSystem,
kDisplay,
kLog,
kInput,
kSystemServices,
kFont,
kEventQueue,
kCount
};
}
typedef GpDriverIDs::GpDriverID GpDriverID_t;
template<int T>
struct GpDriverIndex
{
};
#define GP_DEFINE_DRIVER(driverID, type) \
struct type;\
template<>\
struct GpDriverIndex<GpDriverIDs::driverID>\
{\
typedef type Type_t;\
static const bool kIsMultiDriver = false;\
}
#define GP_DEFINE_MULTI_DRIVER(driverID, type) \
struct type;\
template<>\
struct GpDriverIndex<GpDriverIDs::driverID>\
{\
typedef type Type_t;\
static const bool kIsMultiDriver = true;\
}
GP_DEFINE_DRIVER(kAudio, IGpAudioDriver);
GP_DEFINE_DRIVER(kFileSystem, IGpFileSystem);
GP_DEFINE_DRIVER(kDisplay, IGpDisplayDriver);
GP_DEFINE_DRIVER(kLog, IGpLogDriver);
GP_DEFINE_MULTI_DRIVER(kInput, IGpInputDriver);
GP_DEFINE_DRIVER(kSystemServices, IGpSystemServices);
GP_DEFINE_DRIVER(kFont, IGpFontHandler);
GP_DEFINE_DRIVER(kEventQueue, IGpVOSEventQueue);
struct GpDriverCollection
{
GpDriverCollection();
template<GpDriverID_t T>
void SetDriver(typename GpDriverIndex<T>::Type_t *driver);
template<GpDriverID_t T>
void SetDrivers(typename GpDriverIndex<T>::Type_t *const* drivers, size_t numDrivers);
template<GpDriverID_t T>
typename GpDriverIndex<T>::Type_t *GetDriver() const;
template<GpDriverID_t T>
typename GpDriverIndex<T>::Type_t *GetDriver(size_t index) const;
template<GpDriverID_t T>
size_t GetDriverCount() const;
private:
struct DriverEntry
{
void *m_value;
size_t m_numDrivers;
};
DriverEntry m_drivers[GpDriverIDs::kCount];
};
inline GpDriverCollection::GpDriverCollection()
{
for (int i = 0; i < GpDriverIDs::kCount; i++)
{
this->m_drivers[i].m_value = nullptr;
this->m_drivers[i].m_numDrivers = 0;
}
}
template<GpDriverID_t T>
void GpDriverCollection::SetDriver(typename GpDriverIndex<T>::Type_t *driver)
{
GP_STATIC_ASSERT(!GpDriverIndex<T>::kIsMultiDriver);
m_drivers[T].m_numDrivers = 1;
m_drivers[T].m_value = driver;
}
template<GpDriverID_t T>
void GpDriverCollection::SetDrivers(typename GpDriverIndex<T>::Type_t *const* drivers, size_t numDrivers)
{
GP_STATIC_ASSERT(GpDriverIndex<T>::kIsMultiDriver);
m_drivers[T].m_numDrivers = numDrivers;
m_drivers[T].m_value = const_cast<typename GpDriverIndex<T>::Type_t **>(drivers);
}
template<GpDriverID_t T>
inline typename GpDriverIndex<T>::Type_t *GpDriverCollection::GetDriver() const
{
GP_STATIC_ASSERT(!GpDriverIndex<T>::kIsMultiDriver);
return static_cast<typename GpDriverIndex<T>::Type_t*>(this->m_drivers[T].m_value);
}
template<GpDriverID_t T>
inline typename GpDriverIndex<T>::Type_t *GpDriverCollection::GetDriver(size_t index) const
{
GP_STATIC_ASSERT(GpDriverIndex<T>::kIsMultiDriver);
return static_cast<typename GpDriverIndex<T>::Type_t*const*>(this->m_drivers[T].m_value)[index];
}
template<GpDriverID_t T>
size_t GpDriverCollection::GetDriverCount() const
{
GP_STATIC_ASSERT(GpDriverIndex<T>::kIsMultiDriver);
return this->m_drivers[T].m_numDrivers;
}

View File

@@ -0,0 +1,8 @@
#pragma once
struct IGpDirectoryCursor
{
public:
virtual bool GetNext(const char *&outFileName) = 0;
virtual void Destroy() = 0;
};

View File

@@ -31,7 +31,8 @@ struct IGpDisplayDriver
virtual void Run() = 0;
virtual void Shutdown() = 0;
virtual void GetDisplayResolution(unsigned int *width, unsigned int *height) = 0;
// Returns the initial resolution before any display resolution events are posted
virtual void GetInitialDisplayResolution(unsigned int *width, unsigned int *height) = 0;
virtual IGpDisplayDriverSurface *CreateSurface(size_t width, size_t height, size_t pitch, GpPixelFormat_t pixelFormat, SurfaceInvalidateCallback_t invalidateCallback, void *invalidateContext) = 0;
virtual void DrawSurface(IGpDisplayDriverSurface *surface, int32_t x, int32_t y, size_t width, size_t height, const GpDisplayDriverSurfaceEffects *effects) = 0;

43
GpCommon/IGpFileSystem.h Normal file
View File

@@ -0,0 +1,43 @@
#pragma once
#include "GpFileCreationDisposition.h"
#include "VirtualDirectory.h"
#include <stdint.h>
class GpIOStream;
struct IGpThreadRelay;
struct IGpDirectoryCursor;
struct IGpFileSystem
{
public:
typedef void(*DelayCallback_t)(uint32_t ticks);
virtual bool FileExists(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path) = 0;
virtual bool FileLocked(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool *exists) = 0;
virtual GpIOStream *OpenFileNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* subPaths, size_t numSubPaths, bool writeAccess, GpFileCreationDisposition_t createDisposition) = 0;
virtual bool DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed) = 0;
virtual IGpDirectoryCursor *ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths) = 0;
virtual bool ValidateFilePath(const char *path, size_t pathLen) const = 0;
virtual bool ValidateFilePathUnicodeChar(uint32_t ch) const = 0;
virtual bool IsVirtualDirectoryLooseResources(PortabilityLayer::VirtualDirectory_t virtualDir) const = 0;
virtual void SetMainThreadRelay(IGpThreadRelay *relay) = 0;
virtual void SetDelayCallback(DelayCallback_t delayCallback) = 0;
// Helpers
GpIOStream *OpenFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool writeAccess, GpFileCreationDisposition_t createDisposition);
IGpDirectoryCursor *ScanDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory);
};
inline GpIOStream *IGpFileSystem::OpenFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool writeAccess, GpFileCreationDisposition_t createDisposition)
{
return this->OpenFileNested(virtualDirectory, &path, 1, writeAccess, createDisposition);
}
inline IGpDirectoryCursor *IGpFileSystem::ScanDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory)
{
return this->ScanDirectoryNested(virtualDirectory, nullptr, 0);
}

10
GpCommon/IGpMutex.h Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
struct IGpMutex
{
public:
virtual void Destroy() = 0;
virtual void Lock() = 0;
virtual void Unlock() = 0;
};

View File

@@ -0,0 +1,37 @@
#pragma once
#include <stdint.h>
#ifdef CreateMutex
#error "CreateMutex was macrod"
#endif
#ifdef CreateThread
#error "CreateThread was macrod"
#endif
struct IGpMutex;
struct IGpThreadEvent;
struct IGpSystemServices
{
public:
typedef int(*ThreadFunc_t)(void *context);
virtual int64_t GetTime() const = 0;
virtual void GetLocalDateTime(unsigned int &year, unsigned int &month, unsigned int &day, unsigned int &hour, unsigned int &minute, unsigned int &second) const = 0;
virtual IGpMutex *CreateMutex() = 0;
virtual IGpMutex *CreateRecursiveMutex() = 0;
virtual void *CreateThread(ThreadFunc_t threadFunc, void *context) = 0;
virtual IGpThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) = 0;
virtual uint64_t GetFreeMemoryCosmetic() const = 0; // Returns free memory in bytes, does not have to be accurate
virtual void Beep() const = 0;
virtual bool IsTouchscreen() const = 0;
virtual bool IsUsingMouseAsTouch() const = 0;
virtual bool IsFullscreenPreferred() const = 0;
virtual bool IsTextInputObstructive() const = 0;
virtual unsigned int GetCPUCount() const = 0;
virtual void SetTextInputEnabled(bool isEnabled) = 0;
virtual bool IsTextInputEnabled() const = 0;
virtual bool AreFontResourcesSeekable() const = 0;
};

12
GpCommon/IGpThreadEvent.h Normal file
View File

@@ -0,0 +1,12 @@
#pragma once
#include <stdint.h>
struct IGpThreadEvent
{
public:
virtual void Wait() = 0;
virtual bool WaitTimed(uint32_t msec) = 0;
virtual void Signal() = 0;
virtual void Destroy() = 0;
};

View File

@@ -1,10 +1,10 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 232, 177, 184, 42, 191, 44, 237, 186, 185, 1, 42,
67, 157, 207, 200, 70, 1, 0, 0, 0, 116, 5, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 52, 1, 0, 0, 140, 1, 0, 0, 192,
1, 0, 0, 248, 4, 0, 0, 82, 68, 69, 70, 248, 0, 0, 0,
68, 88, 66, 67, 36, 129, 233, 7, 7, 186, 125, 28, 230, 207, 54,
71, 251, 69, 112, 99, 1, 0, 0, 0, 144, 5, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 60, 1, 0, 0, 148, 1, 0, 0, 200,
1, 0, 0, 20, 5, 0, 0, 82, 68, 69, 70, 0, 1, 0, 0,
1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 208, 0, 0, 0, 92, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 216, 0, 0, 0, 92, 0,
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 0,
107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -14,85 +14,86 @@ static unsigned char gs_shaderData[] = {
101, 108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 107, 0, 0,
0, 1, 0, 0, 0, 156, 0, 0, 0, 16, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, 0, 16,
0, 0, 0, 2, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0,
100, 120, 100, 121, 95, 85, 110, 117, 115, 101, 100, 0, 1, 0, 3,
0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105,
99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83,
76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108,
101, 114, 32, 49, 48, 46, 49, 0, 73, 83, 71, 78, 80, 0, 0,
0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15,
0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79,
82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1,
0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
68, 82, 48, 3, 0, 0, 64, 0, 0, 0, 204, 0, 0, 0, 89,
0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0,
88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0,
0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 5,
0, 0, 0, 51, 0, 0, 11, 50, 0, 16, 0, 0, 0, 0, 0,
70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0,
0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0,
0, 0, 50, 0, 0, 14, 194, 0, 16, 0, 0, 0, 0, 0, 6,
132, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63, 0, 0, 0, 63, 6, 20, 16, 0, 1, 0, 0, 0, 52, 0,
0, 10, 194, 0, 16, 0, 0, 0, 0, 0, 166, 14, 16, 0, 0,
0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 50, 0, 16,
0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 230, 10,
16, 0, 0, 0, 0, 0, 65, 0, 0, 5, 194, 0, 16, 0, 0,
0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5,
50, 0, 16, 0, 1, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0,
0, 65, 0, 0, 5, 194, 0, 16, 0, 0, 0, 0, 0, 6, 4,
16, 0, 0, 0, 0, 0, 0, 0, 0, 8, 50, 0, 16, 0, 0,
0, 0, 0, 230, 10, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0,
70, 0, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16,
0, 2, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0, 0, 14, 32,
0, 8, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
0, 0, 0, 70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
54, 0, 0, 5, 66, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0,
0, 0, 0, 0, 0, 54, 0, 0, 5, 194, 0, 16, 0, 2, 0,
0, 0, 86, 9, 16, 0, 1, 0, 0, 0, 45, 0, 0, 7, 242,
0, 16, 0, 3, 0, 0, 0, 70, 15, 16, 0, 2, 0, 0, 0,
70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0, 16,
0, 4, 0, 0, 0, 134, 15, 16, 0, 2, 0, 0, 0, 70, 126,
16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1,
0, 0, 0, 26, 0, 16, 0, 2, 0, 0, 0, 45, 0, 0, 7,
242, 0, 16, 0, 2, 0, 0, 0, 198, 10, 16, 0, 1, 0, 0,
0, 70, 126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0,
16, 0, 1, 0, 0, 0, 70, 10, 16, 0, 1, 0, 0, 0, 70,
126, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
4, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
0, 4, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 3, 0,
0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 3,
0, 0, 0, 0, 0, 0, 11, 82, 0, 16, 0, 0, 0, 0, 0,
6, 1, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0,
0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0,
0, 0, 50, 0, 0, 9, 114, 0, 16, 0, 2, 0, 0, 0, 6,
0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0,
70, 2, 16, 0, 3, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16,
0, 2, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 70, 2,
16, 0, 2, 0, 0, 0, 50, 0, 0, 9, 178, 0, 16, 0, 0,
0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 8, 16, 0,
1, 0, 0, 0, 70, 8, 16, 0, 4, 0, 0, 0, 50, 0, 0,
9, 114, 32, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 0, 0,
0, 0, 70, 3, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2,
0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
84, 116, 0, 0, 0, 26, 0, 0, 0, 5, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 2, 0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 0,
100, 120, 100, 121, 95, 73, 110, 118, 80, 105, 120, 101, 108, 83, 99,
97, 108, 101, 0, 171, 1, 0, 3, 0, 1, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101,
114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, 49,
0, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0,
0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
0, 0, 0, 0, 0, 0, 0, 15, 3, 0, 0, 68, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0,
0, 3, 0, 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, 68, 3, 0, 0, 64,
0, 0, 0, 209, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0,
0, 0, 0, 0, 1, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16,
0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 32, 0, 4, 50, 16,
16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242,
32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 5, 0, 0, 0,
0, 0, 0, 10, 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16,
0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 191, 0, 0,
0, 191, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 8, 50,
0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0,
230, 138, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0,
10, 50, 0, 16, 0, 0, 0, 0, 0, 70, 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, 51, 0, 0, 11, 194, 0, 16, 0,
0, 0, 0, 0, 6, 132, 32, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
128, 63, 0, 0, 128, 63, 0, 0, 0, 7, 194, 0, 16, 0, 0,
0, 0, 0, 166, 14, 16, 0, 0, 0, 0, 0, 6, 4, 16, 0,
0, 0, 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0,
0, 70, 0, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 50, 0,
16, 0, 1, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 65,
0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 230, 10, 16, 0,
0, 0, 0, 0, 0, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0,
0, 6, 4, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 166, 14,
16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 2,
0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 14, 32, 0, 8,
50, 0, 16, 0, 0, 0, 0, 0, 230, 10, 16, 0, 0, 0, 0,
0, 70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
0, 5, 66, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0,
0, 0, 0, 54, 0, 0, 5, 194, 0, 16, 0, 2, 0, 0, 0,
86, 9, 16, 0, 1, 0, 0, 0, 45, 0, 0, 7, 242, 0, 16,
0, 3, 0, 0, 0, 70, 15, 16, 0, 2, 0, 0, 0, 70, 126,
16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0, 16, 0, 4,
0, 0, 0, 134, 15, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0,
0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, 0, 0,
0, 26, 0, 16, 0, 2, 0, 0, 0, 45, 0, 0, 7, 242, 0,
16, 0, 2, 0, 0, 0, 198, 10, 16, 0, 1, 0, 0, 0, 70,
126, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0, 16, 0,
1, 0, 0, 0, 70, 10, 16, 0, 1, 0, 0, 0, 70, 126, 16,
0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 4, 0,
0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 4,
0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 3, 0, 0, 0,
6, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0,
0, 0, 0, 0, 11, 82, 0, 16, 0, 0, 0, 0, 0, 6, 1,
16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0,
50, 0, 0, 9, 114, 0, 16, 0, 2, 0, 0, 0, 6, 0, 16,
0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2,
16, 0, 3, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 2,
0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
2, 0, 0, 0, 50, 0, 0, 9, 178, 0, 16, 0, 0, 0, 0,
0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 8, 16, 0, 1, 0,
0, 0, 70, 8, 16, 0, 4, 0, 0, 0, 50, 0, 0, 9, 114,
32, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 0, 0, 0, 0,
70, 3, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0,
0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64,
0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116,
0, 0, 0, 27, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4,
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
namespace GpBinarizedShaders

View File

@@ -814,10 +814,10 @@ void GpDisplayDriverD3D11::ScaleVirtualScreen()
float fHeight = static_cast<float>(m_windowHeightVirtual) * m_pixelScaleY;
DrawQuadVertexConstants vConstantsData;
vConstantsData.m_ndcOriginX = twoDivWidth - 1.0f;
vConstantsData.m_ndcOriginY = negativeTwoDivHeight + 1.0f;
vConstantsData.m_ndcWidth = fWidth * twoDivWidth;
vConstantsData.m_ndcHeight = fHeight * negativeTwoDivHeight;
vConstantsData.m_ndcOriginX = - 1.0f;
vConstantsData.m_ndcOriginY = 1.0f;
vConstantsData.m_ndcWidth = 2.0;
vConstantsData.m_ndcHeight = -2.0;
vConstantsData.m_surfaceDimensionX = static_cast<float>(m_windowWidthVirtual);
vConstantsData.m_surfaceDimensionY = static_cast<float>(m_windowHeightVirtual);
@@ -832,6 +832,8 @@ void GpDisplayDriverD3D11::ScaleVirtualScreen()
ScaleQuadPixelConstants pConstantsData;
pConstantsData.m_dx = static_cast<float>(static_cast<double>(m_windowWidthVirtual) / static_cast<double>(m_windowWidthPhysical));
pConstantsData.m_dy = static_cast<float>(static_cast<double>(m_windowHeightVirtual) / static_cast<double>(m_windowHeightPhysical));
pConstantsData.m_invScaleX = static_cast<float>(1.0f / m_pixelScaleX);
pConstantsData.m_invScaleY = static_cast<float>(1.0f / m_pixelScaleY);
D3D11_MAPPED_SUBRESOURCE mappedPConstants;
if (m_deviceContext->Map(m_scaleQuadPixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedPConstants) == S_OK)
@@ -1127,7 +1129,7 @@ void GpDisplayDriverD3D11::Run()
HMENU menus = NULL;
// TODO: Fix the resolution here
RECT wr = { 0, 0, m_windowWidthPhysical, m_windowHeightPhysical };
RECT wr = { 0, 0, static_cast<DWORD>(m_windowWidthPhysical), static_cast<DWORD>(m_windowHeightPhysical) };
AdjustWindowRect(&wr, windowStyle, menus != NULL);
m_osGlobals->m_hwnd = CreateWindowExW(NULL, L"GPD3D11WindowClass", GP_APPLICATION_NAME_W, WS_OVERLAPPEDWINDOW, 300, 300, wr.right - wr.left, wr.bottom - wr.top, NULL, menus, m_osGlobals->m_hInstance, NULL);
@@ -1141,6 +1143,9 @@ void GpDisplayDriverD3D11::Run()
LARGE_INTEGER lastTimestamp;
memset(&lastTimestamp, 0, sizeof(lastTimestamp));
m_initialWidth = m_windowWidthVirtual;
m_initialHeight = m_windowHeightVirtual;
MSG msg;
for (;;)
{
@@ -1240,12 +1245,12 @@ void GpDisplayDriverD3D11::Shutdown()
free(this);
}
void GpDisplayDriverD3D11::GetDisplayResolution(unsigned int *width, unsigned int *height)
void GpDisplayDriverD3D11::GetInitialDisplayResolution(unsigned int *width, unsigned int *height)
{
if (width)
*width = m_windowWidthVirtual;
*width = m_initialWidth;
if (height)
*height = m_windowHeightVirtual;
*height = m_initialHeight;
}
IGpDisplayDriverSurface *GpDisplayDriverD3D11::CreateSurface(size_t width, size_t height, size_t pitch, GpPixelFormat_t pixelFormat, IGpDisplayDriver::SurfaceInvalidateCallback_t invalidateCallback, void *invalidateContext)
@@ -1514,6 +1519,8 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
, m_windowHeightPhysical(480)
, m_windowWidthVirtual(640)
, m_windowHeightVirtual(480)
, m_initialWidth(640)
, m_initialHeight(480)
, m_pixelScaleX(1.0f)
, m_pixelScaleY(1.0f)
, m_vosFiber(nullptr)

View File

@@ -39,7 +39,7 @@ public:
void Run() override;
void Shutdown() override;
void GetDisplayResolution(unsigned int *width, unsigned int *height) override;
void GetInitialDisplayResolution(unsigned int *width, unsigned int *height) override;
IGpDisplayDriverSurface *CreateSurface(size_t width, size_t height, size_t pitch, GpPixelFormat_t pixelFormat, IGpDisplayDriver::SurfaceInvalidateCallback_t invalidateCallback, void *invalidateContext) override;
void DrawSurface(IGpDisplayDriverSurface *surface, int32_t x, int32_t y, size_t width, size_t height, const GpDisplayDriverSurfaceEffects *effects) override;
@@ -99,7 +99,8 @@ private:
{
float m_dx;
float m_dy;
float m_unused[2];
float m_invScaleX;
float m_invScaleY;
};
struct CompactedPresentHistoryItem
@@ -177,6 +178,9 @@ private:
float m_pixelScaleX;
float m_pixelScaleY;
unsigned int m_initialWidth;
unsigned int m_initialHeight;
IGpCursor_Win32 *m_activeCursor;
IGpCursor_Win32 *m_pendingCursor;
EGpStandardCursor_t m_currentStandardCursor;

View File

@@ -11,14 +11,14 @@
void GpDisplayDriverSurfaceD3D11::Upload(const void *data, size_t x, size_t y, size_t width, size_t height, size_t pitch)
{
D3D11_BOX box;
box.left = x;
box.right = x + width;
box.top = y;
box.bottom = y + height;
box.left = static_cast<UINT>(x);
box.right = static_cast<UINT>(x + width);
box.top = static_cast<UINT>(y);
box.bottom = static_cast<UINT>(y + height);
box.front = 0;
box.back = 1;
m_deviceContext->UpdateSubresource(m_texture, 0, &box, data, pitch, height * pitch);
m_deviceContext->UpdateSubresource(m_texture, 0, &box, data, pitch, static_cast<UINT>(height * pitch));
}
void GpDisplayDriverSurfaceD3D11::UploadEntire(const void *data, size_t pitch)

View File

@@ -20,7 +20,6 @@ LOCAL_SRC_FILES := \
GpGlobalConfig.cpp \
GpInputDriverFactory.cpp \
GpMain.cpp \
GpMemoryBuffer.cpp \
GpVOSEventQueue.cpp
include $(BUILD_STATIC_LIBRARY)

View File

@@ -136,7 +136,7 @@ void GpAppEnvironment::SetVOSEventQueue(GpVOSEventQueue *eventQueue)
m_vosEventQueue = eventQueue;
}
void GpAppEnvironment::SetSystemServices(PortabilityLayer::HostSystemServices *systemServices)
void GpAppEnvironment::SetSystemServices(IGpSystemServices *systemServices)
{
m_systemServices = systemServices;
}
@@ -156,13 +156,14 @@ void GpAppEnvironment::AppThreadFunc()
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);
GpDriverCollection *drivers = GpAppInterface_Get()->PL_GetDriverCollection();
drivers->SetDriver<GpDriverIDs::kDisplay>(m_displayDriver);
drivers->SetDriver<GpDriverIDs::kAudio>(m_audioDriver);
drivers->SetDrivers<GpDriverIDs::kInput>(m_inputDrivers, m_numInputDrivers);
drivers->SetDriver<GpDriverIDs::kFont>(m_fontHandler);
drivers->SetDriver<GpDriverIDs::kEventQueue>(m_vosEventQueue);
GpAppInterface_Get()->PL_HostFontHandler_SetInstance(m_fontHandler);
GpAppInterface_Get()->PL_HostVOSEventQueue_SetInstance(m_vosEventQueue);
GpAppInterface_Get()->PL_InstallHostSuspendHook(GpAppEnvironment::StaticSuspendHookFunc, this);
}
void GpAppEnvironment::SynchronizeState()

View File

@@ -9,15 +9,15 @@
namespace PortabilityLayer
{
union HostSuspendCallArgument;
class HostVOSEventQueue;
class HostSystemServices;
}
struct IGpDisplayDriver;
struct IGpAudioDriver;
struct IGpInputDriver;
struct IGpFiber;
struct IGpFontHandler;
struct IGpInputDriver;
struct IGpSystemServices;
struct IGpVOSEventQueue;
class GpAppEnvironment
{
@@ -36,7 +36,7 @@ public:
void SetInputDrivers(IGpInputDriver *const* inputDrivers, size_t numDrivers);
void SetFontHandler(IGpFontHandler *fontHandler);
void SetVOSEventQueue(GpVOSEventQueue *eventQueue);
void SetSystemServices(PortabilityLayer::HostSystemServices *systemServices);
void SetSystemServices(IGpSystemServices *systemServices);
private:
enum ApplicationState
@@ -64,7 +64,7 @@ private:
IGpInputDriver *const* m_inputDrivers;
IGpFontHandler *m_fontHandler;
GpVOSEventQueue *m_vosEventQueue;
PortabilityLayer::HostSystemServices *m_systemServices;
IGpSystemServices *m_systemServices;
IGpFiber *m_applicationFiber;
IGpFiber *m_vosFiber;

View File

@@ -1,16 +1,12 @@
#pragma once
struct IGpFiber;
namespace PortabilityLayer
{
class HostSystemServices;
}
struct IGpSystemServices;
class GpFiberStarter
{
public:
typedef void(*ThreadFunc_t)(void *context);
static IGpFiber *StartFiber(PortabilityLayer::HostSystemServices *systemServices, ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber);
static IGpFiber *StartFiber(IGpSystemServices *systemServices, ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber);
};

View File

@@ -8,11 +8,7 @@
#include <stdint.h>
struct IGpLogDriver;
namespace PortabilityLayer
{
class HostSystemServices;
}
struct IGpSystemServices;
struct GpGlobalConfig
{
@@ -24,7 +20,7 @@ struct GpGlobalConfig
size_t m_numInputDrivers;
IGpLogDriver *m_logger;
PortabilityLayer::HostSystemServices *m_systemServices;
IGpSystemServices *m_systemServices;
void *m_osGlobals;
};

View File

@@ -1,49 +0,0 @@
#include "GpMemoryBuffer.h"
#include <new>
void *GpMemoryBuffer::Contents()
{
return reinterpret_cast<uint8_t*>(this) + AlignedSize();
}
size_t GpMemoryBuffer::Size()
{
return m_size;
}
void GpMemoryBuffer::Destroy()
{
delete[] reinterpret_cast<uint8_t*>(this);
}
GpMemoryBuffer *GpMemoryBuffer::Create(size_t sz)
{
const size_t allowedSize = SIZE_MAX - AlignedSize();
if (sz > allowedSize)
return nullptr;
const size_t bufferSize = GpMemoryBuffer::AlignedSize() + sz;
uint8_t *buffer = new uint8_t[bufferSize];
new (buffer) GpMemoryBuffer(sz);
return reinterpret_cast<GpMemoryBuffer*>(buffer);
}
GpMemoryBuffer::GpMemoryBuffer(size_t sz)
: m_size(sz)
{
}
GpMemoryBuffer::~GpMemoryBuffer()
{
}
size_t GpMemoryBuffer::AlignedSize()
{
const size_t paddedSize = (sizeof(GpMemoryBuffer) + GP_SYSTEM_MEMORY_ALIGNMENT - 1);
const size_t sz = paddedSize - paddedSize % GP_SYSTEM_MEMORY_ALIGNMENT;
return sz;
}

View File

@@ -1,21 +0,0 @@
#pragma once
#include "HostMemoryBuffer.h"
class GpMemoryBuffer final : public PortabilityLayer::HostMemoryBuffer
{
public:
void *Contents() override;
size_t Size() override;
void Destroy() override;
static GpMemoryBuffer *Create(size_t sz);
private:
explicit GpMemoryBuffer(size_t sz);
~GpMemoryBuffer();
static size_t AlignedSize();
size_t m_size;
};

View File

@@ -81,7 +81,6 @@
<ClCompile Include="GpGlobalConfig.cpp" />
<ClCompile Include="GpInputDriverFactory.cpp" />
<ClCompile Include="GpMain.cpp" />
<ClCompile Include="GpMemoryBuffer.cpp" />
<ClCompile Include="GpVOSEventQueue.cpp" />
</ItemGroup>
<ItemGroup>

View File

@@ -36,9 +36,6 @@
<ClCompile Include="GpMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpMemoryBuffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpVOSEventQueue.cpp">
<Filter>Source Files</Filter>
</ClCompile>

View File

@@ -2,10 +2,10 @@
#include <stdint.h>
#include "HostVOSEventQueue.h"
#include "IGpVOSEventQueue.h"
#include "GpVOSEvent.h"
class GpVOSEventQueue final : public PortabilityLayer::HostVOSEventQueue
class GpVOSEventQueue final : public IGpVOSEventQueue
{
public:
GpVOSEventQueue();

View File

@@ -0,0 +1,9 @@
{
"add" :
{
},
"delete" :
[
"snd$20/3001.wav"
]
}

View File

@@ -0,0 +1,9 @@
{
"add" :
{
},
"delete" :
[
"snd$20/3003.wav"
]
}

View File

@@ -0,0 +1,9 @@
{
"add" :
{
},
"delete" :
[
"snd$20/3001.wav"
]
}

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