mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-15 12:39:38 +00:00
Merge branch 'master' into mac
# Conflicts: # GpApp/Main.cpp
This commit is contained in:
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
[submodule "AerofoilWeb/FileSaverDotJS"]
|
||||
path = AerofoilWeb/FileSaverDotJS
|
||||
url = https://github.com/eligrey/FileSaver.js.git
|
||||
branch = master
|
||||
@@ -1,13 +1,32 @@
|
||||
#include "GpFileStream_Win32.h"
|
||||
#include "IGpAllocator.h"
|
||||
|
||||
GpFileStream_Win32::GpFileStream_Win32(HANDLE handle, bool readable, bool writeable, bool seekable)
|
||||
: m_handle(handle)
|
||||
#include <new>
|
||||
|
||||
GpFileStream_Win32::GpFileStream_Win32(IGpAllocator *alloc, HANDLE handle, bool readable, bool writeable, bool seekable)
|
||||
: m_alloc(alloc)
|
||||
, m_handle(handle)
|
||||
, m_readable(readable)
|
||||
, m_writeable(writeable)
|
||||
, m_seekable(seekable)
|
||||
{
|
||||
}
|
||||
|
||||
GpFileStream_Win32 *GpFileStream_Win32::Create(IGpAllocator *alloc, HANDLE handle, bool readable, bool writeable, bool seekable)
|
||||
{
|
||||
void *storage = alloc->Alloc(sizeof(GpFileStream_Win32));
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
return new (storage) GpFileStream_Win32(alloc, handle, readable, writeable, seekable);
|
||||
}
|
||||
|
||||
|
||||
GpFileStream_Win32::~GpFileStream_Win32()
|
||||
{
|
||||
CloseHandle(m_handle);
|
||||
}
|
||||
|
||||
size_t GpFileStream_Win32::Read(void *bytesOut, size_t size)
|
||||
{
|
||||
if (!m_readable)
|
||||
@@ -122,7 +141,10 @@ GpUFilePos_t GpFileStream_Win32::Tell() const
|
||||
|
||||
void GpFileStream_Win32::Close()
|
||||
{
|
||||
CloseHandle(m_handle);
|
||||
IGpAllocator *alloc = m_alloc;
|
||||
this->~GpFileStream_Win32();
|
||||
|
||||
alloc->Release(this);
|
||||
}
|
||||
|
||||
void GpFileStream_Win32::Flush()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
class GpFileStream_Win32 final : public GpIOStream
|
||||
{
|
||||
public:
|
||||
explicit GpFileStream_Win32(HANDLE handle, bool readable, bool writeable, bool seekable);
|
||||
~GpFileStream_Win32();
|
||||
|
||||
size_t Read(void *bytesOut, size_t size) override;
|
||||
size_t Write(const void *bytes, size_t size) override;
|
||||
@@ -26,7 +26,12 @@ public:
|
||||
void Close();
|
||||
#endif
|
||||
|
||||
static GpFileStream_Win32 *Create(IGpAllocator *alloc, HANDLE handle, bool readable, bool writeable, bool seekable);
|
||||
|
||||
private:
|
||||
GpFileStream_Win32(IGpAllocator *alloc, HANDLE handle, bool readable, bool writeable, bool seekable);
|
||||
|
||||
IGpAllocator *m_alloc;
|
||||
HANDLE m_handle;
|
||||
bool m_readable;
|
||||
bool m_writeable;
|
||||
|
||||
@@ -115,6 +115,7 @@ GpFileSystem_Win32::GpFileSystem_Win32(IGpAllocator *alloc)
|
||||
, m_userHousesDir(alloc)
|
||||
, m_userSavesDir(alloc)
|
||||
, m_resourcesDir(alloc)
|
||||
, m_exportDir(alloc)
|
||||
{
|
||||
m_executablePath[0] = 0;
|
||||
}
|
||||
@@ -155,18 +156,23 @@ bool GpFileSystem_Win32::Init()
|
||||
if (!m_logsDir.Set(m_prefsDir) || !m_logsDir.Append(L"\\Logs"))
|
||||
return false;
|
||||
|
||||
if (!m_exportDir.Set(m_prefsDir) || !m_exportDir.Append(L"\\Export"))
|
||||
return false;
|
||||
|
||||
CreateDirectoryW(m_prefsDir.Buffer(), nullptr);
|
||||
CreateDirectoryW(m_scoresDir.Buffer(), nullptr);
|
||||
CreateDirectoryW(m_userHousesDir.Buffer(), nullptr);
|
||||
CreateDirectoryW(m_userSavesDir.Buffer(), nullptr);
|
||||
CreateDirectoryW(m_logsDir.Buffer(), nullptr);
|
||||
CreateDirectoryW(m_exportDir.Buffer(), nullptr);
|
||||
|
||||
if (!m_prefsDir.Append(L"\\") ||
|
||||
!m_scoresDir.Append(L"\\") ||
|
||||
!m_userHousesDir.Append(L"\\") ||
|
||||
!m_userSavesDir.Append(L"\\") ||
|
||||
!m_logsDir.Append(L"\\") ||
|
||||
!m_resourcesDir.Append(L"\\"))
|
||||
!m_resourcesDir.Append(L"\\") ||
|
||||
!m_exportDir.Append(L"\\"))
|
||||
return false;
|
||||
|
||||
DWORD modulePathSize = GetModuleFileNameW(nullptr, m_executablePath, MAX_PATH);
|
||||
@@ -284,7 +290,7 @@ GpIOStream *GpFileSystem_Win32::OpenFileNested(PortabilityLayer::VirtualDirector
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
return new GpFileStream_Win32(h, true, writeAccess, true);
|
||||
return GpFileStream_Win32::Create(m_alloc, h, true, writeAccess, true);
|
||||
}
|
||||
|
||||
bool GpFileSystem_Win32::DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed)
|
||||
@@ -509,6 +515,9 @@ bool GpFileSystem_Win32::ResolvePath(PortabilityLayer::VirtualDirectory_t virtua
|
||||
case PortabilityLayer::VirtualDirectories::kLogs:
|
||||
baseDir = m_logsDir.Buffer();
|
||||
break;
|
||||
case PortabilityLayer::VirtualDirectories::kSourceExport:
|
||||
baseDir = m_exportDir.Buffer();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ private:
|
||||
GpWString m_userHousesDir;
|
||||
GpWString m_userSavesDir;
|
||||
GpWString m_resourcesDir;
|
||||
GpWString m_exportDir;
|
||||
wchar_t m_executablePath[MAX_PATH];
|
||||
|
||||
IGpAllocator *m_alloc;
|
||||
|
||||
@@ -232,9 +232,10 @@ uint64_t GpSystemServices_Win32::GetFreeMemoryCosmetic() const
|
||||
return memStatus.ullAvailPhys;
|
||||
}
|
||||
|
||||
void GpSystemServices_Win32::Beep() const
|
||||
bool GpSystemServices_Win32::Beep() const
|
||||
{
|
||||
MessageBeep(MB_OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Win32::IsTouchscreen() const
|
||||
@@ -262,6 +263,21 @@ bool GpSystemServices_Win32::IsFullscreenOnStartup() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Win32::HasNativeFileManager() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
GpOperatingSystem_t GpSystemServices_Win32::GetOperatingSystem() const
|
||||
{
|
||||
return GpOperatingSystems::kWindows;
|
||||
}
|
||||
|
||||
GpOperatingSystemFlavor_t GpSystemServices_Win32::GetOperatingSystemFlavor() const
|
||||
{
|
||||
return GpOperatingSystemFlavors::kGeneric;
|
||||
}
|
||||
|
||||
unsigned int GpSystemServices_Win32::GetCPUCount() const
|
||||
{
|
||||
SYSTEM_INFO sysInfo;
|
||||
|
||||
@@ -28,12 +28,15 @@ public:
|
||||
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
|
||||
IGpThreadEvent *CreateThreadEvent(bool autoReset, bool startSignaled) override;
|
||||
uint64_t GetFreeMemoryCosmetic() const override;
|
||||
void Beep() const override;
|
||||
bool Beep() const override;
|
||||
bool IsTouchscreen() const override;
|
||||
bool IsUsingMouseAsTouch() const override;
|
||||
bool IsTextInputObstructive() const override;
|
||||
bool IsFullscreenPreferred() const override;
|
||||
bool IsFullscreenOnStartup() const override;
|
||||
bool HasNativeFileManager() const override;
|
||||
GpOperatingSystem_t GetOperatingSystem() const override;
|
||||
GpOperatingSystemFlavor_t GetOperatingSystemFlavor() const override;
|
||||
unsigned int GetCPUCount() const override;
|
||||
void SetTextInputEnabled(bool isEnabled) override;
|
||||
bool IsTextInputEnabled() const override;
|
||||
|
||||
@@ -55,8 +55,9 @@ void *GpSystemServices_Android::CreateThread(ThreadFunc_t threadFunc, void *cont
|
||||
return thread;
|
||||
}
|
||||
|
||||
void GpSystemServices_Android::Beep() const
|
||||
bool GpSystemServices_Android::Beep() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Android::IsTouchscreen() const
|
||||
@@ -84,6 +85,21 @@ bool GpSystemServices_Android::IsFullscreenOnStartup() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Android::HasNativeFileManager() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
GpOperatingSystem_t GpSystemServices_Android::GetOperatingSystem() const
|
||||
{
|
||||
return GpOperatingSystems::kAndroid;
|
||||
}
|
||||
|
||||
GpOperatingSystemFlavor_t GpSystemServices_Android::GetOperatingSystemFlavor() const
|
||||
{
|
||||
return GpOperatingSystemFlavors::kGeneric;
|
||||
}
|
||||
|
||||
unsigned int GpSystemServices_Android::GetCPUCount() const
|
||||
{
|
||||
return SDL_GetCPUCount();
|
||||
|
||||
@@ -9,12 +9,15 @@ public:
|
||||
GpSystemServices_Android();
|
||||
|
||||
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
|
||||
void Beep() const override;
|
||||
bool Beep() const override;
|
||||
bool IsTouchscreen() const override;
|
||||
bool IsUsingMouseAsTouch() const override;
|
||||
bool IsTextInputObstructive() const override;
|
||||
bool IsFullscreenPreferred() const override;
|
||||
bool IsFullscreenOnStartup() const override;
|
||||
bool HasNativeFileManager() const override;
|
||||
GpOperatingSystem_t GetOperatingSystem() const override;
|
||||
GpOperatingSystemFlavor_t GetOperatingSystemFlavor() const override;
|
||||
unsigned int GetCPUCount() const override;
|
||||
void SetTextInputEnabled(bool isEnabled) override;
|
||||
bool IsTextInputEnabled() const override;
|
||||
|
||||
@@ -2711,7 +2711,7 @@ bool GpDisplayDriver_SDL_GL2::InitBackBuffer(uint32_t width, uint32_t height)
|
||||
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
m_useUpscaleFilter = ((m_pixelScaleX < 2.0f && m_pixelScaleX > 1.0f) || (m_pixelScaleY < 2.0f && m_pixelScaleY > 1.0f));
|
||||
m_useUpscaleFilter = (m_pixelScaleX == 1.5f || m_pixelScaleX == 2.5f || m_pixelScaleY == 1.5f || m_pixelScaleY == 2.5f);
|
||||
|
||||
if (m_useUpscaleFilter)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
"vec4 ApplyDesaturation(float desaturation, vec4 color)\n"\
|
||||
"{\n"\
|
||||
" // This is intentionally done in gamma space\n"\
|
||||
" if (desaturation == 0.0)\n"\
|
||||
" if (desaturation == 0.0 || (color.r == 1.0 && color.g == 1.0 && color.b == 0.0))\n"\
|
||||
" return color;\n"\
|
||||
"\n"\
|
||||
" float grayLevel = dot(color.rgb, vec3(3.0, 6.0, 1.0) / 10.0);\n"\
|
||||
|
||||
11
AerofoilWeb/BuildAerofoilPortable.bat
Normal file
11
AerofoilWeb/BuildAerofoilPortable.bat
Normal file
@@ -0,0 +1,11 @@
|
||||
set INPUT_DIR=../AerofoilPortable
|
||||
set OUTPUT_DIR=obj
|
||||
|
||||
rem set DEBUG_LEVEL_FLAGS=-g4 -O0
|
||||
set DEBUG_LEVEL_FLAGS=-O3
|
||||
|
||||
set FLAGS=-s USE_SDL=2 -flto -I../GpCommon/ -I../Common/ -s ASYNCIFY %DEBUG_LEVEL_FLAGS% -DGP_DEBUG_CONFIG=0
|
||||
|
||||
emcc -c %INPUT_DIR%/GpAllocator_C.cpp -o %OUTPUT_DIR%/AerofoilPortable_Combined.o %FLAGS%
|
||||
|
||||
pause
|
||||
@@ -1,6 +1,10 @@
|
||||
set INPUT_DIR=.
|
||||
set OUTPUT_DIR=obj
|
||||
set FLAGS=-s USE_SDL=2 -flto -I../GpCommon/ -I../PortabilityLayer/ -I../Common/ -I../GpShell/ -s ASYNCIFY -O3 -DGP_DEBUG_CONFIG=0
|
||||
|
||||
rem set DEBUG_LEVEL_FLAGS=-g4 -O0
|
||||
set DEBUG_LEVEL_FLAGS=-O3
|
||||
|
||||
set FLAGS=-s USE_SDL=2 -flto -I../GpCommon/ -I../PortabilityLayer/ -I../Common/ -I../AerofoilPortable/ -I../GpShell/ -s ASYNCIFY %DEBUG_LEVEL_FLAGS% -DGP_DEBUG_CONFIG=0
|
||||
|
||||
emcc -c %INPUT_DIR%/AerofoilWeb_Combined.cpp -o %OUTPUT_DIR%/AerofoilWeb_Combined.o %FLAGS%
|
||||
|
||||
|
||||
1
AerofoilWeb/FileSaverDotJS
Submodule
1
AerofoilWeb/FileSaverDotJS
Submodule
Submodule AerofoilWeb/FileSaverDotJS added at b5e61ec889
@@ -39,6 +39,22 @@ EM_JS(void, FlushFileSystem, (), {
|
||||
});
|
||||
});
|
||||
|
||||
EM_JS(void, DownloadAndDeleteFile, (const char *fileNamePtr, const char *prettyNamePtr), {
|
||||
var fileName = UTF8ToString(fileNamePtr);
|
||||
var prettyName = UTF8ToString(prettyNamePtr);
|
||||
console.log("Flush download of file " + fileName + " as " + prettyName);
|
||||
|
||||
var mimeType = "application/octet-stream";
|
||||
if (prettyName.endsWith(".bin"))
|
||||
mimeType = "application/macbinary";
|
||||
else if (prettyName.endsWith(".gpf"))
|
||||
mimeType = "application/zip";
|
||||
|
||||
var byteArray = FS.readFile(fileName, { encoding: "binary" });
|
||||
var blob = new Blob([byteArray], { type: mimeType });
|
||||
saveAs(blob, prettyName);
|
||||
});
|
||||
|
||||
|
||||
class GpDirectoryCursor_Web final : public IGpDirectoryCursor
|
||||
{
|
||||
@@ -255,7 +271,7 @@ void GpFileStream_Web_StaticMemFile::Flush()
|
||||
class GpFileStream_Web_File final : public GpIOStream
|
||||
{
|
||||
public:
|
||||
GpFileStream_Web_File(FILE *f, bool readOnly, bool writeOnly, bool synchronizeOnClose);
|
||||
GpFileStream_Web_File(FILE *f, const std::string &filePath, const std::string &prettyName, bool readOnly, bool writeOnly, bool synchronizeOnClose, bool isIDB);
|
||||
~GpFileStream_Web_File();
|
||||
|
||||
size_t Read(void *bytesOut, size_t size) override;
|
||||
@@ -273,18 +289,24 @@ public:
|
||||
|
||||
private:
|
||||
FILE *m_f;
|
||||
std::string m_filePath;
|
||||
std::string m_prettyName;
|
||||
bool m_seekable;
|
||||
bool m_isReadOnly;
|
||||
bool m_isWriteOnly;
|
||||
bool m_synchronizeOnClose;
|
||||
bool m_isIDB;
|
||||
};
|
||||
|
||||
|
||||
GpFileStream_Web_File::GpFileStream_Web_File(FILE *f, bool readOnly, bool writeOnly, bool synchronizeOnClose)
|
||||
GpFileStream_Web_File::GpFileStream_Web_File(FILE *f, const std::string &filePath, const std::string &prettyName, bool readOnly, bool writeOnly, bool synchronizeOnClose, bool isIDB)
|
||||
: m_f(f)
|
||||
, m_isReadOnly(readOnly)
|
||||
, m_isWriteOnly(writeOnly)
|
||||
, m_synchronizeOnClose(synchronizeOnClose)
|
||||
, m_isIDB(isIDB)
|
||||
, m_filePath(filePath)
|
||||
, m_prettyName(prettyName)
|
||||
{
|
||||
m_seekable = (fseek(m_f, 0, SEEK_CUR) == 0);
|
||||
}
|
||||
@@ -294,7 +316,12 @@ GpFileStream_Web_File::~GpFileStream_Web_File()
|
||||
fclose(m_f);
|
||||
|
||||
if (m_synchronizeOnClose)
|
||||
{
|
||||
if (m_isIDB)
|
||||
GpFileSystem_Web::MarkFSStateDirty();
|
||||
else
|
||||
GpFileSystem_Web::SyncDownloadFile(m_filePath, m_prettyName);
|
||||
}
|
||||
}
|
||||
|
||||
size_t GpFileStream_Web_File::Read(void *bytesOut, size_t size)
|
||||
@@ -384,10 +411,12 @@ void GpFileStream_Web_File::Flush()
|
||||
bool GpFileSystem_Web::ms_fsStateDirty;
|
||||
|
||||
|
||||
bool GpFileSystem_Web::ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, bool trailingSlash, std::string &resolution)
|
||||
bool GpFileSystem_Web::ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, bool trailingSlash, std::string &resolution, bool &outIsIDB)
|
||||
{
|
||||
const char *prefsAppend = nullptr;
|
||||
const char *pathAppend = nullptr;
|
||||
const std::string *rootPath = nullptr;
|
||||
std::string unsanitized;
|
||||
bool isIDB = false;
|
||||
|
||||
switch (virtualDirectory)
|
||||
{
|
||||
@@ -401,24 +430,37 @@ bool GpFileSystem_Web::ResolvePath(PortabilityLayer::VirtualDirectory_t virtualD
|
||||
unsanitized = std::string("Resources");
|
||||
break;
|
||||
case PortabilityLayer::VirtualDirectories::kHighScores:
|
||||
prefsAppend = "HighScores";
|
||||
pathAppend = "HighScores";
|
||||
rootPath = &m_prefsPath;
|
||||
isIDB = true;
|
||||
break;
|
||||
case PortabilityLayer::VirtualDirectories::kUserData:
|
||||
prefsAppend = "Houses";
|
||||
pathAppend = "Houses";
|
||||
rootPath = &m_prefsPath;
|
||||
isIDB = true;
|
||||
break;
|
||||
case PortabilityLayer::VirtualDirectories::kUserSaves:
|
||||
prefsAppend = "SavedGames";
|
||||
pathAppend = "SavedGames";
|
||||
rootPath = &m_prefsPath;
|
||||
isIDB = true;
|
||||
break;
|
||||
case PortabilityLayer::VirtualDirectories::kPrefs:
|
||||
prefsAppend = "Prefs";
|
||||
pathAppend = "Prefs";
|
||||
rootPath = &m_prefsPath;
|
||||
isIDB = true;
|
||||
break;
|
||||
case PortabilityLayer::VirtualDirectories::kSourceExport:
|
||||
pathAppend = "Export";
|
||||
rootPath = &m_exportPath;
|
||||
isIDB = false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
};
|
||||
|
||||
if (prefsAppend)
|
||||
if (pathAppend)
|
||||
{
|
||||
unsanitized = prefsAppend;
|
||||
unsanitized = pathAppend;
|
||||
|
||||
for (size_t i = 0; i < numPaths; i++)
|
||||
{
|
||||
@@ -448,7 +490,7 @@ bool GpFileSystem_Web::ResolvePath(PortabilityLayer::VirtualDirectory_t virtualD
|
||||
}
|
||||
}
|
||||
|
||||
resolution = m_prefsPath + "/" + sanitized;
|
||||
resolution = (*rootPath) + "/" + sanitized;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -463,6 +505,7 @@ bool GpFileSystem_Web::ResolvePath(PortabilityLayer::VirtualDirectory_t virtualD
|
||||
resolution = sanitized;
|
||||
}
|
||||
|
||||
outIsIDB = isIDB;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -478,6 +521,7 @@ GpFileSystem_Web::~GpFileSystem_Web()
|
||||
void GpFileSystem_Web::Init()
|
||||
{
|
||||
m_prefsPath = "/aerofoil";
|
||||
m_exportPath = "/aerofoil_memfs";
|
||||
|
||||
char *baseDir = SDL_GetBasePath();
|
||||
m_basePath = baseDir;
|
||||
@@ -503,7 +547,8 @@ bool GpFileSystem_Web::FileExists(PortabilityLayer::VirtualDirectory_t virtualDi
|
||||
}
|
||||
|
||||
std::string resolvedPath;
|
||||
if (!ResolvePath(virtualDirectory, &path, 1, false, resolvedPath))
|
||||
bool isIDB = false;
|
||||
if (!ResolvePath(virtualDirectory, &path, 1, false, resolvedPath, isIDB))
|
||||
return false;
|
||||
|
||||
struct stat s;
|
||||
@@ -529,7 +574,8 @@ bool GpFileSystem_Web::FileLocked(PortabilityLayer::VirtualDirectory_t virtualDi
|
||||
}
|
||||
|
||||
std::string resolvedPath;
|
||||
if (!ResolvePath(virtualDirectory, &path, 1, false, resolvedPath))
|
||||
bool isIDB = false;
|
||||
if (!ResolvePath(virtualDirectory, &path, 1, false, resolvedPath, isIDB))
|
||||
{
|
||||
if (exists)
|
||||
exists = false;
|
||||
@@ -584,11 +630,9 @@ GpIOStream *GpFileSystem_Web::OpenFileNested(PortabilityLayer::VirtualDirectory_
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
if (virtualDirectory == PortabilityLayer::VirtualDirectories::kSourceExport)
|
||||
return nullptr;
|
||||
|
||||
std::string resolvedPath;
|
||||
if (!ResolvePath(virtualDirectory, subPaths, numSubPaths, false, resolvedPath))
|
||||
bool isIDB = false;
|
||||
if (!ResolvePath(virtualDirectory, subPaths, numSubPaths, false, resolvedPath, isIDB))
|
||||
return nullptr;
|
||||
|
||||
void *objStorage = malloc(sizeof(GpFileStream_Web_File));
|
||||
@@ -615,7 +659,11 @@ GpIOStream *GpFileSystem_Web::OpenFileNested(PortabilityLayer::VirtualDirectory_
|
||||
}
|
||||
}
|
||||
|
||||
return new (objStorage) GpFileStream_Web_File(f, !writeAccess, false, writeAccess);
|
||||
std::string prettyName;
|
||||
if (numSubPaths > 0)
|
||||
prettyName = subPaths[numSubPaths - 1];
|
||||
|
||||
return new (objStorage) GpFileStream_Web_File(f, resolvedPath, prettyName, !writeAccess, false, writeAccess, isIDB);
|
||||
}
|
||||
|
||||
bool GpFileSystem_Web::DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed)
|
||||
@@ -624,7 +672,8 @@ bool GpFileSystem_Web::DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDi
|
||||
return false;
|
||||
|
||||
std::string resolvedPath;
|
||||
if (!ResolvePath(virtualDirectory, &path, 1, false, resolvedPath))
|
||||
bool isIDB = false;
|
||||
if (!ResolvePath(virtualDirectory, &path, 1, false, resolvedPath, isIDB))
|
||||
{
|
||||
existed = false;
|
||||
return false;
|
||||
@@ -633,11 +682,12 @@ bool GpFileSystem_Web::DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDi
|
||||
if (unlink(resolvedPath.c_str()) < 0)
|
||||
{
|
||||
existed = (errno != ENOENT);
|
||||
if (existed)
|
||||
FlushFileSystem();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isIDB)
|
||||
MarkFSStateDirty();
|
||||
|
||||
existed = true;
|
||||
return true;
|
||||
}
|
||||
@@ -743,7 +793,8 @@ IGpDirectoryCursor *GpFileSystem_Web::ScanDirectoryNested(PortabilityLayer::Virt
|
||||
return ScanCatalog(*catalog);
|
||||
|
||||
std::string resolvedPrefix;
|
||||
if (!ResolvePath(virtualDirectory, paths, numPaths, true, resolvedPrefix))
|
||||
bool isIDB = false;
|
||||
if (!ResolvePath(virtualDirectory, paths, numPaths, true, resolvedPrefix, isIDB))
|
||||
return nullptr;
|
||||
|
||||
std::string trimmedPrefix = resolvedPrefix.substr(m_prefsPath.size() + 1);
|
||||
@@ -780,6 +831,11 @@ void GpFileSystem_Web::MarkFSStateDirty()
|
||||
ms_fsStateDirty = true;
|
||||
}
|
||||
|
||||
void GpFileSystem_Web::SyncDownloadFile(const std::string &filePath, const std::string &prettyName)
|
||||
{
|
||||
DownloadAndDeleteFile(filePath.c_str(), prettyName.c_str());
|
||||
}
|
||||
|
||||
void GpFileSystem_Web::FlushFS()
|
||||
{
|
||||
if (ms_fsStateDirty)
|
||||
@@ -799,7 +855,11 @@ void GpIOStream::Close()
|
||||
|
||||
bool IGpFileSystem::DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed)
|
||||
{
|
||||
return static_cast<GpFileSystem_Web*>(this)->DeleteFile(virtualDirectory, path, existed);
|
||||
bool deleted = static_cast<GpFileSystem_Web*>(this)->DeleteFile(virtualDirectory, path, existed);
|
||||
if (deleted)
|
||||
GpFileSystem_Web::FlushFS();
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
void SetDelayCallback(DelayCallback_t delayCallback) override;
|
||||
|
||||
static void MarkFSStateDirty();
|
||||
static void SyncDownloadFile(const std::string &filePath, const std::string &prettyName);
|
||||
static void FlushFS();
|
||||
|
||||
static GpFileSystem_Web *GetInstance();
|
||||
@@ -54,12 +55,13 @@ private:
|
||||
|
||||
static IGpDirectoryCursor *ScanCatalog(const GpFileSystem_Web_Resources::FileCatalog &catalog);
|
||||
|
||||
bool ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, bool trailingSlash, std::string &resolution);
|
||||
bool ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, bool trailingSlash, std::string &resolution, bool &outIsIDB);
|
||||
|
||||
DelayCallback_t m_delayCallback;
|
||||
|
||||
std::string m_prefsPath;
|
||||
std::string m_basePath;
|
||||
std::string m_exportPath;
|
||||
static bool ms_fsStateDirty;
|
||||
|
||||
static GpFileSystem_Web ms_instance;
|
||||
|
||||
@@ -58,8 +58,8 @@ void GpLogDriver_Web::VPrintf(Category category, const char *fmt, va_list args)
|
||||
|
||||
vsnprintf(charBuff, formattedSize + 1, fmt, args);
|
||||
|
||||
fprintf(stderr, "%s%s%s\n", timestampBuffer, debugTag, charBuff);
|
||||
fflush(stderr);
|
||||
fprintf(stdout, "%s%s%s\n", timestampBuffer, debugTag, charBuff);
|
||||
fflush(stdout);
|
||||
|
||||
free(charBuff);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "SDL_main.h"
|
||||
|
||||
#include "GpMain.h"
|
||||
#include "GpAllocator_C.h"
|
||||
#include "GpAudioDriverFactory.h"
|
||||
#include "GpDisplayDriverFactory.h"
|
||||
#include "GpGlobalConfig.h"
|
||||
@@ -30,7 +31,9 @@ IGpInputDriver *GpDriver_CreateInputDriver_SDL2_Gamepad(const GpInputDriverPrope
|
||||
EM_JS(void, InitFileSystem, (), {
|
||||
Asyncify.handleSleep(wakeUp => {
|
||||
FS.mkdir('/aerofoil');
|
||||
FS.mkdir('/aerofoil_memfs');
|
||||
FS.mount(IDBFS, {}, '/aerofoil');
|
||||
FS.mount(MEMFS, {}, '/aerofoil_memfs');
|
||||
FS.syncfs(true, function (err) {
|
||||
assert(!err);
|
||||
wakeUp();
|
||||
@@ -40,6 +43,8 @@ EM_JS(void, InitFileSystem, (), {
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
IGpAllocator *alloc = GpAllocator_C::GetInstance();
|
||||
|
||||
InitFileSystem();
|
||||
|
||||
GpLogDriver_Web::Init();
|
||||
@@ -65,6 +70,7 @@ int main(int argc, char* argv[])
|
||||
drivers->SetDriver<GpDriverIDs::kFileSystem>(GpFileSystem_Web::GetInstance());
|
||||
drivers->SetDriver<GpDriverIDs::kSystemServices>(GpSystemServices_Web::GetInstance());
|
||||
drivers->SetDriver<GpDriverIDs::kLog>(GpLogDriver_Web::GetInstance());
|
||||
drivers->SetDriver<GpDriverIDs::kAlloc>(alloc);
|
||||
|
||||
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_SDL_GL2;
|
||||
|
||||
@@ -83,6 +89,7 @@ int main(int argc, char* argv[])
|
||||
g_gpGlobalConfig.m_osGlobals = &g_gpXGlobals;
|
||||
g_gpGlobalConfig.m_logger = logger;
|
||||
g_gpGlobalConfig.m_systemServices = GpSystemServices_Web::GetInstance();
|
||||
g_gpGlobalConfig.m_allocator = alloc;
|
||||
|
||||
GpDisplayDriverFactory::RegisterDisplayDriverFactory(EGpDisplayDriverType_SDL_GL2, GpDriver_CreateDisplayDriver_SDL_GL2);
|
||||
GpAudioDriverFactory::RegisterAudioDriverFactory(EGpAudioDriverType_SDL2, GpDriver_CreateAudioDriver_SDL);
|
||||
|
||||
@@ -136,8 +136,9 @@ void *GpSystemServices_Web::CreateThread(ThreadFunc_t threadFunc, void *context)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GpSystemServices_Web::Beep() const
|
||||
bool GpSystemServices_Web::Beep() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Web::IsTouchscreen() const
|
||||
@@ -165,6 +166,21 @@ bool GpSystemServices_Web::IsFullscreenOnStartup() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Web::HasNativeFileManager() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
GpOperatingSystem_t GpSystemServices_Web::GetOperatingSystem() const
|
||||
{
|
||||
return GpOperatingSystems::kWeb;
|
||||
}
|
||||
|
||||
GpOperatingSystemFlavor_t GpSystemServices_Web::GetOperatingSystemFlavor() const
|
||||
{
|
||||
return GpOperatingSystemFlavors::kGeneric;
|
||||
}
|
||||
|
||||
unsigned int GpSystemServices_Web::GetCPUCount() const
|
||||
{
|
||||
return SDL_GetCPUCount();
|
||||
|
||||
@@ -12,12 +12,15 @@ public:
|
||||
~GpSystemServices_Web();
|
||||
|
||||
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
|
||||
void Beep() const override;
|
||||
bool Beep() const override;
|
||||
bool IsTouchscreen() const override;
|
||||
bool IsUsingMouseAsTouch() const override;
|
||||
bool IsTextInputObstructive() const override;
|
||||
bool IsFullscreenPreferred() const override;
|
||||
bool IsFullscreenOnStartup() const override;
|
||||
bool HasNativeFileManager() const override;
|
||||
GpOperatingSystem_t GetOperatingSystem() const override;
|
||||
GpOperatingSystemFlavor_t GetOperatingSystemFlavor() const override;
|
||||
unsigned int GetCPUCount() const override;
|
||||
void SetTextInputEnabled(bool isEnabled) override;
|
||||
bool IsTextInputEnabled() const override;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
set INPUT_DIR=.
|
||||
set OUTPUT_DIR=bin
|
||||
set FLAGS=-flto -O3 -s USE_SDL=2 -s USE_ZLIB=1 -s ASYNCIFY -s ASYNCIFY_IGNORE_INDIRECT -s INITIAL_MEMORY=33554432 -s ASYNCIFY_ADVISE -lidbfs.js -s ASYNCIFY_IMPORTS=['InitFileSystem','FlushFileSystem'] --shell-file shell_minimal.html
|
||||
emcc obj/AerofoilWeb_Combined.o obj/AerofoilWeb_Resources.o obj/GpShell_Combined.o obj/AerofoilSDL_Combined.o obj/GpApp_Combined.o obj/PortabilityLayer_Combined.o obj/MacRomanConversion.o -o %OUTPUT_DIR%/aerofoil.html %FLAGS%
|
||||
|
||||
rem set DEBUG_LEVEL_FLAGS=-g4 -O0
|
||||
set DEBUG_LEVEL_FLAGS=-O3
|
||||
|
||||
copy /Y FileSaverDotJS\dist\FileSaver.js bin\FileSaver.js
|
||||
|
||||
set FLAGS=-flto %DEBUG_LEVEL_FLAGS% -s USE_SDL=2 -s USE_ZLIB=1 -s ASYNCIFY -s ASYNCIFY_IGNORE_INDIRECT -s INITIAL_MEMORY=33554432 -s ASYNCIFY_ADVISE -lidbfs.js -s ASYNCIFY_IMPORTS=['InitFileSystem','FlushFileSystem'] --shell-file shell_minimal.html
|
||||
emcc obj/AerofoilWeb_Combined.o obj/AerofoilWeb_Resources.o obj/GpShell_Combined.o obj/AerofoilSDL_Combined.o obj/AerofoilPortable_Combined.o obj/GpApp_Combined.o obj/PortabilityLayer_Combined.o obj/MacRomanConversion.o -o %OUTPUT_DIR%/aerofoil.html %FLAGS%
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Aerofoil Web Pre-Release</title>
|
||||
<title>Aerofoil</title>
|
||||
<style>
|
||||
.emscripten { padding-right: 0; padding-top: 0; margin-left: auto; margin-right: auto; margin-top: 0; display: block; }
|
||||
textarea.emscripten { font-family: monospace; width: 80%; }
|
||||
@@ -135,6 +135,7 @@
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="FileSaver.js"></script>
|
||||
{{{ SCRIPT }}}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -70,8 +70,9 @@ void *GpSystemServices_X::CreateThread(ThreadFunc_t threadFunc, void *context)
|
||||
return thread;
|
||||
}
|
||||
|
||||
void GpSystemServices_X::Beep() const
|
||||
bool GpSystemServices_X::Beep() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GpSystemServices_X::IsTouchscreen() const
|
||||
@@ -103,6 +104,21 @@ bool GpSystemServices_X::IsFullscreenOnStartup() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GpSystemServices_X::HasNativeFileManager() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
GpOperatingSystem_t GpSystemServices_X::GetOperatingSystem() const
|
||||
{
|
||||
return GpOperatingSystems::kLinux;
|
||||
}
|
||||
|
||||
GpOperatingSystemFlavor_t GpSystemServices_X::GetOperatingSystemFlavor() const
|
||||
{
|
||||
return GpOperatingSystemFlavors::kGeneric;
|
||||
}
|
||||
|
||||
unsigned int GpSystemServices_X::GetCPUCount() const
|
||||
{
|
||||
return SDL_GetCPUCount();
|
||||
|
||||
@@ -12,12 +12,15 @@ public:
|
||||
~GpSystemServices_X();
|
||||
|
||||
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
|
||||
void Beep() const override;
|
||||
bool Beep() const override;
|
||||
bool IsTouchscreen() const override;
|
||||
bool IsUsingMouseAsTouch() const override;
|
||||
bool IsTextInputObstructive() const override;
|
||||
bool IsFullscreenPreferred() const override;
|
||||
bool IsFullscreenOnStartup() const override;
|
||||
bool HasNativeFileManager() const override;
|
||||
GpOperatingSystem_t GetOperatingSystem() const override;
|
||||
GpOperatingSystemFlavor_t GetOperatingSystemFlavor() const override;
|
||||
unsigned int GetCPUCount() const override;
|
||||
void SetTextInputEnabled(bool isEnabled) override;
|
||||
bool IsTextInputEnabled() const override;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"name" : "Okay",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 376, 240 ],
|
||||
"pos" : [ 376, 288 ],
|
||||
"size" : [ 58, 20 ],
|
||||
"id" : 1,
|
||||
"enabled" : true
|
||||
@@ -12,7 +12,7 @@
|
||||
{
|
||||
"name" : "Third Party/Licensing Info...",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 176, 240 ],
|
||||
"pos" : [ 176, 288 ],
|
||||
"size" : [ 190, 20 ],
|
||||
"id" : 1,
|
||||
"enabled" : true
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"enabled" : false
|
||||
},
|
||||
{
|
||||
"name" : "Aerofoil ©2019-2021 Eric Lasota",
|
||||
"name" : "Aerofoil ©2019-2021 Gale Force Games LLC",
|
||||
"itemType" : "Label",
|
||||
"pos" : [ 16, 21 ],
|
||||
"size" : [ 406, 20 ],
|
||||
|
||||
61
ApplicationResourcePatches/DITL/2009.json
Normal file
61
ApplicationResourcePatches/DITL/2009.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"items" :
|
||||
[
|
||||
{
|
||||
"name" : "Okay",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 376, 240 ],
|
||||
"size" : [ 58, 20 ],
|
||||
"id" : 1,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "Cancel",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 302, 240 ],
|
||||
"size" : [ 58, 20 ],
|
||||
"id" : 2,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "",
|
||||
"itemType" : "CustomControl",
|
||||
"pos" : [ 17, 33 ],
|
||||
"size" : [ 401, 186 ],
|
||||
"id" : 2,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "",
|
||||
"itemType" : "CustomControl",
|
||||
"pos" : [ 418, 32 ],
|
||||
"size" : [ 16, 188 ],
|
||||
"id" : 3,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "",
|
||||
"itemType" : "EditBox",
|
||||
"pos" : [ 16, 240 ],
|
||||
"size" : [ 196, 16 ],
|
||||
"id" : 4,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "^0",
|
||||
"itemType" : "Label",
|
||||
"pos" : [ 16, 16 ],
|
||||
"size" : [ 418, 16 ],
|
||||
"id" : 10,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "Delete",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 228, 240 ],
|
||||
"size" : [ 58, 20 ],
|
||||
"id" : 2,
|
||||
"enabled" : false
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
ApplicationResourcePatches/SND/1063.wav
Normal file
BIN
ApplicationResourcePatches/SND/1063.wav
Normal file
Binary file not shown.
@@ -12,6 +12,7 @@
|
||||
"DITL/2006.json" : "ApplicationResourcePatches/DITL/2006.json",
|
||||
"DITL/2007.json" : "ApplicationResourcePatches/DITL/2007.json",
|
||||
"DITL/2008.json" : "ApplicationResourcePatches/DITL/2008.json",
|
||||
"DITL/2009.json" : "ApplicationResourcePatches/DITL/2009.json",
|
||||
"PICT/1300.bmp" : "ApplicationResourcePatches/PICT/1300.bmp",
|
||||
"PICT/1301.bmp" : "ApplicationResourcePatches/PICT/1301.bmp",
|
||||
"PICT/1971.bmp" : "ApplicationResourcePatches/PICT/1971.bmp",
|
||||
@@ -38,7 +39,8 @@
|
||||
"LICS/1004.txt" : "ApplicationResourcePatches/LICS/1004.txt",
|
||||
"LICS/1005.txt" : "ApplicationResourcePatches/LICS/1005.txt",
|
||||
"LICS/1006.txt" : "ApplicationResourcePatches/LICS/1006.txt",
|
||||
"STR$23/1006.txt" : "ApplicationResourcePatches/STR/1006.txt"
|
||||
"STR$23/1006.txt" : "ApplicationResourcePatches/STR/1006.txt",
|
||||
"snd$20/1063.wav" : "ApplicationResourcePatches/SND/1063.wav"
|
||||
},
|
||||
"delete" :
|
||||
[
|
||||
|
||||
@@ -66,7 +66,6 @@ add_library(PortabilityLayer STATIC
|
||||
PortabilityLayer/MemoryManager.cpp
|
||||
PortabilityLayer/MemReaderStream.cpp
|
||||
PortabilityLayer/MenuManager.cpp
|
||||
PortabilityLayer/MMBlock.cpp
|
||||
PortabilityLayer/MMHandleBlock.cpp
|
||||
PortabilityLayer/PLApplication.cpp
|
||||
PortabilityLayer/PLButtonWidget.cpp
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define GP_ALIGNED(n) __declspec(align(n))
|
||||
#else
|
||||
#define GP_ALIGNED(n) __attribute__((aligned(n)))
|
||||
#define GP_RESTRICT
|
||||
#endif
|
||||
|
||||
#if GP_IS_CPP11
|
||||
|
||||
@@ -309,7 +309,7 @@ void DoAboutFramework (void)
|
||||
static const int kAboutFrameworkDialogTemplateID = 2000;
|
||||
static const int kAboutOpenSourceButton = 2;
|
||||
|
||||
const Rect windowRect = Rect::Create(0, 0, 272, 450);
|
||||
const Rect windowRect = Rect::Create(0, 0, 320, 450);
|
||||
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
|
||||
|
||||
@@ -319,6 +319,7 @@ void DoAboutFramework (void)
|
||||
|
||||
int16_t verticalPoint = 16 + font->GetMetrics().m_ascent;
|
||||
int16_t horizontalOffset = 16;
|
||||
int16_t creditsHorizontalOffset = 80;
|
||||
const int16_t spacing = 12;
|
||||
|
||||
PortabilityLayer::DialogManager *dialogManager = PortabilityLayer::DialogManager::GetInstance();
|
||||
@@ -333,23 +334,28 @@ void DoAboutFramework (void)
|
||||
Window *window = dialog->GetWindow();
|
||||
|
||||
DrawSurface *surface = window->GetDrawSurface();
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 0), PSTR(GP_APPLICATION_NAME " " GP_APPLICATION_VERSION_STRING " \xa9" GP_APPLICATION_COPYRIGHT_STRING), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 2), PSTR(GP_APPLICATION_NAME " is an unoffical third-party port of Glider PRO."), 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 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);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 10), PSTR("If you would like to contribute to this project, visit:"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 11), PSTR(GP_APPLICATION_WEBSITE_STRING), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 13), PSTR("To report a problem or request support, submit an issue via"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 14), PSTR("the website above."), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 16), PSTR("For more information, please see the accompanying documentation."), blackColor, font);
|
||||
int lineNum = 0;
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR(GP_APPLICATION_NAME " " GP_APPLICATION_VERSION_STRING " \xa9" GP_APPLICATION_COPYRIGHT_STRING), blackColor, font);
|
||||
(lineNum++);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum)), PSTR("Credits:"), blackColor, font);
|
||||
surface->DrawString(Point::Create(creditsHorizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("Eric Lasota - Programming, admin"), blackColor, font);
|
||||
(lineNum++);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR(GP_APPLICATION_NAME " is an unoffical third-party port of Glider PRO."), blackColor, font);
|
||||
(lineNum++);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("This software is not maintained by, supported by, endorsed by, or"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("otherwise associated with the authors or publishers of Glider PRO."), blackColor, font);
|
||||
(lineNum++);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("Please do not contact any of them regarding issues that you have"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("with " GP_APPLICATION_NAME "."), blackColor, font);
|
||||
(lineNum++);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("If you would like to contribute to this project, visit:"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR(GP_APPLICATION_WEBSITE_STRING), blackColor, font);
|
||||
(lineNum++);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("To report a problem or request support, submit an issue via"), blackColor, font);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("the website above."), blackColor, font);
|
||||
(lineNum++);
|
||||
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * (lineNum++)), PSTR("For more information, please see the accompanying documentation."), blackColor, font);
|
||||
|
||||
surface->DrawString(Point::Create(horizontalOffset, windowRect.bottom - 16), PSTR("Build: " __DATE__ " " __TIME__ " " ABOUT_DIALOG_CONFIGURATION_TAG), blackColor, fontLight);
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ namespace PortabilityLayer
|
||||
#define iObjectWindow 20
|
||||
#define iCoordinateWindow 21
|
||||
|
||||
#define iExportGliderPROHouse 1
|
||||
#define iDownloadHouse 2
|
||||
|
||||
//-------------------------------------------------------------- Structs
|
||||
/*
|
||||
typedef short SICN[16];
|
||||
|
||||
@@ -115,7 +115,8 @@
|
||||
#define kTransInSound 60 // <20><> <20><>
|
||||
#define kBonusSound 61 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define kHissSound 62 //
|
||||
#define kTriggerSound 63
|
||||
#define kPingSound 63 //
|
||||
#define kTriggerSound 64 // This must be the last one
|
||||
|
||||
#define kHitWallPriority 100 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define kScoreTikPriority 101 // <20><>
|
||||
@@ -177,6 +178,7 @@
|
||||
#define kFollowPriority 904
|
||||
#define kTransInPriority 905
|
||||
#define kTransOutPriority 906
|
||||
#define kPingPriority 907
|
||||
#define kTriggerPriority 999
|
||||
|
||||
#define kArrowCursor 0
|
||||
@@ -187,6 +189,7 @@
|
||||
#define kGameMenuID 129
|
||||
#define kOptionsMenuID 130
|
||||
#define kHouseMenuID 131
|
||||
#define kExportMenuID 132
|
||||
|
||||
#define kSplashMode 0
|
||||
#define kEditMode 1
|
||||
|
||||
@@ -106,6 +106,7 @@ Boolean ReadScoresFromDisk (void);
|
||||
|
||||
Boolean CreateNewHouse (void); // --- House.c
|
||||
Boolean InitializeEmptyHouse (void);
|
||||
Boolean InitializeEmptyHouseInEditor (void);
|
||||
SInt16 RealRoomNumberCount (void);
|
||||
SInt16 GetFirstRoomNumber (void);
|
||||
void WhereDoesGliderBegin (Rect *, SInt16);
|
||||
@@ -119,12 +120,13 @@ void GenerateRetroLinks (void);
|
||||
void DoGoToDialog (void);
|
||||
void ConvertHouseVer1To2 (void);
|
||||
void ShiftWholeHouse (SInt16);
|
||||
void ExportHouse (void);
|
||||
void DownloadHouse (void);
|
||||
|
||||
void DoHouseInfo (void); // --- HouseInfo.c
|
||||
|
||||
Boolean OpenHouse (Boolean load); // --- HouseIO.c
|
||||
Boolean OpenSpecificHouse (const VFileSpec &);
|
||||
Boolean SaveHouseAs (void);
|
||||
Boolean ReadHouse (GpIOStream *houseStream, bool untrusted);
|
||||
Boolean WriteHouse (Boolean);
|
||||
Boolean CloseHouse (void);
|
||||
|
||||
@@ -51,40 +51,70 @@ extern short numberRooms, mapLeftRoom, mapTopRoom, numStarsRemaining;
|
||||
extern Boolean houseOpen, noRoomAtAll;
|
||||
extern Boolean twoPlayerGame, wardBitSet, phoneBitSet;
|
||||
|
||||
struct FBUI_House_Context
|
||||
{
|
||||
FBUI_House_Context();
|
||||
|
||||
static void FBUI_House_DrawLabels(DrawSurface *surface, const Point &basePoint)
|
||||
bool m_deletedAny;
|
||||
};
|
||||
|
||||
FBUI_House_Context::FBUI_House_Context()
|
||||
: m_deletedAny(false)
|
||||
{
|
||||
}
|
||||
|
||||
static void FBUI_House_DrawFileDetails(DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails)
|
||||
static void FBUI_House_DrawLabels(void *context, DrawSurface *surface, const Point &basePoint)
|
||||
{
|
||||
}
|
||||
|
||||
static void *FBUI_House_LoadFileDetails(PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
static void FBUI_House_DrawFileDetails(void *context, DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails)
|
||||
{
|
||||
}
|
||||
|
||||
static void *FBUI_House_LoadFileDetails(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void FBUI_House_FreeFileDetails(void *fileDetails)
|
||||
static void FBUI_House_FreeFileDetails(void *context, void *fileDetails)
|
||||
{
|
||||
}
|
||||
|
||||
static bool FBUI_House_FilterFile(PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
static bool FBUI_House_FilterFile(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
PortabilityLayer::CompositeFile *cfile = PortabilityLayer::FileManager::GetInstance()->OpenCompositeFile(dirID, filename);
|
||||
|
||||
return PortabilityLayer::ResTypeIDCodec::Decode(cfile->GetProperties().m_fileType) == 'gliH';
|
||||
}
|
||||
|
||||
static PortabilityLayer::FileBrowserUI_DetailsCallbackAPI GetHouseDetailsAPI()
|
||||
static bool FBUI_House_IsDeleteValid(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
if (dirID != PortabilityLayer::VirtualDirectories::kUserData)
|
||||
return false;
|
||||
|
||||
return !StrCmp::EqualCaseInsensitive(thisHouseName, filename);
|
||||
}
|
||||
|
||||
static void FBUI_House_OnDeleted(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
if (dirID != PortabilityLayer::VirtualDirectories::kUserData)
|
||||
return;
|
||||
|
||||
static_cast<FBUI_House_Context*>(context)->m_deletedAny = true;
|
||||
}
|
||||
|
||||
static PortabilityLayer::FileBrowserUI_DetailsCallbackAPI GetHouseDetailsAPI(FBUI_House_Context *context)
|
||||
{
|
||||
PortabilityLayer::FileBrowserUI_DetailsCallbackAPI api;
|
||||
|
||||
api.m_context = context;
|
||||
api.m_drawLabelsCallback = FBUI_House_DrawLabels;
|
||||
api.m_drawFileDetailsCallback = FBUI_House_DrawFileDetails;
|
||||
api.m_loadFileDetailsCallback = FBUI_House_LoadFileDetails;
|
||||
api.m_freeFileDetailsCallback = FBUI_House_FreeFileDetails;
|
||||
api.m_filterFileCallback = FBUI_House_FilterFile;
|
||||
api.m_isDeleteValidCallback = FBUI_House_IsDeleteValid;
|
||||
api.m_onDeletedCallback = FBUI_House_OnDeleted;
|
||||
|
||||
return api;
|
||||
}
|
||||
@@ -109,8 +139,18 @@ Boolean CreateNewHouse (void)
|
||||
char savePath[sizeof(theSpec.m_name) + 1];
|
||||
size_t savePathLength = 0;
|
||||
|
||||
if (!fm->PromptSaveFile(theSpec.m_dir, ".gpf", savePath, savePathLength, sizeof(theSpec.m_name), PSTR("My House"), PSTR("Create House"), true, GetHouseDetailsAPI()))
|
||||
FBUI_House_Context fbuiContext;
|
||||
|
||||
if (!fm->PromptSaveFile(theSpec.m_dir, ".gpf", savePath, savePathLength, sizeof(theSpec.m_name), PSTR("My House"), PSTR("Create House"), true, GetHouseDetailsAPI(&fbuiContext)))
|
||||
{
|
||||
if (fbuiContext.m_deletedAny)
|
||||
{
|
||||
BuildHouseList();
|
||||
InitCursor();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(savePathLength < sizeof(theSpec.m_name) - 1);
|
||||
|
||||
@@ -165,6 +205,7 @@ Boolean CreateNewHouse (void)
|
||||
// Initializes all the structures for an empty (new) house.
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
|
||||
Boolean InitializeEmptyHouse (void)
|
||||
{
|
||||
houseType *thisHousePtr;
|
||||
@@ -173,7 +214,8 @@ Boolean InitializeEmptyHouse (void)
|
||||
if (thisHouse != nil)
|
||||
thisHouse.Dispose();
|
||||
|
||||
thisHouse = NewHandle(sizeof(houseType) - sizeof(roomType)).StaticCast<houseType>();
|
||||
const size_t houseSizeNoRooms = sizeof(sizeof(houseType) - sizeof(roomType));
|
||||
thisHouse = NewHandle(houseSizeNoRooms).StaticCast<houseType>();
|
||||
|
||||
if (thisHouse == nil)
|
||||
{
|
||||
@@ -211,11 +253,18 @@ Boolean InitializeEmptyHouse (void)
|
||||
UpdateMapWindow();
|
||||
noRoomAtAll = true;
|
||||
fileDirty = true;
|
||||
UpdateMenus(false);
|
||||
ReflectCurrentRoom(true);
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
Boolean InitializeEmptyHouseInEditor (void)
|
||||
{
|
||||
if (!InitializeEmptyHouse())
|
||||
return (false);
|
||||
|
||||
UpdateMenus(false);
|
||||
ReflectCurrentRoom(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- RealRoomNumberCount
|
||||
|
||||
1546
GpApp/HouseIO.cpp
1546
GpApp/HouseIO.cpp
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "IGpSystemServices.h"
|
||||
#include "GpApplicationName.h"
|
||||
#include "Map.h"
|
||||
#include "MenuManager.h"
|
||||
@@ -32,7 +33,7 @@ extern WindowPtr mapWindow, toolsWindow, linkWindow;
|
||||
extern Rect boardSrcRect, localRoomsDest[];
|
||||
extern IGpCursor *handCursor, *vertCursor, *horiCursor;
|
||||
extern IGpCursor *diagCursor;
|
||||
extern MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu;
|
||||
extern MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu, exportMenu;
|
||||
extern long incrementModeTime;
|
||||
extern UInt32 doubleTime;
|
||||
extern short fadeInSequence[], idleMode;
|
||||
@@ -50,6 +51,8 @@ extern Boolean twoPlayerGame, paused, hasMirror, splashDrawn;
|
||||
|
||||
void InitializeMenus (void)
|
||||
{
|
||||
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||
|
||||
appleMenu = GetMenu(kAppleMenuID);
|
||||
if (appleMenu == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
@@ -70,13 +73,17 @@ void InitializeMenus (void)
|
||||
if (!thisMac.isTouchscreen)
|
||||
{
|
||||
menusUp = true;
|
||||
PortabilityLayer::MenuManager::GetInstance()->SetMenuVisible(true);
|
||||
mm->SetMenuVisible(true);
|
||||
}
|
||||
|
||||
houseMenu = GetMenu(kHouseMenuID);
|
||||
if (houseMenu == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
|
||||
exportMenu = mm->CreateMenu(PSTR("Import/Export"), kExportMenuID, true, 100, 16, 0);
|
||||
mm->AppendMenuItem(exportMenu, 0, 0, 0, 0, true, false, PSTR("Export Glider PRO\xaa House..."));
|
||||
mm->AppendMenuItem(exportMenu, 0, 0, 0, 0, false, false, PSTR("Download House..."));
|
||||
|
||||
UpdateMenus(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
//#include <Balloons.h>
|
||||
#include "PLDrivers.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLHacks.h"
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "House.h"
|
||||
#include "IGpSystemServices.h"
|
||||
#include "MenuManager.h"
|
||||
#include "ObjectEdit.h"
|
||||
|
||||
@@ -32,7 +33,7 @@ void UpdateMenusHouseClosed (void);
|
||||
void HeyYourPissingAHighScore (void);
|
||||
|
||||
|
||||
MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu;
|
||||
MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu, exportMenu;
|
||||
Boolean menusUp, resumedSavedGame;
|
||||
|
||||
|
||||
@@ -71,12 +72,12 @@ void UpdateMenusNonEditMode (void)
|
||||
DisableMenuItem(gameMenu, iOpenSavedGame);
|
||||
if (houseOpen)
|
||||
{
|
||||
EnableMenuItem(gameMenu, iLoadHouse);
|
||||
EnableMenuItem(optionsMenu, iEditor);
|
||||
EnableMenuItem(optionsMenu, iHighScores);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableMenuItem(gameMenu, iLoadHouse);
|
||||
DisableMenuItem(optionsMenu, iEditor);
|
||||
DisableMenuItem(optionsMenu, iHighScores);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +86,7 @@ void UpdateMenusNonEditMode (void)
|
||||
EnableMenuItem(gameMenu, iNewGame);
|
||||
EnableMenuItem(gameMenu, iTwoPlayer);
|
||||
EnableMenuItem(gameMenu, iOpenSavedGame);
|
||||
EnableMenuItem(gameMenu, iLoadHouse);
|
||||
EnableMenuItem(optionsMenu, iEditor);
|
||||
EnableMenuItem(optionsMenu, iHighScores);
|
||||
}
|
||||
if (demoHouseIndex == -1)
|
||||
@@ -141,6 +142,19 @@ void UpdateMenusHouseOpen (void)
|
||||
EnableMenuItem(houseMenu, iSendBack);
|
||||
}
|
||||
}
|
||||
|
||||
if (houseUnlocked)
|
||||
{
|
||||
EnableMenuItem(exportMenu, iExportGliderPROHouse);
|
||||
if (PLDrivers::GetSystemServices()->GetOperatingSystem() == GpOperatingSystems::kWeb)
|
||||
EnableMenuItem(exportMenu, iDownloadHouse);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableMenuItem(exportMenu, iExportGliderPROHouse);
|
||||
if (PLDrivers::GetSystemServices()->GetOperatingSystem() == GpOperatingSystems::kWeb)
|
||||
DisableMenuItem(exportMenu, iDownloadHouse);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- UpdateMenusHouseClosed
|
||||
@@ -159,6 +173,8 @@ void UpdateMenusHouseClosed (void)
|
||||
DisableMenuItem(houseMenu, iPaste);
|
||||
DisableMenuItem(houseMenu, iClear);
|
||||
DisableMenuItem(houseMenu, iDuplicate);
|
||||
|
||||
DisableMenuItem(exportMenu, iExportGliderPROHouse);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- UpdateClipboardMenus
|
||||
@@ -254,12 +270,19 @@ void UpdateMenus (Boolean newMode)
|
||||
{
|
||||
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||
if (theMode == kEditMode)
|
||||
{
|
||||
InsertMenu(houseMenu, 0);
|
||||
InsertMenu(exportMenu, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
THandle<Menu> houseMenu = mm->GetMenuByID(kHouseMenuID);
|
||||
if (houseMenu)
|
||||
mm->RemoveMenu(houseMenu);
|
||||
|
||||
THandle<Menu> exportMenu = mm->GetMenuByID(kExportMenuID);
|
||||
if (exportMenu)
|
||||
mm->RemoveMenu(exportMenu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,6 +488,22 @@ void DoOptionsMenu (short theItem)
|
||||
//-------------------------------------------------------------- DoHouseMenu
|
||||
// Handle the user selecting an item from the House menu (only in Edit mode).
|
||||
|
||||
void DoExportMenu(short theItem)
|
||||
{
|
||||
switch (theItem)
|
||||
{
|
||||
case iExportGliderPROHouse:
|
||||
ExportHouse();
|
||||
break;
|
||||
case iDownloadHouse:
|
||||
DownloadHouse();
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DoHouseMenu
|
||||
// Handle the user selecting an item from the House menu (only in Edit mode).
|
||||
|
||||
void DoHouseMenu (short theItem)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
@@ -476,7 +515,7 @@ void DoHouseMenu (short theItem)
|
||||
case iNewHouse:
|
||||
if (CreateNewHouse())
|
||||
{
|
||||
whoCares = InitializeEmptyHouse();
|
||||
whoCares = InitializeEmptyHouseInEditor();
|
||||
whoCares = WriteHouse(false); // Save initial house so it's not an empty file if reloaded immediately
|
||||
OpenCloseEditWindows();
|
||||
}
|
||||
@@ -647,6 +686,10 @@ void DoMenuChoice (long menuChoice)
|
||||
case kHouseMenuID:
|
||||
DoHouseMenu(theItem);
|
||||
break;
|
||||
|
||||
case kExportMenuID:
|
||||
DoExportMenu(theItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,11 @@ static const int kStarsOffset = 180;
|
||||
static const int kGlidersOffset = 260;
|
||||
static const int kScoreOffset = 320;
|
||||
|
||||
static void FBUI_Save_DrawLabels(DrawSurface *surface, const Point &basePoint)
|
||||
struct FBUI_Save_Context
|
||||
{
|
||||
};
|
||||
|
||||
static void FBUI_Save_DrawLabels(void *context, DrawSurface *surface, const Point &basePoint)
|
||||
{
|
||||
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
|
||||
PortabilityLayer::RenderedFont *rfont = GetFont(PortabilityLayer::FontPresets::kSystem12Bold);
|
||||
@@ -51,7 +55,7 @@ static void FBUI_Save_DrawLabels(DrawSurface *surface, const Point &basePoint)
|
||||
surface->DrawString(basePoint + Point::Create(kScoreOffset, 0), PSTR("Score"), blackColor, rfont);
|
||||
}
|
||||
|
||||
static void FBUI_Save_DrawFileDetails(DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails)
|
||||
static void FBUI_Save_DrawFileDetails(void *context, DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails)
|
||||
{
|
||||
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
|
||||
PortabilityLayer::RenderedFont *rfont = GetFont(PortabilityLayer::FontPresets::kSystem12Bold);
|
||||
@@ -70,7 +74,7 @@ static void FBUI_Save_DrawFileDetails(DrawSurface *surface, const Point &basePoi
|
||||
surface->DrawString(basePoint + Point::Create(kScoreOffset, 0), numStr, blackColor, rfont);
|
||||
}
|
||||
|
||||
static void *FBUI_Save_LoadFileDetails(PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
static void *FBUI_Save_LoadFileDetails(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
GpIOStream *stream = nullptr;
|
||||
if (PortabilityLayer::FileManager::GetInstance()->OpenNonCompositeFile(dirID, filename, ".sav", PortabilityLayer::EFilePermission_Read, GpFileCreationDispositions::kOpenExisting, stream) != PLErrors::kNone)
|
||||
@@ -97,25 +101,37 @@ static void *FBUI_Save_LoadFileDetails(PortabilityLayer::VirtualDirectory_t dirI
|
||||
return gameData;
|
||||
}
|
||||
|
||||
static void FBUI_Save_FreeFileDetails(void *fileDetails)
|
||||
static void FBUI_Save_FreeFileDetails(void *context, void *fileDetails)
|
||||
{
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Release(fileDetails);
|
||||
}
|
||||
|
||||
static bool FBUI_Save_FilterFile(PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
static bool FBUI_Save_FilterFile(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static PortabilityLayer::FileBrowserUI_DetailsCallbackAPI GetSavedGameDetailsAPI()
|
||||
static bool FBUI_Save_IsDeleteValid(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void FBUI_Save_OnDeleted(void *context, PortabilityLayer::VirtualDirectory_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
}
|
||||
|
||||
static PortabilityLayer::FileBrowserUI_DetailsCallbackAPI GetSavedGameDetailsAPI(FBUI_Save_Context *context)
|
||||
{
|
||||
PortabilityLayer::FileBrowserUI_DetailsCallbackAPI api;
|
||||
|
||||
api.m_context = context;
|
||||
api.m_drawLabelsCallback = FBUI_Save_DrawLabels;
|
||||
api.m_drawFileDetailsCallback = FBUI_Save_DrawFileDetails;
|
||||
api.m_loadFileDetailsCallback = FBUI_Save_LoadFileDetails;
|
||||
api.m_freeFileDetailsCallback = FBUI_Save_FreeFileDetails;
|
||||
api.m_filterFileCallback = FBUI_Save_FilterFile;
|
||||
api.m_isDeleteValidCallback = FBUI_Save_IsDeleteValid;
|
||||
api.m_onDeletedCallback = FBUI_Save_OnDeleted;
|
||||
|
||||
return api;
|
||||
}
|
||||
@@ -169,7 +185,8 @@ Boolean SaveGame2 (void)
|
||||
char savePath[sizeof(spec.m_name) + 1];
|
||||
size_t savePathLength = 0;
|
||||
|
||||
if (!fm->PromptSaveFile(spec.m_dir, ".sav", savePath, savePathLength, sizeof(spec.m_name), PLPasStr(gameNameStr), PSTR("Save Game"), false, GetSavedGameDetailsAPI()))
|
||||
FBUI_Save_Context context;
|
||||
if (!fm->PromptSaveFile(spec.m_dir, ".sav", savePath, savePathLength, sizeof(spec.m_name), PLPasStr(gameNameStr), PSTR("Save Game"), false, GetSavedGameDetailsAPI(&context)))
|
||||
{
|
||||
mm->Release(savedGame);
|
||||
return false;
|
||||
@@ -266,7 +283,8 @@ Boolean OpenSavedGame (void)
|
||||
char savePath[sizeof(spec.m_name) + 1];
|
||||
size_t savePathLength = 0;
|
||||
|
||||
if (!fm->PromptOpenFile(spec.m_dir, ".sav", savePath, savePathLength, sizeof(spec.m_name), PSTR("Open Saved Game"), false, GetSavedGameDetailsAPI()))
|
||||
FBUI_Save_Context context;
|
||||
if (!fm->PromptOpenFile(spec.m_dir, ".sav", savePath, savePathLength, sizeof(spec.m_name), PSTR("Open Saved Game"), false, GetSavedGameDetailsAPI(&context)))
|
||||
return false;
|
||||
|
||||
assert(savePathLength < sizeof(spec.m_name) - 1);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
#define kBaseBufferSoundID 1000
|
||||
#define kMaxSounds 64
|
||||
#define kMaxSounds 65
|
||||
|
||||
|
||||
void CallBack0 (PortabilityLayer::AudioChannel *);
|
||||
@@ -38,7 +38,7 @@ IGpAudioBuffer *ParseAndConvertSound(const THandle<void> &handle);
|
||||
PortabilityLayer::AudioChannel *channel0, *channel1, *channel2;
|
||||
IGpAudioBuffer *theSoundData[kMaxSounds];
|
||||
short numSoundsLoaded;
|
||||
Boolean soundLoaded[kMaxSounds], dontLoadSounds;
|
||||
Boolean dontLoadSounds;
|
||||
Boolean channelOpen, isSoundOn, failedSound;
|
||||
|
||||
//============================================================== Functions
|
||||
@@ -341,6 +341,14 @@ void CloseSoundChannels (void)
|
||||
channelOpen = false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- PingBeep
|
||||
|
||||
void PingBeep (int duration)
|
||||
{
|
||||
PlayPrioritySound(kPingSound, kPingPriority);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------- InitSound
|
||||
|
||||
void InitSound (void)
|
||||
@@ -376,6 +384,8 @@ void InitSound (void)
|
||||
failedSound = true;
|
||||
}
|
||||
}
|
||||
|
||||
SetBeepFunction (PingBeep);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- KillSound
|
||||
@@ -404,23 +414,23 @@ void TellHerNoSounds (void)
|
||||
|
||||
//-------------------------------------------------------------- ParseAndConvertSound
|
||||
|
||||
IGpAudioBuffer *ParseAndConvertSoundChecked(const THandle<void> &handle)
|
||||
bool ParseAndConvertSoundChecked(const THandle<void> &handle, void const*& outDataContents, size_t &outDataSize)
|
||||
{
|
||||
const uint8_t *dataStart = static_cast<const uint8_t*>(*handle);
|
||||
const size_t size = handle.MMBlock()->m_size;
|
||||
|
||||
if (size < sizeof(PortabilityLayer::RIFFTag))
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
PortabilityLayer::RIFFTag mainRiffTag;
|
||||
memcpy(&mainRiffTag, dataStart, sizeof(PortabilityLayer::RIFFTag));
|
||||
|
||||
if (mainRiffTag.m_tag != PortabilityLayer::WaveConstants::kRiffChunkID)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
const uint32_t riffSize = mainRiffTag.m_chunkSize;
|
||||
if (riffSize < 4 || riffSize - 4 > size - sizeof(PortabilityLayer::RIFFTag))
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
const uint8_t *riffStart = dataStart + sizeof(PortabilityLayer::RIFFTag);
|
||||
const uint8_t *riffEnd = riffStart + riffSize;
|
||||
@@ -432,7 +442,7 @@ IGpAudioBuffer *ParseAndConvertSoundChecked(const THandle<void> &handle)
|
||||
memcpy(&waveMarker, riffStart, 4);
|
||||
|
||||
if (waveMarker != PortabilityLayer::WaveConstants::kWaveChunkID)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
const uint8_t *tagSearchLoc = riffStart + 4;
|
||||
|
||||
@@ -440,7 +450,7 @@ IGpAudioBuffer *ParseAndConvertSoundChecked(const THandle<void> &handle)
|
||||
while (tagSearchLoc != riffEnd)
|
||||
{
|
||||
if (riffEnd - tagSearchLoc < sizeof(PortabilityLayer::RIFFTag))
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
PortabilityLayer::RIFFTag riffTag;
|
||||
memcpy(&riffTag, tagSearchLoc, sizeof(PortabilityLayer::RIFFTag));
|
||||
@@ -453,20 +463,20 @@ IGpAudioBuffer *ParseAndConvertSoundChecked(const THandle<void> &handle)
|
||||
const uint32_t riffTagSizeUnpadded = riffTag.m_chunkSize;
|
||||
|
||||
if (riffTagSizeUnpadded == 0xffffffffU)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
const uint32_t riffTagSizePadded = riffTagSizeUnpadded + (riffTagSizeUnpadded & 1);
|
||||
|
||||
tagSearchLoc += sizeof(PortabilityLayer::RIFFTag);
|
||||
|
||||
if (riffEnd - tagSearchLoc < riffTagSizePadded)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
tagSearchLoc += riffTagSizePadded;
|
||||
}
|
||||
|
||||
if (formatTagLoc == nullptr || dataTagLoc == nullptr)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
PortabilityLayer::RIFFTag fmtTag;
|
||||
memcpy(&fmtTag, formatTagLoc, sizeof(PortabilityLayer::RIFFTag));
|
||||
@@ -500,7 +510,7 @@ IGpAudioBuffer *ParseAndConvertSoundChecked(const THandle<void> &handle)
|
||||
copyableSize = sizeof(PortabilityLayer::WaveFormatChunkV1);
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
memcpy(&formatChunkV3, formatContents, copyableSize);
|
||||
|
||||
@@ -508,23 +518,22 @@ IGpAudioBuffer *ParseAndConvertSoundChecked(const THandle<void> &handle)
|
||||
const PortabilityLayer::WaveFormatChunkV1 formatChunkV1 = formatChunkV2.m_v1;
|
||||
|
||||
if (formatChunkV1.m_bitsPerSample != 8)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
if (formatChunkV1.m_formatCode != PortabilityLayer::WaveConstants::kFormatPCM ||
|
||||
formatChunkV1.m_numChannels != 1 ||
|
||||
formatChunkV1.m_blockAlignmentBytes != 1 ||
|
||||
formatChunkV1.m_bitsPerSample != 8)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
uint32_t dataSize = dataTag.m_chunkSize;
|
||||
if (dataSize > 0x1000000 || dataSize < 1)
|
||||
return nullptr;
|
||||
return false;
|
||||
|
||||
IGpAudioDriver *audioDriver = PLDrivers::GetAudioDriver();
|
||||
if (!audioDriver)
|
||||
return nullptr;
|
||||
outDataContents = dataContents;
|
||||
outDataSize = dataSize;
|
||||
|
||||
return audioDriver->CreateBuffer(dataContents, dataSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
IGpAudioBuffer *ParseAndConvertSound(const THandle<void> &handle)
|
||||
@@ -532,6 +541,14 @@ IGpAudioBuffer *ParseAndConvertSound(const THandle<void> &handle)
|
||||
if (!handle)
|
||||
return nullptr;
|
||||
|
||||
IGpAudioBuffer *buffer = ParseAndConvertSoundChecked(handle);
|
||||
return buffer;
|
||||
IGpAudioDriver *audioDriver = PLDrivers::GetAudioDriver();
|
||||
if (!audioDriver)
|
||||
return nullptr;
|
||||
|
||||
const void *dataContents = nullptr;
|
||||
size_t dataSize = 0;
|
||||
if (!ParseAndConvertSoundChecked(handle, dataContents, dataSize))
|
||||
return nullptr;
|
||||
|
||||
return audioDriver->CreateBuffer(dataContents, dataSize);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
#define GP_BUILD_VERSION_MINOR 1
|
||||
#define GP_BUILD_VERSION_UPDATE 0
|
||||
|
||||
#define GP_APPLICATION_VERSION_STRING "1.1.0"
|
||||
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2021 Eric Lasota"
|
||||
#define GP_APPLICATION_VERSION_STRING "1.1.0 rc1"
|
||||
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2021 Gale Force Games LLC"
|
||||
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"
|
||||
|
||||
@@ -37,8 +37,12 @@ public:
|
||||
const T &operator[](size_t index) const;
|
||||
|
||||
bool Resize(size_t newSize);
|
||||
bool Reserve(size_t newSize);
|
||||
bool ResizeNoConstruct(size_t newSize);
|
||||
|
||||
bool Append(const T &item);
|
||||
bool Append(T &&item);
|
||||
|
||||
T *Buffer();
|
||||
const T *Buffer() const;
|
||||
|
||||
@@ -148,7 +152,6 @@ const T &GpVector<T, TStaticSize>::operator[](size_t index) const
|
||||
return m_elements[index];
|
||||
}
|
||||
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Resize(size_t newSize)
|
||||
{
|
||||
@@ -163,6 +166,21 @@ bool GpVector<T, TStaticSize>::Resize(size_t newSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Reserve(size_t newSize)
|
||||
{
|
||||
const size_t oldCount = m_count;
|
||||
|
||||
if (!ResizeNoConstruct(newSize))
|
||||
return false;
|
||||
|
||||
m_count = oldCount;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::ResizeNoConstruct(size_t newSize)
|
||||
{
|
||||
@@ -211,6 +229,53 @@ bool GpVector<T, TStaticSize>::ResizeNoConstruct(size_t newSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Append(const T &item)
|
||||
{
|
||||
const size_t oldCount = m_count;
|
||||
|
||||
if (m_count == m_capacity)
|
||||
{
|
||||
size_t newCapacity = m_capacity * 2;
|
||||
if (newCapacity < 8)
|
||||
newCapacity = 8;
|
||||
|
||||
if (!Reserve(newCapacity))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ResizeNoConstruct(oldCount + 1))
|
||||
return false;
|
||||
|
||||
new (m_elements + oldCount) T(item);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
bool GpVector<T, TStaticSize>::Append(T &&item)
|
||||
{
|
||||
const size_t oldCount = m_count;
|
||||
|
||||
if (m_count == m_capacity)
|
||||
{
|
||||
size_t newCapacity = m_capacity * 2;
|
||||
if (newCapacity < 8)
|
||||
newCapacity = 8;
|
||||
|
||||
if (!Reserve(newCapacity))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ResizeNoConstruct(oldCount + 1))
|
||||
return false;
|
||||
|
||||
new (m_elements + oldCount) T(static_cast<T&&>(item));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class T, size_t TStaticSize>
|
||||
const size_t GpVector<T, TStaticSize>::Count() const
|
||||
{
|
||||
|
||||
@@ -14,6 +14,34 @@ struct IGpMutex;
|
||||
struct IGpThreadEvent;
|
||||
struct IGpClipboardContents;
|
||||
|
||||
namespace GpOperatingSystems
|
||||
{
|
||||
enum GpOperatingSystem
|
||||
{
|
||||
kUnknown,
|
||||
|
||||
kWindows,
|
||||
kAndroid,
|
||||
kWeb,
|
||||
kLinux,
|
||||
kMacOS,
|
||||
kIOS,
|
||||
};
|
||||
}
|
||||
|
||||
typedef GpOperatingSystems::GpOperatingSystem GpOperatingSystem_t;
|
||||
|
||||
namespace GpOperatingSystemFlavors
|
||||
{
|
||||
enum GpOperatingSystemFlavor
|
||||
{
|
||||
kGeneric,
|
||||
};
|
||||
}
|
||||
|
||||
typedef GpOperatingSystemFlavors::GpOperatingSystemFlavor GpOperatingSystemFlavor_t;
|
||||
|
||||
|
||||
struct IGpSystemServices
|
||||
{
|
||||
public:
|
||||
@@ -26,12 +54,15 @@ public:
|
||||
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 Beep() const = 0;
|
||||
virtual bool IsTouchscreen() const = 0;
|
||||
virtual bool IsUsingMouseAsTouch() const = 0;
|
||||
virtual bool IsFullscreenPreferred() const = 0;
|
||||
virtual bool IsFullscreenOnStartup() const = 0;
|
||||
virtual bool IsTextInputObstructive() const = 0;
|
||||
virtual bool HasNativeFileManager() const = 0;
|
||||
virtual GpOperatingSystem_t GetOperatingSystem() const = 0;
|
||||
virtual GpOperatingSystemFlavor_t GetOperatingSystemFlavor() const = 0;
|
||||
virtual unsigned int GetCPUCount() const = 0;
|
||||
virtual void SetTextInputEnabled(bool isEnabled) = 0;
|
||||
virtual bool IsTextInputEnabled() const = 0;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
static unsigned char gs_shaderData[] = {
|
||||
68, 88, 66, 67, 200, 182, 33, 104, 202, 4, 76, 179, 221, 223, 225,
|
||||
247, 101, 77, 248, 3, 1, 0, 0, 0, 12, 8, 0, 0, 5, 0,
|
||||
68, 88, 66, 67, 183, 33, 168, 132, 150, 47, 5, 18, 245, 254, 40,
|
||||
246, 168, 148, 158, 158, 1, 0, 0, 0, 176, 8, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0, 172, 2, 0, 0, 4, 3, 0, 0, 56,
|
||||
3, 0, 0, 144, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
|
||||
3, 0, 0, 52, 8, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
|
||||
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
|
||||
0, 0, 4, 255, 255, 0, 137, 0, 0, 72, 2, 0, 0, 124, 0,
|
||||
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
|
||||
@@ -54,7 +54,7 @@ static unsigned char gs_shaderData[] = {
|
||||
1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
|
||||
0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
|
||||
72, 68, 82, 80, 4, 0, 0, 64, 0, 0, 0, 20, 1, 0, 0,
|
||||
72, 68, 82, 244, 4, 0, 0, 64, 0, 0, 0, 61, 1, 0, 0,
|
||||
89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0,
|
||||
0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68,
|
||||
0, 0, 88, 16, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85,
|
||||
@@ -93,50 +93,61 @@ static unsigned char gs_shaderData[] = {
|
||||
64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63,
|
||||
0, 0, 128, 63, 29, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0,
|
||||
0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0,
|
||||
0, 0, 13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 57,
|
||||
0, 0, 13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 24,
|
||||
0, 0, 8, 18, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0,
|
||||
0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0,
|
||||
0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154,
|
||||
153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9,
|
||||
66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0,
|
||||
0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0,
|
||||
128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26,
|
||||
0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0,
|
||||
0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0,
|
||||
0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 0, 0, 9, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0,
|
||||
150, 7, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 29, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 2, 64,
|
||||
0, 0, 230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37, 61, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10,
|
||||
114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 2, 64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61, 145, 131,
|
||||
158, 61, 0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
|
||||
174, 71, 97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0, 0, 0,
|
||||
0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114, 63, 110,
|
||||
167, 114, 63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0, 0, 5,
|
||||
114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25, 64, 154,
|
||||
153, 25, 64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0, 0, 5,
|
||||
114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 55, 0, 0, 9, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70,
|
||||
2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
|
||||
0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0,
|
||||
1, 83, 84, 65, 84, 116, 0, 0, 0, 33, 0, 0, 0, 3, 0,
|
||||
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 4,
|
||||
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 24, 0, 0, 10, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 0, 1, 0, 0, 7,
|
||||
34, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0,
|
||||
0, 26, 0, 16, 0, 1, 0, 0, 0, 1, 0, 0, 7, 34, 0,
|
||||
16, 0, 1, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 26,
|
||||
0, 16, 0, 1, 0, 0, 0, 60, 0, 0, 7, 18, 0, 16, 0,
|
||||
1, 0, 0, 0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16,
|
||||
0, 1, 0, 0, 0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0,
|
||||
0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154,
|
||||
153, 153, 62, 154, 153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0,
|
||||
0, 0, 0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32,
|
||||
128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64,
|
||||
0, 0, 0, 0, 128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1,
|
||||
0, 0, 0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0,
|
||||
0, 0, 0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16,
|
||||
0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10,
|
||||
16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55,
|
||||
0, 0, 9, 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0,
|
||||
1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 150, 7, 16,
|
||||
0, 1, 0, 0, 0, 29, 0, 0, 10, 114, 0, 16, 0, 1, 0,
|
||||
0, 0, 2, 64, 0, 0, 230, 174, 37, 61, 230, 174, 37, 61, 230,
|
||||
174, 37, 61, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
|
||||
56, 0, 0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16,
|
||||
0, 0, 0, 0, 0, 2, 64, 0, 0, 145, 131, 158, 61, 145, 131,
|
||||
158, 61, 145, 131, 158, 61, 0, 0, 0, 0, 52, 0, 0, 10, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 70, 2, 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, 10, 114, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 174,
|
||||
71, 97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0, 0, 0, 0,
|
||||
56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
|
||||
0, 0, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114, 63, 110, 167,
|
||||
114, 63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0, 0, 5, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
|
||||
56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
|
||||
0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25, 64, 154, 153,
|
||||
25, 64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
|
||||
55, 0, 0, 9, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16,
|
||||
0, 1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0,
|
||||
0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
|
||||
83, 84, 65, 84, 116, 0, 0, 0, 38, 0, 0, 0, 3, 0, 0,
|
||||
0, 0, 0, 0, 0, 2, 0, 0, 0, 17, 0, 0, 0, 4, 0,
|
||||
0, 0, 4, 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, 2, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4,
|
||||
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0,
|
||||
0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
};
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
static unsigned char gs_shaderData[] = {
|
||||
68, 88, 66, 67, 124, 220, 109, 55, 227, 43, 211, 66, 26, 106, 247,
|
||||
85, 84, 5, 208, 10, 1, 0, 0, 0, 208, 7, 0, 0, 5, 0,
|
||||
68, 88, 66, 67, 91, 245, 0, 26, 141, 247, 8, 90, 250, 198, 29,
|
||||
196, 50, 53, 108, 15, 1, 0, 0, 0, 76, 8, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0, 172, 2, 0, 0, 4, 3, 0, 0, 56,
|
||||
3, 0, 0, 84, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
|
||||
3, 0, 0, 208, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
|
||||
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
|
||||
0, 0, 4, 255, 255, 0, 137, 0, 0, 72, 2, 0, 0, 124, 0,
|
||||
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
|
||||
@@ -54,7 +54,7 @@ static unsigned char gs_shaderData[] = {
|
||||
1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
|
||||
0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
|
||||
72, 68, 82, 20, 4, 0, 0, 64, 0, 0, 0, 5, 1, 0, 0,
|
||||
72, 68, 82, 144, 4, 0, 0, 64, 0, 0, 0, 36, 1, 0, 0,
|
||||
89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0,
|
||||
0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68,
|
||||
0, 0, 88, 16, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85,
|
||||
@@ -93,46 +93,54 @@ static unsigned char gs_shaderData[] = {
|
||||
64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63,
|
||||
0, 0, 128, 63, 29, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0,
|
||||
0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0,
|
||||
0, 0, 13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 57,
|
||||
0, 0, 13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 24,
|
||||
0, 0, 8, 18, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0,
|
||||
0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0,
|
||||
0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154,
|
||||
153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9,
|
||||
66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0,
|
||||
0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0,
|
||||
128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26,
|
||||
0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0,
|
||||
0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0,
|
||||
0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 32, 0, 9, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0,
|
||||
150, 7, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 47, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
|
||||
102, 102, 230, 63, 102, 102, 230, 63, 102, 102, 230, 63, 0, 0, 0,
|
||||
0, 25, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 1,
|
||||
0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
|
||||
150, 246, 160, 189, 43, 199, 117, 63, 40, 177, 243, 60, 0, 0, 0,
|
||||
0, 50, 0, 0, 12, 114, 0, 16, 0, 1, 0, 0, 0, 6, 0,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 87, 203, 136, 63, 86,
|
||||
131, 197, 60, 225, 104, 227, 58, 0, 0, 0, 0, 70, 2, 16, 0,
|
||||
1, 0, 0, 0, 50, 32, 0, 12, 114, 32, 16, 0, 0, 0, 0,
|
||||
0, 166, 10, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 5, 9,
|
||||
34, 60, 158, 151, 129, 60, 194, 240, 119, 63, 0, 0, 0, 0, 70,
|
||||
2, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
|
||||
0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0,
|
||||
1, 83, 84, 65, 84, 116, 0, 0, 0, 31, 0, 0, 0, 2, 0,
|
||||
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 14, 0, 0, 0, 4,
|
||||
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 24, 0, 0, 10, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 0, 1, 0, 0, 7,
|
||||
34, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0,
|
||||
0, 26, 0, 16, 0, 1, 0, 0, 0, 1, 0, 0, 7, 34, 0,
|
||||
16, 0, 1, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 26,
|
||||
0, 16, 0, 1, 0, 0, 0, 60, 0, 0, 7, 18, 0, 16, 0,
|
||||
1, 0, 0, 0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16,
|
||||
0, 1, 0, 0, 0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0,
|
||||
0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154,
|
||||
153, 153, 62, 154, 153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0,
|
||||
0, 0, 0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32,
|
||||
128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64,
|
||||
0, 0, 0, 0, 128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1,
|
||||
0, 0, 0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0,
|
||||
0, 0, 0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16,
|
||||
0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10,
|
||||
16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55,
|
||||
32, 0, 9, 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0,
|
||||
1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 150, 7, 16,
|
||||
0, 1, 0, 0, 0, 47, 0, 0, 5, 114, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
|
||||
2, 64, 0, 0, 102, 102, 230, 63, 102, 102, 230, 63, 102, 102, 230,
|
||||
63, 0, 0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114,
|
||||
0, 16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0,
|
||||
2, 64, 0, 0, 150, 246, 160, 189, 43, 199, 117, 63, 40, 177, 243,
|
||||
60, 0, 0, 0, 0, 50, 0, 0, 12, 114, 0, 16, 0, 1, 0,
|
||||
0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 87,
|
||||
203, 136, 63, 86, 131, 197, 60, 225, 104, 227, 58, 0, 0, 0, 0,
|
||||
70, 2, 16, 0, 1, 0, 0, 0, 50, 32, 0, 12, 114, 32, 16,
|
||||
0, 0, 0, 0, 0, 166, 10, 16, 0, 0, 0, 0, 0, 2, 64,
|
||||
0, 0, 5, 9, 34, 60, 158, 151, 129, 60, 194, 240, 119, 63, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
|
||||
130, 32, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
|
||||
0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 35, 0,
|
||||
0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15,
|
||||
0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 3,
|
||||
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,
|
||||
0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
static unsigned char gs_shaderData[] = {
|
||||
68, 88, 66, 67, 70, 73, 170, 202, 197, 249, 120, 87, 61, 204, 7,
|
||||
189, 64, 34, 147, 57, 1, 0, 0, 0, 144, 7, 0, 0, 5, 0,
|
||||
68, 88, 66, 67, 134, 184, 60, 11, 56, 236, 116, 213, 80, 103, 169,
|
||||
81, 62, 1, 57, 206, 1, 0, 0, 0, 52, 8, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0, 124, 2, 0, 0, 212, 2, 0, 0, 8,
|
||||
3, 0, 0, 20, 7, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
|
||||
3, 0, 0, 184, 7, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
|
||||
1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
|
||||
0, 0, 4, 255, 255, 0, 137, 0, 0, 24, 2, 0, 0, 92, 0,
|
||||
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
|
||||
@@ -51,7 +51,7 @@ static unsigned char gs_shaderData[] = {
|
||||
0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83,
|
||||
86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82,
|
||||
4, 4, 0, 0, 64, 0, 0, 0, 1, 1, 0, 0, 89, 0, 0,
|
||||
168, 4, 0, 0, 64, 0, 0, 0, 42, 1, 0, 0, 89, 0, 0,
|
||||
4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 88, 24,
|
||||
0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98,
|
||||
16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3,
|
||||
@@ -85,50 +85,60 @@ static unsigned char gs_shaderData[] = {
|
||||
0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63,
|
||||
29, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0,
|
||||
0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 13, 0,
|
||||
4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 57, 0, 0, 8, 18,
|
||||
4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 24, 0, 0, 8, 18,
|
||||
0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 16, 0, 0,
|
||||
10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0,
|
||||
0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154, 153, 25, 63, 205,
|
||||
204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9, 66, 0, 16, 0,
|
||||
1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0,
|
||||
0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16, 0, 1,
|
||||
0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0,
|
||||
50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
|
||||
0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0, 0, 0, 86, 5,
|
||||
16, 0, 1, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0,
|
||||
1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 29, 0, 0,
|
||||
10, 114, 0, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, 230, 174,
|
||||
37, 61, 230, 174, 37, 61, 230, 174, 37, 61, 0, 0, 0, 0, 70,
|
||||
2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0,
|
||||
2, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0,
|
||||
0, 145, 131, 158, 61, 145, 131, 158, 61, 145, 131, 158, 61, 0, 0,
|
||||
0, 0, 0, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70,
|
||||
2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 174, 71, 97, 61,
|
||||
174, 71, 97, 61, 174, 71, 97, 61, 0, 0, 0, 0, 56, 0, 0,
|
||||
10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
|
||||
0, 0, 2, 64, 0, 0, 110, 167, 114, 63, 110, 167, 114, 63, 110,
|
||||
167, 114, 63, 0, 0, 0, 0, 47, 0, 0, 5, 114, 0, 16, 0,
|
||||
0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0,
|
||||
10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
|
||||
0, 0, 2, 64, 0, 0, 154, 153, 25, 64, 154, 153, 25, 64, 154,
|
||||
153, 25, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0,
|
||||
0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 55, 0, 0,
|
||||
9, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 1, 0,
|
||||
0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0,
|
||||
0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
|
||||
58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
|
||||
84, 116, 0, 0, 0, 31, 0, 0, 0, 3, 0, 0, 0, 0, 0,
|
||||
0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 4, 0, 0, 0, 1,
|
||||
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 24, 0, 0,
|
||||
10, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
|
||||
0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0,
|
||||
0, 128, 63, 0, 0, 0, 0, 1, 0, 0, 7, 34, 0, 16, 0,
|
||||
1, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16,
|
||||
0, 1, 0, 0, 0, 1, 0, 0, 7, 34, 0, 16, 0, 1, 0,
|
||||
0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16, 0, 1,
|
||||
0, 0, 0, 60, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0,
|
||||
26, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 0, 1, 0, 0,
|
||||
0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154,
|
||||
153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9,
|
||||
66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0,
|
||||
0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0,
|
||||
128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26,
|
||||
0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0,
|
||||
0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0,
|
||||
0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 0, 0, 9, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0,
|
||||
70, 2, 16, 0, 0, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0,
|
||||
0, 29, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 2, 64,
|
||||
0, 0, 230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37, 61, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10,
|
||||
114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 2, 64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61, 145, 131,
|
||||
158, 61, 0, 0, 0, 0, 52, 0, 0, 10, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 2, 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, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 2,
|
||||
0, 0, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 174, 71, 97, 61, 174,
|
||||
71, 97, 61, 174, 71, 97, 61, 0, 0, 0, 0, 56, 0, 0, 10,
|
||||
114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 2, 64, 0, 0, 110, 167, 114, 63, 110, 167, 114, 63, 110, 167,
|
||||
114, 63, 0, 0, 0, 0, 47, 0, 0, 5, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10,
|
||||
114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
|
||||
0, 2, 64, 0, 0, 154, 153, 25, 64, 154, 153, 25, 64, 154, 153,
|
||||
25, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
|
||||
114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0,
|
||||
0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0, 0,
|
||||
0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 58,
|
||||
0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84,
|
||||
116, 0, 0, 0, 36, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 17, 0, 0, 0, 4, 0, 0, 0, 4, 0,
|
||||
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 2, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
};
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
static unsigned char gs_shaderData[] = {
|
||||
68, 88, 66, 67, 108, 52, 221, 105, 109, 174, 81, 46, 155, 29, 71,
|
||||
86, 93, 178, 121, 166, 1, 0, 0, 0, 84, 7, 0, 0, 5, 0,
|
||||
68, 88, 66, 67, 57, 37, 253, 18, 22, 100, 108, 128, 58, 208, 65,
|
||||
95, 40, 243, 207, 218, 1, 0, 0, 0, 208, 7, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0, 124, 2, 0, 0, 212, 2, 0, 0, 8,
|
||||
3, 0, 0, 216, 6, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
|
||||
3, 0, 0, 84, 7, 0, 0, 82, 68, 69, 70, 64, 2, 0, 0,
|
||||
1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
|
||||
0, 0, 4, 255, 255, 0, 137, 0, 0, 24, 2, 0, 0, 92, 0,
|
||||
0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255,
|
||||
@@ -51,7 +51,7 @@ static unsigned char gs_shaderData[] = {
|
||||
0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83,
|
||||
86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82,
|
||||
200, 3, 0, 0, 64, 0, 0, 0, 242, 0, 0, 0, 89, 0, 0,
|
||||
68, 4, 0, 0, 64, 0, 0, 0, 17, 1, 0, 0, 89, 0, 0,
|
||||
4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 88, 24,
|
||||
0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98,
|
||||
16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3,
|
||||
@@ -85,46 +85,54 @@ static unsigned char gs_shaderData[] = {
|
||||
0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63,
|
||||
29, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0,
|
||||
0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 13, 0,
|
||||
4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 57, 0, 0, 8, 18,
|
||||
4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 24, 0, 0, 8, 18,
|
||||
0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 16, 0, 0,
|
||||
10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0,
|
||||
0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154, 153, 25, 63, 205,
|
||||
204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9, 66, 0, 16, 0,
|
||||
1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0, 0, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 56, 0,
|
||||
0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16, 0, 1,
|
||||
0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0,
|
||||
50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
|
||||
0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0, 0, 0, 86, 5,
|
||||
16, 0, 1, 0, 0, 0, 55, 32, 0, 9, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0,
|
||||
1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 47, 0, 0,
|
||||
5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
|
||||
0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70,
|
||||
2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 102, 102, 230, 63,
|
||||
102, 102, 230, 63, 102, 102, 230, 63, 0, 0, 0, 0, 25, 0, 0,
|
||||
5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
|
||||
0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 86,
|
||||
5, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 150, 246, 160, 189,
|
||||
43, 199, 117, 63, 40, 177, 243, 60, 0, 0, 0, 0, 50, 0, 0,
|
||||
12, 114, 0, 16, 0, 1, 0, 0, 0, 6, 0, 16, 0, 0, 0,
|
||||
0, 0, 2, 64, 0, 0, 87, 203, 136, 63, 86, 131, 197, 60, 225,
|
||||
104, 227, 58, 0, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0,
|
||||
50, 32, 0, 12, 114, 32, 16, 0, 0, 0, 0, 0, 166, 10, 16,
|
||||
0, 0, 0, 0, 0, 2, 64, 0, 0, 5, 9, 34, 60, 158, 151,
|
||||
129, 60, 194, 240, 119, 63, 0, 0, 0, 0, 70, 2, 16, 0, 1,
|
||||
0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
|
||||
58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
|
||||
84, 116, 0, 0, 0, 29, 0, 0, 0, 2, 0, 0, 0, 0, 0,
|
||||
0, 0, 2, 0, 0, 0, 14, 0, 0, 0, 4, 0, 0, 0, 1,
|
||||
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 24, 0, 0,
|
||||
10, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
|
||||
0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0,
|
||||
0, 128, 63, 0, 0, 0, 0, 1, 0, 0, 7, 34, 0, 16, 0,
|
||||
1, 0, 0, 0, 42, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16,
|
||||
0, 1, 0, 0, 0, 1, 0, 0, 7, 34, 0, 16, 0, 1, 0,
|
||||
0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 26, 0, 16, 0, 1,
|
||||
0, 0, 0, 60, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0,
|
||||
26, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 0, 1, 0, 0,
|
||||
0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153, 62, 154,
|
||||
153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0, 0, 9,
|
||||
66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65, 0, 0,
|
||||
0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0, 0,
|
||||
128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0, 0, 26,
|
||||
0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1, 0, 0,
|
||||
0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 1, 0,
|
||||
0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 32, 0, 9, 114,
|
||||
0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0,
|
||||
70, 2, 16, 0, 0, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0,
|
||||
0, 47, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0,
|
||||
0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
|
||||
102, 102, 230, 63, 102, 102, 230, 63, 102, 102, 230, 63, 0, 0, 0,
|
||||
0, 25, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 1,
|
||||
0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
|
||||
150, 246, 160, 189, 43, 199, 117, 63, 40, 177, 243, 60, 0, 0, 0,
|
||||
0, 50, 0, 0, 12, 114, 0, 16, 0, 1, 0, 0, 0, 6, 0,
|
||||
16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 87, 203, 136, 63, 86,
|
||||
131, 197, 60, 225, 104, 227, 58, 0, 0, 0, 0, 70, 2, 16, 0,
|
||||
1, 0, 0, 0, 50, 32, 0, 12, 114, 32, 16, 0, 0, 0, 0,
|
||||
0, 166, 10, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 5, 9,
|
||||
34, 60, 158, 151, 129, 60, 194, 240, 119, 63, 0, 0, 0, 0, 70,
|
||||
2, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
|
||||
0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0,
|
||||
1, 83, 84, 65, 84, 116, 0, 0, 0, 33, 0, 0, 0, 2, 0,
|
||||
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 4,
|
||||
0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 2,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3,
|
||||
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
#include "PLApplication.h"
|
||||
#include "PLArrayView.h"
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLButtonWidget.h"
|
||||
@@ -471,7 +472,7 @@ namespace PortabilityLayer
|
||||
Rect2i windowFullRect = WindowManager::GetInstance()->GetWindowFullRect(window);
|
||||
if (!windowFullRect.Contains(Vec2i(mouseEvent.m_x, mouseEvent.m_y)))
|
||||
{
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
SysBeep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -834,7 +835,7 @@ namespace PortabilityLayer
|
||||
// If sound index is 0, play no sound
|
||||
|
||||
if (soundIndexes[0] != 0)
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
SysBeep(1);
|
||||
|
||||
const Rect dialogRect = alertResData.m_rect.ToRect();
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "WindowDef.h"
|
||||
#include "MacRomanConversion.h"
|
||||
|
||||
#include "PLApplication.h"
|
||||
#include "PLArrayView.h"
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "PLCore.h"
|
||||
@@ -40,13 +41,15 @@ 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 kOpenDeleteButton = 5;
|
||||
static const int kSaveDeleteButton = 7;
|
||||
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 kFileBrowserUISaveDialogWithDeleteButtonTemplateID = 2009;
|
||||
|
||||
|
||||
static const int kOverwriteNoButton = 1;
|
||||
@@ -57,7 +60,7 @@ namespace PortabilityLayer
|
||||
class FileBrowserUIImpl
|
||||
{
|
||||
public:
|
||||
explicit FileBrowserUIImpl(const FileBrowserUI_DetailsCallbackAPI &callbackAPI);
|
||||
FileBrowserUIImpl(VirtualDirectory_t dir, const FileBrowserUI_DetailsCallbackAPI &callbackAPI);
|
||||
~FileBrowserUIImpl();
|
||||
|
||||
static void PubScrollBarCallback(void *captureContext, Widget *control, int part);
|
||||
@@ -111,6 +114,8 @@ namespace PortabilityLayer
|
||||
uint32_t m_doubleClickTime;
|
||||
bool m_haveFirstClick;
|
||||
|
||||
VirtualDirectory_t m_dir;
|
||||
|
||||
const FileBrowserUI_DetailsCallbackAPI m_api;
|
||||
};
|
||||
}
|
||||
@@ -128,7 +133,7 @@ static int16_t FileBrowserUIImpl_PopUpAlertUIFilter(void *context, Dialog *dialo
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
FileBrowserUIImpl::FileBrowserUIImpl(const FileBrowserUI_DetailsCallbackAPI &callbackAPI)
|
||||
FileBrowserUIImpl::FileBrowserUIImpl(VirtualDirectory_t dir, const FileBrowserUI_DetailsCallbackAPI &callbackAPI)
|
||||
: m_offset(0)
|
||||
, m_surface(nullptr)
|
||||
, m_window(nullptr)
|
||||
@@ -142,6 +147,7 @@ namespace PortabilityLayer
|
||||
, m_doubleClickTime(0)
|
||||
, m_haveFirstClick(false)
|
||||
, m_api(callbackAPI)
|
||||
, m_dir(dir)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -151,7 +157,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
FileEntry *entries = *m_entries;
|
||||
for (size_t i = 0; i < m_numEntries; i++)
|
||||
m_api.m_freeFileDetailsCallback(entries[i].m_fileDetails);
|
||||
m_api.m_freeFileDetailsCallback(m_api.m_context, entries[i].m_fileDetails);
|
||||
}
|
||||
m_entries.Dispose();
|
||||
}
|
||||
@@ -207,7 +213,7 @@ namespace PortabilityLayer
|
||||
ResolveCachingColor blackColor = StdColors::Black();
|
||||
|
||||
const Point basePoint = Point::Create(16, 16 + font->GetMetrics().m_ascent);
|
||||
m_api.m_drawLabelsCallback(m_surface, basePoint);
|
||||
m_api.m_drawLabelsCallback(m_api.m_context, m_surface, basePoint);
|
||||
}
|
||||
|
||||
void FileBrowserUIImpl::DrawFileList()
|
||||
@@ -243,7 +249,7 @@ namespace PortabilityLayer
|
||||
Point itemStringPoint = Point::Create(itemRect.left + 2, itemRect.top + glyphOffset);
|
||||
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);
|
||||
m_api.m_drawFileDetailsCallback(m_api.m_context, m_surface, itemStringPoint, m_rect, (*m_entries)[i].m_fileDetails);
|
||||
|
||||
itemRect.top += spacing;
|
||||
itemRect.bottom += spacing;
|
||||
@@ -294,11 +300,10 @@ namespace PortabilityLayer
|
||||
if (m_selectedIndex < 0)
|
||||
return;
|
||||
|
||||
|
||||
FileEntry *entries = *m_entries;
|
||||
|
||||
FileEntry &removedEntry = entries[m_selectedIndex];
|
||||
m_api.m_freeFileDetailsCallback(removedEntry.m_fileDetails);
|
||||
m_api.m_freeFileDetailsCallback(m_api.m_context, removedEntry.m_fileDetails);
|
||||
|
||||
for (size_t i = m_selectedIndex; i < m_numEntries - 1; i++)
|
||||
entries[i] = entries[i + 1];
|
||||
@@ -439,8 +444,19 @@ namespace PortabilityLayer
|
||||
|
||||
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetEnabled(selection >= 0);
|
||||
|
||||
bool isDeleteValid = (selection >= 0);
|
||||
|
||||
if (isDeleteValid)
|
||||
{
|
||||
const FileBrowserUIImpl::FileEntry &entry = (*m_entries)[selection];
|
||||
isDeleteValid = m_api.m_isDeleteValidCallback(m_api.m_context, m_dir, entry.m_nameStr.ToShortStr());
|
||||
}
|
||||
|
||||
if (gs_currentFileBrowserUIMode == FileBrowserUI::Mode_Open)
|
||||
dialog->GetItems()[kDeleteButton - 1].GetWidget()->SetEnabled(selection >= 0);
|
||||
dialog->GetItems()[kOpenDeleteButton - 1].GetWidget()->SetEnabled(isDeleteValid);
|
||||
else if (gs_currentFileBrowserUIMode == FileBrowserUI::Mode_SaveWithDelete)
|
||||
dialog->GetItems()[kSaveDeleteButton - 1].GetWidget()->SetEnabled(isDeleteValid);
|
||||
|
||||
|
||||
DrawFileList();
|
||||
}
|
||||
@@ -585,24 +601,30 @@ namespace PortabilityLayer
|
||||
int windowHeight = 272;
|
||||
if (mode == Mode_Open)
|
||||
dialogID = kFileBrowserUIOpenDialogTemplateID;
|
||||
else if (mode == Mode_Save)
|
||||
else if (mode == Mode_SaveWithDelete || mode == Mode_SaveNoDelete)
|
||||
{
|
||||
if (PLDrivers::GetSystemServices()->IsTextInputObstructive())
|
||||
{
|
||||
dialogID = kFileBrowserUISaveDialogUnobstructiveTemplateID;
|
||||
windowHeight = 208;
|
||||
isObstructive = true;
|
||||
mode = Mode_SaveNoDelete; // HACK HACK HACK
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mode == Mode_SaveWithDelete)
|
||||
dialogID = kFileBrowserUISaveDialogWithDeleteButtonTemplateID;
|
||||
else
|
||||
dialogID = kFileBrowserUISaveDialogTemplateID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
FileBrowserUIImpl uiImpl(callbackAPI);
|
||||
FileBrowserUIImpl uiImpl(dirID, callbackAPI);
|
||||
|
||||
// Enumerate files
|
||||
IGpFileSystem *fs = PLDrivers::GetFileSystem();
|
||||
@@ -624,10 +646,10 @@ namespace PortabilityLayer
|
||||
if (!memcmp(nameExt, extension, extensionLength))
|
||||
{
|
||||
PLPasStr fnamePStr = PLPasStr(nameLength - extensionLength, fileName);
|
||||
if (!callbackAPI.m_filterFileCallback(dirID, fnamePStr))
|
||||
if (!callbackAPI.m_filterFileCallback(callbackAPI.m_context, dirID, fnamePStr))
|
||||
continue;
|
||||
|
||||
if (!uiImpl.AppendName(fileName, nameLength - extensionLength, callbackAPI.m_loadFileDetailsCallback(dirID, fnamePStr)))
|
||||
if (!uiImpl.AppendName(fileName, nameLength - extensionLength, callbackAPI.m_loadFileDetailsCallback(callbackAPI.m_context, dirID, fnamePStr)))
|
||||
{
|
||||
dirCursor->Destroy();
|
||||
return false;
|
||||
@@ -674,7 +696,7 @@ namespace PortabilityLayer
|
||||
const Rect scrollBarRect = dialog->GetItems()[kFileListScrollBar - 1].GetWidget()->GetRect();
|
||||
|
||||
EditboxWidget *editbox = nullptr;
|
||||
if (mode == Mode_Save)
|
||||
if (mode == Mode_SaveWithDelete || mode == Mode_SaveNoDelete)
|
||||
{
|
||||
editbox = static_cast<EditboxWidget*>(dialog->GetItems()[kFileNameEditBox - 1].GetWidget());
|
||||
editbox->SetCharacterFilter(&uiImpl, FileBrowserUIImpl::PubEditBoxCharFilter);
|
||||
@@ -725,7 +747,7 @@ namespace PortabilityLayer
|
||||
if (hit == kFileListScrollBar)
|
||||
uiImpl.SetScrollOffset(scrollBar->GetState());
|
||||
|
||||
if (hit == kOkayButton && mode == Mode_Save)
|
||||
if (hit == kOkayButton && (mode == Mode_SaveWithDelete || mode == Mode_SaveNoDelete))
|
||||
{
|
||||
IGpFileSystem *fs = PLDrivers::GetFileSystem();
|
||||
|
||||
@@ -734,7 +756,7 @@ namespace PortabilityLayer
|
||||
PLPasStr nameStr = editBox->GetString();
|
||||
if (nameStr.Length() == 0 || !fs->ValidateFilePath(nameStr.Chars(), nameStr.Length()))
|
||||
{
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
SysBeep(1);
|
||||
FileBrowserUIImpl::PopUpAlert(Rect::Create(0, 0, 135, 327), kFileBrowserUIBadNameDialogTemplateID, nullptr);
|
||||
hit = -1;
|
||||
}
|
||||
@@ -750,7 +772,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
DialogTextSubstitutions substitutions(nameStr);
|
||||
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
SysBeep(1);
|
||||
int16_t subHit = FileBrowserUIImpl::PopUpAlert(Rect::Create(0, 0, 135, 327), kFileBrowserUIOverwriteDialogTemplateID, &substitutions);
|
||||
|
||||
if (subHit == kOverwriteNoButton)
|
||||
@@ -759,23 +781,32 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == Mode_Open && hit == kDeleteButton)
|
||||
if ((mode == Mode_Open && hit == kOpenDeleteButton) || (mode == Mode_SaveWithDelete && hit == kSaveDeleteButton))
|
||||
{
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
SysBeep(1);
|
||||
int16_t subHit = FileBrowserUIImpl::PopUpAlert(Rect::Create(0, 0, 135, 327), kFileBrowserUIDeleteDialogTemplateID, &substitutions);
|
||||
|
||||
if (subHit == kOverwriteYesButton)
|
||||
{
|
||||
PLPasStr uiFileName = uiImpl.GetSelectedFileName();
|
||||
|
||||
bool deleted = false;
|
||||
if (composites)
|
||||
PortabilityLayer::FileManager::GetInstance()->DeleteCompositeFile(dirID, uiFileName);
|
||||
deleted = PortabilityLayer::FileManager::GetInstance()->DeleteCompositeFile(dirID, uiFileName);
|
||||
else
|
||||
PortabilityLayer::FileManager::GetInstance()->DeleteNonCompositeFile(dirID, uiFileName, extension);
|
||||
deleted = PortabilityLayer::FileManager::GetInstance()->DeleteNonCompositeFile(dirID, uiFileName, extension);
|
||||
|
||||
if (deleted)
|
||||
{
|
||||
callbackAPI.m_onDeletedCallback(callbackAPI.m_context, dirID, uiFileName);
|
||||
|
||||
uiImpl.RemoveSelectedFile();
|
||||
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetEnabled(false);
|
||||
dialog->GetItems()[kDeleteButton - 1].GetWidget()->SetEnabled(false);
|
||||
if (mode == Mode_Open)
|
||||
dialog->GetItems()[kOpenDeleteButton - 1].GetWidget()->SetEnabled(false);
|
||||
else if (mode == Mode_SaveWithDelete)
|
||||
dialog->GetItems()[kSaveDeleteButton - 1].GetWidget()->SetEnabled(false);
|
||||
}
|
||||
}
|
||||
hit = -1;
|
||||
}
|
||||
@@ -793,7 +824,7 @@ namespace PortabilityLayer
|
||||
uiFileName = uiImpl.GetSelectedFileName();
|
||||
confirmed = true;
|
||||
}
|
||||
else if (mode == Mode_Save)
|
||||
else if (mode == Mode_SaveWithDelete || mode == Mode_SaveNoDelete)
|
||||
{
|
||||
uiFileName = editbox->GetString();
|
||||
confirmed = true;
|
||||
|
||||
@@ -16,12 +16,16 @@ namespace PortabilityLayer
|
||||
|
||||
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_context;
|
||||
|
||||
void *(*m_loadFileDetailsCallback)(VirtualDirectory_t dirID, const PLPasStr &filename);
|
||||
void(*m_freeFileDetailsCallback)(void *fileDetails);
|
||||
bool(*m_filterFileCallback)(VirtualDirectory_t dirID, const PLPasStr &filename);
|
||||
void (*m_drawLabelsCallback)(void *context, DrawSurface *surface, const Point &basePoint);
|
||||
void (*m_drawFileDetailsCallback)(void *context, DrawSurface *surface, const Point &basePoint, const Rect &constraintRect, void *fileDetails);
|
||||
|
||||
void *(*m_loadFileDetailsCallback)(void *context, VirtualDirectory_t dirID, const PLPasStr &filename);
|
||||
void (*m_freeFileDetailsCallback)(void *context, void *fileDetails);
|
||||
bool (*m_filterFileCallback)(void *context, VirtualDirectory_t dirID, const PLPasStr &filename);
|
||||
bool (*m_isDeleteValidCallback)(void *context, VirtualDirectory_t dirID, const PLPasStr &filename);
|
||||
void (*m_onDeletedCallback)(void *context, VirtualDirectory_t dirID, const PLPasStr &filename);
|
||||
};
|
||||
|
||||
class FileBrowserUI
|
||||
@@ -30,7 +34,8 @@ namespace PortabilityLayer
|
||||
|
||||
enum Mode
|
||||
{
|
||||
Mode_Save,
|
||||
Mode_SaveNoDelete,
|
||||
Mode_SaveWithDelete,
|
||||
Mode_Open,
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "PLErrorCodes.h"
|
||||
#include "PLSysCalls.h"
|
||||
|
||||
#include <vector>
|
||||
#include <new>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
@@ -282,7 +282,11 @@ namespace PortabilityLayer
|
||||
if (!FileManagerTools::ConstructFilename(extFN, initialFileName, ""))
|
||||
return false;
|
||||
|
||||
return FileBrowserUI::Prompt(FileBrowserUI::Mode_Save, dirID, extension, path, outPathLength, pathCapacity, initialFileName, promptText, composites, detailsAPI);
|
||||
FileBrowserUI::Mode mode = FileBrowserUI::Mode_SaveNoDelete;
|
||||
if (!PLDrivers::GetSystemServices()->HasNativeFileManager())
|
||||
mode = FileBrowserUI::Mode_SaveWithDelete;
|
||||
|
||||
return FileBrowserUI::Prompt(mode, dirID, extension, path, outPathLength, pathCapacity, initialFileName, promptText, composites, detailsAPI);
|
||||
}
|
||||
|
||||
bool FileManagerImpl::PromptOpenFile(VirtualDirectory_t dirID, const char *extension, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &promptText, bool composites, const FileBrowserUI_DetailsCallbackAPI &detailsAPI)
|
||||
|
||||
@@ -91,9 +91,8 @@ namespace PortabilityLayer
|
||||
return output;
|
||||
}
|
||||
|
||||
bool GpArcResourceTypeTag::Load(const char *str)
|
||||
bool GpArcResourceTypeTag::Load(const char *str, size_t l)
|
||||
{
|
||||
size_t l = strlen(str);
|
||||
if (l < sizeof(m_id))
|
||||
{
|
||||
memcpy(m_id, str, l);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class ResTypeID;
|
||||
@@ -10,7 +12,7 @@ namespace PortabilityLayer
|
||||
|
||||
static GpArcResourceTypeTag Encode(const ResTypeID &tag);
|
||||
|
||||
bool Load(const char *str);
|
||||
bool Load(const char *str, size_t strLen);
|
||||
bool Decode(ResTypeID &outTag);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,13 +40,9 @@ namespace
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
void MacBinary2::WriteBin(const MacFileMem *file, GpIOStream *stream)
|
||||
void MacBinary2::SerializeHeader(unsigned char *mb2Header, const MacFileInfo &fileInfo)
|
||||
{
|
||||
const MacFileInfo &fileInfo = file->FileInfo();
|
||||
|
||||
uint8_t mb2Header[128];
|
||||
|
||||
memset(mb2Header, 0, sizeof(mb2Header));
|
||||
memset(mb2Header, 0, kHeaderSize);
|
||||
|
||||
mb2Header[MB2FileOffsets::Version] = 0;
|
||||
|
||||
@@ -87,7 +83,15 @@ namespace PortabilityLayer
|
||||
mb2Header[MB2FileOffsets::MinVersion] = 129;
|
||||
|
||||
BytePack::BigUInt16(mb2Header + MB2FileOffsets::Checksum, XModemCRC(mb2Header, 124, 0));
|
||||
}
|
||||
|
||||
void MacBinary2::WriteBin(const MacFileMem *file, GpIOStream *stream)
|
||||
{
|
||||
const MacFileInfo &fileInfo = file->FileInfo();
|
||||
|
||||
uint8_t mb2Header[128];
|
||||
|
||||
SerializeHeader(mb2Header, fileInfo);
|
||||
stream->Write(mb2Header, 128);
|
||||
|
||||
uint8_t *padding = mb2Header;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __PL_MACBINARY2_H__
|
||||
#define __PL_MACBINARY2_H__
|
||||
|
||||
class GpIOStream;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class MacFileMem;
|
||||
struct MacFileInfo;
|
||||
|
||||
namespace MacBinary2
|
||||
{
|
||||
static const int kHeaderSize = 128;
|
||||
|
||||
void SerializeHeader(unsigned char *headerBytes, const MacFileInfo &macFileInfo);
|
||||
|
||||
void WriteBin(const MacFileMem *file, GpIOStream *stream);
|
||||
MacFileMem *ReadBin(GpIOStream *stream);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace PortabilityLayer
|
||||
if (newSize != hdl->m_size)
|
||||
{
|
||||
void *newBuf = Realloc(hdl->m_contents, newSize);
|
||||
if (!newBuf)
|
||||
if (!newBuf && newSize != 0)
|
||||
return false;
|
||||
|
||||
hdl->m_contents = newBuf;
|
||||
|
||||
@@ -128,6 +128,7 @@ namespace PortabilityLayer
|
||||
virtual void Init() override;
|
||||
virtual void Shutdown() override;
|
||||
|
||||
THandle<Menu> CreateMenu(const PLPasStr &title, uint16_t menuID, bool enabled, uint16_t width, uint16_t height, uint16_t commandID) const override;
|
||||
THandle<Menu> DeserializeMenu(const void *resData) const override;
|
||||
THandle<Menu> GetMenuByID(int id) const override;
|
||||
|
||||
@@ -294,6 +295,60 @@ namespace PortabilityLayer
|
||||
// GP TODO: Dispose of menus properly
|
||||
}
|
||||
|
||||
THandle<Menu> MenuManagerImpl::CreateMenu(const PLPasStr &title, uint16_t menuID, bool enabled, uint16_t width, uint16_t height, uint16_t commandID) const
|
||||
{
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
|
||||
const uint8_t titleLength = title.Length();
|
||||
|
||||
size_t stringDataLength = 1 + titleLength;
|
||||
size_t numMenuItems = 0;
|
||||
|
||||
MMHandleBlock *stringData = mm->AllocHandle(stringDataLength);
|
||||
if (!stringData)
|
||||
{
|
||||
mm->ReleaseHandle(stringData);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MMHandleBlock *menuData = mm->AllocHandle(sizeof(Menu) + sizeof(MenuItem) * (numMenuItems - 1));
|
||||
if (!menuData)
|
||||
{
|
||||
mm->ReleaseHandle(stringData);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Menu *menu = static_cast<Menu*>(menuData->m_contents);
|
||||
menu->menuID = menuID;
|
||||
menu->width = width;
|
||||
menu->height = height;
|
||||
menu->commandID = commandID;
|
||||
menu->enabled = true;
|
||||
menu->menuIndex = 0;
|
||||
menu->cumulativeOffset = 0;
|
||||
menu->unpaddedTitleWidth = 0;
|
||||
menu->isIcon = false;
|
||||
menu->haveMenuLayout = false;
|
||||
|
||||
uint8_t *stringDataStart = static_cast<uint8_t*>(stringData->m_contents);
|
||||
uint8_t *stringDest = stringDataStart;
|
||||
stringDest[0] = title.Length();
|
||||
memcpy(stringDest + 1, title.UChars(), title.Length());
|
||||
|
||||
menu->numMenuItems = numMenuItems;
|
||||
menu->stringBlobHandle = stringData;
|
||||
menu->prevMenu = nullptr;
|
||||
menu->nextMenu = nullptr;
|
||||
menu->layoutHintHorizontalOffset = 0;
|
||||
menu->layoutWidth = 0;
|
||||
menu->layoutBaseHeight = 0;
|
||||
menu->layoutFinalHeight = 0;
|
||||
menu->bottomItemsTruncated = 0;
|
||||
menu->topItemsTruncated = 0;
|
||||
|
||||
return THandle<Menu>(menuData);
|
||||
}
|
||||
|
||||
THandle<Menu> MenuManagerImpl::DeserializeMenu(const void *resData) const
|
||||
{
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace PortabilityLayer
|
||||
virtual void Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual THandle<Menu> CreateMenu(const PLPasStr &title, uint16_t menuID, bool enabled, uint16_t width, uint16_t height, uint16_t commandID) const = 0;
|
||||
virtual THandle<Menu> DeserializeMenu(const void *resData) const = 0;
|
||||
virtual THandle<Menu> GetMenuByID(int id) const = 0;
|
||||
|
||||
|
||||
@@ -18,9 +18,18 @@ namespace PortabilityLayer
|
||||
memcpy(dest + 1, src, sz);
|
||||
}
|
||||
}
|
||||
|
||||
static BeepFunction_t gs_beepFunction = nullptr;
|
||||
}
|
||||
|
||||
void SysBeep(int duration)
|
||||
{
|
||||
PLDrivers::GetSystemServices()->Beep();
|
||||
if (!PLDrivers::GetSystemServices()->Beep())
|
||||
if (PortabilityLayer::gs_beepFunction != nullptr)
|
||||
PortabilityLayer::gs_beepFunction(duration);
|
||||
}
|
||||
|
||||
void SetBeepFunction(BeepFunction_t beepFunction)
|
||||
{
|
||||
PortabilityLayer::gs_beepFunction = beepFunction;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@ void PasStringCopy(const PortabilityLayer::PascalStrLiteral<TSize> &src, unsigne
|
||||
|
||||
void SysBeep(int duration);
|
||||
|
||||
typedef void (*BeepFunction_t)(int duration);
|
||||
void SetBeepFunction(BeepFunction_t beepFunction);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "PascalStrLiteral.h"
|
||||
|
||||
|
||||
@@ -886,14 +886,6 @@ ArrayView<PortabilityLayer::Widget*> Window::GetWidgets() const
|
||||
return ArrayView<PortabilityLayer::Widget*>(m_widgets, m_numWidgets);
|
||||
}
|
||||
|
||||
PortabilityLayer::Widget* Window::GetWidgetById() const
|
||||
{
|
||||
//for (size_t i = 0; i < m_numWidgets; i++)
|
||||
// m_widgets[i]->get
|
||||
//return ArrayView<PortabilityLayer::Widget*>(m_widgets, m_numWidgets);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Window::ReplaceWidget(PortabilityLayer::Widget *oldWidget, PortabilityLayer::Widget *newWidget)
|
||||
{
|
||||
for (size_t i = 0; i < m_numWidgets; i++)
|
||||
|
||||
@@ -106,7 +106,6 @@ struct Window
|
||||
|
||||
bool AddWidget(PortabilityLayer::Widget *widget);
|
||||
ArrayView<PortabilityLayer::Widget*> GetWidgets() const;
|
||||
PortabilityLayer::Widget *GetWidgetById() const;
|
||||
bool ReplaceWidget(PortabilityLayer::Widget *oldWidget, PortabilityLayer::Widget *newWidget);
|
||||
|
||||
void FocusWidget(PortabilityLayer::Widget *widget);
|
||||
|
||||
@@ -493,6 +493,71 @@ static void RedistributeError(int16_t *errorDiffusionNextRow, int16_t *errorDiff
|
||||
}
|
||||
}
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
bool FindBitSpan(uint32_t mask, int &outLowBit, int &outHighBit)
|
||||
{
|
||||
bool haveAnyBits = false;
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
if (mask & (1 << i))
|
||||
{
|
||||
if (!haveAnyBits)
|
||||
{
|
||||
haveAnyBits = true;
|
||||
outLowBit = i;
|
||||
}
|
||||
outHighBit = i;
|
||||
}
|
||||
}
|
||||
|
||||
return haveAnyBits;
|
||||
}
|
||||
|
||||
int DecodeMaskRShift1(uint32_t mask)
|
||||
{
|
||||
int lowBit, highBit;
|
||||
if (!FindBitSpan(mask, lowBit, highBit))
|
||||
return 0;
|
||||
|
||||
return lowBit;
|
||||
}
|
||||
|
||||
int DecodeMaskRShift2(uint32_t mask)
|
||||
{
|
||||
int lowBit, highBit;
|
||||
if (!FindBitSpan(mask, lowBit, highBit))
|
||||
return 0;
|
||||
|
||||
int numBits = highBit - lowBit + 1;
|
||||
|
||||
int expandedBits = numBits;
|
||||
while (expandedBits < 8)
|
||||
expandedBits += numBits;
|
||||
|
||||
return expandedBits - 8;
|
||||
}
|
||||
|
||||
int DecodeMaskMultiplier(uint32_t mask)
|
||||
{
|
||||
int lowBit, highBit;
|
||||
if (!FindBitSpan(mask, lowBit, highBit))
|
||||
return 0;
|
||||
|
||||
int numBits = highBit - lowBit + 1;
|
||||
|
||||
int expandedBits = numBits;
|
||||
int expansionFactor = 1;
|
||||
while (expandedBits < 8)
|
||||
{
|
||||
expandedBits += numBits;
|
||||
expansionFactor = (expansionFactor << numBits) | 1;
|
||||
}
|
||||
|
||||
return expansionFactor;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds, bool errorDiffusion)
|
||||
{
|
||||
if (!pictHdl)
|
||||
@@ -572,9 +637,9 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
memcpy(&fileHeader, bmpBytes, sizeof(fileHeader));
|
||||
memcpy(&infoHeader, bmpBytes + sizeof(fileHeader), sizeof(infoHeader));
|
||||
|
||||
const uint16_t bpp = infoHeader.m_bitsPerPixel;
|
||||
uint16_t bpp = infoHeader.m_bitsPerPixel;
|
||||
|
||||
if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24)
|
||||
if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32)
|
||||
return;
|
||||
|
||||
uint32_t numColors = infoHeader.m_numColors;
|
||||
@@ -584,6 +649,18 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
if (numColors == 0 && bpp <= 8)
|
||||
numColors = (1 << bpp);
|
||||
|
||||
LEUInt32_t masks[4];
|
||||
int maskRShift1[4];
|
||||
int maskRShift2[4];
|
||||
int maskMultiplier[4];
|
||||
bool haveMasks = false;
|
||||
if (infoHeader.m_thisStructureSize >= sizeof(PortabilityLayer::BitmapInfoHeader) + sizeof(uint32_t) * 4)
|
||||
{
|
||||
const uint8_t *masksLoc = bmpBytes + sizeof(fileHeader) + sizeof(PortabilityLayer::BitmapInfoHeader);
|
||||
memcpy(masks, masksLoc, 16);
|
||||
haveMasks = true;
|
||||
}
|
||||
|
||||
const uint8_t *ctabLoc = bmpBytes + sizeof(fileHeader) + infoHeader.m_thisStructureSize;
|
||||
|
||||
const size_t ctabSize = numColors * sizeof(PortabilityLayer::BitmapColorTableEntry);
|
||||
@@ -592,6 +669,57 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
if (ctabSize > availCTabBytes)
|
||||
return;
|
||||
|
||||
const uint32_t compressionCode = static_cast<uint32_t>(infoHeader.m_compression);
|
||||
if (bpp == 16)
|
||||
{
|
||||
if (compressionCode == 0)
|
||||
{
|
||||
haveMasks = true;
|
||||
masks[0] = (0x1f << 10);
|
||||
masks[1] = (0x1f << 5);
|
||||
masks[2] = (0x1f << 0);
|
||||
masks[3] = (1 << 15);
|
||||
}
|
||||
else if (compressionCode == 3)
|
||||
{
|
||||
if (!haveMasks)
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else if (bpp == 32)
|
||||
{
|
||||
if (compressionCode == 0)
|
||||
{
|
||||
haveMasks = true;
|
||||
masks[0] = (0xff << 16);
|
||||
masks[1] = (0xff << 8);
|
||||
masks[2] = (0xff << 0);
|
||||
masks[3] = (0xff << 24);
|
||||
}
|
||||
if (compressionCode == 3)
|
||||
{
|
||||
if (!haveMasks)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (compressionCode != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (haveMasks)
|
||||
{
|
||||
for (int mi = 0; mi < 4; mi++)
|
||||
{
|
||||
maskRShift1[mi] = PortabilityLayer::DecodeMaskRShift1(masks[mi]);
|
||||
maskRShift2[mi] = PortabilityLayer::DecodeMaskRShift2(masks[mi]);
|
||||
maskMultiplier[mi] = PortabilityLayer::DecodeMaskMultiplier(masks[mi]);
|
||||
}
|
||||
}
|
||||
|
||||
if (bpp <= 8)
|
||||
{
|
||||
// Perform palette mapping
|
||||
@@ -672,7 +800,7 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
int16_t *errorDiffusionNextRow = nullptr;
|
||||
int16_t *errorDiffusionCurrentRow = nullptr;
|
||||
|
||||
if ((bpp == 16 || bpp == 24) && errorDiffusion)
|
||||
if ((bpp == 16 || bpp == 24 || bpp == 32) && errorDiffusion)
|
||||
{
|
||||
errorDiffusionBuffer = static_cast<int16_t*>(memManager->Alloc(sizeof(int16_t) * numCopyCols * 2 * 3));
|
||||
if (!errorDiffusionBuffer)
|
||||
@@ -739,12 +867,13 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
const uint8_t srcLow = currentSourceRow[srcColIndex * 2 + 0];
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
const uint32_t combinedValue = srcLow | (srcHigh << 8);
|
||||
|
||||
if (r + g + b > 46)
|
||||
uint8_t rgb[3];
|
||||
for (unsigned int ch = 0; ch < 3; ch++)
|
||||
rgb[ch] = (((combinedValue & masks[ch]) >> maskRShift1[ch]) * maskMultiplier[ch]) >> maskRShift2[ch];
|
||||
|
||||
if (rgb[0] + rgb[1] + rgb[2] > 382)
|
||||
currentDestRow[destColIndex] = 0;
|
||||
else
|
||||
currentDestRow[destColIndex] = 1;
|
||||
@@ -763,15 +892,12 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
|
||||
const unsigned int xr = (r << 5) | (r >> 2);
|
||||
const unsigned int xg = (g << 5) | (g >> 2);
|
||||
const unsigned int xb = (b << 5) | (b >> 2);
|
||||
uint8_t rgb[3];
|
||||
for (unsigned int ch = 0; ch < 3; ch++)
|
||||
rgb[ch] = (((combinedValue & masks[ch]) >> maskRShift1[ch]) * maskMultiplier[ch]) >> maskRShift2[ch];
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(xr, xg, xb, 255));
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(rgb[0], rgb[1], rgb[2], 255));
|
||||
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
}
|
||||
@@ -787,15 +913,12 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
|
||||
const unsigned int xr = (r << 5) | (r >> 2);
|
||||
const unsigned int xg = (g << 5) | (g >> 2);
|
||||
const unsigned int xb = (b << 5) | (b >> 2);
|
||||
uint8_t rgb[3];
|
||||
for (unsigned int ch = 0; ch < 3; ch++)
|
||||
rgb[ch] = (((combinedValue & masks[ch]) >> maskRShift1[ch]) * maskMultiplier[ch]) >> maskRShift2[ch];
|
||||
|
||||
ErrorDiffusionWorkPixel wp = ApplyErrorDiffusion(errorDiffusionCurrentRow, xr, xg, xb, col, numCopyCols);
|
||||
ErrorDiffusionWorkPixel wp = ApplyErrorDiffusion(errorDiffusionCurrentRow, rgb[0], rgb[1], rgb[2], col, numCopyCols);
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(wp.m_8[0], wp.m_8[1], wp.m_8[2], 255));
|
||||
PortabilityLayer::RGBAColor resultColor = stdPalette->GetColors()[colorIndex];
|
||||
@@ -816,15 +939,11 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
const uint8_t srcLow = currentSourceRow[srcColIndex * 2 + 0];
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
const uint8_t r = currentSourceRow[srcColIndex * 3 + 2];
|
||||
const uint8_t g = currentSourceRow[srcColIndex * 3 + 1];
|
||||
const uint8_t b = currentSourceRow[srcColIndex * 3 + 0];
|
||||
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
|
||||
if (r + g + b > 46)
|
||||
if (r + g + b > 382)
|
||||
currentDestRow[destColIndex] = 0;
|
||||
else
|
||||
currentDestRow[destColIndex] = 1;
|
||||
@@ -867,6 +986,62 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bpp == 32)
|
||||
{
|
||||
if (destFormat == GpPixelFormats::kBW1)
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
const uint8_t r = currentSourceRow[srcColIndex * 4 + 2];
|
||||
const uint8_t g = currentSourceRow[srcColIndex * 4 + 1];
|
||||
const uint8_t b = currentSourceRow[srcColIndex * 4 + 0];
|
||||
|
||||
if (r + g + b > 382)
|
||||
currentDestRow[destColIndex] = 0;
|
||||
else
|
||||
currentDestRow[destColIndex] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!errorDiffusion)
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
const uint8_t r = currentSourceRow[srcColIndex * 4 + 2];
|
||||
const uint8_t g = currentSourceRow[srcColIndex * 4 + 1];
|
||||
const uint8_t b = currentSourceRow[srcColIndex * 4 + 0];
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(r, g, b, 255));
|
||||
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
ErrorDiffusionWorkPixel wp = ApplyErrorDiffusion(errorDiffusionCurrentRow, currentSourceRow[srcColIndex * 4 + 2], currentSourceRow[srcColIndex * 4 + 1], currentSourceRow[srcColIndex * 4 + 0], col, numCopyCols);
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(wp.m_8[0], wp.m_8[1], wp.m_8[2], 255));
|
||||
PortabilityLayer::RGBAColor resultColor = stdPalette->GetColors()[colorIndex];
|
||||
|
||||
RedistributeError(errorDiffusionNextRow, errorDiffusionCurrentRow, wp.m_16[0], wp.m_16[1], wp.m_16[2], resultColor.r, resultColor.g, resultColor.b, col, numCopyCols);
|
||||
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentSourceRow -= sourcePitch;
|
||||
currentDestRow += destPitch;
|
||||
@@ -907,7 +1082,7 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
const unsigned int srcIndex = (currentSourceRow[srcColIndex / 8] >> (8 - ((srcColIndex & 7) + 1))) & 0x01;
|
||||
currentDestRow32[destColIndex] = srcIndex ? blackColor32 : whiteColor32;
|
||||
currentDestRow32[destColIndex] = unpackedColors[srcIndex];
|
||||
}
|
||||
}
|
||||
else if (bpp == 4)
|
||||
@@ -943,17 +1118,10 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
|
||||
const unsigned int xr = (r << 5) | (r >> 2);
|
||||
const unsigned int xg = (g << 5) | (g >> 2);
|
||||
const unsigned int xb = (b << 5) | (b >> 2);
|
||||
for (unsigned int ch = 0; ch < 3; ch++)
|
||||
currentDestRowBytes[destColIndex * 4 + ch] = (((combinedValue & masks[ch]) >> maskRShift1[ch]) * maskMultiplier[ch]) >> maskRShift2[ch];
|
||||
|
||||
currentDestRowBytes[destColIndex * 4 + 0] = xr;
|
||||
currentDestRowBytes[destColIndex * 4 + 1] = xg;
|
||||
currentDestRowBytes[destColIndex * 4 + 2] = xb;
|
||||
currentDestRowBytes[destColIndex * 4 + 3] = 255;
|
||||
}
|
||||
}
|
||||
@@ -970,6 +1138,19 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds,
|
||||
currentDestRowBytes[destColIndex * 4 + 3] = 255;
|
||||
}
|
||||
}
|
||||
else if (bpp == 32)
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
currentDestRowBytes[destColIndex * 4 + 0] = currentSourceRow[srcColIndex * 4 + 2];
|
||||
currentDestRowBytes[destColIndex * 4 + 1] = currentSourceRow[srcColIndex * 4 + 1];
|
||||
currentDestRowBytes[destColIndex * 4 + 2] = currentSourceRow[srcColIndex * 4 + 0];
|
||||
currentDestRowBytes[destColIndex * 4 + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
currentSourceRow -= sourcePitch;
|
||||
currentDestRowBytes += destPitch;
|
||||
|
||||
@@ -40,6 +40,61 @@ static const char *kPICTExtension = ".bmp";
|
||||
|
||||
typedef ResourceValidationRules::ResourceValidationRule ResourceValidationRule_t;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class ResourceArchiveZipFileIterator : public IResourceIterator
|
||||
{
|
||||
public:
|
||||
explicit ResourceArchiveZipFileIterator(PortabilityLayer::ZipFileProxy *proxy);
|
||||
|
||||
void Destroy() override;
|
||||
bool GetOne(ResTypeID &resTypeID, int16_t &outID) override;
|
||||
|
||||
private:
|
||||
~ResourceArchiveZipFileIterator();
|
||||
|
||||
PortabilityLayer::ZipFileProxy *m_proxy;
|
||||
size_t m_numFiles;
|
||||
size_t m_currentIndex;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
PortabilityLayer::ResourceArchiveZipFileIterator::ResourceArchiveZipFileIterator(PortabilityLayer::ZipFileProxy *proxy)
|
||||
: m_proxy(proxy)
|
||||
, m_numFiles(proxy->NumFiles())
|
||||
, m_currentIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
void PortabilityLayer::ResourceArchiveZipFileIterator::Destroy()
|
||||
{
|
||||
this->~ResourceArchiveZipFileIterator();
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Release(this);
|
||||
}
|
||||
|
||||
bool PortabilityLayer::ResourceArchiveZipFileIterator::GetOne(ResTypeID &resTypeID, int16_t &outID)
|
||||
{
|
||||
while (m_currentIndex != m_numFiles)
|
||||
{
|
||||
const size_t index = m_currentIndex++;
|
||||
|
||||
const char *name = nullptr;
|
||||
size_t nameLength = 0;
|
||||
m_proxy->GetFileName(index, name, nameLength);
|
||||
|
||||
const bool isParseable = ResourceArchiveZipFile::ParseResFromName(name, nameLength, resTypeID, outID);
|
||||
if (isParseable)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
PortabilityLayer::ResourceArchiveZipFileIterator::~ResourceArchiveZipFileIterator()
|
||||
{
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// Validation here is only intended to be minimal, to ensure later checks can determine the format size and do certain operations
|
||||
@@ -433,6 +488,93 @@ namespace PortabilityLayer
|
||||
return haveAny;
|
||||
}
|
||||
|
||||
IResourceIterator *ResourceArchiveZipFile::EnumerateResources() const
|
||||
{
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
void *storage = mm->Alloc(sizeof(ResourceArchiveZipFileIterator));
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
return new (storage) ResourceArchiveZipFileIterator(m_zipFileProxy);
|
||||
}
|
||||
|
||||
bool ResourceArchiveZipFile::ParseResFromName(const char *name, size_t nameLength, ResTypeID &outResTypeID, int16_t &outID)
|
||||
{
|
||||
size_t slashPos = nameLength;
|
||||
for (size_t i = 0; i < nameLength; i++)
|
||||
{
|
||||
if (name[i] == '/')
|
||||
{
|
||||
slashPos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (slashPos == nameLength)
|
||||
return false;
|
||||
|
||||
GpArcResourceTypeTag resTag;
|
||||
if (!resTag.Load(name, slashPos))
|
||||
return false;
|
||||
|
||||
if (!resTag.Decode(outResTypeID))
|
||||
return false;
|
||||
|
||||
int validationRule = 0;
|
||||
const char *expectedExtension = GetFileExtensionForResType(outResTypeID, validationRule);
|
||||
|
||||
const size_t idStart = slashPos + 1;
|
||||
if (idStart == nameLength)
|
||||
return false;
|
||||
|
||||
bool isNegative = false;
|
||||
size_t digitsStart = idStart;
|
||||
|
||||
if (name[idStart] == '-')
|
||||
{
|
||||
isNegative = true;
|
||||
digitsStart++;
|
||||
}
|
||||
|
||||
size_t digitsEnd = nameLength;
|
||||
int32_t resID = 0;
|
||||
for (size_t i = digitsStart; i < nameLength; i++)
|
||||
{
|
||||
if (name[i] == '.')
|
||||
{
|
||||
digitsEnd = i;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
char digit = name[i];
|
||||
if (digit < '0' || digit > '9')
|
||||
return false;
|
||||
|
||||
int32_t digitNumber = static_cast<int32_t>(digit) - '0';
|
||||
resID *= 10;
|
||||
if (isNegative)
|
||||
resID -= digitNumber;
|
||||
else
|
||||
resID += digitNumber;
|
||||
|
||||
if (resID < -32768 || resID > 32767)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
outID = static_cast<int16_t>(resID);
|
||||
|
||||
const size_t extAvailable = nameLength - digitsEnd;
|
||||
if (strlen(expectedExtension) != extAvailable)
|
||||
return false;
|
||||
|
||||
if (memcmp(name + digitsEnd, expectedExtension, extAvailable) != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResourceArchiveZipFile::IndexResource(const ResTypeID &resTypeID, int id, size_t &outIndex, int &outValidationRule) const
|
||||
{
|
||||
const char *extension = GetFileExtensionForResType(resTypeID, outValidationRule);
|
||||
@@ -461,6 +603,11 @@ namespace PortabilityLayer
|
||||
handle = ref->m_handle;
|
||||
else
|
||||
{
|
||||
const size_t resSize = m_zipFileProxy->GetFileSize(index);
|
||||
|
||||
if (resSize > kMaxResourceSize)
|
||||
return THandle<void>();
|
||||
|
||||
handle = MemoryManager::GetInstance()->AllocHandle(0);
|
||||
if (!handle)
|
||||
return THandle<void>();
|
||||
@@ -468,7 +615,7 @@ namespace PortabilityLayer
|
||||
handle->m_rmSelfRef = ref;
|
||||
ref->m_handle = handle;
|
||||
ref->m_resID = static_cast<int16_t>(id);
|
||||
ref->m_size = m_zipFileProxy->GetFileSize(index);
|
||||
ref->m_size = resSize;
|
||||
}
|
||||
|
||||
if (handle->m_contents == nullptr && load)
|
||||
|
||||
@@ -180,6 +180,9 @@ namespace PortabilityLayer
|
||||
|
||||
bool AudioChannelImpl::AddBuffer(IGpAudioBuffer *buffer, bool blocking)
|
||||
{
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
buffer->AddRef();
|
||||
|
||||
AudioCommand cmd;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "RGBAColor.h"
|
||||
#include "Vec2i.h"
|
||||
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
|
||||
struct QDPictDecodeState
|
||||
|
||||
@@ -55,9 +55,9 @@ namespace PortabilityLayer
|
||||
memcpy(&v2Version, v2Header + 4, 2);
|
||||
|
||||
// In version 2 header, v2Version == -1
|
||||
// Followed by fixed-point bounding rectangle (16 bytes) and 4 reserved
|
||||
// Followed by 2-byte reserved (usually -1), fixed-point bounding rectangle (16 bytes) and 4 reserved (usually 0)
|
||||
// In ext. version 2 header, v2Version == -2
|
||||
// Followed by 2-byte reserved, horizontal DPI (fixed point, 4 bytes), vertical DPI (fixed point, 4 bytes) optimal source rect (8 bytes), and 2 reserved
|
||||
// Followed by 2-byte reserved (0), horizontal DPI (fixed point, 4 bytes), vertical DPI (fixed point, 4 bytes) optimal source rect (8 bytes), and 2 reserved
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -27,6 +27,12 @@ namespace PortabilityLayer
|
||||
int16_t m_resID;
|
||||
};
|
||||
|
||||
struct IResourceIterator
|
||||
{
|
||||
virtual void Destroy() = 0;
|
||||
virtual bool GetOne(ResTypeID &resTypeID, int16_t &outID) = 0;
|
||||
};
|
||||
|
||||
struct IResourceArchive
|
||||
{
|
||||
virtual void Destroy() = 0;
|
||||
@@ -35,6 +41,8 @@ namespace PortabilityLayer
|
||||
|
||||
virtual bool HasAnyResourcesOfType(const ResTypeID &resTypeID) const = 0;
|
||||
virtual bool FindFirstResourceOfType(const ResTypeID &resTypeID, int16_t &outID) const = 0;
|
||||
|
||||
virtual IResourceIterator *EnumerateResources() const = 0;
|
||||
};
|
||||
|
||||
class ResourceArchiveBase : public IResourceArchive
|
||||
@@ -43,9 +51,13 @@ namespace PortabilityLayer
|
||||
static const char *GetFileExtensionForResType(const ResTypeID &resTypeID, int &outValidationRule);
|
||||
};
|
||||
|
||||
class ResourceArchiveZipFileIterator;
|
||||
|
||||
class ResourceArchiveZipFile final : public ResourceArchiveBase
|
||||
{
|
||||
public:
|
||||
friend class ResourceArchiveZipFileIterator;
|
||||
|
||||
static ResourceArchiveZipFile *Create(ZipFileProxy *zipFileProxy, bool proxyIsShared, GpIOStream *stream);
|
||||
void Destroy() override;
|
||||
|
||||
@@ -54,7 +66,14 @@ namespace PortabilityLayer
|
||||
bool HasAnyResourcesOfType(const ResTypeID &resTypeID) const override;
|
||||
bool FindFirstResourceOfType(const ResTypeID &resTypeID, int16_t &outID) const override;
|
||||
|
||||
IResourceIterator *EnumerateResources() const override;
|
||||
|
||||
static bool ParseResFromName(const char *name, size_t nameLength, ResTypeID &outResTypeID, int16_t &outID);
|
||||
|
||||
|
||||
private:
|
||||
static const size_t kMaxResourceSize = 32 * 1024 * 1024;
|
||||
|
||||
ResourceArchiveZipFile(ZipFileProxy *zipFileProxy, bool proxyIsShared, GpIOStream *stream, ResourceArchiveRef *resourceHandles);
|
||||
~ResourceArchiveZipFile();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
-->
|
||||
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Product Id="*" Name="Aerofoil" Language="1033" Version="$(var.AerofoilReleaseVersion)" Manufacturer="The Aerofoil Project" UpgradeCode="$(var.AerofoilUpgradeCode)">
|
||||
<Product Id="*" Name="Aerofoil" Language="1033" Version="$(var.AerofoilReleaseVersion)" Manufacturer="Gale Force Games" UpgradeCode="$(var.AerofoilUpgradeCode)">
|
||||
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine">
|
||||
</Package>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ float SRGBToLinear(float v)
|
||||
if (v <= 0.04045)
|
||||
return v * (1.0 / 12.92);
|
||||
else
|
||||
return pow(((v + 0.055) * (1.0 / 1.055)), 2.4);
|
||||
return pow(((max(v, 0.0) + 0.055) * (1.0 / 1.055)), 2.4);
|
||||
}
|
||||
|
||||
float2 SRGBToLinear(float2 v)
|
||||
@@ -47,8 +47,8 @@ float4 ApplyFlicker(int2 coordinate, int startThreshold, int endThreshold, float
|
||||
|
||||
float4 ApplyDesaturation(float desaturation, float4 color)
|
||||
{
|
||||
// This is intentionally done in gamma space
|
||||
if (desaturation == 0.0)
|
||||
// This is intentionally done in gamma space, and keeps solid yellow
|
||||
if (desaturation == 0.0 || all(color.rgb == float3(1.0, 1.0, 0.0)))
|
||||
return color;
|
||||
|
||||
float grayLevel = dot(color.rgb, float3(3.0, 6.0, 1.0) / 10.0);
|
||||
|
||||
Reference in New Issue
Block a user