mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Cygwin port
This commit is contained in:
13
.gitignore
vendored
13
.gitignore
vendored
@@ -20,6 +20,7 @@
|
|||||||
*.idb
|
*.idb
|
||||||
*.aps
|
*.aps
|
||||||
*.res
|
*.res
|
||||||
|
*.a
|
||||||
.vs/*
|
.vs/*
|
||||||
Packaged/*
|
Packaged/*
|
||||||
DebugData/*
|
DebugData/*
|
||||||
@@ -30,9 +31,21 @@ InstallerPackages/*
|
|||||||
*.wixobj
|
*.wixobj
|
||||||
*.CopyComplete
|
*.CopyComplete
|
||||||
*.lnk
|
*.lnk
|
||||||
|
*.cmake
|
||||||
ReleasePackageInstaller/obj/*
|
ReleasePackageInstaller/obj/*
|
||||||
ReleasePackageInstaller/bin/*
|
ReleasePackageInstaller/bin/*
|
||||||
ReleasePackageInstaller/AerofoilPackageDefs.wxi
|
ReleasePackageInstaller/AerofoilPackageDefs.wxi
|
||||||
ReleasePackageInstaller/AerofoilPackageVersion.wxi
|
ReleasePackageInstaller/AerofoilPackageVersion.wxi
|
||||||
packages/*
|
packages/*
|
||||||
!SDL2-2.0.12/lib/x64/*
|
!SDL2-2.0.12/lib/x64/*
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/*
|
||||||
|
Makefile
|
||||||
|
SDL2-2.0.12/CMakeFiles/*
|
||||||
|
SDL2-2.0.12/build
|
||||||
|
SDL2-2.0.12/config.status
|
||||||
|
SDL2-2.0.12/libtool
|
||||||
|
SDL2-2.0.12/Makefile.rules
|
||||||
|
SDL2-2.0.12/sdl2.pc
|
||||||
|
SDL2-2.0.12/sdl2-config
|
||||||
|
install_manifest.txt
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "GpAudioDriverFactory.h"
|
#include "GpAudioDriverFactory.h"
|
||||||
#include "GpDisplayDriverFactory.h"
|
#include "GpDisplayDriverFactory.h"
|
||||||
#include "GpGlobalConfig.h"
|
#include "GpGlobalConfig.h"
|
||||||
#include "GpFiber_SDL.h"
|
#include "GpFiber_Thread.h"
|
||||||
#include "GpFileSystem_Android.h"
|
#include "GpFileSystem_Android.h"
|
||||||
#include "GpFontHandlerFactory.h"
|
#include "GpFontHandlerFactory.h"
|
||||||
#include "GpInputDriverFactory.h"
|
#include "GpInputDriverFactory.h"
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ LOCAL_CFLAGS := -DGP_DEBUG_CONFIG=0
|
|||||||
# Add your application source files here...
|
# Add your application source files here...
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
GpThreadEvent_Cpp11.cpp \
|
GpThreadEvent_Cpp11.cpp \
|
||||||
GpSystemServices_POSIX.cpp
|
GpSystemServices_POSIX.cpp \
|
||||||
|
GpFiber_Thread.cpp \
|
||||||
|
GpFiberStarter_Thread.cpp \
|
||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
#include "GpFiberStarter.h"
|
#include "GpFiberStarter.h"
|
||||||
#include "GpFiber_SDL.h"
|
#include "GpFiber_Thread.h"
|
||||||
|
|
||||||
#include "IGpSystemServices.h"
|
#include "IGpSystemServices.h"
|
||||||
#include "IGpThreadEvent.h"
|
#include "IGpThreadEvent.h"
|
||||||
|
|
||||||
#include "SDL_thread.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace GpFiberStarter_SDL
|
namespace GpFiberStarter_Thread
|
||||||
{
|
{
|
||||||
struct FiberStartState
|
struct FiberStartState
|
||||||
{
|
{
|
||||||
@@ -18,7 +16,7 @@ namespace GpFiberStarter_SDL
|
|||||||
void *m_context;
|
void *m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int SDLCALL FiberStartRoutine(void *lpThreadParameter)
|
static int FiberStartRoutine(void *lpThreadParameter)
|
||||||
{
|
{
|
||||||
const FiberStartState *tss = static_cast<const FiberStartState*>(lpThreadParameter);
|
const FiberStartState *tss = static_cast<const FiberStartState*>(lpThreadParameter);
|
||||||
|
|
||||||
@@ -49,13 +47,13 @@ IGpFiber *GpFiberStarter::StartFiber(IGpSystemServices *systemServices, ThreadFu
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GpFiberStarter_SDL::FiberStartState startState;
|
GpFiberStarter_Thread::FiberStartState startState;
|
||||||
startState.m_context = context;
|
startState.m_context = context;
|
||||||
startState.m_creatingReturnEvent = returnEvent;
|
startState.m_creatingReturnEvent = returnEvent;
|
||||||
startState.m_creatingWakeEvent = wakeEvent;
|
startState.m_creatingWakeEvent = wakeEvent;
|
||||||
startState.m_threadFunc = threadFunc;
|
startState.m_threadFunc = threadFunc;
|
||||||
|
|
||||||
SDL_Thread *thread = SDL_CreateThread(GpFiberStarter_SDL::FiberStartRoutine, "Fiber", &startState);
|
void *thread = systemServices->CreateThread(GpFiberStarter_Thread::FiberStartRoutine, &startState);
|
||||||
if (!thread)
|
if (!thread)
|
||||||
{
|
{
|
||||||
returnEvent->Destroy();
|
returnEvent->Destroy();
|
||||||
@@ -66,5 +64,5 @@ IGpFiber *GpFiberStarter::StartFiber(IGpSystemServices *systemServices, ThreadFu
|
|||||||
returnEvent->Wait();
|
returnEvent->Wait();
|
||||||
returnEvent->Destroy();
|
returnEvent->Destroy();
|
||||||
|
|
||||||
return new GpFiber_SDL(thread, wakeEvent);
|
return new GpFiber_Thread(thread, wakeEvent);
|
||||||
}
|
}
|
||||||
29
AerofoilPortable/GpFiber_Thread.cpp
Normal file
29
AerofoilPortable/GpFiber_Thread.cpp
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include "GpFiber_Thread.h"
|
||||||
|
#include "IGpThreadEvent.h"
|
||||||
|
|
||||||
|
GpFiber_Thread::GpFiber_Thread(void *thread, IGpThreadEvent *threadEvent)
|
||||||
|
: m_event(threadEvent)
|
||||||
|
, m_thread(thread)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GpFiber_Thread::~GpFiber_Thread()
|
||||||
|
{
|
||||||
|
m_event->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFiber_Thread::YieldTo(IGpFiber *toFiber)
|
||||||
|
{
|
||||||
|
static_cast<GpFiber_Thread*>(toFiber)->m_event->Signal();
|
||||||
|
m_event->Wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFiber_Thread::YieldToTerminal(IGpFiber *toFiber)
|
||||||
|
{
|
||||||
|
static_cast<GpFiber_Thread*>(toFiber)->m_event->Signal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFiber_Thread::Destroy()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "IGpFiber.h"
|
#include "IGpFiber.h"
|
||||||
#include "SDL_thread.h"
|
|
||||||
|
|
||||||
struct IGpThreadEvent;
|
struct IGpThreadEvent;
|
||||||
|
|
||||||
class GpFiber_SDL final : public IGpFiber
|
class GpFiber_Thread final : public IGpFiber
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit GpFiber_SDL(SDL_Thread *thread, IGpThreadEvent *threadEvent);
|
explicit GpFiber_Thread(void *thread, IGpThreadEvent *threadEvent);
|
||||||
~GpFiber_SDL();
|
~GpFiber_Thread();
|
||||||
|
|
||||||
void YieldTo(IGpFiber *fromFiber) override;
|
void YieldTo(IGpFiber *fromFiber) override;
|
||||||
void YieldToTerminal(IGpFiber *fromFiber) override;
|
void YieldToTerminal(IGpFiber *fromFiber) override;
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int SDLCALL InternalThreadFunction(void *data);
|
static int InternalThreadFunction(void *data);
|
||||||
|
|
||||||
bool m_isDestroying;
|
bool m_isDestroying;
|
||||||
IGpThreadEvent *m_event;
|
IGpThreadEvent *m_event;
|
||||||
SDL_Thread *m_thread;
|
void *m_thread;
|
||||||
};
|
};
|
||||||
@@ -11,6 +11,7 @@ LOCAL_C_INCLUDES := \
|
|||||||
$(LOCAL_PATH)/../GpShell \
|
$(LOCAL_PATH)/../GpShell \
|
||||||
$(LOCAL_PATH)/../Common \
|
$(LOCAL_PATH)/../Common \
|
||||||
$(LOCAL_PATH)/../PortabilityLayer \
|
$(LOCAL_PATH)/../PortabilityLayer \
|
||||||
|
$(LOCAL_PATH)/../AerofoilPortable \
|
||||||
$(LOCAL_PATH)/$(SDL_PATH)/include
|
$(LOCAL_PATH)/$(SDL_PATH)/include
|
||||||
|
|
||||||
LOCAL_CFLAGS := -DGP_DEBUG_CONFIG=0
|
LOCAL_CFLAGS := -DGP_DEBUG_CONFIG=0
|
||||||
@@ -19,8 +20,6 @@ LOCAL_CFLAGS := -DGP_DEBUG_CONFIG=0
|
|||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
GpAudioDriver_SDL2.cpp \
|
GpAudioDriver_SDL2.cpp \
|
||||||
GpDisplayDriver_SDL_GL2.cpp \
|
GpDisplayDriver_SDL_GL2.cpp \
|
||||||
GpFiber_SDL.cpp \
|
|
||||||
GpFiberStarter_SDL.cpp \
|
|
||||||
ShaderCode/CopyQuadP.cpp \
|
ShaderCode/CopyQuadP.cpp \
|
||||||
ShaderCode/DrawQuadPaletteP.cpp \
|
ShaderCode/DrawQuadPaletteP.cpp \
|
||||||
ShaderCode/DrawQuad32P.cpp \
|
ShaderCode/DrawQuad32P.cpp \
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "CoreDefs.h"
|
||||||
#include "IGpAudioDriver.h"
|
#include "IGpAudioDriver.h"
|
||||||
#include "IGpAudioChannel.h"
|
#include "IGpAudioChannel.h"
|
||||||
#include "IGpAudioChannelCallbacks.h"
|
#include "IGpAudioChannelCallbacks.h"
|
||||||
@@ -5,8 +6,7 @@
|
|||||||
#include "IGpPrefsHandler.h"
|
#include "IGpPrefsHandler.h"
|
||||||
#include "IGpSystemServices.h"
|
#include "IGpSystemServices.h"
|
||||||
#include "GpAudioDriverProperties.h"
|
#include "GpAudioDriverProperties.h"
|
||||||
#include "CoreDefs.h"
|
#include "GpSDL.h"
|
||||||
|
|
||||||
|
|
||||||
#include "SDL_audio.h"
|
#include "SDL_audio.h"
|
||||||
#include "GpRingBuffer.h"
|
#include "GpRingBuffer.h"
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
#include "GpApplicationName.h"
|
#include "GpApplicationName.h"
|
||||||
#include "GpComPtr.h"
|
#include "GpComPtr.h"
|
||||||
#include "GpFiber_SDL.h"
|
#include "GpFiber_Thread.h"
|
||||||
#include "GpDisplayDriverProperties.h"
|
#include "GpDisplayDriverProperties.h"
|
||||||
#include "GpVOSEvent.h"
|
#include "GpVOSEvent.h"
|
||||||
#include "GpRingBuffer.h"
|
#include "GpRingBuffer.h"
|
||||||
#include "GpInputDriver_SDL_Gamepad.h"
|
#include "GpInputDriver_SDL_Gamepad.h"
|
||||||
|
#include "GpSDL.h"
|
||||||
#include "IGpCursor.h"
|
#include "IGpCursor.h"
|
||||||
#include "IGpDisplayDriverSurface.h"
|
#include "IGpDisplayDriverSurface.h"
|
||||||
#include "IGpLogDriver.h"
|
#include "IGpLogDriver.h"
|
||||||
@@ -1847,7 +1848,7 @@ void GpDisplayDriver_SDL_GL2::Run()
|
|||||||
IGpLogDriver *logger = m_properties.m_logger;
|
IGpLogDriver *logger = m_properties.m_logger;
|
||||||
|
|
||||||
m_vosEvent = m_properties.m_systemServices->CreateThreadEvent(true, false);
|
m_vosEvent = m_properties.m_systemServices->CreateThreadEvent(true, false);
|
||||||
m_vosFiber = new GpFiber_SDL(nullptr, m_vosEvent);
|
m_vosFiber = new GpFiber_Thread(nullptr, m_vosEvent);
|
||||||
|
|
||||||
uint32_t windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
|
uint32_t windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
|
||||||
if (m_properties.m_systemServices->IsFullscreenOnStartup())
|
if (m_properties.m_systemServices->IsFullscreenOnStartup())
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#include "GpFiber_SDL.h"
|
|
||||||
#include "IGpThreadEvent.h"
|
|
||||||
|
|
||||||
GpFiber_SDL::GpFiber_SDL(SDL_Thread *thread, IGpThreadEvent *threadEvent)
|
|
||||||
: m_event(threadEvent)
|
|
||||||
, m_thread(thread)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
GpFiber_SDL::~GpFiber_SDL()
|
|
||||||
{
|
|
||||||
m_event->Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GpFiber_SDL::YieldTo(IGpFiber *toFiber)
|
|
||||||
{
|
|
||||||
static_cast<GpFiber_SDL*>(toFiber)->m_event->Signal();
|
|
||||||
m_event->Wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GpFiber_SDL::YieldToTerminal(IGpFiber *toFiber)
|
|
||||||
{
|
|
||||||
static_cast<GpFiber_SDL*>(toFiber)->m_event->Signal();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GpFiber_SDL::Destroy()
|
|
||||||
{
|
|
||||||
delete this;
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "GpDisplayDriverFactory.h"
|
#include "GpDisplayDriverFactory.h"
|
||||||
#include "GpGlobalConfig.h"
|
#include "GpGlobalConfig.h"
|
||||||
#include "GpFiber_Win32.h"
|
#include "GpFiber_Win32.h"
|
||||||
#include "GpFiber_SDL.h"
|
|
||||||
#include "GpFileSystem_Win32.h"
|
#include "GpFileSystem_Win32.h"
|
||||||
#include "GpLogDriver_Win32.h"
|
#include "GpLogDriver_Win32.h"
|
||||||
#include "GpFontHandlerFactory.h"
|
#include "GpFontHandlerFactory.h"
|
||||||
|
|||||||
5
AerofoilSDL/GpSDL.h
Normal file
5
AerofoilSDL/GpSDL.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#ifdef __CYGWIN__
|
||||||
|
#define GP_SDL_DIRECTORY_PREFIX "SDL2/"
|
||||||
|
#else
|
||||||
|
#define GP_SDL_DIRECTORY_PREFIX
|
||||||
|
#endif
|
||||||
518
AerofoilX/GpFileSystem_X.cpp
Normal file
518
AerofoilX/GpFileSystem_X.cpp
Normal file
@@ -0,0 +1,518 @@
|
|||||||
|
#define _LARGEFILE64_SOURCE
|
||||||
|
#include "GpFileSystem_X.h"
|
||||||
|
#include "GpIOStream.h"
|
||||||
|
#include "IGpDirectoryCursor.h"
|
||||||
|
#include "IGpSystemServices.h"
|
||||||
|
#include "IGpMutex.h"
|
||||||
|
#include "IGpThreadRelay.h"
|
||||||
|
#include "VirtualDirectory.h"
|
||||||
|
|
||||||
|
#include "PLDrivers.h"
|
||||||
|
|
||||||
|
#include "SDL2/SDL.h"
|
||||||
|
#include "SDL2/SDL_rwops.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
|
#include "UTF8.h"
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
typedef off_t off64_t;
|
||||||
|
#define fstat64 fstat
|
||||||
|
#define fseek64 fseek
|
||||||
|
#define ftruncate64 ftruncate
|
||||||
|
#define stat64 stat
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class GpFileStream_X_File final : public GpIOStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GpFileStream_X_File(FILE *f, bool readOnly, bool writeOnly);
|
||||||
|
~GpFileStream_X_File();
|
||||||
|
|
||||||
|
size_t Read(void *bytesOut, size_t size) override;
|
||||||
|
size_t Write(const void *bytes, size_t size) override;
|
||||||
|
bool IsSeekable() const override;
|
||||||
|
bool IsReadOnly() const override;
|
||||||
|
bool IsWriteOnly() const override;
|
||||||
|
bool SeekStart(GpUFilePos_t loc) override;
|
||||||
|
bool SeekCurrent(GpFilePos_t loc) override;
|
||||||
|
bool SeekEnd(GpUFilePos_t loc) override;
|
||||||
|
GpUFilePos_t Size() const override;
|
||||||
|
GpUFilePos_t Tell() const override;
|
||||||
|
void Close() override;
|
||||||
|
void Flush() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
FILE *m_f;
|
||||||
|
bool m_seekable;
|
||||||
|
bool m_isReadOnly;
|
||||||
|
bool m_isWriteOnly;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
GpFileStream_X_File::GpFileStream_X_File(FILE *f, bool readOnly, bool writeOnly)
|
||||||
|
: m_f(f)
|
||||||
|
, m_isReadOnly(readOnly)
|
||||||
|
, m_isWriteOnly(writeOnly)
|
||||||
|
{
|
||||||
|
m_seekable = (fseek(m_f, 0, SEEK_CUR) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GpFileStream_X_File::~GpFileStream_X_File()
|
||||||
|
{
|
||||||
|
fclose(m_f);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t GpFileStream_X_File::Read(void *bytesOut, size_t size)
|
||||||
|
{
|
||||||
|
if (m_isWriteOnly)
|
||||||
|
return 0;
|
||||||
|
return fread(bytesOut, 1, size, m_f);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t GpFileStream_X_File::Write(const void *bytes, size_t size)
|
||||||
|
{
|
||||||
|
if (m_isReadOnly)
|
||||||
|
return 0;
|
||||||
|
return fwrite(bytes, 1, size, m_f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileStream_X_File::IsSeekable() const
|
||||||
|
{
|
||||||
|
return m_seekable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileStream_X_File::IsReadOnly() const
|
||||||
|
{
|
||||||
|
return m_isReadOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileStream_X_File::IsWriteOnly() const
|
||||||
|
{
|
||||||
|
return m_isWriteOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileStream_X_File::SeekStart(GpUFilePos_t loc)
|
||||||
|
{
|
||||||
|
if (!m_seekable)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
fflush(m_f);
|
||||||
|
return fseek64(m_f, static_cast<off64_t>(loc), SEEK_SET) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileStream_X_File::SeekCurrent(GpFilePos_t loc)
|
||||||
|
{
|
||||||
|
if (!m_seekable)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
fflush(m_f);
|
||||||
|
return fseek64(m_f, static_cast<off64_t>(loc), SEEK_CUR) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileStream_X_File::SeekEnd(GpUFilePos_t loc)
|
||||||
|
{
|
||||||
|
if (!m_seekable)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
fflush(m_f);
|
||||||
|
return fseek64(m_f, -static_cast<off64_t>(loc), SEEK_END) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpUFilePos_t GpFileStream_X_File::Size() const
|
||||||
|
{
|
||||||
|
fflush(m_f);
|
||||||
|
|
||||||
|
struct stat64 s;
|
||||||
|
if (fstat64(fileno(m_f), &s) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return static_cast<GpUFilePos_t>(s.st_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
GpUFilePos_t GpFileStream_X_File::Tell() const
|
||||||
|
{
|
||||||
|
return static_cast<GpUFilePos_t>(ftell(m_f));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFileStream_X_File::Close()
|
||||||
|
{
|
||||||
|
this->~GpFileStream_X_File();
|
||||||
|
free(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFileStream_X_File::Flush()
|
||||||
|
{
|
||||||
|
fflush(m_f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileSystem_X::ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, std::string &resolution)
|
||||||
|
{
|
||||||
|
const char *prefsAppend = nullptr;
|
||||||
|
|
||||||
|
switch (virtualDirectory)
|
||||||
|
{
|
||||||
|
case PortabilityLayer::VirtualDirectories::kApplicationData:
|
||||||
|
resolution = std::string("Packaged");
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kGameData:
|
||||||
|
resolution = std::string("Packaged/Houses");
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kFonts:
|
||||||
|
resolution = std::string("Resources");
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kHighScores:
|
||||||
|
prefsAppend = "HighScores";
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kUserData:
|
||||||
|
prefsAppend = "Houses";
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kUserSaves:
|
||||||
|
prefsAppend = "SavedGames";
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kPrefs:
|
||||||
|
prefsAppend = "Prefs";
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::VirtualDirectories::kFontCache:
|
||||||
|
prefsAppend = "FontCache";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (prefsAppend)
|
||||||
|
resolution = m_prefsPath + prefsAppend;
|
||||||
|
else
|
||||||
|
resolution = m_basePath + resolution;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < numPaths; i++)
|
||||||
|
{
|
||||||
|
resolution += "/";
|
||||||
|
resolution += paths[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpFileSystem_X::GpFileSystem_X()
|
||||||
|
: m_relay(nullptr)
|
||||||
|
, m_delayCallback(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GpFileSystem_X::~GpFileSystem_X()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFileSystem_X::Init()
|
||||||
|
{
|
||||||
|
char *prefsDir = SDL_GetPrefPath("aerofoil", "aerofoil");
|
||||||
|
m_prefsPath = prefsDir;
|
||||||
|
|
||||||
|
char *baseDir = SDL_GetBasePath();
|
||||||
|
m_basePath = baseDir;
|
||||||
|
SDL_free(baseDir);
|
||||||
|
|
||||||
|
char baseDirSeparator = m_basePath[m_basePath.size() - 1];
|
||||||
|
if (m_basePath.size() >= 4 && m_basePath.substr(m_basePath.size() - 4, 3) == "bin")
|
||||||
|
m_basePath = m_basePath.substr(0, m_basePath.size() - 4) + "lib" + baseDirSeparator + "aerofoil" + baseDirSeparator;
|
||||||
|
|
||||||
|
const char *extensions[] = { "HighScores", "Houses", "SavedGames", "Prefs", "FontCache" };
|
||||||
|
for (size_t i = 0; i < sizeof(extensions) / sizeof(extensions[0]); i++)
|
||||||
|
{
|
||||||
|
std::string prefsPath = std::string(prefsDir) + extensions[i];
|
||||||
|
int created = mkdir(prefsPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||||
|
}
|
||||||
|
SDL_free(prefsDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileSystem_X::FileExists(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path)
|
||||||
|
{
|
||||||
|
std::string resolvedPath;
|
||||||
|
if (!ResolvePath(virtualDirectory, &path, 1, resolvedPath))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
struct stat s;
|
||||||
|
return stat(resolvedPath.c_str(), &s) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileSystem_X::FileLocked(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &exists)
|
||||||
|
{
|
||||||
|
std::string resolvedPath;
|
||||||
|
if (!ResolvePath(virtualDirectory, &path, 1, resolvedPath))
|
||||||
|
{
|
||||||
|
if (exists)
|
||||||
|
exists = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int permissions = access(resolvedPath.c_str(), W_OK | F_OK);
|
||||||
|
exists = ((permissions & F_OK) != 0);
|
||||||
|
return ((permissions & W_OK) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GpIOStream *GpFileSystem_X::OpenFileNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* subPaths, size_t numSubPaths, bool writeAccess, GpFileCreationDisposition_t createDisposition)
|
||||||
|
{
|
||||||
|
const char *mode = nullptr;
|
||||||
|
bool canWrite = false;
|
||||||
|
bool needResetPosition = false;
|
||||||
|
|
||||||
|
switch (createDisposition)
|
||||||
|
{
|
||||||
|
case GpFileCreationDispositions::kCreateOrOverwrite:
|
||||||
|
mode = "wb";
|
||||||
|
break;
|
||||||
|
case GpFileCreationDispositions::kCreateNew:
|
||||||
|
mode = "x+b";
|
||||||
|
break;
|
||||||
|
case GpFileCreationDispositions::kCreateOrOpen:
|
||||||
|
mode = "a+b";
|
||||||
|
needResetPosition = true;
|
||||||
|
break;
|
||||||
|
case GpFileCreationDispositions::kOpenExisting:
|
||||||
|
mode = writeAccess ? "r+b" : "rb";
|
||||||
|
break;
|
||||||
|
case GpFileCreationDispositions::kOverwriteExisting:
|
||||||
|
mode = "r+b";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (virtualDirectory == PortabilityLayer::VirtualDirectories::kSourceExport)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
std::string resolvedPath;
|
||||||
|
if (!ResolvePath(virtualDirectory, subPaths, numSubPaths, resolvedPath))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
void *objStorage = malloc(sizeof(GpFileStream_X_File));
|
||||||
|
if (!objStorage)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
FILE *f = fopen(resolvedPath.c_str(), mode);
|
||||||
|
if (!f)
|
||||||
|
{
|
||||||
|
free(objStorage);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needResetPosition)
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
||||||
|
if (createDisposition == GpFileCreationDispositions::kOverwriteExisting)
|
||||||
|
{
|
||||||
|
if (ftruncate64(fileno(f), 0) < 0)
|
||||||
|
{
|
||||||
|
free(objStorage);
|
||||||
|
fclose(f);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new (objStorage) GpFileStream_X_File(f, !writeAccess, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileSystem_X::DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed)
|
||||||
|
{
|
||||||
|
std::string resolvedPath;
|
||||||
|
if (!ResolvePath(virtualDirectory, &path, 1, resolvedPath))
|
||||||
|
{
|
||||||
|
existed = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unlink(resolvedPath.c_str()) < 0)
|
||||||
|
{
|
||||||
|
existed = (errno != ENOENT);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
existed = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IGpDirectoryCursor *GpFileSystem_X::ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *const *paths, size_t numPaths)
|
||||||
|
{
|
||||||
|
ScanDirectoryNestedContext ctx;
|
||||||
|
ctx.m_this = this;
|
||||||
|
ctx.m_returnValue = nullptr;
|
||||||
|
ctx.m_virtualDirectory = virtualDirectory;
|
||||||
|
ctx.m_paths = paths;
|
||||||
|
ctx.m_numPaths = numPaths;
|
||||||
|
m_relay->Invoke(ScanDirectoryNestedThunk, &ctx);
|
||||||
|
|
||||||
|
return ctx.m_returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFileSystem_X::ScanDirectoryNestedThunk(void *context)
|
||||||
|
{
|
||||||
|
ScanDirectoryNestedContext *ctx = static_cast<ScanDirectoryNestedContext*>(context);
|
||||||
|
ctx->m_returnValue = ctx->m_this->ScanDirectoryNestedInternal(ctx->m_virtualDirectory, ctx->m_paths, ctx->m_numPaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
IGpDirectoryCursor *GpFileSystem_X::ScanDirectoryNestedInternal(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *const *paths, size_t numPaths)
|
||||||
|
{
|
||||||
|
return ScanDirectory(virtualDirectory, paths, numPaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileSystem_X::ValidateFilePath(const char *path, size_t length) const
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
const char c = path[i];
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (c == '_' || c == '.' || c == '\'' || c == '!')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (c == ' ' && i != 0 && i != length - 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (c >= 'a' && c <= 'z')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (c >= 'A' && c <= 'Z')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpFileSystem_X::ValidateFilePathUnicodeChar(uint32_t c) const
|
||||||
|
{
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (c == '_' || c == '\'')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (c == ' ')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (c >= 'a' && c <= 'z')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (c >= 'A' && c <= 'Z')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFileSystem_X::SetMainThreadRelay(IGpThreadRelay *relay)
|
||||||
|
{
|
||||||
|
m_relay = relay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpFileSystem_X::SetDelayCallback(DelayCallback_t delayCallback)
|
||||||
|
{
|
||||||
|
m_delayCallback = delayCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpFileSystem_X *GpFileSystem_X::GetInstance()
|
||||||
|
{
|
||||||
|
return &ms_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
class GpDirectoryCursor_StringList final : public IGpDirectoryCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit GpDirectoryCursor_StringList(std::vector<std::string> &paths);
|
||||||
|
~GpDirectoryCursor_StringList();
|
||||||
|
|
||||||
|
bool GetNext(const char *&outFileName) override;
|
||||||
|
void Destroy() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<std::string> m_paths;
|
||||||
|
size_t m_index;
|
||||||
|
};
|
||||||
|
|
||||||
|
GpDirectoryCursor_StringList::GpDirectoryCursor_StringList(std::vector<std::string> &paths)
|
||||||
|
: m_index(0)
|
||||||
|
{
|
||||||
|
std::swap(paths, m_paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
GpDirectoryCursor_StringList::~GpDirectoryCursor_StringList()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpDirectoryCursor_StringList::GetNext(const char *&outFileName)
|
||||||
|
{
|
||||||
|
if (m_index == m_paths.size())
|
||||||
|
return false;
|
||||||
|
outFileName = m_paths[m_index].c_str();
|
||||||
|
m_index++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpDirectoryCursor_StringList::Destroy()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
class GpDirectoryCursor_POSIX final : public IGpDirectoryCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit GpDirectoryCursor_POSIX(DIR *dir);
|
||||||
|
~GpDirectoryCursor_POSIX();
|
||||||
|
|
||||||
|
bool GetNext(const char *&outFileName) override;
|
||||||
|
void Destroy() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DIR *m_dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
GpDirectoryCursor_POSIX::GpDirectoryCursor_POSIX(DIR *dir)
|
||||||
|
: m_dir(dir)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GpDirectoryCursor_POSIX::~GpDirectoryCursor_POSIX()
|
||||||
|
{
|
||||||
|
closedir(m_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpDirectoryCursor_POSIX::GetNext(const char *&outFileName)
|
||||||
|
{
|
||||||
|
struct dirent *dir = readdir(m_dir);
|
||||||
|
if (!dir)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
outFileName = dir->d_name;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpDirectoryCursor_POSIX::Destroy()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IGpDirectoryCursor *GpFileSystem_X::ScanDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths)
|
||||||
|
{
|
||||||
|
std::string resolvedPath;
|
||||||
|
std::vector<std::string> subPaths;
|
||||||
|
if (!ResolvePath(virtualDirectory, paths, numPaths, resolvedPath))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
DIR *d = opendir(resolvedPath.c_str());
|
||||||
|
if (!d)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return new GpDirectoryCursor_POSIX(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GpFileSystem_X GpFileSystem_X::ms_instance;
|
||||||
59
AerofoilX/GpFileSystem_X.h
Normal file
59
AerofoilX/GpFileSystem_X.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "IGpFileSystem.h"
|
||||||
|
|
||||||
|
#include "GpCoreDefs.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
struct IGpMutex;
|
||||||
|
|
||||||
|
class GpFileSystem_X final : public IGpFileSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GpFileSystem_X();
|
||||||
|
~GpFileSystem_X();
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
bool FileExists(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path) override;
|
||||||
|
bool FileLocked(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &exists) override;
|
||||||
|
GpIOStream *OpenFileNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* subPaths, size_t numSubPaths, bool writeAccess, GpFileCreationDisposition_t createDisposition) override;
|
||||||
|
bool DeleteFile(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path, bool &existed) override;
|
||||||
|
IGpDirectoryCursor *ScanDirectoryNested(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths) override;
|
||||||
|
|
||||||
|
bool ValidateFilePath(const char *path, size_t pathLen) const override;
|
||||||
|
bool ValidateFilePathUnicodeChar(uint32_t ch) const override;
|
||||||
|
|
||||||
|
void SetMainThreadRelay(IGpThreadRelay *relay) override;
|
||||||
|
void SetDelayCallback(DelayCallback_t delayCallback) override;
|
||||||
|
|
||||||
|
static GpFileSystem_X *GetInstance();
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct ScanDirectoryNestedContext
|
||||||
|
{
|
||||||
|
GpFileSystem_X *m_this;
|
||||||
|
|
||||||
|
IGpDirectoryCursor *m_returnValue;
|
||||||
|
PortabilityLayer::VirtualDirectory_t m_virtualDirectory;
|
||||||
|
char const *const *m_paths;
|
||||||
|
size_t m_numPaths;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void ScanDirectoryNestedThunk(void *context);
|
||||||
|
IGpDirectoryCursor *ScanDirectoryNestedInternal(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
|
||||||
|
|
||||||
|
IGpDirectoryCursor *ScanDirectory(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths);
|
||||||
|
|
||||||
|
bool ResolvePath(PortabilityLayer::VirtualDirectory_t virtualDirectory, char const* const* paths, size_t numPaths, std::string &resolution);
|
||||||
|
|
||||||
|
IGpThreadRelay *m_relay;
|
||||||
|
DelayCallback_t m_delayCallback;
|
||||||
|
|
||||||
|
std::string m_prefsPath;
|
||||||
|
std::string m_basePath;
|
||||||
|
|
||||||
|
static GpFileSystem_X ms_instance;
|
||||||
|
};
|
||||||
127
AerofoilX/GpLogDriver_X.cpp
Normal file
127
AerofoilX/GpLogDriver_X.cpp
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
#include "GpLogDriver_X.h"
|
||||||
|
#include "GpFileSystem_X.h"
|
||||||
|
|
||||||
|
#include "GpApplicationName.h"
|
||||||
|
#include "GpIOStream.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
GpLogDriver_X::GpLogDriver_X()
|
||||||
|
: m_stream(nullptr)
|
||||||
|
, m_isInitialized(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpLogDriver_X::Init()
|
||||||
|
{
|
||||||
|
ms_instance.InitInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpLogDriver_X::VPrintf(Category category, const char *fmt, va_list args)
|
||||||
|
{
|
||||||
|
size_t fmtSize = 0;
|
||||||
|
bool hasFormatting = false;
|
||||||
|
for (const char *fmtCheck = fmt; *fmtCheck; fmtCheck++)
|
||||||
|
{
|
||||||
|
if (*fmtCheck == '%')
|
||||||
|
hasFormatting = true;
|
||||||
|
|
||||||
|
fmtSize++;
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t t = time(nullptr);
|
||||||
|
struct tm sysTime = *localtime(&t);
|
||||||
|
|
||||||
|
char timestampBuffer[64];
|
||||||
|
sprintf(timestampBuffer, "[%02d:%02d:%02d] ", sysTime.tm_hour, sysTime.tm_min, sysTime.tm_sec);
|
||||||
|
|
||||||
|
if (m_stream)
|
||||||
|
m_stream->Write(timestampBuffer, strlen(timestampBuffer));
|
||||||
|
|
||||||
|
const char *debugTag = "";
|
||||||
|
|
||||||
|
switch (category)
|
||||||
|
{
|
||||||
|
case Category_Warning:
|
||||||
|
debugTag = "[WARNING] ";
|
||||||
|
break;
|
||||||
|
case Category_Error:
|
||||||
|
debugTag = "[ERROR] ";
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (debugTag[0])
|
||||||
|
{
|
||||||
|
if (m_stream)
|
||||||
|
m_stream->Write(debugTag, strlen(debugTag));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasFormatting)
|
||||||
|
{
|
||||||
|
if (m_stream)
|
||||||
|
m_stream->Write(fmt, fmtSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int formattedSize = vsnprintf(nullptr, 0, fmt, args);
|
||||||
|
if (formattedSize <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
char *charBuff = static_cast<char*>(malloc(formattedSize + 1));
|
||||||
|
if (!charBuff)
|
||||||
|
return;
|
||||||
|
|
||||||
|
vsnprintf(charBuff, formattedSize + 1, fmt, args);
|
||||||
|
|
||||||
|
if (m_stream)
|
||||||
|
m_stream->Write(charBuff, formattedSize);
|
||||||
|
|
||||||
|
free(charBuff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_stream)
|
||||||
|
{
|
||||||
|
m_stream->Write("\n", 1);
|
||||||
|
m_stream->Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpLogDriver_X::Shutdown()
|
||||||
|
{
|
||||||
|
if (m_stream)
|
||||||
|
m_stream->Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
GpLogDriver_X *GpLogDriver_X::GetInstance()
|
||||||
|
{
|
||||||
|
if (ms_instance.m_isInitialized)
|
||||||
|
return &ms_instance;
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpLogDriver_X::InitInternal()
|
||||||
|
{
|
||||||
|
time_t t = time(nullptr);
|
||||||
|
struct tm utcTime = *gmtime(&t);
|
||||||
|
|
||||||
|
char logFileName[256];
|
||||||
|
|
||||||
|
sprintf(logFileName, GP_APPLICATION_NAME "-%04d-%02d-%02d_%02d-%02d_%02d.txt", utcTime.tm_year, utcTime.tm_mon, utcTime.tm_mday, utcTime.tm_hour, utcTime.tm_min, utcTime.tm_sec);
|
||||||
|
|
||||||
|
m_stream = GpFileSystem_X::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kLogs, logFileName, true, GpFileCreationDispositions::kCreateOrOverwrite);
|
||||||
|
if (m_stream)
|
||||||
|
{
|
||||||
|
this->Printf(IGpLogDriver::Category_Information, GP_APPLICATION_NAME " build " __TIMESTAMP__);
|
||||||
|
#if !GP_DEBUG_CONFIG
|
||||||
|
this->Printf(IGpLogDriver::Category_Information, "Configuration: Release");
|
||||||
|
#else
|
||||||
|
this->Printf(IGpLogDriver::Category_Information, "Configuration: Debug");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_isInitialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GpLogDriver_X GpLogDriver_X::ms_instance;
|
||||||
28
AerofoilX/GpLogDriver_X.h
Normal file
28
AerofoilX/GpLogDriver_X.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "IGpLogDriver.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
class GpIOStream;
|
||||||
|
|
||||||
|
class GpLogDriver_X : public IGpLogDriver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GpLogDriver_X();
|
||||||
|
|
||||||
|
static void Init();
|
||||||
|
|
||||||
|
void VPrintf(Category category, const char *fmt, va_list args) override;
|
||||||
|
void Shutdown() override;
|
||||||
|
|
||||||
|
static GpLogDriver_X *GetInstance();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void InitInternal();
|
||||||
|
|
||||||
|
GpIOStream *m_stream;
|
||||||
|
bool m_isInitialized;
|
||||||
|
|
||||||
|
static GpLogDriver_X ms_instance;
|
||||||
|
};
|
||||||
81
AerofoilX/GpMain_SDL_X.cpp
Normal file
81
AerofoilX/GpMain_SDL_X.cpp
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#include "SDL.h"
|
||||||
|
#include "SDL_main.h"
|
||||||
|
|
||||||
|
#include "GpMain.h"
|
||||||
|
#include "GpAudioDriverFactory.h"
|
||||||
|
#include "GpDisplayDriverFactory.h"
|
||||||
|
#include "GpGlobalConfig.h"
|
||||||
|
#include "GpFiber_Thread.h"
|
||||||
|
#include "GpFileSystem_X.h"
|
||||||
|
#include "GpLogDriver_X.h"
|
||||||
|
#include "GpFontHandlerFactory.h"
|
||||||
|
#include "GpInputDriverFactory.h"
|
||||||
|
#include "GpAppInterface.h"
|
||||||
|
#include "GpSystemServices_X.h"
|
||||||
|
#include "GpVOSEvent.h"
|
||||||
|
#include "GpX.h"
|
||||||
|
|
||||||
|
#include "IGpFileSystem.h"
|
||||||
|
#include "IGpThreadEvent.h"
|
||||||
|
#include "IGpVOSEventQueue.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
GpXGlobals g_gpXGlobals;
|
||||||
|
|
||||||
|
extern "C" IGpFontHandler *GpDriver_CreateFontHandler_FreeType2(const GpFontHandlerProperties &properties);
|
||||||
|
|
||||||
|
IGpDisplayDriver *GpDriver_CreateDisplayDriver_SDL_GL2(const GpDisplayDriverProperties &properties);
|
||||||
|
IGpAudioDriver *GpDriver_CreateAudioDriver_SDL(const GpAudioDriverProperties &properties);
|
||||||
|
IGpInputDriver *GpDriver_CreateInputDriver_SDL2_Gamepad(const GpInputDriverProperties &properties);
|
||||||
|
|
||||||
|
|
||||||
|
SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
GpLogDriver_X::Init();
|
||||||
|
|
||||||
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
GpFileSystem_X::GetInstance()->Init();
|
||||||
|
|
||||||
|
IGpLogDriver *logger = GpLogDriver_X::GetInstance();
|
||||||
|
GpDriverCollection *drivers = GpAppInterface_Get()->PL_GetDriverCollection();
|
||||||
|
|
||||||
|
drivers->SetDriver<GpDriverIDs::kFileSystem>(GpFileSystem_X::GetInstance());
|
||||||
|
drivers->SetDriver<GpDriverIDs::kSystemServices>(GpSystemServices_X::GetInstance());
|
||||||
|
drivers->SetDriver<GpDriverIDs::kLog>(GpLogDriver_X::GetInstance());
|
||||||
|
|
||||||
|
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_SDL_GL2;
|
||||||
|
|
||||||
|
g_gpGlobalConfig.m_audioDriverType = EGpAudioDriverType_SDL2;
|
||||||
|
|
||||||
|
g_gpGlobalConfig.m_fontHandlerType = EGpFontHandlerType_FreeType2;
|
||||||
|
|
||||||
|
EGpInputDriverType inputDrivers[] =
|
||||||
|
{
|
||||||
|
EGpInputDriverType_SDL2_Gamepad
|
||||||
|
};
|
||||||
|
|
||||||
|
g_gpGlobalConfig.m_inputDriverTypes = inputDrivers;
|
||||||
|
g_gpGlobalConfig.m_numInputDrivers = sizeof(inputDrivers) / sizeof(inputDrivers[0]);
|
||||||
|
|
||||||
|
g_gpGlobalConfig.m_osGlobals = &g_gpXGlobals;
|
||||||
|
g_gpGlobalConfig.m_logger = logger;
|
||||||
|
g_gpGlobalConfig.m_systemServices = GpSystemServices_X::GetInstance();
|
||||||
|
|
||||||
|
GpDisplayDriverFactory::RegisterDisplayDriverFactory(EGpDisplayDriverType_SDL_GL2, GpDriver_CreateDisplayDriver_SDL_GL2);
|
||||||
|
GpAudioDriverFactory::RegisterAudioDriverFactory(EGpAudioDriverType_SDL2, GpDriver_CreateAudioDriver_SDL);
|
||||||
|
GpInputDriverFactory::RegisterInputDriverFactory(EGpInputDriverType_SDL2_Gamepad, GpDriver_CreateInputDriver_SDL2_Gamepad);
|
||||||
|
GpFontHandlerFactory::RegisterFontHandlerFactory(EGpFontHandlerType_FreeType2, GpDriver_CreateFontHandler_FreeType2);
|
||||||
|
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "SDL environment configured, starting up");
|
||||||
|
|
||||||
|
int returnCode = GpMain::Run();
|
||||||
|
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "SDL environment exited with code %i, cleaning up", returnCode);
|
||||||
|
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
137
AerofoilX/GpSystemServices_X.cpp
Normal file
137
AerofoilX/GpSystemServices_X.cpp
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
#include "GpSystemServices_X.h"
|
||||||
|
|
||||||
|
#include "IGpClipboardContents.h"
|
||||||
|
#include "IGpThreadEvent.h"
|
||||||
|
#include "SDL2/SDL.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
struct GpSystemServices_X_ThreadStartParams
|
||||||
|
{
|
||||||
|
GpSystemServices_X::ThreadFunc_t m_threadFunc;
|
||||||
|
void *m_threadContext;
|
||||||
|
IGpThreadEvent *m_threadStartEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void *StaticStartThread(void *lpThreadParameter)
|
||||||
|
{
|
||||||
|
const GpSystemServices_X_ThreadStartParams *threadParams = static_cast<const GpSystemServices_X_ThreadStartParams*>(lpThreadParameter);
|
||||||
|
|
||||||
|
GpSystemServices_X::ThreadFunc_t threadFunc = threadParams->m_threadFunc;
|
||||||
|
void *threadContext = threadParams->m_threadContext;
|
||||||
|
IGpThreadEvent *threadStartEvent = threadParams->m_threadStartEvent;
|
||||||
|
|
||||||
|
threadStartEvent->Signal();
|
||||||
|
|
||||||
|
return reinterpret_cast<void*>(static_cast<intptr_t>(threadFunc(threadContext)));
|
||||||
|
}
|
||||||
|
|
||||||
|
GpSystemServices_X::GpSystemServices_X()
|
||||||
|
: m_textInputEnabled(false)
|
||||||
|
, m_clipboardContents(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GpSystemServices_X::~GpSystemServices_X()
|
||||||
|
{
|
||||||
|
if (m_clipboardContents)
|
||||||
|
m_clipboardContents->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void *GpSystemServices_X::CreateThread(ThreadFunc_t threadFunc, void *context)
|
||||||
|
{
|
||||||
|
IGpThreadEvent *evt = CreateThreadEvent(true, false);
|
||||||
|
if (!evt)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
GpSystemServices_X_ThreadStartParams startParams;
|
||||||
|
startParams.m_threadContext = context;
|
||||||
|
startParams.m_threadFunc = threadFunc;
|
||||||
|
startParams.m_threadStartEvent = evt;
|
||||||
|
|
||||||
|
pthread_t thread = nullptr;
|
||||||
|
if (pthread_create(&thread, nullptr, StaticStartThread, &startParams) != 0)
|
||||||
|
{
|
||||||
|
evt->Destroy();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
evt->Wait();
|
||||||
|
evt->Destroy();
|
||||||
|
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpSystemServices_X::Beep() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpSystemServices_X::IsTouchscreen() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpSystemServices_X::IsUsingMouseAsTouch() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpSystemServices_X::IsTextInputObstructive() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpSystemServices_X::IsFullscreenPreferred() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpSystemServices_X::IsFullscreenOnStartup() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int GpSystemServices_X::GetCPUCount() const
|
||||||
|
{
|
||||||
|
return SDL_GetCPUCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpSystemServices_X::SetTextInputEnabled(bool isEnabled)
|
||||||
|
{
|
||||||
|
m_textInputEnabled = isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpSystemServices_X::IsTextInputEnabled() const
|
||||||
|
{
|
||||||
|
return m_textInputEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GpSystemServices_X::AreFontResourcesSeekable() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IGpClipboardContents *GpSystemServices_X::GetClipboardContents() const
|
||||||
|
{
|
||||||
|
return m_clipboardContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpSystemServices_X::SetClipboardContents(IGpClipboardContents *contents)
|
||||||
|
{
|
||||||
|
if (contents != m_clipboardContents)
|
||||||
|
{
|
||||||
|
if (m_clipboardContents)
|
||||||
|
m_clipboardContents->Destroy();
|
||||||
|
|
||||||
|
m_clipboardContents = contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GpSystemServices_X *GpSystemServices_X::GetInstance()
|
||||||
|
{
|
||||||
|
return &ms_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpSystemServices_X GpSystemServices_X::ms_instance;
|
||||||
35
AerofoilX/GpSystemServices_X.h
Normal file
35
AerofoilX/GpSystemServices_X.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GpSystemServices_POSIX.h"
|
||||||
|
#include "GpCoreDefs.h"
|
||||||
|
|
||||||
|
struct IGpClipboardContents;
|
||||||
|
|
||||||
|
class GpSystemServices_X final : public GpSystemServices_POSIX
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GpSystemServices_X();
|
||||||
|
~GpSystemServices_X();
|
||||||
|
|
||||||
|
void *CreateThread(ThreadFunc_t threadFunc, void *context) override;
|
||||||
|
void Beep() const override;
|
||||||
|
bool IsTouchscreen() const override;
|
||||||
|
bool IsUsingMouseAsTouch() const override;
|
||||||
|
bool IsTextInputObstructive() const override;
|
||||||
|
bool IsFullscreenPreferred() const override;
|
||||||
|
bool IsFullscreenOnStartup() const override;
|
||||||
|
unsigned int GetCPUCount() const override;
|
||||||
|
void SetTextInputEnabled(bool isEnabled) override;
|
||||||
|
bool IsTextInputEnabled() const override;
|
||||||
|
bool AreFontResourcesSeekable() const override;
|
||||||
|
IGpClipboardContents *GetClipboardContents() const override;
|
||||||
|
void SetClipboardContents(IGpClipboardContents *contents) override;
|
||||||
|
|
||||||
|
static GpSystemServices_X *GetInstance();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static GpSystemServices_X ms_instance;
|
||||||
|
|
||||||
|
IGpClipboardContents *m_clipboardContents;
|
||||||
|
bool m_textInputEnabled;
|
||||||
|
};
|
||||||
314
CMakeLists.txt
Normal file
314
CMakeLists.txt
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
project (Aerofoil)
|
||||||
|
|
||||||
|
message(${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
find_package(SDL2 REQUIRED)
|
||||||
|
|
||||||
|
add_definitions(-DGP_DEBUG_CONFIG=0)
|
||||||
|
|
||||||
|
add_library(stb STATIC
|
||||||
|
stb/stb_image_write.c
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(FreeType STATIC
|
||||||
|
FreeType/freetype/src/base/ftbase.c
|
||||||
|
FreeType/freetype/src/base/ftbitmap.c
|
||||||
|
FreeType/freetype/src/base/ftdebug.c
|
||||||
|
FreeType/freetype/src/base/ftinit.c
|
||||||
|
FreeType/freetype/src/base/ftsystem.c
|
||||||
|
FreeType/freetype/src/winfonts/winfnt.c
|
||||||
|
FreeType/freetype/src/autofit/autofit.c
|
||||||
|
FreeType/freetype/src/bdf/bdf.c
|
||||||
|
FreeType/freetype/src/cff/cff.c
|
||||||
|
FreeType/freetype/src/gzip/ftgzip.c
|
||||||
|
FreeType/freetype/src/lzw/ftlzw.c
|
||||||
|
FreeType/freetype/src/pcf/pcf.c
|
||||||
|
FreeType/freetype/src/pfr/pfr.c
|
||||||
|
FreeType/freetype/src/psaux/psaux.c
|
||||||
|
FreeType/freetype/src/pshinter/pshinter.c
|
||||||
|
FreeType/freetype/src/psnames/psnames.c
|
||||||
|
FreeType/freetype/src/raster/raster.c
|
||||||
|
FreeType/freetype/src/sfnt/sfnt.c
|
||||||
|
FreeType/freetype/src/smooth/smooth.c
|
||||||
|
FreeType/freetype/src/truetype/truetype.c
|
||||||
|
FreeType/freetype/src/type1/type1.c
|
||||||
|
FreeType/freetype/src/cid/type1cid.c
|
||||||
|
FreeType/freetype/src/type42/type42.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_options(FreeType PRIVATE -ansi)
|
||||||
|
target_compile_definitions(FreeType PRIVATE -DFT2_BUILD_LIBRARY)
|
||||||
|
|
||||||
|
target_include_directories(FreeType PRIVATE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FreeType/freetype/include>
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(GpFontHandler_FreeType2 STATIC
|
||||||
|
GpFontHandler_FreeType2/GpFontHandler_FreeType2.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(GpFontHandler_FreeType2 PRIVATE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpCommon>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FreeType/freetype/include>
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(GpFontHandler_FreeType2 FreeType)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(zlib STATIC
|
||||||
|
zlib/adler32.c
|
||||||
|
zlib/crc32.c
|
||||||
|
zlib/deflate.c
|
||||||
|
zlib/inffast.c
|
||||||
|
zlib/inflate.c
|
||||||
|
zlib/inftrees.c
|
||||||
|
zlib/trees.c
|
||||||
|
zlib/zutil.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(MacRomanConversion STATIC
|
||||||
|
MacRomanConversion/MacRomanConversion.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(PortabilityLayer STATIC
|
||||||
|
PortabilityLayer/AntiAliasTable.cpp
|
||||||
|
PortabilityLayer/AppEventHandler.cpp
|
||||||
|
PortabilityLayer/BinHex4.cpp
|
||||||
|
PortabilityLayer/BitmapImage.cpp
|
||||||
|
PortabilityLayer/ByteSwap.cpp
|
||||||
|
PortabilityLayer/CFileStream.cpp
|
||||||
|
PortabilityLayer/DeflateCodec.cpp
|
||||||
|
PortabilityLayer/DialogManager.cpp
|
||||||
|
PortabilityLayer/DisplayDeviceManager.cpp
|
||||||
|
PortabilityLayer/EllipsePlotter.cpp
|
||||||
|
PortabilityLayer/FileBrowserUI.cpp
|
||||||
|
PortabilityLayer/FileManager.cpp
|
||||||
|
PortabilityLayer/FileSectionStream.cpp
|
||||||
|
PortabilityLayer/FontFamily.cpp
|
||||||
|
PortabilityLayer/FontManager.cpp
|
||||||
|
PortabilityLayer/FontRenderer.cpp
|
||||||
|
PortabilityLayer/GPArchive.cpp
|
||||||
|
PortabilityLayer/HostSuspendHook.cpp
|
||||||
|
PortabilityLayer/IconLoader.cpp
|
||||||
|
PortabilityLayer/InflateStream.cpp
|
||||||
|
PortabilityLayer/InputManager.cpp
|
||||||
|
PortabilityLayer/LinePlotter.cpp
|
||||||
|
PortabilityLayer/MacBinary2.cpp
|
||||||
|
PortabilityLayer/MacFileInfo.cpp
|
||||||
|
PortabilityLayer/MacFileMem.cpp
|
||||||
|
PortabilityLayer/MemoryManager.cpp
|
||||||
|
PortabilityLayer/MemReaderStream.cpp
|
||||||
|
PortabilityLayer/MenuManager.cpp
|
||||||
|
PortabilityLayer/MMBlock.cpp
|
||||||
|
PortabilityLayer/MMHandleBlock.cpp
|
||||||
|
PortabilityLayer/PLApplication.cpp
|
||||||
|
PortabilityLayer/PLButtonWidget.cpp
|
||||||
|
PortabilityLayer/PLControlDefinitions.cpp
|
||||||
|
PortabilityLayer/PLCore.cpp
|
||||||
|
PortabilityLayer/PLCTabReducer.cpp
|
||||||
|
PortabilityLayer/PLDialogs.cpp
|
||||||
|
PortabilityLayer/PLDrivers.cpp
|
||||||
|
PortabilityLayer/PLEditboxWidget.cpp
|
||||||
|
PortabilityLayer/PLEventQueue.cpp
|
||||||
|
PortabilityLayer/PLHacks.cpp
|
||||||
|
PortabilityLayer/PLHandle.cpp
|
||||||
|
PortabilityLayer/PLIconWidget.cpp
|
||||||
|
PortabilityLayer/PLImageWidget.cpp
|
||||||
|
PortabilityLayer/PLInvisibleWidget.cpp
|
||||||
|
PortabilityLayer/PLKeyEncoding.cpp
|
||||||
|
PortabilityLayer/PLLabelWidget.cpp
|
||||||
|
PortabilityLayer/PLMenus.cpp
|
||||||
|
PortabilityLayer/PLMovies.cpp
|
||||||
|
PortabilityLayer/PLNumberFormatting.cpp
|
||||||
|
PortabilityLayer/PLPopupMenuWidget.cpp
|
||||||
|
PortabilityLayer/PLQDOffscreen.cpp
|
||||||
|
PortabilityLayer/PLQDraw.cpp
|
||||||
|
PortabilityLayer/PLResourceManager.cpp
|
||||||
|
PortabilityLayer/PLResources.cpp
|
||||||
|
PortabilityLayer/PLScrollBarWidget.cpp
|
||||||
|
PortabilityLayer/PLSound.cpp
|
||||||
|
PortabilityLayer/PLStandardColors.cpp
|
||||||
|
PortabilityLayer/PLStringCompare.cpp
|
||||||
|
PortabilityLayer/PLSysCalls.cpp
|
||||||
|
PortabilityLayer/PLTimeTaggedVOSEvent.cpp
|
||||||
|
PortabilityLayer/PLWidgets.cpp
|
||||||
|
PortabilityLayer/QDGraf.cpp
|
||||||
|
PortabilityLayer/QDManager.cpp
|
||||||
|
PortabilityLayer/QDPictDecoder.cpp
|
||||||
|
PortabilityLayer/QDPictEmitContext.cpp
|
||||||
|
PortabilityLayer/QDPictHeader.cpp
|
||||||
|
PortabilityLayer/QDPixMap.cpp
|
||||||
|
PortabilityLayer/QDPort.cpp
|
||||||
|
PortabilityLayer/QDStandardPalette.cpp
|
||||||
|
PortabilityLayer/RandomNumberGenerator.cpp
|
||||||
|
PortabilityLayer/ResolveCachingColor.cpp
|
||||||
|
PortabilityLayer/ResourceCompiledRef.cpp
|
||||||
|
PortabilityLayer/ResourceFile.cpp
|
||||||
|
PortabilityLayer/ScanlineMask.cpp
|
||||||
|
PortabilityLayer/ScanlineMaskBuilder.cpp
|
||||||
|
PortabilityLayer/ScanlineMaskConverter.cpp
|
||||||
|
PortabilityLayer/ScanlineMaskIterator.cpp
|
||||||
|
PortabilityLayer/SimpleGraphic.cpp
|
||||||
|
PortabilityLayer/TextPlacer.cpp
|
||||||
|
PortabilityLayer/UTF8.cpp
|
||||||
|
PortabilityLayer/UTF16.cpp
|
||||||
|
PortabilityLayer/WindowDef.cpp
|
||||||
|
PortabilityLayer/WindowManager.cpp
|
||||||
|
PortabilityLayer/WorkerThread.cpp
|
||||||
|
PortabilityLayer/XModemCRC.cpp
|
||||||
|
PortabilityLayer/ZipFileProxy.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(PortabilityLayer PRIVATE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpCommon>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/PortabilityLayer>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/zlib>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/MacRomanConversion>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/stb>
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_options(PortabilityLayer PRIVATE -Wno-multichar)
|
||||||
|
|
||||||
|
target_link_libraries(PortabilityLayer zlib MacRomanConversion stb)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(GpShell STATIC
|
||||||
|
GpShell/GpAppEnvironment.cpp
|
||||||
|
GpShell/GpAudioDriverFactory.cpp
|
||||||
|
GpShell/GpDisplayDriverFactory.cpp
|
||||||
|
GpShell/GpFontHandlerFactory.cpp
|
||||||
|
GpShell/GpGlobalConfig.cpp
|
||||||
|
GpShell/GpInputDriverFactory.cpp
|
||||||
|
GpShell/GpMain.cpp
|
||||||
|
GpShell/GpVOSEventQueue.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(GpShell PRIVATE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpCommon>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/PortabilityLayer>
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(GpApp STATIC
|
||||||
|
GpApp/About.cpp
|
||||||
|
GpApp/AnimCursor.cpp
|
||||||
|
GpApp/AppleEvents.cpp
|
||||||
|
GpApp/Banner.cpp
|
||||||
|
GpApp/ColorUtils.cpp
|
||||||
|
GpApp/Coordinates.cpp
|
||||||
|
GpApp/DialogUtils.cpp
|
||||||
|
GpApp/DynamicMaps.cpp
|
||||||
|
GpApp/Dynamics.cpp
|
||||||
|
GpApp/Dynamics2.cpp
|
||||||
|
GpApp/Dynamics3.cpp
|
||||||
|
GpApp/Environ.cpp
|
||||||
|
GpApp/Events.cpp
|
||||||
|
GpApp/FileError.cpp
|
||||||
|
GpApp/GameOver.cpp
|
||||||
|
GpApp/GpAppInterface.cpp
|
||||||
|
GpApp/Grease.cpp
|
||||||
|
GpApp/HighScores.cpp
|
||||||
|
GpApp/House.cpp
|
||||||
|
GpApp/HouseInfo.cpp
|
||||||
|
GpApp/HouseIO.cpp
|
||||||
|
GpApp/HouseLegal.cpp
|
||||||
|
GpApp/Input.cpp
|
||||||
|
GpApp/Interactions.cpp
|
||||||
|
GpApp/InterfaceInit.cpp
|
||||||
|
GpApp/Link.cpp
|
||||||
|
GpApp/Main.cpp
|
||||||
|
GpApp/MainMenuUI.cpp
|
||||||
|
GpApp/MainWindow.cpp
|
||||||
|
GpApp/Map.cpp
|
||||||
|
GpApp/Marquee.cpp
|
||||||
|
GpApp/Menu.cpp
|
||||||
|
GpApp/Modes.cpp
|
||||||
|
GpApp/Music.cpp
|
||||||
|
GpApp/ObjectAdd.cpp
|
||||||
|
GpApp/ObjectDraw.cpp
|
||||||
|
GpApp/ObjectDraw2.cpp
|
||||||
|
GpApp/ObjectDrawAll.cpp
|
||||||
|
GpApp/ObjectEdit.cpp
|
||||||
|
GpApp/ObjectInfo.cpp
|
||||||
|
GpApp/ObjectRects.cpp
|
||||||
|
GpApp/Objects.cpp
|
||||||
|
GpApp/Play.cpp
|
||||||
|
GpApp/Player.cpp
|
||||||
|
GpApp/Prefs.cpp
|
||||||
|
GpApp/RectUtils.cpp
|
||||||
|
GpApp/Render.cpp
|
||||||
|
GpApp/Room.cpp
|
||||||
|
GpApp/RoomGraphics.cpp
|
||||||
|
GpApp/RoomInfo.cpp
|
||||||
|
GpApp/RubberBands.cpp
|
||||||
|
GpApp/SavedGames.cpp
|
||||||
|
GpApp/Scoreboard.cpp
|
||||||
|
GpApp/Scrap.cpp
|
||||||
|
GpApp/SelectHouse.cpp
|
||||||
|
GpApp/Settings.cpp
|
||||||
|
GpApp/Sound.cpp
|
||||||
|
GpApp/SoundSync_Cpp11.cpp
|
||||||
|
GpApp/SourceExport.cpp
|
||||||
|
GpApp/StringUtils.cpp
|
||||||
|
GpApp/StructuresInit.cpp
|
||||||
|
GpApp/StructuresInit2.cpp
|
||||||
|
GpApp/Tools.cpp
|
||||||
|
GpApp/Transit.cpp
|
||||||
|
GpApp/Transitions.cpp
|
||||||
|
GpApp/Triggers.cpp
|
||||||
|
GpApp/Trip.cpp
|
||||||
|
GpApp/Utilities.cpp
|
||||||
|
GpApp/WindowUtils.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_options(GpApp PRIVATE -Wno-multichar)
|
||||||
|
|
||||||
|
target_include_directories(GpApp PRIVATE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpCommon>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/PortabilityLayer>
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(GpApp PortabilityLayer)
|
||||||
|
|
||||||
|
if(CMAKE_HOST_UNIX)
|
||||||
|
add_executable(AerofoilX
|
||||||
|
AerofoilPortable/GpSystemServices_POSIX.cpp
|
||||||
|
AerofoilPortable/GpThreadEvent_Cpp11.cpp
|
||||||
|
AerofoilPortable/GpFiber_Thread.cpp
|
||||||
|
AerofoilPortable/GpFiberStarter_Thread.cpp
|
||||||
|
AerofoilSDL/GpAudioDriver_SDL2.cpp
|
||||||
|
AerofoilSDL/GpDisplayDriver_SDL_GL2.cpp
|
||||||
|
AerofoilSDL/GpInputDriver_SDL_Gamepad.cpp
|
||||||
|
AerofoilSDL/ShaderCode/CopyQuadP.cpp
|
||||||
|
AerofoilSDL/ShaderCode/DrawQuad32P.cpp
|
||||||
|
AerofoilSDL/ShaderCode/DrawQuadPaletteP.cpp
|
||||||
|
AerofoilSDL/ShaderCode/DrawQuadV.cpp
|
||||||
|
AerofoilSDL/ShaderCode/ScaleQuadP.cpp
|
||||||
|
AerofoilX/GpMain_SDL_X.cpp
|
||||||
|
AerofoilX/GpLogDriver_X.cpp
|
||||||
|
AerofoilX/GpSystemServices_X.cpp
|
||||||
|
AerofoilX/GpFileSystem_X.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(AerofoilX PRIVATE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpCommon>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GpShell>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/AerofoilSDL>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/AerofoilPortable>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/PortabilityLayer>
|
||||||
|
${SDL2_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(AerofoilX ${SDL2_LIBRARIES} GpApp GpShell GpFontHandler_FreeType2)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
install (TARGETS AerofoilX)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#if __cplusplus >= 199711L
|
#if __cplusplus >= 199711L
|
||||||
#define GP_IS_CPP11 1
|
#define GP_IS_CPP11 1
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#define kSwitchDepthAlert 130
|
#define kSwitchDepthAlert 130
|
||||||
#define kSetMemoryAlert 180
|
#define kSetMemoryAlert 180
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "GpFilePos.h"
|
#include "GpFilePos.h"
|
||||||
|
|
||||||
class GpIOStream
|
class GpIOStream
|
||||||
|
|||||||
12
GpCommon/GpX.h
Normal file
12
GpCommon/GpX.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct IGpFiber;
|
||||||
|
struct IGpBWCursor_Win32;
|
||||||
|
struct IGpCursor_Win32;
|
||||||
|
struct IGpVOSEventQueue;
|
||||||
|
|
||||||
|
struct GpXGlobals
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
extern GpXGlobals g_gpXGlobals;
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
struct IGpAudioChannelCallbacks;
|
struct IGpAudioChannelCallbacks;
|
||||||
|
|
||||||
struct IGpAudioChannel
|
struct IGpAudioChannel
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "GpClipboardContentsType.h"
|
#include "GpClipboardContentsType.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
struct IGpClipboardContents
|
struct IGpClipboardContents
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "EGpStandardCursor.h"
|
#include "EGpStandardCursor.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
struct IGpDisplayDriverSurface;
|
struct IGpDisplayDriverSurface;
|
||||||
struct IGpCursor;
|
struct IGpCursor;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "VirtualDirectory.h"
|
#include "VirtualDirectory.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
class GpIOStream;
|
class GpIOStream;
|
||||||
struct IGpThreadRelay;
|
struct IGpThreadRelay;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "EGpInputDriverType.h"
|
#include "EGpInputDriverType.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
struct IGpLogDriver;
|
struct IGpLogDriver;
|
||||||
struct IGpSystemServices;
|
struct IGpSystemServices;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "IGpVOSEventQueue.h"
|
#include "IGpVOSEventQueue.h"
|
||||||
#include "GpVOSEvent.h"
|
#include "GpVOSEvent.h"
|
||||||
|
|||||||
@@ -8,61 +8,10 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
// TODO: This is not gamma correct...
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
void AntiAliasTable::GenerateForPalette(const RGBAColor &baseColorRef, const RGBAColor *colors, size_t numColors)
|
|
||||||
{
|
|
||||||
const RGBAColor baseColor = baseColorRef;
|
|
||||||
|
|
||||||
if (numColors > 256)
|
|
||||||
numColors = 256;
|
|
||||||
|
|
||||||
unsigned int baseCh[3] = { baseColor.r, baseColor.g, baseColor.b };
|
|
||||||
|
|
||||||
for (size_t i = 0; i < numColors; i++)
|
|
||||||
{
|
|
||||||
const RGBAColor existingColor = colors[i];
|
|
||||||
|
|
||||||
unsigned int existingCh[3] = { existingColor.r, existingColor.g, existingColor.b };
|
|
||||||
|
|
||||||
// 0 alpha is always the same color
|
|
||||||
m_aaTranslate[i][0] = static_cast<uint8_t>(i);
|
|
||||||
|
|
||||||
for (unsigned int b = 1; b < 16; b++)
|
|
||||||
{
|
|
||||||
unsigned int newCh[3];
|
|
||||||
|
|
||||||
for (unsigned int ch = 0; ch < 3; ch++)
|
|
||||||
newCh[ch] = (15 - b) * existingCh[ch] + b * baseCh[ch];
|
|
||||||
|
|
||||||
uint32_t bestError = 0xffffffffU;
|
|
||||||
size_t bestColor = 0;
|
|
||||||
for (size_t cmp = 0; cmp < numColors; cmp++)
|
|
||||||
{
|
|
||||||
int16_t existingChScaled[3] = { colors[cmp].r * 15, colors[cmp].g * 15, colors[cmp].b * 15 };
|
|
||||||
|
|
||||||
uint32_t error = 0;
|
|
||||||
for (unsigned int ch = 0; ch < 3; ch++)
|
|
||||||
{
|
|
||||||
int16_t delta = static_cast<int16_t>(newCh[ch]) - existingChScaled[ch];
|
|
||||||
error += static_cast<uint32_t>(delta * delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error < bestError)
|
|
||||||
{
|
|
||||||
bestError = error;
|
|
||||||
bestColor = cmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_aaTranslate[i][b] = static_cast<uint8_t>(bestColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
bool AntiAliasTable::LoadFromCache(const char *cacheFileName)
|
bool AntiAliasTable::LoadFromCache(const char *cacheFileName)
|
||||||
{
|
{
|
||||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, cacheFileName, false, GpFileCreationDispositions::kOpenExisting);
|
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, cacheFileName, false, GpFileCreationDispositions::kOpenExisting);
|
||||||
@@ -203,5 +152,4 @@ namespace PortabilityLayer
|
|||||||
if (cacheable)
|
if (cacheable)
|
||||||
SaveToCache(cacheFileName);
|
SaveToCache(cacheFileName);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
class GpIOStream;
|
class GpIOStream;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "VirtualDirectory.h"
|
#include "VirtualDirectory.h"
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "PLSysCalls.h"
|
#include "PLSysCalls.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "HostSuspendCallID.h"
|
#include "HostSuspendCallID.h"
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#define __PL_MEMORY_MANAGER_H__
|
#define __PL_MEMORY_MANAGER_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "PLErrorCodes.h"
|
#include "PLErrorCodes.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class ArrayViewIterator;
|
class ArrayViewIterator;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
class PLMainThreadRelay final : public IGpThreadRelay
|
class PLMainThreadRelay final : public IGpThreadRelay
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
struct Rect;
|
struct Rect;
|
||||||
class GpIOStream;
|
class GpIOStream;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "ScanlineMaskDataStorage.h"
|
#include "ScanlineMaskDataStorage.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "Vec2i.h"
|
#include "Vec2i.h"
|
||||||
|
|
||||||
class PLPasStr;
|
class PLPasStr;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "DataTypes.h"
|
#include "DataTypes.h"
|
||||||
#include "SmallestInt.h"
|
#include "SmallestInt.h"
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
class PLPasStr;
|
class PLPasStr;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __PL_XMODEMCRC_H__
|
#include <stdint.h>
|
||||||
#define __PL_XMODEMCRC_H__
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "DataTypes.h"
|
#include "DataTypes.h"
|
||||||
|
|
||||||
@@ -9,5 +9,3 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
uint16_t XModemCRC(const void *bytes, size_t size, uint16_t initialValue);
|
uint16_t XModemCRC(const void *bytes, size_t size, uint16_t initialValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user