mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c0abd77dc4 | ||
|
754b988f09 | ||
|
1c57a51316 | ||
|
80abb498af | ||
|
29cc376438 | ||
|
ef12c471a7 | ||
|
8f4ecfafe1 | ||
|
3c3f9e3675 | ||
|
5c640b72eb | ||
|
9d0f2c35b3 | ||
|
7df624d9b1 | ||
|
29fbe83e8d | ||
|
ad3a878a16 | ||
|
f0e7379db6 | ||
|
e34fec38a2 | ||
|
76db422456 | ||
|
396d107608 | ||
|
30b39c6991 | ||
|
9dafba1092 | ||
|
801408077a | ||
|
2c073937c3 | ||
|
bbd147e1ab | ||
|
66a111dd23 | ||
|
2febed5d2a | ||
|
b47813330a | ||
|
0f630a74a2 | ||
|
edc43e0bed | ||
|
2aca0b6b28 | ||
|
f9a101486c | ||
|
dbf3303145 | ||
|
a28a4cd73d | ||
|
4c6e646133 | ||
|
a13f90bd71 |
@@ -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;
|
||||
|
@@ -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];
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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"
|
||||
@@ -414,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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "HostSystemServices.h"
|
||||
#include "IGpSystemServices.h"
|
||||
#include "GpCoreDefs.h"
|
||||
#include "GpWindows.h"
|
||||
|
||||
@@ -15,22 +15,23 @@
|
||||
#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;
|
||||
|
@@ -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;
|
||||
|
@@ -15,8 +15,8 @@ android {
|
||||
}
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
versionCode 4
|
||||
versionName "1.0.9b2"
|
||||
versionCode 6
|
||||
versionName "1.0.10"
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "APP_PLATFORM=android-16"
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
@@ -187,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)
|
||||
@@ -199,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;
|
||||
|
||||
@@ -221,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)
|
||||
@@ -230,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)
|
||||
@@ -265,6 +265,11 @@ bool GpSystemServices_Android::IsTextInputObstructive() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Android::IsFullscreenPreferred() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int GpSystemServices_Android::GetCPUCount() const
|
||||
{
|
||||
return SDL_GetCPUCount();
|
||||
|
@@ -1,24 +1,25 @@
|
||||
#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;
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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"
|
||||
@@ -897,7 +897,7 @@ private:
|
||||
bool m_mouseIsInClientArea;
|
||||
|
||||
IGpFiber *m_vosFiber;
|
||||
PortabilityLayer::HostThreadEvent *m_vosEvent;
|
||||
IGpThreadEvent *m_vosEvent;
|
||||
|
||||
float m_bgColor[4];
|
||||
bool m_bgIsDark;
|
||||
@@ -1215,7 +1215,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;
|
||||
@@ -2410,6 +2410,8 @@ bool GpDisplayDriver_SDL_GL2::InitResources(uint32_t physicalWidth, uint32_t phy
|
||||
|
||||
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);
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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;
|
||||
|
45
ApplicationResourcePatches/DITL/1041.json
Normal file
45
ApplicationResourcePatches/DITL/1041.json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
@@ -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",
|
||||
|
29
ApplicationResourcePatches/DITL/2008.json
Normal file
29
ApplicationResourcePatches/DITL/2008.json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
BIN
ApplicationResourcePatches/PICT/1303.bmp
Normal file
BIN
ApplicationResourcePatches/PICT/1303.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
@@ -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",
|
||||
@@ -10,9 +11,11 @@
|
||||
"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",
|
||||
|
@@ -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)
|
||||
|
@@ -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"
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -5,18 +5,18 @@
|
||||
//----------------------------------------------------------------------------
|
||||
//============================================================================
|
||||
|
||||
|
||||
#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 "WindowManager.h"
|
||||
|
||||
#include "PLDrivers.h"
|
||||
#include "PLResources.h"
|
||||
#include "PLPasStr.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define kSwitchDepthAlert 130
|
||||
@@ -301,8 +301,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,14 +415,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);
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(&width, &height);
|
||||
|
||||
SetRect(rect, 0, 0, static_cast<short>(width), static_cast<short>(height));
|
||||
}
|
||||
|
@@ -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.
|
||||
|
@@ -118,7 +118,7 @@ typedef struct
|
||||
Boolean wasEscPauseKey;
|
||||
Boolean wasDoAutoDemo, wasAutoScale;
|
||||
Boolean wasDoBackground, wasHouseChecks;
|
||||
Boolean wasPrettyMap, wasBitchDialogs;
|
||||
Boolean wasPrettyMap, wasComplainDialogs;
|
||||
Boolean wasUseICCProfile;
|
||||
} prefsInfo;
|
||||
|
||||
|
@@ -425,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);
|
||||
|
||||
@@ -461,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);
|
||||
|
@@ -1,20 +1,15 @@
|
||||
#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"
|
||||
|
||||
int gpAppMain();
|
||||
void gpAppInit();
|
||||
|
||||
|
||||
class GpAppInterfaceImpl final : public GpAppInterface
|
||||
{
|
||||
public:
|
||||
@@ -23,14 +18,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;
|
||||
};
|
||||
@@ -56,44 +44,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)
|
||||
|
@@ -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
|
||||
@@ -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)
|
||||
@@ -503,6 +503,19 @@ 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 = 0;
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &height);
|
||||
|
||||
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).
|
||||
|
||||
@@ -530,6 +543,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
|
||||
|
||||
@@ -640,6 +656,9 @@ void GetHighScoreBanner (void)
|
||||
|
||||
UpdateBannerDialog(theDial);
|
||||
|
||||
if (PLDrivers::GetSystemServices()->IsTextInputObstructive())
|
||||
MoveDialogToTopOfScreen(theDial);
|
||||
|
||||
Window *exclStack = theDial->GetWindow();
|
||||
wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms
|
||||
|
||||
|
@@ -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"
|
||||
@@ -48,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.
|
||||
@@ -68,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);
|
||||
|
@@ -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
|
||||
@@ -675,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;
|
||||
|
||||
@@ -854,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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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:
|
||||
@@ -793,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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
634
GpApp/Main.cpp
634
GpApp/Main.cpp
@@ -8,34 +8,40 @@
|
||||
|
||||
#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 "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 +49,7 @@ int loadScreenProgress;
|
||||
DrawSurface *loadScreenRingSurface;
|
||||
|
||||
|
||||
#define kPrefsVersion 0x0038
|
||||
#define kPrefsVersion 0x0039
|
||||
|
||||
|
||||
void ReadInPrefs (void);
|
||||
@@ -71,7 +77,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 +165,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 +250,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 +351,7 @@ void WriteOutPrefs (void)
|
||||
thePrefs.wasUseICCProfile = isUseICCProfile;
|
||||
thePrefs.wasDoBackground = doBackground;
|
||||
thePrefs.wasPrettyMap = doPrettyMap;
|
||||
thePrefs.wasBitchDialogs = doBitchDialogs;
|
||||
thePrefs.wasComplainDialogs = doComplainDialogs;
|
||||
|
||||
THandle<void> modulePrefs;
|
||||
|
||||
@@ -369,18 +375,171 @@ 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)
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
Rect loadScreenProgressBarFillRect = loadScreenProgressBarRect.Inset(1, 1);
|
||||
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 = 42;
|
||||
loadScreenProgress = loadScreenProgress + steps;
|
||||
if (loadScreenProgress > loadScreenMax)
|
||||
loadScreenProgress = loadScreenMax;
|
||||
@@ -393,7 +552,7 @@ void StepLoadScreen(int steps)
|
||||
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);
|
||||
@@ -409,72 +568,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("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);
|
||||
|
||||
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);
|
||||
loadScreenProgress = 0;
|
||||
|
||||
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;
|
||||
CreateLoadScreenWindow(loadScreenWindowPhase);
|
||||
}
|
||||
|
||||
enum PreloadFontCategory
|
||||
@@ -495,7 +594,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;
|
||||
@@ -540,12 +639,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();
|
||||
}
|
||||
|
||||
@@ -553,6 +652,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 },
|
||||
@@ -561,7 +663,6 @@ 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, 40, PortabilityLayer::FontFamilyFlag_None, true },
|
||||
{ FontCategory_Handwriting, 24, PortabilityLayer::FontFamilyFlag_None, true },
|
||||
{ FontCategory_Handwriting, 48, PortabilityLayer::FontFamilyFlag_None, true },
|
||||
@@ -580,19 +681,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,9 +702,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++;
|
||||
}
|
||||
@@ -612,7 +713,338 @@ void PreloadFonts()
|
||||
StepLoadScreenRing();
|
||||
Delay(1, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
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's Glider PRO, based",
|
||||
"on the 2016 release of the game's 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 the most iconic Macintosh-exclusive games.",
|
||||
"",
|
||||
"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 and contains some differences",
|
||||
"from the original. Some fonts, graphics, and sounds have been",
|
||||
"substituted or removed for copyright reasons. This software",
|
||||
"is not developed by, maintained by, supported by, endorsed by,",
|
||||
"or otherwise associated with the authors or publishers of Glider PRO."
|
||||
};
|
||||
|
||||
const size_t numLines = sizeof(disclaimerLines) / sizeof(disclaimerLines[0]);
|
||||
|
||||
PortabilityLayer::RenderedFont *rfont = GetApplicationFont(18, 0, 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 = rfont->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, rfont);
|
||||
|
||||
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()
|
||||
@@ -653,8 +1085,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;
|
||||
@@ -673,12 +1107,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)
|
||||
{
|
||||
@@ -696,6 +1130,8 @@ int gpAppMain()
|
||||
if (!isPrefsLoaded)
|
||||
{
|
||||
WriteOutPrefs();
|
||||
|
||||
ShowInitialLaunchDisclaimer();
|
||||
}
|
||||
|
||||
OpenMainWindow();
|
||||
|
@@ -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;
|
||||
@@ -169,7 +170,7 @@ static void DrawMainMenuControl(DrawSurface *surface, MainMenuUIState::ControlID
|
||||
void StartScrollForPage()
|
||||
{
|
||||
unsigned int displayHeight = 0;
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
|
||||
DismissMainMenuUI();
|
||||
|
||||
@@ -263,7 +264,7 @@ void StartMainMenuUI()
|
||||
static void DismissMainMenuUIPage()
|
||||
{
|
||||
unsigned int displayHeight = 0;
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
@@ -293,7 +294,7 @@ void TickMainMenuUI()
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
unsigned int displayHeight = 0;
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
|
||||
mainMenu.m_scrollInStep -= MainMenuUIState::kControlScrollInDecay;
|
||||
mainMenu.m_scrollInOffset -= (mainMenu.m_scrollInStep >> MainMenuUIState::kControlScrollInDecayFalloffBits);
|
||||
@@ -328,7 +329,7 @@ void HandleMainMenuUIResolutionChange()
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
unsigned int displayHeight = 0;
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(nullptr, &displayHeight);
|
||||
|
||||
for (int i = 0; i < MainMenuUIState::Control_Count; i++)
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -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())
|
||||
{
|
||||
|
@@ -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];
|
||||
|
@@ -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");
|
||||
|
||||
|
@@ -296,6 +296,7 @@ void DoDemoGame (void)
|
||||
if (OpenHouse())
|
||||
whoCares = ReadHouse();
|
||||
incrementModeTime = TickCount() + kIdleSplashTicks;
|
||||
RedrawSplashScreen();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitGlider
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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[];
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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,7 @@ 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);
|
||||
|
||||
|
||||
@@ -109,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;
|
||||
@@ -135,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
|
||||
@@ -238,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);
|
||||
@@ -246,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);
|
||||
|
||||
@@ -272,7 +272,7 @@ void DoBrainsPrefs (void)
|
||||
doBackground = wasBackground;
|
||||
isHouseChecks = wasErrorCheck;
|
||||
doPrettyMap = wasPrettyMap;
|
||||
doBitchDialogs = wasBitchDialogs;
|
||||
doComplainDialogs = wasComplainDialogs;
|
||||
leaving = true;
|
||||
break;
|
||||
|
||||
@@ -315,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;
|
||||
}
|
||||
}
|
||||
@@ -1121,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);
|
||||
@@ -1285,7 +1285,7 @@ void DoSettingsMain (void)
|
||||
leaving = false;
|
||||
nextRestartChange = false;
|
||||
|
||||
wasFullscreenPref = PortabilityLayer::HostDisplayDriver::GetInstance()->IsFullScreen();
|
||||
wasFullscreenPref = PLDrivers::GetDisplayDriver()->IsFullScreen();
|
||||
|
||||
Window* exclWindow = prefDlg->GetWindow();
|
||||
|
||||
@@ -1340,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))
|
||||
{
|
||||
@@ -1354,18 +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;
|
||||
|
@@ -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
|
||||
|
@@ -3,14 +3,11 @@
|
||||
#include "Environ.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"
|
||||
@@ -20,6 +17,11 @@
|
||||
#include "WindowManager.h"
|
||||
#include "FontFamily.h"
|
||||
|
||||
#include "PLCore.h"
|
||||
#include "PLDrivers.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLSysCalls.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
@@ -140,7 +142,7 @@ static void InitSourceExportWindow(SourceExportState *state)
|
||||
// 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);
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(&displayWidth, &displayHeight);
|
||||
|
||||
int32_t lsX = (static_cast<int32_t>(displayWidth) - kLoadScreenWidth) / 2;
|
||||
int32_t lsY = (static_cast<int32_t>(displayHeight) - kLoadScreenHeight) / 2;
|
||||
@@ -183,7 +185,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 +201,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 +404,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 +427,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 +666,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 +675,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 +732,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;
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include "DialogManager.h"
|
||||
#include "DisplayDeviceManager.h"
|
||||
#include "Externs.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "IconLoader.h"
|
||||
#include "InputManager.h"
|
||||
#include "ResourceManager.h"
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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 10
|
||||
|
||||
#define GP_APPLICATION_VERSION_STRING "1.0.9"
|
||||
#define GP_APPLICATION_VERSION_STRING "1.0.10"
|
||||
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2020 Eric Lasota"
|
||||
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"
|
||||
|
@@ -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
132
GpCommon/GpDriverIndex.h
Normal 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;
|
||||
}
|
8
GpCommon/IGpDirectoryCursor.h
Normal file
8
GpCommon/IGpDirectoryCursor.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
struct IGpDirectoryCursor
|
||||
{
|
||||
public:
|
||||
virtual bool GetNext(const char *&outFileName) = 0;
|
||||
virtual void Destroy() = 0;
|
||||
};
|
43
GpCommon/IGpFileSystem.h
Normal file
43
GpCommon/IGpFileSystem.h
Normal 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
10
GpCommon/IGpMutex.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
struct IGpMutex
|
||||
{
|
||||
public:
|
||||
virtual void Destroy() = 0;
|
||||
|
||||
virtual void Lock() = 0;
|
||||
virtual void Unlock() = 0;
|
||||
};
|
36
GpCommon/IGpSystemServices.h
Normal file
36
GpCommon/IGpSystemServices.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#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;
|
||||
};
|
12
GpCommon/IGpThreadEvent.h
Normal file
12
GpCommon/IGpThreadEvent.h
Normal 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;
|
||||
};
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -99,7 +99,8 @@ private:
|
||||
{
|
||||
float m_dx;
|
||||
float m_dy;
|
||||
float m_unused[2];
|
||||
float m_invScaleX;
|
||||
float m_invScaleY;
|
||||
};
|
||||
|
||||
struct CompactedPresentHistoryItem
|
||||
|
@@ -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)
|
||||
|
@@ -20,7 +20,6 @@ LOCAL_SRC_FILES := \
|
||||
GpGlobalConfig.cpp \
|
||||
GpInputDriverFactory.cpp \
|
||||
GpMain.cpp \
|
||||
GpMemoryBuffer.cpp \
|
||||
GpVOSEventQueue.cpp
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
@@ -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()
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
};
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
@@ -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;
|
||||
}
|
@@ -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;
|
||||
};
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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();
|
||||
|
9
HousePatches/GrandPrix.json
Normal file
9
HousePatches/GrandPrix.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"add" :
|
||||
{
|
||||
},
|
||||
"delete" :
|
||||
[
|
||||
"snd$20/3001.wav"
|
||||
]
|
||||
}
|
9
HousePatches/ImagineHousePROII.json
Normal file
9
HousePatches/ImagineHousePROII.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"add" :
|
||||
{
|
||||
},
|
||||
"delete" :
|
||||
[
|
||||
"snd$20/3003.wav"
|
||||
]
|
||||
}
|
9
HousePatches/InTheMirror.json
Normal file
9
HousePatches/InTheMirror.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"add" :
|
||||
{
|
||||
},
|
||||
"delete" :
|
||||
[
|
||||
"snd$20/3001.wav"
|
||||
]
|
||||
}
|
12
HousePatches/Leviathan.json
Normal file
12
HousePatches/Leviathan.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"add" :
|
||||
{
|
||||
},
|
||||
"delete" :
|
||||
[
|
||||
"snd$20/3003.wav",
|
||||
"snd$20/3006.wav",
|
||||
"snd$20/3008.wav",
|
||||
"snd$20/3012.wav"
|
||||
]
|
||||
}
|
9
HousePatches/RainbowsEnd.json
Normal file
9
HousePatches/RainbowsEnd.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"add" :
|
||||
{
|
||||
},
|
||||
"delete" :
|
||||
[
|
||||
"snd$20/3000.wav"
|
||||
]
|
||||
}
|
@@ -6,3 +6,5 @@ cd ..
|
||||
rmdir /S /Q ReleasePkg\Aerofoil
|
||||
rmdir /S /Q ReleasePkg\en-us
|
||||
rmdir /S /Q ReleasePkg\PDBs
|
||||
|
||||
git archive --format zip -o ReleasePkg\Aerofoil-src.zip HEAD
|
||||
|
@@ -33,15 +33,7 @@ LOCAL_SRC_FILES := \
|
||||
FontManager.cpp \
|
||||
FontRenderer.cpp \
|
||||
GPArchive.cpp \
|
||||
HostAudioDriver.cpp \
|
||||
HostDisplayDriver.cpp \
|
||||
HostFileSystem.cpp \
|
||||
HostFontHandler.cpp \
|
||||
HostInputDriver.cpp \
|
||||
HostLogDriver.cpp \
|
||||
HostSuspendHook.cpp \
|
||||
HostSystemServices.cpp \
|
||||
HostVOSEventQueue.cpp \
|
||||
IconLoader.cpp \
|
||||
InputManager.cpp \
|
||||
LinePlotter.cpp \
|
||||
@@ -59,6 +51,7 @@ LOCAL_SRC_FILES := \
|
||||
PLCore.cpp \
|
||||
PLCTabReducer.cpp \
|
||||
PLDialogs.cpp \
|
||||
PLDrivers.cpp \
|
||||
PLEditboxWidget.cpp \
|
||||
PLEventQueue.cpp \
|
||||
PLHacks.cpp \
|
||||
|
@@ -1,5 +1,10 @@
|
||||
#include "AntiAliasTable.h"
|
||||
#include "RGBAColor.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "IGpFileSystem.h"
|
||||
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLDrivers.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
@@ -58,8 +63,49 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
#else
|
||||
void AntiAliasTable::GenerateForPalette(const RGBAColor &baseColorRef, const RGBAColor *colors, size_t numColors)
|
||||
bool AntiAliasTable::LoadFromCache(const char *cacheFileName)
|
||||
{
|
||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, cacheFileName, false, GpFileCreationDispositions::kOpenExisting);
|
||||
if (!stream)
|
||||
return false;
|
||||
|
||||
BEUInt32_t cacheVersion;
|
||||
if (stream->Read(&cacheVersion, sizeof(cacheVersion)) != sizeof(cacheVersion) || cacheVersion != kCacheVersion)
|
||||
{
|
||||
stream->Close();
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t readSize = sizeof(m_aaTranslate);
|
||||
const bool readOK = (stream->Read(m_aaTranslate, readSize) == readSize);
|
||||
stream->Close();
|
||||
|
||||
return readOK;
|
||||
}
|
||||
|
||||
void AntiAliasTable::SaveToCache(const char *cacheFileName)
|
||||
{
|
||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, cacheFileName, true, GpFileCreationDispositions::kCreateOrOverwrite);
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
BEUInt32_t cacheVersion(static_cast<uint32_t>(kCacheVersion));
|
||||
stream->Write(&cacheVersion, sizeof(cacheVersion));
|
||||
|
||||
stream->Write(m_aaTranslate, sizeof(m_aaTranslate));
|
||||
stream->Close();
|
||||
}
|
||||
|
||||
void AntiAliasTable::GenerateForPalette(const RGBAColor &baseColorRef, const RGBAColor *colors, size_t numColors, bool cacheable)
|
||||
{
|
||||
char cacheFileName[256];
|
||||
if (cacheable)
|
||||
{
|
||||
sprintf(cacheFileName, "aa_p_%02x%02x%02x%02x.cache", static_cast<int>(baseColorRef.r), static_cast<int>(baseColorRef.g), static_cast<int>(baseColorRef.b), static_cast<int>(baseColorRef.a));
|
||||
if (LoadFromCache(cacheFileName))
|
||||
return;
|
||||
}
|
||||
|
||||
const RGBAColor baseColor = baseColorRef;
|
||||
|
||||
if (numColors > 256)
|
||||
@@ -118,10 +164,21 @@ namespace PortabilityLayer
|
||||
m_aaTranslate[i][b] = static_cast<uint8_t>(bestColor);
|
||||
}
|
||||
}
|
||||
|
||||
if (cacheable)
|
||||
SaveToCache(cacheFileName);
|
||||
}
|
||||
|
||||
void AntiAliasTable::GenerateForSimpleScale(uint8_t colorChannel)
|
||||
void AntiAliasTable::GenerateForSimpleScale(uint8_t colorChannel, bool cacheable)
|
||||
{
|
||||
char cacheFileName[256];
|
||||
if (cacheable)
|
||||
{
|
||||
sprintf(cacheFileName, "aa_t_%02x.cache", static_cast<int>(colorChannel));
|
||||
if (LoadFromCache(cacheFileName))
|
||||
return;
|
||||
}
|
||||
|
||||
const double gamma = 1.8;
|
||||
const double rcpGamma = 1.0 / gamma;
|
||||
const double rcp255 = 1.0 / 255.0;
|
||||
@@ -142,6 +199,9 @@ namespace PortabilityLayer
|
||||
m_aaTranslate[baseColor][opacity] = static_cast<uint8_t>(floor(blendedColorGammaSpace * 255.0 + 0.5));
|
||||
}
|
||||
}
|
||||
|
||||
if (cacheable)
|
||||
SaveToCache(cacheFileName);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -11,7 +11,13 @@ namespace PortabilityLayer
|
||||
// Striped 256x16 because constant background color is more likely than constant sample
|
||||
uint8_t m_aaTranslate[256][16];
|
||||
|
||||
void GenerateForPalette(const RGBAColor &baseColor, const RGBAColor *colors, size_t numColors);
|
||||
void GenerateForSimpleScale(uint8_t colorChannel);
|
||||
void GenerateForPalette(const RGBAColor &baseColor, const RGBAColor *colors, size_t numColors, bool cacheable);
|
||||
void GenerateForSimpleScale(uint8_t colorChannel, bool cacheable);
|
||||
|
||||
private:
|
||||
bool LoadFromCache(const char *path);
|
||||
void SaveToCache(const char *path);
|
||||
|
||||
static const unsigned int kCacheVersion = 1;
|
||||
};
|
||||
}
|
||||
|
@@ -1,13 +1,21 @@
|
||||
#include "DialogManager.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "IconLoader.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "IGpSystemServices.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "Rect2i.h"
|
||||
#include "ResTypeID.h"
|
||||
#include "SharedTypes.h"
|
||||
#include "UTF8.h"
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
#include "PLArrayView.h"
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLButtonWidget.h"
|
||||
#include "PLDialogs.h"
|
||||
#include "PLDrivers.h"
|
||||
#include "PLEditboxWidget.h"
|
||||
#include "PLIconWidget.h"
|
||||
#include "PLImageWidget.h"
|
||||
@@ -18,13 +26,6 @@
|
||||
#include "PLSysCalls.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "PLWidgets.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "Rect2i.h"
|
||||
#include "ResTypeID.h"
|
||||
#include "SharedTypes.h"
|
||||
#include "UTF8.h"
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
#include "rapidjson/rapidjson.h"
|
||||
#include "rapidjson/document.h"
|
||||
@@ -388,7 +389,7 @@ namespace PortabilityLayer
|
||||
Rect2i windowFullRect = WindowManager::GetInstance()->GetWindowFullRect(window);
|
||||
if (!windowFullRect.Contains(Vec2i(mouseEvent.m_x, mouseEvent.m_y)))
|
||||
{
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->Beep();
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -759,7 +760,7 @@ namespace PortabilityLayer
|
||||
// If sound index is 0, play no sound
|
||||
|
||||
if (soundIndexes[0] != 0)
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->Beep();
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
|
||||
const Rect dialogRect = alertResData.m_rect.ToRect();
|
||||
|
||||
@@ -830,7 +831,7 @@ namespace PortabilityLayer
|
||||
void DialogManagerImpl::PositionWindow(Window *window, const Rect &rect) const
|
||||
{
|
||||
unsigned int displayWidth, displayHeight;
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&displayWidth, &displayHeight);
|
||||
PLDrivers::GetDisplayDriver()->GetDisplayResolution(&displayWidth, &displayHeight);
|
||||
|
||||
const unsigned int halfDisplayHeight = displayHeight / 2;
|
||||
const unsigned int quarterDisplayWidth = displayHeight / 4;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "DisplayDeviceManager.h"
|
||||
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "PLDrivers.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "PLQDraw.h"
|
||||
#include "MemoryManager.h"
|
||||
@@ -56,7 +56,7 @@ namespace PortabilityLayer
|
||||
for (size_t i = 0; i < 256; i++)
|
||||
{
|
||||
PortabilityLayer::RGBAColor &color = m_palette[i];
|
||||
color.r = color.g = color.b = i;
|
||||
color.r = color.g = color.b = static_cast<uint8_t>(i);
|
||||
color.a = 255;
|
||||
}
|
||||
}
|
||||
|
@@ -6,12 +6,14 @@
|
||||
#include "FontFamily.h"
|
||||
#include "GpApplicationName.h"
|
||||
#include "GpBuildVersion.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostDirectoryCursor.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "IGpDirectoryCursor.h"
|
||||
#include "IGpFileSystem.h"
|
||||
#include "IGpFont.h"
|
||||
#include "IGpSystemServices.h"
|
||||
#include "WindowManager.h"
|
||||
#include "MacFileInfo.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "RenderedFont.h"
|
||||
@@ -23,6 +25,7 @@
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "PLCore.h"
|
||||
#include "PLDialogs.h"
|
||||
#include "PLDrivers.h"
|
||||
#include "PLEditboxWidget.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLQDraw.h"
|
||||
@@ -37,11 +40,13 @@ static const int kCancelButton = 2;
|
||||
static const int kFileList = 3;
|
||||
static const int kFileListScrollBar = 4;
|
||||
static const int kFileNameEditBox = 5;
|
||||
static const int kDeleteButton = 5;
|
||||
static const int kFileBrowserUIOpenDialogTemplateID = 2001;
|
||||
static const int kFileBrowserUISaveDialogTemplateID = 2002;
|
||||
static const int kFileBrowserUIOverwriteDialogTemplateID = 2003;
|
||||
static const int kFileBrowserUIBadNameDialogTemplateID = 2004;
|
||||
static const int kFileBrowserUISaveDialogUnobstructiveTemplateID = 2007;
|
||||
static const int kFileBrowserUIDeleteDialogTemplateID = 2008;
|
||||
|
||||
|
||||
static const int kOverwriteNoButton = 1;
|
||||
@@ -52,7 +57,7 @@ namespace PortabilityLayer
|
||||
class FileBrowserUIImpl
|
||||
{
|
||||
public:
|
||||
FileBrowserUIImpl();
|
||||
explicit FileBrowserUIImpl(const FileBrowserUI_DetailsCallbackAPI &callbackAPI);
|
||||
~FileBrowserUIImpl();
|
||||
|
||||
static void PubScrollBarCallback(void *captureContext, Widget *control, int part);
|
||||
@@ -60,8 +65,9 @@ namespace PortabilityLayer
|
||||
static int16_t PubFileBrowserUIFilter(void *context, Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
static int16_t PubPopUpAlertUIFilter(void *context, Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
bool AppendName(const char *name, size_t nameLength);
|
||||
bool AppendName(const char *name, size_t nameLength, void *details);
|
||||
void SortNames();
|
||||
void DrawHeaders();
|
||||
void DrawFileList();
|
||||
|
||||
void CaptureFileListDrag();
|
||||
@@ -72,22 +78,31 @@ namespace PortabilityLayer
|
||||
|
||||
PLPasStr GetSelectedFileName() const;
|
||||
|
||||
void RemoveSelectedFile();
|
||||
|
||||
static int16_t PopUpAlert(const Rect &rect, int dialogResID, const DialogTextSubstitutions *substitutions);
|
||||
|
||||
private:
|
||||
typedef PascalStr<255> NameStr_t;
|
||||
|
||||
struct FileEntry
|
||||
{
|
||||
NameStr_t m_nameStr;
|
||||
void *m_fileDetails;
|
||||
};
|
||||
|
||||
void ScrollBarCallback(Widget *control, int part);
|
||||
int16_t FileBrowserUIFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
int16_t PopUpAlertUIFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
static bool NameSortPred(const NameStr_t &a, const NameStr_t &b);
|
||||
static bool FileEntrySortPred(const FileEntry &a, const FileEntry &b);
|
||||
|
||||
int m_offset;
|
||||
int m_selectedIndex;
|
||||
int32_t m_scrollOffset;
|
||||
int32_t m_fontSpacing;
|
||||
THandle<NameStr_t> m_names;
|
||||
size_t m_numNames;
|
||||
THandle<FileEntry> m_entries;
|
||||
size_t m_numEntries;
|
||||
DrawSurface *m_surface;
|
||||
Window *m_window;
|
||||
EditboxWidget *m_editBox;
|
||||
@@ -96,9 +111,11 @@ namespace PortabilityLayer
|
||||
Point m_doubleClickPos;
|
||||
uint32_t m_doubleClickTime;
|
||||
bool m_haveFirstClick;
|
||||
|
||||
const FileBrowserUI_DetailsCallbackAPI m_api;
|
||||
};
|
||||
|
||||
FileBrowserUIImpl::FileBrowserUIImpl()
|
||||
FileBrowserUIImpl::FileBrowserUIImpl(const FileBrowserUI_DetailsCallbackAPI &callbackAPI)
|
||||
: m_offset(0)
|
||||
, m_surface(nullptr)
|
||||
, m_window(nullptr)
|
||||
@@ -107,16 +124,23 @@ namespace PortabilityLayer
|
||||
, m_selectedIndex(-1)
|
||||
, m_scrollOffset(0)
|
||||
, m_fontSpacing(1)
|
||||
, m_numNames(0)
|
||||
, m_numEntries(0)
|
||||
, m_doubleClickPos(Point::Create(0, 0))
|
||||
, m_doubleClickTime(0)
|
||||
, m_haveFirstClick(false)
|
||||
, m_api(callbackAPI)
|
||||
{
|
||||
}
|
||||
|
||||
FileBrowserUIImpl::~FileBrowserUIImpl()
|
||||
{
|
||||
m_names.Dispose();
|
||||
if (m_entries)
|
||||
{
|
||||
FileEntry *entries = *m_entries;
|
||||
for (size_t i = 0; i < m_numEntries; i++)
|
||||
m_api.m_freeFileDetailsCallback(entries[i].m_fileDetails);
|
||||
}
|
||||
m_entries.Dispose();
|
||||
}
|
||||
|
||||
void FileBrowserUIImpl::PubScrollBarCallback(void *captureContext, Widget *control, int part)
|
||||
@@ -138,42 +162,54 @@ namespace PortabilityLayer
|
||||
{
|
||||
uint16_t unicodeChar = MacRoman::ToUnicode(ch);
|
||||
|
||||
return HostFileSystem::GetInstance()->ValidateFilePathUnicodeChar(unicodeChar);
|
||||
return PLDrivers::GetFileSystem()->ValidateFilePathUnicodeChar(unicodeChar);
|
||||
}
|
||||
|
||||
bool FileBrowserUIImpl::AppendName(const char *name, size_t nameLen)
|
||||
bool FileBrowserUIImpl::AppendName(const char *name, size_t nameLen, void *details)
|
||||
{
|
||||
MemoryManager *mm = MemoryManager::GetInstance();
|
||||
if (!m_names)
|
||||
if (!m_entries)
|
||||
{
|
||||
m_names = THandle<NameStr_t>(mm->AllocHandle(0));
|
||||
if (!m_names)
|
||||
m_entries = THandle<FileEntry>(mm->AllocHandle(0));
|
||||
if (!m_entries)
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t oldSize = m_names.MMBlock()->m_size;
|
||||
size_t oldSize = m_entries.MMBlock()->m_size;
|
||||
|
||||
if (!mm->ResizeHandle(m_names.MMBlock(), oldSize + sizeof(NameStr_t)))
|
||||
if (!mm->ResizeHandle(m_entries.MMBlock(), oldSize + sizeof(FileEntry)))
|
||||
return false;
|
||||
|
||||
(*m_names)[m_numNames++] = NameStr_t(nameLen, name);
|
||||
FileEntry &entry = (*m_entries)[m_numEntries++];
|
||||
entry.m_nameStr = NameStr_t(nameLen, name);
|
||||
entry.m_fileDetails = details;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileBrowserUIImpl::SortNames()
|
||||
{
|
||||
if (!m_names)
|
||||
if (!m_entries)
|
||||
return;
|
||||
|
||||
NameStr_t *names = *m_names;
|
||||
FileEntry *entries = *m_entries;
|
||||
|
||||
std::sort(names, names + m_numNames, NameSortPred);
|
||||
std::sort(entries, entries + m_numEntries, FileEntrySortPred);
|
||||
}
|
||||
|
||||
void FileBrowserUIImpl::DrawHeaders()
|
||||
{
|
||||
PortabilityLayer::RenderedFont *font = GetApplicationFont(12, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold, true);
|
||||
|
||||
ResolveCachingColor blackColor = StdColors::Black();
|
||||
|
||||
const Point basePoint = Point::Create(16, 16 + font->GetMetrics().m_ascent);
|
||||
m_api.m_drawLabelsCallback(m_surface, basePoint);
|
||||
}
|
||||
|
||||
void FileBrowserUIImpl::DrawFileList()
|
||||
{
|
||||
if (!m_names.MMBlock())
|
||||
if (!m_entries.MMBlock())
|
||||
return;
|
||||
|
||||
PortabilityLayer::RenderedFont *font = GetApplicationFont(12, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold, true);
|
||||
@@ -192,7 +228,7 @@ namespace PortabilityLayer
|
||||
|
||||
m_surface->FillRect(m_rect, whiteColor);
|
||||
|
||||
for (size_t i = 0; i < m_numNames; i++)
|
||||
for (size_t i = 0; i < m_numEntries; i++)
|
||||
{
|
||||
if (m_selectedIndex >= 0 && static_cast<size_t>(m_selectedIndex) == i)
|
||||
{
|
||||
@@ -202,7 +238,9 @@ namespace PortabilityLayer
|
||||
}
|
||||
|
||||
Point itemStringPoint = Point::Create(itemRect.left + 2, itemRect.top + glyphOffset);
|
||||
m_surface->DrawStringConstrained(itemStringPoint, (*m_names)[i].ToShortStr(), m_rect, blackColor, font);
|
||||
m_surface->DrawStringConstrained(itemStringPoint, (*m_entries)[i].m_nameStr.ToShortStr(), m_rect, blackColor, font);
|
||||
|
||||
m_api.m_drawFileDetailsCallback(m_surface, itemStringPoint, m_rect, (*m_entries)[i].m_fileDetails);
|
||||
|
||||
itemRect.top += spacing;
|
||||
itemRect.bottom += spacing;
|
||||
@@ -224,7 +262,7 @@ namespace PortabilityLayer
|
||||
uint16_t FileBrowserUIImpl::GetScrollCapacity() const
|
||||
{
|
||||
int32_t boxHeight = m_rect.Height();
|
||||
int32_t overCapacity = (static_cast<int32_t>(m_numNames) * m_fontSpacing - boxHeight);
|
||||
int32_t overCapacity = (static_cast<int32_t>(m_numEntries) * m_fontSpacing - boxHeight);
|
||||
|
||||
if (overCapacity < 0)
|
||||
return 0;
|
||||
@@ -245,7 +283,28 @@ namespace PortabilityLayer
|
||||
if (m_selectedIndex < 0)
|
||||
return PSTR("");
|
||||
else
|
||||
return (*m_names)[m_selectedIndex].ToShortStr();
|
||||
return (*m_entries)[m_selectedIndex].m_nameStr.ToShortStr();
|
||||
}
|
||||
|
||||
void FileBrowserUIImpl::RemoveSelectedFile()
|
||||
{
|
||||
if (m_selectedIndex < 0)
|
||||
return;
|
||||
|
||||
|
||||
FileEntry *entries = *m_entries;
|
||||
|
||||
FileEntry &removedEntry = entries[m_selectedIndex];
|
||||
m_api.m_freeFileDetailsCallback(removedEntry.m_fileDetails);
|
||||
|
||||
for (size_t i = m_selectedIndex; i < m_numEntries - 1; i++)
|
||||
entries[i] = entries[i + 1];
|
||||
|
||||
m_numEntries--;
|
||||
PortabilityLayer::MemoryManager::GetInstance()->ResizeHandle(m_entries.MMBlock(), sizeof(FileEntry) * m_numEntries);
|
||||
|
||||
m_selectedIndex = -1;
|
||||
DrawFileList();
|
||||
}
|
||||
|
||||
void FileBrowserUIImpl::ScrollBarCallback(Widget *control, int part)
|
||||
@@ -273,6 +332,8 @@ namespace PortabilityLayer
|
||||
SetScrollOffset(control->GetState());
|
||||
}
|
||||
|
||||
static FileBrowserUI::Mode gs_currentFileBrowserUIMode;
|
||||
|
||||
int16_t FileBrowserUIImpl::FileBrowserUIFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
bool handledIt = false;
|
||||
@@ -362,7 +423,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
int32_t selection = (mousePt.v - m_rect.top + m_scrollOffset) / m_fontSpacing;
|
||||
|
||||
if (selection < 0 || static_cast<size_t>(selection) >= m_numNames)
|
||||
if (selection < 0 || static_cast<size_t>(selection) >= m_numEntries)
|
||||
selection = -1;
|
||||
|
||||
if (selection >= 0)
|
||||
@@ -373,12 +434,15 @@ namespace PortabilityLayer
|
||||
|
||||
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetEnabled(selection >= 0);
|
||||
|
||||
if (gs_currentFileBrowserUIMode == FileBrowserUI::Mode_Open)
|
||||
dialog->GetItems()[kDeleteButton - 1].GetWidget()->SetEnabled(selection >= 0);
|
||||
|
||||
DrawFileList();
|
||||
}
|
||||
|
||||
if (m_editBox)
|
||||
{
|
||||
PLPasStr nameStr = (*m_names)[m_selectedIndex].ToShortStr();
|
||||
PLPasStr nameStr = (*m_entries)[m_selectedIndex].m_nameStr.ToShortStr();
|
||||
m_editBox->SetString(nameStr);
|
||||
m_editBox->SetSelection(0, nameStr.Length());
|
||||
}
|
||||
@@ -455,14 +519,14 @@ namespace PortabilityLayer
|
||||
return hit;
|
||||
}
|
||||
|
||||
bool FileBrowserUIImpl::NameSortPred(const NameStr_t &a, const NameStr_t &b)
|
||||
bool FileBrowserUIImpl::FileEntrySortPred(const FileEntry &a, const FileEntry &b)
|
||||
{
|
||||
const size_t lenA = a.Length();
|
||||
const size_t lenB = b.Length();
|
||||
const size_t lenA = a.m_nameStr.Length();
|
||||
const size_t lenB = b.m_nameStr.Length();
|
||||
|
||||
const size_t shorterLength = std::min(lenA, lenB);
|
||||
|
||||
int comparison = memcmp(a.UnsafeCharPtr(), b.UnsafeCharPtr(), shorterLength);
|
||||
int comparison = memcmp(a.m_nameStr.UnsafeCharPtr(), b.m_nameStr.UnsafeCharPtr(), shorterLength);
|
||||
if (comparison > 0)
|
||||
return false;
|
||||
|
||||
@@ -474,7 +538,7 @@ namespace PortabilityLayer
|
||||
|
||||
int16_t FileBrowserUIImpl::PopUpAlert(const Rect &rect, int dialogResID, const DialogTextSubstitutions *substitutions)
|
||||
{
|
||||
PortabilityLayer::HostSystemServices *sysServices = PortabilityLayer::HostSystemServices::GetInstance();
|
||||
IGpSystemServices *sysServices = PLDrivers::GetSystemServices();
|
||||
|
||||
// Disable text input temporarily and restore it after
|
||||
const bool wasTextInput = sysServices->IsTextInputEnabled();
|
||||
@@ -501,7 +565,7 @@ namespace PortabilityLayer
|
||||
return hit;
|
||||
}
|
||||
|
||||
bool FileBrowserUI::Prompt(Mode mode, VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText)
|
||||
bool FileBrowserUI::Prompt(Mode mode, VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &callbackAPI)
|
||||
{
|
||||
int dialogID = 0;
|
||||
bool isObstructive = false;
|
||||
@@ -510,7 +574,7 @@ namespace PortabilityLayer
|
||||
dialogID = kFileBrowserUIOpenDialogTemplateID;
|
||||
else if (mode == Mode_Save)
|
||||
{
|
||||
if (PortabilityLayer::HostSystemServices::GetInstance()->IsTextInputObstructive())
|
||||
if (PLDrivers::GetSystemServices()->IsTextInputObstructive())
|
||||
{
|
||||
dialogID = kFileBrowserUISaveDialogUnobstructiveTemplateID;
|
||||
windowHeight = 208;
|
||||
@@ -525,11 +589,11 @@ namespace PortabilityLayer
|
||||
return false;
|
||||
}
|
||||
|
||||
FileBrowserUIImpl uiImpl;
|
||||
FileBrowserUIImpl uiImpl(callbackAPI);
|
||||
|
||||
// Enumerate files
|
||||
PortabilityLayer::HostFileSystem *fs = PortabilityLayer::HostFileSystem::GetInstance();
|
||||
PortabilityLayer::HostDirectoryCursor *dirCursor = fs->ScanDirectory(dirID);
|
||||
IGpFileSystem *fs = PLDrivers::GetFileSystem();
|
||||
IGpDirectoryCursor *dirCursor = fs->ScanDirectory(dirID);
|
||||
|
||||
if (!dirCursor)
|
||||
return false;
|
||||
@@ -546,7 +610,28 @@ namespace PortabilityLayer
|
||||
|
||||
if (!memcmp(nameExt, ".gpf", 4))
|
||||
{
|
||||
if (!uiImpl.AppendName(fileName, nameLength - 4))
|
||||
GpIOStream *metadataStream = fs->OpenFile(dirID, fileName, false, GpFileCreationDispositions::kOpenExisting);
|
||||
if (!metadataStream)
|
||||
continue;
|
||||
|
||||
MacFilePropertiesSerialized serializedMetadata;
|
||||
if (metadataStream->Read(&serializedMetadata, sizeof(serializedMetadata)) != sizeof(serializedMetadata))
|
||||
{
|
||||
metadataStream->Close();
|
||||
continue;
|
||||
}
|
||||
|
||||
metadataStream->Close();
|
||||
|
||||
MacFileProperties metadata;
|
||||
serializedMetadata.Deserialize(metadata);
|
||||
|
||||
char ftype[4];
|
||||
fileType.ExportAsChars(ftype);
|
||||
if (memcmp(metadata.m_fileType, ftype, 4))
|
||||
continue;
|
||||
|
||||
if (!uiImpl.AppendName(fileName, nameLength - 4, callbackAPI.m_loadFileDetailsCallback(dirID, PLPasStr(nameLength - 4, fileName))))
|
||||
{
|
||||
dirCursor->Destroy();
|
||||
return false;
|
||||
@@ -627,12 +712,16 @@ namespace PortabilityLayer
|
||||
|
||||
window->DrawControls();
|
||||
|
||||
uiImpl.DrawHeaders();
|
||||
|
||||
int16_t hit = 0;
|
||||
|
||||
Window *exclWindow = dialog->GetWindow();
|
||||
|
||||
WindowManager::GetInstance()->SwapExclusiveWindow(exclWindow);
|
||||
|
||||
gs_currentFileBrowserUIMode = mode;
|
||||
|
||||
do
|
||||
{
|
||||
hit = dialog->ExecuteModal(&uiImpl, FileBrowserUIImpl::PubFileBrowserUIFilter);
|
||||
@@ -642,14 +731,14 @@ namespace PortabilityLayer
|
||||
|
||||
if (hit == kOkayButton && mode == Mode_Save)
|
||||
{
|
||||
HostFileSystem *fs = HostFileSystem::GetInstance();
|
||||
IGpFileSystem *fs = PLDrivers::GetFileSystem();
|
||||
|
||||
EditboxWidget *editBox = static_cast<EditboxWidget*>(dialog->GetItems()[kFileNameEditBox - 1].GetWidget());
|
||||
|
||||
PLPasStr nameStr = editBox->GetString();
|
||||
if (nameStr.Length() == 0 || !fs->ValidateFilePath(nameStr.Chars(), nameStr.Length()))
|
||||
{
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->Beep();
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
FileBrowserUIImpl::PopUpAlert(Rect::Create(0, 0, 135, 327), kFileBrowserUIBadNameDialogTemplateID, nullptr);
|
||||
hit = -1;
|
||||
}
|
||||
@@ -657,13 +746,30 @@ namespace PortabilityLayer
|
||||
{
|
||||
DialogTextSubstitutions substitutions(nameStr);
|
||||
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->Beep();
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
int16_t subHit = FileBrowserUIImpl::PopUpAlert(Rect::Create(0, 0, 135, 327), kFileBrowserUIOverwriteDialogTemplateID, &substitutions);
|
||||
|
||||
if (subHit == kOverwriteNoButton)
|
||||
hit = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == Mode_Open && hit == kDeleteButton)
|
||||
{
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
int16_t subHit = FileBrowserUIImpl::PopUpAlert(Rect::Create(0, 0, 135, 327), kFileBrowserUIDeleteDialogTemplateID, &substitutions);
|
||||
|
||||
if (subHit == kOverwriteYesButton)
|
||||
{
|
||||
PLPasStr uiFileName = uiImpl.GetSelectedFileName();
|
||||
|
||||
PortabilityLayer::FileManager::GetInstance()->DeleteFile(dirID, uiFileName);
|
||||
uiImpl.RemoveSelectedFile();
|
||||
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetEnabled(false);
|
||||
dialog->GetItems()[kDeleteButton - 1].GetWidget()->SetEnabled(false);
|
||||
}
|
||||
hit = -1;
|
||||
}
|
||||
} while (hit != kOkayButton && hit != kCancelButton);
|
||||
|
||||
WindowManager::GetInstance()->SwapExclusiveWindow(exclWindow);
|
||||
|
@@ -5,18 +5,33 @@
|
||||
#include "VirtualDirectory.h"
|
||||
|
||||
class PLPasStr;
|
||||
struct DrawSurface;
|
||||
struct Point;
|
||||
struct Rect;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class ResTypeID;
|
||||
|
||||
struct FileBrowserUI_DetailsCallbackAPI
|
||||
{
|
||||
void(*m_drawLabelsCallback)(DrawSurface *surface, const Point &basePoint);
|
||||
void(*m_drawFileDetailsCallback)(DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails);
|
||||
|
||||
void *(*m_loadFileDetailsCallback)(VirtualDirectory_t dirID, const PLPasStr &filename);
|
||||
void(*m_freeFileDetailsCallback)(void *fileDetails);
|
||||
};
|
||||
|
||||
class FileBrowserUI
|
||||
{
|
||||
public:
|
||||
|
||||
enum Mode
|
||||
{
|
||||
Mode_Save,
|
||||
Mode_Open,
|
||||
};
|
||||
|
||||
static bool Prompt(Mode mode, VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText);
|
||||
static bool Prompt(Mode mode, VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &callbackAPI);
|
||||
};
|
||||
}
|
||||
|
@@ -1,16 +1,17 @@
|
||||
#include "FileManager.h"
|
||||
|
||||
#include "FileBrowserUI.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostMemoryBuffer.h"
|
||||
#include "IGpFileSystem.h"
|
||||
#include "IGpSystemServices.h"
|
||||
#include "MemReaderStream.h"
|
||||
#include "MacBinary2.h"
|
||||
#include "MacFileMem.h"
|
||||
#include "ResTypeID.h"
|
||||
|
||||
#include "PLDrivers.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLErrorCodes.h"
|
||||
#include "PLSysCalls.h"
|
||||
#include "ResTypeID.h"
|
||||
#include "HostSystemServices.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -35,8 +36,8 @@ namespace PortabilityLayer
|
||||
PLError_t RawOpenFileData(VirtualDirectory_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, GpFileCreationDisposition_t creationDisposition, GpIOStream *&outStream) override;
|
||||
PLError_t RawOpenFileResources(VirtualDirectory_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, GpFileCreationDisposition_t creationDisposition, GpIOStream *&outStream) override;
|
||||
|
||||
bool PromptSaveFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText) override;
|
||||
bool PromptOpenFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &promptText) override;
|
||||
bool PromptSaveFile(VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &callbackAPI) override;
|
||||
bool PromptOpenFile(VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &callbackAPI) override;
|
||||
|
||||
static FileManagerImpl *GetInstance();
|
||||
|
||||
@@ -57,7 +58,7 @@ namespace PortabilityLayer
|
||||
if (!ConstructFilename(extFN, filename, ".gpf"))
|
||||
return false;
|
||||
|
||||
return HostFileSystem::GetInstance()->FileExists(dirID, extFN);
|
||||
return PLDrivers::GetFileSystem()->FileExists(dirID, extFN);
|
||||
}
|
||||
|
||||
bool FileManagerImpl::FileLocked(VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
@@ -71,7 +72,7 @@ namespace PortabilityLayer
|
||||
return true;
|
||||
|
||||
bool exists = false;
|
||||
if (HostFileSystem::GetInstance()->FileLocked(dirID, extFN, &exists) && exists)
|
||||
if (PLDrivers::GetFileSystem()->FileLocked(dirID, extFN, &exists) && exists)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ namespace PortabilityLayer
|
||||
return true;
|
||||
|
||||
bool existed = false;
|
||||
if (!PortabilityLayer::HostFileSystem::GetInstance()->DeleteFile(dirID, extFN, existed))
|
||||
if (!PLDrivers::GetFileSystem()->DeleteFile(dirID, extFN, existed))
|
||||
{
|
||||
if (extMayNotExist[extIndex] && !existed)
|
||||
continue;
|
||||
@@ -134,7 +135,7 @@ namespace PortabilityLayer
|
||||
MacFileProperties mfp;
|
||||
fileCreator.ExportAsChars(mfp.m_fileCreator);
|
||||
fileType.ExportAsChars(mfp.m_fileType);
|
||||
mfp.m_creationDate = mfp.m_modifiedDate = PortabilityLayer::HostSystemServices::GetInstance()->GetTime();
|
||||
mfp.m_creationDate = mfp.m_modifiedDate = PLDrivers::GetSystemServices()->GetTime();
|
||||
|
||||
return CreateFile(dirID, filename, mfp);
|
||||
}
|
||||
@@ -176,18 +177,18 @@ namespace PortabilityLayer
|
||||
return RawOpenFileFork(dirID, filename, ".gpa", permission, ignoreMeta, createDisposition, outStream);
|
||||
}
|
||||
|
||||
bool FileManagerImpl::PromptSaveFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText)
|
||||
bool FileManagerImpl::PromptSaveFile(VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &detailsAPI)
|
||||
{
|
||||
ExtendedFileName_t extFN;
|
||||
if (!ConstructFilename(extFN, initialFileName, ""))
|
||||
return false;
|
||||
|
||||
return FileBrowserUI::Prompt(FileBrowserUI::Mode_Save, dirID, path, outPathLength, pathCapacity, initialFileName, promptText);
|
||||
return FileBrowserUI::Prompt(FileBrowserUI::Mode_Save, dirID, fileType, path, outPathLength, pathCapacity, initialFileName, promptText, detailsAPI);
|
||||
}
|
||||
|
||||
bool FileManagerImpl::PromptOpenFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &promptText)
|
||||
bool FileManagerImpl::PromptOpenFile(VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &detailsAPI)
|
||||
{
|
||||
return FileBrowserUI::Prompt(FileBrowserUI::Mode_Open, dirID, path, outPathLength, pathCapacity, PSTR(""), promptText);
|
||||
return FileBrowserUI::Prompt(FileBrowserUI::Mode_Open, dirID, fileType, path, outPathLength, pathCapacity, PSTR(""), promptText, detailsAPI);
|
||||
}
|
||||
|
||||
FileManagerImpl *FileManagerImpl::GetInstance()
|
||||
@@ -222,7 +223,7 @@ namespace PortabilityLayer
|
||||
if (!ConstructFilename(gpfExtFN, filename, ".gpf"))
|
||||
return PLErrors::kBadFileName;
|
||||
|
||||
if (!HostFileSystem::GetInstance()->FileExists(dirID, gpfExtFN))
|
||||
if (!PLDrivers::GetFileSystem()->FileExists(dirID, gpfExtFN))
|
||||
return PLErrors::kFileNotFound;
|
||||
}
|
||||
|
||||
@@ -233,21 +234,21 @@ namespace PortabilityLayer
|
||||
switch (permission)
|
||||
{
|
||||
case EFilePermission_Any:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(dirID, extFN, true, createDisposition);
|
||||
fstream = PLDrivers::GetFileSystem()->OpenFile(dirID, extFN, true, createDisposition);
|
||||
if (fstream)
|
||||
permission = EFilePermission_ReadWrite;
|
||||
else
|
||||
{
|
||||
permission = EFilePermission_Read;
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(dirID, extFN, false, createDisposition);
|
||||
fstream = PLDrivers::GetFileSystem()->OpenFile(dirID, extFN, false, createDisposition);
|
||||
}
|
||||
break;
|
||||
case EFilePermission_Read:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(dirID, extFN, false, createDisposition);
|
||||
fstream = PLDrivers::GetFileSystem()->OpenFile(dirID, extFN, false, createDisposition);
|
||||
break;
|
||||
case EFilePermission_ReadWrite:
|
||||
case EFilePermission_Write:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(dirID, extFN, true, createDisposition);
|
||||
fstream = PLDrivers::GetFileSystem()->OpenFile(dirID, extFN, true, createDisposition);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -268,7 +269,7 @@ namespace PortabilityLayer
|
||||
memcpy(extFN, fn.Chars(), fnameSize);
|
||||
memcpy(extFN + fnameSize, extension, strlen(extension) + 1);
|
||||
|
||||
if (!PortabilityLayer::HostFileSystem::GetInstance()->ValidateFilePath(extFN, fnameSize))
|
||||
if (!PLDrivers::GetFileSystem()->ValidateFilePath(extFN, fnameSize))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@@ -16,6 +16,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
class ResTypeID;
|
||||
struct MacFileProperties;
|
||||
struct FileBrowserUI_DetailsCallbackAPI;
|
||||
|
||||
class FileManager
|
||||
{
|
||||
@@ -35,8 +36,8 @@ namespace PortabilityLayer
|
||||
virtual PLError_t RawOpenFileData(VirtualDirectory_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, GpFileCreationDisposition_t createDisposition, GpIOStream *&outStream) = 0;
|
||||
virtual PLError_t RawOpenFileResources(VirtualDirectory_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, GpFileCreationDisposition_t createDisposition, GpIOStream *&outStream) = 0;
|
||||
|
||||
virtual bool PromptSaveFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText) = 0;
|
||||
virtual bool PromptOpenFile(VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &promptText) = 0;
|
||||
virtual bool PromptSaveFile(VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &callbackAPI) = 0;
|
||||
virtual bool PromptOpenFile(VirtualDirectory_t dirID, const ResTypeID &fileType, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &promptText, const FileBrowserUI_DetailsCallbackAPI &callbackAPI) = 0;
|
||||
|
||||
static FileManager *GetInstance();
|
||||
};
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#include "FontFamily.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "IGpFileSystem.h"
|
||||
#include "IGpFontHandler.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "IGpFont.h"
|
||||
|
||||
#include "PLDrivers.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
|
||||
@@ -12,11 +13,11 @@ namespace PortabilityLayer
|
||||
{
|
||||
void FontFamily::AddFont(int flags, const char *path, FontHacks fontHacks)
|
||||
{
|
||||
GpIOStream *sysFontStream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kFonts, path, false, GpFileCreationDispositions::kOpenExisting);
|
||||
GpIOStream *sysFontStream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFonts, path, false, GpFileCreationDispositions::kOpenExisting);
|
||||
if (!sysFontStream)
|
||||
return;
|
||||
|
||||
IGpFontHandler *fontHandler = PortabilityLayer::HostFontHandler::GetInstance();
|
||||
IGpFontHandler *fontHandler = PLDrivers::GetFontHandler();
|
||||
|
||||
IGpFont *font = fontHandler->LoadFont(sysFontStream);
|
||||
|
||||
|
@@ -2,12 +2,13 @@
|
||||
#include "FontFamily.h"
|
||||
#include "FontRenderer.h"
|
||||
|
||||
#include "HostFileSystem.h"
|
||||
#include "IGpFont.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "IGpFileSystem.h"
|
||||
#include "IGpFont.h"
|
||||
#include "RenderedFont.h"
|
||||
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLDrivers.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -111,7 +112,7 @@ namespace PortabilityLayer
|
||||
if (m_monospaceFont)
|
||||
m_monospaceFont->Destroy();
|
||||
|
||||
IGpFontHandler *hfh = HostFontHandler::GetInstance();
|
||||
IGpFontHandler *hfh = PLDrivers::GetFontHandler();
|
||||
|
||||
for (int i = 0; i < sizeof(m_cachedRenderedFonts) / sizeof(m_cachedRenderedFonts[0]); i++)
|
||||
{
|
||||
@@ -220,7 +221,7 @@ namespace PortabilityLayer
|
||||
char filename[kFontCacheNameSize];
|
||||
GenerateCacheFileName(filename, cacheID, size, aa, flags);
|
||||
|
||||
GpIOStream *stream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, filename, false, GpFileCreationDispositions::kOpenExisting);
|
||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, filename, false, GpFileCreationDispositions::kOpenExisting);
|
||||
if (!stream)
|
||||
return nullptr;
|
||||
|
||||
@@ -242,7 +243,7 @@ namespace PortabilityLayer
|
||||
char filename[kFontCacheNameSize];
|
||||
GenerateCacheFileName(filename, cacheID, size, aa, flags);
|
||||
|
||||
GpIOStream *stream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, filename, true, GpFileCreationDispositions::kCreateOrOverwrite);
|
||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, filename, true, GpFileCreationDispositions::kCreateOrOverwrite);
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
|
@@ -3,15 +3,16 @@
|
||||
#include "CoreDefs.h"
|
||||
#include "IGpFont.h"
|
||||
#include "GpIOStream.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "IGpFontRenderedGlyph.h"
|
||||
#include "MacRomanConversion.h"
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "GpRenderedFontMetrics.h"
|
||||
#include "GpRenderedGlyphMetrics.h"
|
||||
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLDrivers.h"
|
||||
#include "PLPasStr.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -159,7 +160,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
CacheHeader header;
|
||||
header.m_cacheVersion = kRFontCacheVersion;
|
||||
header.m_glyphDataSize = this->m_dataSize;
|
||||
header.m_glyphDataSize = static_cast<uint32_t>(this->m_dataSize);
|
||||
header.m_isAA = m_isAntiAliased;
|
||||
header.m_sizeSize = sizeof(size_t);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user