mirror of https://github.com/OpenRCT2/OpenRCT2.git
Indent preprocessor directives
This commit is contained in:
parent
b02dfdbc93
commit
d787872cbe
|
@ -62,6 +62,7 @@ IncludeCategories:
|
|||
- Regex: '^<'
|
||||
Priority: 2
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
#ifdef __MACOSX__
|
||||
// macOS uses COMMAND rather than CTRL for many keyboard shortcuts
|
||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
||||
# define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
||||
#else
|
||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
|
||||
# define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
|
||||
#endif
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include "UiContext.h"
|
||||
# include "UiContext.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <dlfcn.h>
|
||||
#include <openrct2/common.h>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
# include <SDL.h>
|
||||
# include <dlfcn.h>
|
||||
# include <openrct2/common.h>
|
||||
# include <openrct2/core/String.hpp>
|
||||
# include <openrct2/ui/UiContext.h>
|
||||
# include <sstream>
|
||||
# include <stdexcept>
|
||||
|
||||
namespace OpenRCT2::Ui
|
||||
{
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
|
||||
#if (defined(__linux__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__)) && !defined(__ANDROID__)
|
||||
|
||||
#include "UiContext.h"
|
||||
# include "UiContext.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <dlfcn.h>
|
||||
#include <openrct2/common.h>
|
||||
#include <openrct2/core/Path.hpp>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
# include <SDL.h>
|
||||
# include <dlfcn.h>
|
||||
# include <openrct2/common.h>
|
||||
# include <openrct2/core/Path.hpp>
|
||||
# include <openrct2/core/String.hpp>
|
||||
# include <openrct2/localisation/Localisation.h>
|
||||
# include <openrct2/ui/UiContext.h>
|
||||
# include <sstream>
|
||||
# include <stdexcept>
|
||||
|
||||
namespace OpenRCT2::Ui
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
bool IsSteamOverlayAttached() override
|
||||
{
|
||||
#ifdef __linux__
|
||||
# ifdef __linux__
|
||||
// See http://syprog.blogspot.ru/2011/12/listing-loaded-shared-objects-in-linux.html
|
||||
struct lmap
|
||||
{
|
||||
|
@ -79,9 +79,9 @@ namespace OpenRCT2::Ui
|
|||
dlclose(processHandle);
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
# else
|
||||
return false; // Needed for OpenBSD, likely all other Unixes.
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
void ShowMessageBox(SDL_Window* window, const std::string& message) override
|
||||
|
@ -258,7 +258,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
static int32_t Execute(const std::string& command, std::string* output = nullptr)
|
||||
{
|
||||
#ifndef __EMSCRIPTEN__
|
||||
# ifndef __EMSCRIPTEN__
|
||||
log_verbose("executing \"%s\"...\n", command.c_str());
|
||||
FILE* fpipe = popen(command.c_str(), "r");
|
||||
if (fpipe == nullptr)
|
||||
|
@ -301,10 +301,10 @@ namespace OpenRCT2::Ui
|
|||
|
||||
// Return exit code
|
||||
return pclose(fpipe);
|
||||
#else
|
||||
# else
|
||||
log_warning("Emscripten cannot execute processes. The commandline was '%s'.", command.c_str());
|
||||
return -1;
|
||||
#endif // __EMSCRIPTEN__
|
||||
# endif // __EMSCRIPTEN__
|
||||
}
|
||||
|
||||
static std::string GetKDialogFilterString(const std::vector<FileDialogDesc::Filter> filters)
|
||||
|
|
|
@ -9,31 +9,31 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# ifdef __MINGW32__
|
||||
// 0x0600 == vista
|
||||
#define WINVER 0x0600
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#endif // __MINGW32__
|
||||
# define WINVER 0x0600
|
||||
# define _WIN32_WINNT 0x0600
|
||||
# endif // __MINGW32__
|
||||
|
||||
// Windows.h needs to be included first
|
||||
#include <windows.h>
|
||||
#undef CreateWindow
|
||||
# include <windows.h>
|
||||
# undef CreateWindow
|
||||
|
||||
// Then the rest
|
||||
#include "UiContext.h"
|
||||
# include "UiContext.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
#include <openrct2/common.h>
|
||||
#include <openrct2/core/Math.hpp>
|
||||
#include <openrct2/core/Path.hpp>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <shlobj.h>
|
||||
#include <sstream>
|
||||
# include <SDL2/SDL.h>
|
||||
# include <SDL2/SDL_syswm.h>
|
||||
# include <openrct2/common.h>
|
||||
# include <openrct2/core/Math.hpp>
|
||||
# include <openrct2/core/Path.hpp>
|
||||
# include <openrct2/core/String.hpp>
|
||||
# include <openrct2/ui/UiContext.h>
|
||||
# include <shlobj.h>
|
||||
# include <sstream>
|
||||
|
||||
// Native resource IDs
|
||||
#include "../../resources/resource.h"
|
||||
# include "../../resources/resource.h"
|
||||
|
||||
static std::wstring SHGetPathFromIDListLongPath(LPCITEMIDLIST pidl)
|
||||
{
|
||||
|
|
|
@ -51,9 +51,9 @@ using namespace OpenRCT2::Ui;
|
|||
|
||||
#ifdef __MACOSX__
|
||||
// macOS uses COMMAND rather than CTRL for many keyboard shortcuts
|
||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
||||
# define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
||||
#else
|
||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
|
||||
# define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
|
||||
#endif
|
||||
|
||||
class UiContext final : public IUiContext
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
|
||||
#include "UiContext.h"
|
||||
# include "UiContext.h"
|
||||
|
||||
#include <openrct2/common.h>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
# include <openrct2/common.h>
|
||||
# include <openrct2/core/String.hpp>
|
||||
# include <openrct2/ui/UiContext.h>
|
||||
|
||||
// undefine `interface` and `abstract`, because it's causing conflicts with Objective-C's keywords
|
||||
#undef interface
|
||||
#undef abstract
|
||||
# undef interface
|
||||
# undef abstract
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <SDL.h>
|
||||
#include <mach-o/dyld.h>
|
||||
# import <Cocoa/Cocoa.h>
|
||||
# include <SDL.h>
|
||||
# include <mach-o/dyld.h>
|
||||
|
||||
namespace OpenRCT2::Ui
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "ApplyPaletteShader.h"
|
||||
# include "ApplyPaletteShader.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "ApplyTransparencyShader.h"
|
||||
# include "ApplyTransparencyShader.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "DrawLineShader.h"
|
||||
# include "DrawLineShader.h"
|
||||
|
||||
#include "OpenGLFramebuffer.h"
|
||||
# include "OpenGLFramebuffer.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "DrawRectShader.h"
|
||||
# include "DrawRectShader.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -9,34 +9,34 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "OpenGLAPI.h"
|
||||
# include "OpenGLAPI.h"
|
||||
|
||||
#if OPENGL_NO_LINK
|
||||
# if OPENGL_NO_LINK
|
||||
|
||||
#define OPENGL_PROC(TYPE, PROC) TYPE PROC = nullptr;
|
||||
#include "OpenGLAPIProc.h"
|
||||
#undef OPENGL_PROC
|
||||
# define OPENGL_PROC(TYPE, PROC) TYPE PROC = nullptr;
|
||||
# include "OpenGLAPIProc.h"
|
||||
# undef OPENGL_PROC
|
||||
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
# include <SDL2/SDL_video.h>
|
||||
# include <openrct2/core/Console.hpp>
|
||||
|
||||
static const char* TryLoadAllProcAddresses()
|
||||
{
|
||||
#define OPENGL_PROC(TYPE, PROC) \
|
||||
{ \
|
||||
PROC = (TYPE)SDL_GL_GetProcAddress(#PROC); \
|
||||
if (PROC == nullptr) \
|
||||
{ \
|
||||
return #PROC; \
|
||||
} \
|
||||
}
|
||||
#include "OpenGLAPIProc.h"
|
||||
#undef OPENGL_PROC
|
||||
# define OPENGL_PROC(TYPE, PROC) \
|
||||
{ \
|
||||
PROC = (TYPE)SDL_GL_GetProcAddress(#PROC); \
|
||||
if (PROC == nullptr) \
|
||||
{ \
|
||||
return #PROC; \
|
||||
} \
|
||||
}
|
||||
# include "OpenGLAPIProc.h"
|
||||
# undef OPENGL_PROC
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif /* #if OPENGL_NO_LINK */
|
||||
# endif /* #if OPENGL_NO_LINK */
|
||||
|
||||
namespace OpenGLState
|
||||
{
|
||||
|
@ -63,14 +63,14 @@ bool OpenGLAPI::Initialise()
|
|||
{
|
||||
OpenGLState::Reset();
|
||||
|
||||
#ifdef OPENGL_NO_LINK
|
||||
# ifdef OPENGL_NO_LINK
|
||||
const char* failedProcName = TryLoadAllProcAddresses();
|
||||
if (failedProcName != nullptr)
|
||||
{
|
||||
Console::Error::WriteLine("Failed to load %s.", failedProcName);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,30 +14,30 @@
|
|||
#ifdef OPENGL_NO_LINK
|
||||
|
||||
// BEGIN [Do not define 1.1 function signatures]
|
||||
#define glActiveTexture __static__glActiveTexture
|
||||
#define glBegin __static__glBegin
|
||||
#define glBindTexture __static__glBindTexture
|
||||
#define glBlendFunc __static__glBlendFunc
|
||||
#define glClear __static__glClear
|
||||
#define glClearColor __static__glClearColor
|
||||
#define glCullFace __static__glCullFace
|
||||
#define glDeleteTextures __static__glDeleteTextures
|
||||
#define glDepthFunc __static__glDepthFunc
|
||||
#define glDisable __static__glDisable
|
||||
#define glDrawArrays __static__glDrawArrays
|
||||
#define glEnable __static__glEnable
|
||||
#define glEnd __static__glEnd
|
||||
#define glGenTextures __static__glGenTextures
|
||||
#define glGetError __static__glGetError
|
||||
#define glPixelStorei __static__glPixelStorei
|
||||
#define glReadPixels __static__glReadPixels
|
||||
#define glTexImage2D __static__glTexImage2D
|
||||
#define glTexParameteri __static__glTexParameteri
|
||||
#define glViewport __static__glViewport
|
||||
#define glTexSubImage3D __static__glTexSubImage3D
|
||||
#define glTexImage3D __static__glTexImage3D
|
||||
#define glGetIntegerv __static__glGetIntegerv
|
||||
#define glGetTexImage __static__glGetTexImage
|
||||
# define glActiveTexture __static__glActiveTexture
|
||||
# define glBegin __static__glBegin
|
||||
# define glBindTexture __static__glBindTexture
|
||||
# define glBlendFunc __static__glBlendFunc
|
||||
# define glClear __static__glClear
|
||||
# define glClearColor __static__glClearColor
|
||||
# define glCullFace __static__glCullFace
|
||||
# define glDeleteTextures __static__glDeleteTextures
|
||||
# define glDepthFunc __static__glDepthFunc
|
||||
# define glDisable __static__glDisable
|
||||
# define glDrawArrays __static__glDrawArrays
|
||||
# define glEnable __static__glEnable
|
||||
# define glEnd __static__glEnd
|
||||
# define glGenTextures __static__glGenTextures
|
||||
# define glGetError __static__glGetError
|
||||
# define glPixelStorei __static__glPixelStorei
|
||||
# define glReadPixels __static__glReadPixels
|
||||
# define glTexImage2D __static__glTexImage2D
|
||||
# define glTexParameteri __static__glTexParameteri
|
||||
# define glViewport __static__glViewport
|
||||
# define glTexSubImage3D __static__glTexSubImage3D
|
||||
# define glTexImage3D __static__glTexImage3D
|
||||
# define glGetIntegerv __static__glGetIntegerv
|
||||
# define glGetTexImage __static__glGetTexImage
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -48,30 +48,30 @@
|
|||
#ifdef OPENGL_NO_LINK
|
||||
|
||||
// END [Do not define 1.1 function signatures]
|
||||
#undef glActiveTexture
|
||||
#undef glBegin
|
||||
#undef glBindTexture
|
||||
#undef glBlendFunc
|
||||
#undef glClear
|
||||
#undef glClearColor
|
||||
#undef glCullFace
|
||||
#undef glDeleteTextures
|
||||
#undef glDepthFunc
|
||||
#undef glDisable
|
||||
#undef glDrawArrays
|
||||
#undef glEnable
|
||||
#undef glEnd
|
||||
#undef glGenTextures
|
||||
#undef glGetError
|
||||
#undef glPixelStorei
|
||||
#undef glReadPixels
|
||||
#undef glTexImage2D
|
||||
#undef glTexParameteri
|
||||
#undef glViewport
|
||||
#undef glTexSubImage3D
|
||||
#undef glTexImage3D
|
||||
#undef glGetIntegerv
|
||||
#undef glGetTexImage
|
||||
# undef glActiveTexture
|
||||
# undef glBegin
|
||||
# undef glBindTexture
|
||||
# undef glBlendFunc
|
||||
# undef glClear
|
||||
# undef glClearColor
|
||||
# undef glCullFace
|
||||
# undef glDeleteTextures
|
||||
# undef glDepthFunc
|
||||
# undef glDisable
|
||||
# undef glDrawArrays
|
||||
# undef glEnable
|
||||
# undef glEnd
|
||||
# undef glGenTextures
|
||||
# undef glGetError
|
||||
# undef glPixelStorei
|
||||
# undef glReadPixels
|
||||
# undef glTexImage2D
|
||||
# undef glTexParameteri
|
||||
# undef glViewport
|
||||
# undef glTexSubImage3D
|
||||
# undef glTexImage3D
|
||||
# undef glGetIntegerv
|
||||
# undef glGetTexImage
|
||||
|
||||
// 1.1 function signatures
|
||||
typedef void(APIENTRYP PFNGLBEGINPROC)(GLenum mode);
|
||||
|
@ -105,9 +105,9 @@ typedef void(APIENTRYP PFNGLTEXIMAGE3DPROC)(
|
|||
typedef void(APIENTRYP PFNGLGETINTERGERVPROC)(GLenum pname, GLint* data);
|
||||
typedef void(APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid* img);
|
||||
|
||||
#define OPENGL_PROC(TYPE, PROC) extern TYPE PROC;
|
||||
#include "OpenGLAPIProc.h"
|
||||
#undef OPENGL_PROC
|
||||
# define OPENGL_PROC(TYPE, PROC) extern TYPE PROC;
|
||||
# include "OpenGLAPIProc.h"
|
||||
# undef OPENGL_PROC
|
||||
|
||||
#endif /* OPENGL_NO_LINK */
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#ifndef OPENGL_PROC
|
||||
#error "Do not include OpenGLAPIProc.h directly. Include OpenGLAPI.h instead."
|
||||
# error "Do not include OpenGLAPIProc.h directly. Include OpenGLAPI.h instead."
|
||||
#endif
|
||||
|
||||
// 1.1 function pointers
|
||||
|
|
|
@ -9,33 +9,33 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "../DrawingEngineFactory.hpp"
|
||||
#include "ApplyPaletteShader.h"
|
||||
#include "DrawCommands.h"
|
||||
#include "DrawLineShader.h"
|
||||
#include "DrawRectShader.h"
|
||||
#include "GLSLTypes.h"
|
||||
#include "OpenGLAPI.h"
|
||||
#include "OpenGLFramebuffer.h"
|
||||
#include "SwapFramebuffer.h"
|
||||
#include "TextureCache.h"
|
||||
#include "TransparencyDepth.h"
|
||||
# include "../DrawingEngineFactory.hpp"
|
||||
# include "ApplyPaletteShader.h"
|
||||
# include "DrawCommands.h"
|
||||
# include "DrawLineShader.h"
|
||||
# include "DrawRectShader.h"
|
||||
# include "GLSLTypes.h"
|
||||
# include "OpenGLAPI.h"
|
||||
# include "OpenGLFramebuffer.h"
|
||||
# include "SwapFramebuffer.h"
|
||||
# include "TextureCache.h"
|
||||
# include "TransparencyDepth.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2/Intro.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/IDrawingContext.h>
|
||||
#include <openrct2/drawing/IDrawingEngine.h>
|
||||
#include <openrct2/drawing/LightFX.h>
|
||||
#include <openrct2/drawing/Rain.h>
|
||||
#include <openrct2/interface/Screenshot.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <unordered_map>
|
||||
# include <SDL2/SDL.h>
|
||||
# include <algorithm>
|
||||
# include <cmath>
|
||||
# include <openrct2-ui/interface/Window.h>
|
||||
# include <openrct2/Intro.h>
|
||||
# include <openrct2/config/Config.h>
|
||||
# include <openrct2/core/Console.hpp>
|
||||
# include <openrct2/drawing/Drawing.h>
|
||||
# include <openrct2/drawing/IDrawingContext.h>
|
||||
# include <openrct2/drawing/IDrawingEngine.h>
|
||||
# include <openrct2/drawing/LightFX.h>
|
||||
# include <openrct2/drawing/Rain.h>
|
||||
# include <openrct2/interface/Screenshot.h>
|
||||
# include <openrct2/ui/UiContext.h>
|
||||
# include <unordered_map>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Drawing;
|
||||
|
@ -148,9 +148,9 @@ public:
|
|||
{
|
||||
_window = (SDL_Window*)_uiContext->GetWindow();
|
||||
_drawingContext = new OpenGLDrawingContext(this);
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
# ifdef __ENABLE_LIGHTFX__
|
||||
lightfx_set_available(false);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
~OpenGLDrawingEngine() override
|
||||
|
@ -941,9 +941,9 @@ void OpenGLDrawingContext::HandleTransparency()
|
|||
void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo* dpi)
|
||||
{
|
||||
rct_drawpixelinfo* screenDPI = _engine->GetDPI();
|
||||
#ifndef NDEBUG
|
||||
# ifndef NDEBUG
|
||||
size_t bitsSize = (size_t)screenDPI->height * (size_t)(screenDPI->width + screenDPI->pitch);
|
||||
#endif
|
||||
# endif
|
||||
size_t bitsOffset = (size_t)(dpi->bits - screenDPI->bits);
|
||||
|
||||
assert(bitsOffset < bitsSize);
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "OpenGLFramebuffer.h"
|
||||
# include "OpenGLFramebuffer.h"
|
||||
|
||||
#include <SDL2/SDL_video.h>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <openrct2/common.h>
|
||||
# include <SDL2/SDL_video.h>
|
||||
# include <algorithm>
|
||||
# include <memory>
|
||||
# include <openrct2/common.h>
|
||||
|
||||
constexpr GLuint BACKBUFFER_ID = 0;
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "OpenGLShaderProgram.h"
|
||||
# include "OpenGLShaderProgram.h"
|
||||
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/core/FileStream.hpp>
|
||||
#include <openrct2/core/Path.hpp>
|
||||
#include <openrct2/core/String.hpp>
|
||||
# include <openrct2/Context.h>
|
||||
# include <openrct2/PlatformEnvironment.h>
|
||||
# include <openrct2/core/Console.hpp>
|
||||
# include <openrct2/core/FileStream.hpp>
|
||||
# include <openrct2/core/Path.hpp>
|
||||
# include <openrct2/core/String.hpp>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "SwapFramebuffer.h"
|
||||
# include "SwapFramebuffer.h"
|
||||
|
||||
#include "OpenGLFramebuffer.h"
|
||||
# include "OpenGLFramebuffer.h"
|
||||
|
||||
constexpr GLfloat depthValue[1] = { 1.0f };
|
||||
constexpr GLfloat depthValueTransparent[1] = { 0.0f };
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "TextureCache.h"
|
||||
# include "TextureCache.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
# include <algorithm>
|
||||
# include <openrct2/drawing/Drawing.h>
|
||||
# include <stdexcept>
|
||||
# include <vector>
|
||||
|
||||
constexpr uint32_t UNUSED_INDEX = 0xFFFFFFFF;
|
||||
|
||||
|
@ -245,9 +245,9 @@ AtlasTextureInfo TextureCache::AllocateImage(int32_t imageWidth, int32_t imageHe
|
|||
int32_t atlasIndex = (int32_t)_atlases.size();
|
||||
int32_t atlasSize = (int32_t)powf(2, (float)Atlas::CalculateImageSizeOrder(imageWidth, imageHeight));
|
||||
|
||||
#ifdef DEBUG
|
||||
# ifdef DEBUG
|
||||
log_verbose("new texture atlas #%d (size %d) allocated\n", atlasIndex, atlasSize);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
_atlases.emplace_back(atlasIndex, atlasSize);
|
||||
_atlases.back().Initialise(_atlasesTextureDimensions, _atlasesTextureDimensions);
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include "TransparencyDepth.h"
|
||||
# include "TransparencyDepth.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
# include <algorithm>
|
||||
# include <map>
|
||||
# include <vector>
|
||||
|
||||
/*
|
||||
* Structure to store locations of vertical bounding box edge.
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
#define ALT 0x400
|
||||
#define CMD 0x800
|
||||
#ifdef __MACOSX__
|
||||
#define PLATFORM_MODIFIER CMD
|
||||
# define PLATFORM_MODIFIER CMD
|
||||
#else
|
||||
#define PLATFORM_MODIFIER CTRL
|
||||
# define PLATFORM_MODIFIER CTRL
|
||||
#endif
|
||||
|
||||
enum
|
||||
|
|
|
@ -76,7 +76,7 @@ static FILE* fopen_utf8(const char* path, const char* mode)
|
|||
return file;
|
||||
}
|
||||
|
||||
#define fopen fopen_utf8
|
||||
# define fopen fopen_utf8
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
# include <emscripten.h>
|
||||
#endif // __EMSCRIPTEN__
|
||||
#include "Context.h"
|
||||
#include "Editor.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <cstdio>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
# include <android/log.h>
|
||||
#endif
|
||||
|
||||
[[maybe_unused]] static bool _log_location_enabled = true;
|
||||
|
|
|
@ -45,28 +45,28 @@ enum DIAGNOSTIC_LEVEL
|
|||
*/
|
||||
|
||||
#if defined(DEBUG)
|
||||
#if DEBUG > 0
|
||||
#define DEBUG_LEVEL_1 1
|
||||
#if DEBUG > 1
|
||||
#define DEBUG_LEVEL_2 1
|
||||
#if DEBUG > 2
|
||||
#define DEBUG_LEVEL_3 1
|
||||
# if DEBUG > 0
|
||||
# define DEBUG_LEVEL_1 1
|
||||
# if DEBUG > 1
|
||||
# define DEBUG_LEVEL_2 1
|
||||
# if DEBUG > 2
|
||||
# define DEBUG_LEVEL_3 1
|
||||
# else
|
||||
# define DEBUG_LEVEL_3 0
|
||||
# endif // DEBUG > 2
|
||||
# else
|
||||
# define DEBUG_LEVEL_3 0
|
||||
# define DEBUG_LEVEL_2 0
|
||||
# endif // DEBUG > 1
|
||||
# else
|
||||
# define DEBUG_LEVEL_1 0
|
||||
# define DEBUG_LEVEL_2 0
|
||||
# define DEBUG_LEVEL_3 0
|
||||
# endif // DEBUG > 0
|
||||
#else
|
||||
#define DEBUG_LEVEL_3 0
|
||||
#endif // DEBUG > 2
|
||||
#else
|
||||
#define DEBUG_LEVEL_3 0
|
||||
#define DEBUG_LEVEL_2 0
|
||||
#endif // DEBUG > 1
|
||||
#else
|
||||
#define DEBUG_LEVEL_1 0
|
||||
#define DEBUG_LEVEL_2 0
|
||||
#define DEBUG_LEVEL_3 0
|
||||
#endif // DEBUG > 0
|
||||
#else
|
||||
#define DEBUG_LEVEL_3 0
|
||||
#define DEBUG_LEVEL_2 0
|
||||
#define DEBUG_LEVEL_1 0
|
||||
# define DEBUG_LEVEL_3 0
|
||||
# define DEBUG_LEVEL_2 0
|
||||
# define DEBUG_LEVEL_1 0
|
||||
#endif // defined(DEBUG)
|
||||
|
||||
extern bool _log_levels[DIAGNOSTIC_LEVEL_COUNT];
|
||||
|
@ -76,11 +76,11 @@ void diagnostic_log_with_location(
|
|||
DIAGNOSTIC_LEVEL diagnosticLevel, const char* file, const char* function, int32_t line, const char* format, ...);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define diagnostic_log_macro(level, format, ...) \
|
||||
diagnostic_log_with_location(level, __FILE__, __FUNCTION__, __LINE__, format, ##__VA_ARGS__)
|
||||
# define diagnostic_log_macro(level, format, ...) \
|
||||
diagnostic_log_with_location(level, __FILE__, __FUNCTION__, __LINE__, format, ##__VA_ARGS__)
|
||||
#else
|
||||
#define diagnostic_log_macro(level, format, ...) \
|
||||
diagnostic_log_with_location(level, __FILE__, __func__, __LINE__, format, ##__VA_ARGS__)
|
||||
# define diagnostic_log_macro(level, format, ...) \
|
||||
diagnostic_log_with_location(level, __FILE__, __func__, __LINE__, format, ##__VA_ARGS__)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#define log_fatal(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_FATAL, format, ##__VA_ARGS__)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <string>
|
||||
|
||||
#ifdef OPENRCT2_BUILD_INFO_HEADER
|
||||
#include OPENRCT2_BUILD_INFO_HEADER
|
||||
# include OPENRCT2_BUILD_INFO_HEADER
|
||||
#endif
|
||||
|
||||
const char gVersionInfoFull[] = OPENRCT2_NAME ", "
|
||||
|
@ -23,16 +23,16 @@ const char gVersionInfoFull[] = OPENRCT2_NAME ", "
|
|||
#endif
|
||||
#if defined(OPENRCT2_BRANCH) || defined(OPENRCT2_COMMIT_SHA1_SHORT) || !defined(NDEBUG)
|
||||
" ("
|
||||
#if defined(OPENRCT2_BRANCH) && defined(OPENRCT2_COMMIT_SHA1_SHORT)
|
||||
# if defined(OPENRCT2_BRANCH) && defined(OPENRCT2_COMMIT_SHA1_SHORT)
|
||||
OPENRCT2_COMMIT_SHA1_SHORT " on " OPENRCT2_BRANCH
|
||||
#elif defined(OPENRCT2_COMMIT_SHA1_SHORT)
|
||||
# elif defined(OPENRCT2_COMMIT_SHA1_SHORT)
|
||||
OPENRCT2_COMMIT_SHA1_SHORT
|
||||
#elif defined(OPENRCT2_BRANCH)
|
||||
# elif defined(OPENRCT2_BRANCH)
|
||||
OPENRCT2_BRANCH
|
||||
#endif
|
||||
#ifndef NDEBUG
|
||||
# endif
|
||||
# ifndef NDEBUG
|
||||
", DEBUG"
|
||||
#endif
|
||||
# endif
|
||||
")"
|
||||
#endif
|
||||
#ifdef OPENRCT2_BUILD_SERVER
|
||||
|
|
|
@ -15,60 +15,60 @@
|
|||
#define OPENRCT2_VERSION "0.2.0"
|
||||
|
||||
#if defined(__amd64__) || defined(_M_AMD64)
|
||||
#define OPENRCT2_ARCHITECTURE "x86-64"
|
||||
# define OPENRCT2_ARCHITECTURE "x86-64"
|
||||
#elif defined(__i386__) || defined(_M_IX86)
|
||||
#define OPENRCT2_ARCHITECTURE "x86"
|
||||
# define OPENRCT2_ARCHITECTURE "x86"
|
||||
#elif defined(__aarch64__)
|
||||
#define OPENRCT2_ARCHITECTURE "AArch64"
|
||||
# define OPENRCT2_ARCHITECTURE "AArch64"
|
||||
#elif defined(__arm__) || defined(_M_ARM)
|
||||
#if defined(__ARM_ARCH_7A__)
|
||||
#define OPENRCT2_ARCHITECTURE "arm-v7a"
|
||||
#else
|
||||
#define OPENRCT2_ARCHITECTURE "arm"
|
||||
#endif
|
||||
# if defined(__ARM_ARCH_7A__)
|
||||
# define OPENRCT2_ARCHITECTURE "arm-v7a"
|
||||
# else
|
||||
# define OPENRCT2_ARCHITECTURE "arm"
|
||||
# endif
|
||||
#elif defined(__powerpc__) || defined(_M_PPC)
|
||||
#define OPENRCT2_ARCHITECTURE "PowerPC"
|
||||
# define OPENRCT2_ARCHITECTURE "PowerPC"
|
||||
#elif defined(__mips64)
|
||||
#define OPENRCT2_ARCHITECTURE "mips64"
|
||||
# define OPENRCT2_ARCHITECTURE "mips64"
|
||||
#elif defined(__mips__)
|
||||
#define OPENRCT2_ARCHITECTURE "mips"
|
||||
# define OPENRCT2_ARCHITECTURE "mips"
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#define OPENRCT2_ARCHITECTURE "Emscripten"
|
||||
# define OPENRCT2_ARCHITECTURE "Emscripten"
|
||||
#endif
|
||||
|
||||
#ifndef OPENRCT2_ARCHITECTURE
|
||||
#error "OPENRCT2_ARCHITECTURE is undefined. Please add identification."
|
||||
# error "OPENRCT2_ARCHITECTURE is undefined. Please add identification."
|
||||
#endif
|
||||
|
||||
// Platform
|
||||
#ifdef _WIN32
|
||||
#define OPENRCT2_PLATFORM "Windows"
|
||||
# define OPENRCT2_PLATFORM "Windows"
|
||||
#endif
|
||||
#if defined(__linux__) && !defined(__ANDROID__)
|
||||
#define OPENRCT2_PLATFORM "Linux"
|
||||
# define OPENRCT2_PLATFORM "Linux"
|
||||
#endif
|
||||
#if (defined(__APPLE__) && defined(__MACH__))
|
||||
#define OPENRCT2_PLATFORM "macOS"
|
||||
# define OPENRCT2_PLATFORM "macOS"
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#define OPENRCT2_PLATFORM "FreeBSD"
|
||||
# define OPENRCT2_PLATFORM "FreeBSD"
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
#define OPENRCT2_PLATFORM "Android"
|
||||
# define OPENRCT2_PLATFORM "Android"
|
||||
#endif
|
||||
#ifdef __OpenBSD__
|
||||
#define OPENRCT2_PLATFORM "OpenBSD"
|
||||
# define OPENRCT2_PLATFORM "OpenBSD"
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#define OPENRCT2_PLATFORM "Emscripten"
|
||||
# define OPENRCT2_PLATFORM "Emscripten"
|
||||
#endif
|
||||
#ifndef OPENRCT2_PLATFORM
|
||||
#error Unknown platform!
|
||||
# error Unknown platform!
|
||||
#endif
|
||||
|
||||
#ifndef OPENRCT2_CUSTOM_INFO
|
||||
#define OPENRCT2_CUSTOM_INFO ""
|
||||
# define OPENRCT2_CUSTOM_INFO ""
|
||||
#endif
|
||||
|
||||
extern const char gVersionInfoFull[];
|
||||
|
|
|
@ -52,9 +52,9 @@ namespace GA_FLAGS
|
|||
} // namespace GA_FLAGS
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
};
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
template<uint32_t TType, typename TResultType> struct GameActionBase : GameAction
|
||||
|
|
|
@ -49,10 +49,10 @@ namespace OpenRCT2::Audio
|
|||
} // namespace OpenRCT2::Audio
|
||||
|
||||
#ifndef DSBPAN_LEFT
|
||||
#define DSBPAN_LEFT (-10000)
|
||||
# define DSBPAN_LEFT (-10000)
|
||||
#endif
|
||||
#ifndef DSBPAN_RIGHT
|
||||
#define DSBPAN_RIGHT 10000
|
||||
# define DSBPAN_RIGHT 10000
|
||||
#endif
|
||||
|
||||
void Mixer_Init(const char* device);
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
#include <memory>
|
||||
|
||||
#ifdef USE_BREAKPAD
|
||||
#define IMPLIES_SILENT_BREAKPAD ", implies --silent-breakpad"
|
||||
# define IMPLIES_SILENT_BREAKPAD ", implies --silent-breakpad"
|
||||
#else
|
||||
#define IMPLIES_SILENT_BREAKPAD
|
||||
# define IMPLIES_SILENT_BREAKPAD
|
||||
#endif // USE_BREAKPAD
|
||||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#define _COMMON_H_
|
||||
|
||||
#ifndef _USE_MATH_DEFINES
|
||||
#define _USE_MATH_DEFINES
|
||||
# define _USE_MATH_DEFINES
|
||||
#endif
|
||||
#undef M_PI
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <ctime>
|
||||
# include <ctime>
|
||||
#endif
|
||||
|
||||
#include "Diagnostic.h"
|
||||
|
@ -35,7 +35,7 @@ using utf16string = utf16*;
|
|||
// Define MAX_PATH for various headers that don't want to include system headers
|
||||
// just for MAX_PATH
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
# define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
using codepoint_t = uint32_t;
|
||||
|
@ -60,22 +60,22 @@ using colour_t = uint8_t;
|
|||
#define nameof(symbol) #symbol
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <unistd.h>
|
||||
#define STUB() log_warning("Function %s at %s:%d is a stub.\n", __PRETTY_FUNCTION__, __FILE__, __LINE__)
|
||||
#define _strcmpi _stricmp
|
||||
#define _stricmp(x, y) strcasecmp((x), (y))
|
||||
#define _strnicmp(x, y, n) strncasecmp((x), (y), (n))
|
||||
#define _strdup(x) strdup((x))
|
||||
# include <unistd.h>
|
||||
# define STUB() log_warning("Function %s at %s:%d is a stub.\n", __PRETTY_FUNCTION__, __FILE__, __LINE__)
|
||||
# define _strcmpi _stricmp
|
||||
# define _stricmp(x, y) strcasecmp((x), (y))
|
||||
# define _strnicmp(x, y, n) strncasecmp((x), (y), (n))
|
||||
# define _strdup(x) strdup((x))
|
||||
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#define RCT2_ENDIANESS __ORDER_LITTLE_ENDIAN__
|
||||
#define LOBYTE(w) ((uint8_t)(w))
|
||||
#define HIBYTE(w) ((uint8_t)(((uint16_t)(w) >> 8) & 0xFF))
|
||||
#endif // __BYTE_ORDER__
|
||||
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define RCT2_ENDIANESS __ORDER_LITTLE_ENDIAN__
|
||||
# define LOBYTE(w) ((uint8_t)(w))
|
||||
# define HIBYTE(w) ((uint8_t)(((uint16_t)(w) >> 8) & 0xFF))
|
||||
# endif // __BYTE_ORDER__
|
||||
|
||||
#ifndef RCT2_ENDIANESS
|
||||
#error Unknown endianess!
|
||||
#endif // RCT2_ENDIANESS
|
||||
# ifndef RCT2_ENDIANESS
|
||||
# error Unknown endianess!
|
||||
# endif // RCT2_ENDIANESS
|
||||
|
||||
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
|
||||
|
@ -87,7 +87,7 @@ char* strndup(const char* src, size_t size);
|
|||
|
||||
// BSD and macOS have MAP_ANON instead of MAP_ANONYMOUS
|
||||
#ifndef MAP_ANONYMOUS
|
||||
#define MAP_ANONYMOUS MAP_ANON
|
||||
# define MAP_ANONYMOUS MAP_ANON
|
||||
#endif
|
||||
|
||||
#define OPENRCT2_MASTER_SERVER_URL "https://servers.openrct2.io"
|
||||
|
@ -151,24 +151,24 @@ using rct_string_id = uint16_t;
|
|||
} while (false)
|
||||
|
||||
#ifndef interface
|
||||
#define interface struct
|
||||
# define interface struct
|
||||
#endif
|
||||
#define abstract = 0
|
||||
|
||||
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
|
||||
#define OPENRCT2_X86
|
||||
# define OPENRCT2_X86
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_X64) || defined(_M_IX86)) // VS2008
|
||||
#define OPENRCT2_X86
|
||||
# define OPENRCT2_X86
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(_M_IX86)
|
||||
#define PLATFORM_X86
|
||||
# define PLATFORM_X86
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__) || defined(_WIN64)
|
||||
#define PLATFORM_64BIT
|
||||
# define PLATFORM_64BIT
|
||||
#else
|
||||
#define PLATFORM_32BIT
|
||||
# define PLATFORM_32BIT
|
||||
#endif
|
||||
|
||||
// C99's restrict keywords guarantees the pointer in question, for the whole of its lifetime,
|
||||
|
@ -176,26 +176,26 @@ using rct_string_id = uint16_t;
|
|||
// aliasing the same memory area. Using it lets compiler generate better code. If your compiler
|
||||
// does not support it, feel free to drop it, at some performance hit.
|
||||
#ifdef _MSC_VER
|
||||
#define RESTRICT __restrict
|
||||
# define RESTRICT __restrict
|
||||
#else
|
||||
#define RESTRICT __restrict__
|
||||
# define RESTRICT __restrict__
|
||||
#endif
|
||||
|
||||
#define assert_struct_size(x, y) static_assert(sizeof(x) == (y), "Improper struct size")
|
||||
|
||||
#ifdef PLATFORM_X86
|
||||
#ifndef FASTCALL
|
||||
#ifdef __GNUC__
|
||||
#define FASTCALL __attribute__((fastcall))
|
||||
#elif defined(_MSC_VER)
|
||||
#define FASTCALL __fastcall
|
||||
#else
|
||||
#pragma message "Not using fastcall calling convention, please check your compiler support"
|
||||
#define FASTCALL
|
||||
#endif
|
||||
#endif // FASTCALL
|
||||
#else // PLATFORM_X86
|
||||
#define FASTCALL
|
||||
# ifndef FASTCALL
|
||||
# ifdef __GNUC__
|
||||
# define FASTCALL __attribute__((fastcall))
|
||||
# elif defined(_MSC_VER)
|
||||
# define FASTCALL __fastcall
|
||||
# else
|
||||
# pragma message "Not using fastcall calling convention, please check your compiler support"
|
||||
# define FASTCALL
|
||||
# endif
|
||||
# endif // FASTCALL
|
||||
#else // PLATFORM_X86
|
||||
# define FASTCALL
|
||||
#endif // PLATFORM_X86
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "Crypt.h"
|
||||
# include "Crypt.h"
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/pem.h>
|
||||
# include <stdexcept>
|
||||
# include <string>
|
||||
# include <vector>
|
||||
|
||||
using namespace Crypt;
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#if defined(DEBUG) && defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "Diagnostics.hpp"
|
||||
|
@ -19,12 +19,12 @@ namespace Debug
|
|||
void Break()
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
#if defined(_WIN32)
|
||||
# if defined(_WIN32)
|
||||
if (IsDebuggerPresent())
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
} // namespace Debug
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "../platform/platform.h"
|
||||
|
|
|
@ -10,18 +10,18 @@
|
|||
#include "../common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
# include <dirent.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
#elif defined(_WIN32)
|
||||
// Windows needs this for widechar <-> utf8 conversion utils
|
||||
#include "../localisation/Language.h"
|
||||
# include "../localisation/Language.h"
|
||||
#endif
|
||||
|
||||
#include "FileScanner.h"
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../Version.h"
|
||||
|
@ -142,12 +142,12 @@ namespace Guard
|
|||
|
||||
static void ForceCrash()
|
||||
{
|
||||
#ifdef USE_BREAKPAD
|
||||
# ifdef USE_BREAKPAD
|
||||
// Force a crash that breakpad will handle allowing us to get a dump
|
||||
*((void**)0) = 0;
|
||||
#else
|
||||
# else
|
||||
assert(false);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
} // namespace Guard
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#ifndef _WIN32
|
||||
#include <dirent.h>
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include "../localisation/Language.h"
|
||||
|
|
|
@ -9,25 +9,25 @@
|
|||
|
||||
#ifdef __MINGW32__
|
||||
// 0x0600 == vista
|
||||
#define WINVER 0x0600
|
||||
#define _WIN32_WINNT 0x0600
|
||||
# define WINVER 0x0600
|
||||
# define _WIN32_WINNT 0x0600
|
||||
#endif // __MINGW32__
|
||||
|
||||
#include <cwctype>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#ifndef _WIN32
|
||||
#include <unicode/ucnv.h>
|
||||
#include <unicode/unistr.h>
|
||||
#include <unicode/utypes.h>
|
||||
# include <unicode/ucnv.h>
|
||||
# include <unicode/unistr.h>
|
||||
# include <unicode/utypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../common.h"
|
||||
|
@ -80,14 +80,14 @@ namespace String
|
|||
// Which constructor to use depends on the size of wchar_t...
|
||||
// UTF-32 is the default on most POSIX systems; Windows uses UTF-16.
|
||||
// Unfortunately, we'll have to help the compiler here.
|
||||
#if U_SIZEOF_WCHAR_T == 4
|
||||
# if U_SIZEOF_WCHAR_T == 4
|
||||
icu::UnicodeString str = icu::UnicodeString::fromUTF32((const UChar32*)src.data(), src.length());
|
||||
#elif U_SIZEOF_WCHAR_T == 2
|
||||
# elif U_SIZEOF_WCHAR_T == 2
|
||||
std::wstring wstr = std::wstring(src);
|
||||
icu::UnicodeString str = icu::UnicodeString((const wchar_t*)wstr.c_str());
|
||||
#else
|
||||
#error Unsupported U_SIZEOF_WCHAR_T size
|
||||
#endif
|
||||
# else
|
||||
# error Unsupported U_SIZEOF_WCHAR_T size
|
||||
# endif
|
||||
|
||||
std::string result;
|
||||
str.toUTF8String(result);
|
||||
|
@ -110,20 +110,20 @@ namespace String
|
|||
// Which constructor to use depends on the size of wchar_t...
|
||||
// UTF-32 is the default on most POSIX systems; Windows uses UTF-16.
|
||||
// Unfortunately, we'll have to help the compiler here.
|
||||
#if U_SIZEOF_WCHAR_T == 4
|
||||
# if U_SIZEOF_WCHAR_T == 4
|
||||
size_t length = (size_t)str.length();
|
||||
std::wstring result(length, '\0');
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
str.toUTF32((UChar32*)&result[0], str.length(), status);
|
||||
|
||||
#elif U_SIZEOF_WCHAR_T == 2
|
||||
# elif U_SIZEOF_WCHAR_T == 2
|
||||
const char16_t* buffer = str.getBuffer();
|
||||
std::wstring result = (wchar_t*)buffer;
|
||||
|
||||
#else
|
||||
#error Unsupported U_SIZEOF_WCHAR_T size
|
||||
#endif
|
||||
# else
|
||||
# error Unsupported U_SIZEOF_WCHAR_T size
|
||||
# endif
|
||||
|
||||
return result;
|
||||
#endif
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#ifndef __ANDROID__
|
||||
#include "Zip.h"
|
||||
# include "Zip.h"
|
||||
|
||||
#include "IStream.hpp"
|
||||
# include "IStream.hpp"
|
||||
|
||||
#include <zip.h>
|
||||
# include <zip.h>
|
||||
|
||||
class ZipArchive final : public IZipArchive
|
||||
{
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include "IStream.hpp"
|
||||
#include "Zip.h"
|
||||
# include "IStream.hpp"
|
||||
# include "Zip.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <jni.h>
|
||||
# include <SDL.h>
|
||||
# include <jni.h>
|
||||
|
||||
class ZipArchive final : public IZipArchive
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#ifdef __AVX2__
|
||||
|
||||
#include <immintrin.h>
|
||||
# include <immintrin.h>
|
||||
|
||||
void mask_avx2(
|
||||
int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst,
|
||||
|
@ -44,9 +44,9 @@ void mask_avx2(
|
|||
|
||||
#else
|
||||
|
||||
#ifdef OPENRCT2_X86
|
||||
#error You have to compile this file with AVX2 enabled, when targeting x86!
|
||||
#endif
|
||||
# ifdef OPENRCT2_X86
|
||||
# error You have to compile this file with AVX2 enabled, when targeting x86!
|
||||
# endif
|
||||
|
||||
void mask_avx2(
|
||||
int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst,
|
||||
|
|
|
@ -35,8 +35,8 @@ static std::list<ImageList> _allocatedLists;
|
|||
// MSVC's compiler doesn't support the [[maybe_unused]] attribute for unused static functions. Until this has been resolved, we
|
||||
// need to explicitly tell the compiler to temporarily disable the warning.
|
||||
// See discussion at https://github.com/OpenRCT2/OpenRCT2/pull/7617
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4505) // unreferenced local function has been removed
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4505) // unreferenced local function has been removed
|
||||
|
||||
[[maybe_unused]] static bool AllocatedListContains(uint32_t baseImageId, uint32_t count)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ static std::list<ImageList> _allocatedLists;
|
|||
return contains;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
# pragma warning(pop)
|
||||
|
||||
static bool AllocatedListRemove(uint32_t baseImageId, uint32_t count)
|
||||
{
|
||||
|
|
|
@ -9,23 +9,23 @@
|
|||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
|
||||
#include "LightFX.h"
|
||||
# include "LightFX.h"
|
||||
|
||||
#include "../Game.h"
|
||||
#include "../common.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../interface/Viewport.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Drawing.h"
|
||||
# include "../Game.h"
|
||||
# include "../common.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../interface/Viewport.h"
|
||||
# include "../interface/Window.h"
|
||||
# include "../ride/Ride.h"
|
||||
# include "../util/Util.h"
|
||||
# include "../world/Climate.h"
|
||||
# include "../world/Map.h"
|
||||
# include "../world/Sprite.h"
|
||||
# include "Drawing.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
# include <algorithm>
|
||||
# include <cmath>
|
||||
# include <cstring>
|
||||
|
||||
static uint8_t _bakedLightTexture_lantern_0[32 * 32];
|
||||
static uint8_t _bakedLightTexture_lantern_1[64 * 64];
|
||||
|
@ -242,7 +242,7 @@ void lightfx_prepare_light_list()
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef LIGHTFX_UNKNOWN_PART_1
|
||||
# ifdef LIGHTFX_UNKNOWN_PART_1
|
||||
int32_t tileOffsetX = 0;
|
||||
int32_t tileOffsetY = 0;
|
||||
switch (_current_view_rotation_front)
|
||||
|
@ -275,7 +275,7 @@ void lightfx_prepare_light_list()
|
|||
-3, -2, -3, 2, 3, -2, 3, 2,
|
||||
};
|
||||
// clang-format on
|
||||
#endif // LIGHTFX_UNKNOWN_PART_1
|
||||
# endif // LIGHTFX_UNKNOWN_PART_1
|
||||
|
||||
if (true)
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ void lightfx_prepare_light_list()
|
|||
// offsetPattern[pat*2+1] / mapFrontDiv, VIEWPORT_INTERACTION_MASK_NONE, &mapCoord.x, &mapCoord.y,
|
||||
// &interactionType, &tileElement, NULL);
|
||||
|
||||
#ifdef LIGHTFX_UNKNOWN_PART_1
|
||||
# ifdef LIGHTFX_UNKNOWN_PART_1
|
||||
_unk9AC154 = ~VIEWPORT_INTERACTION_MASK_SPRITE & 0xFFFF;
|
||||
_viewportDpi1.zoom = _current_view_zoom_front;
|
||||
_viewportDpi1.x = entry->x + offsetPattern[0 + pat * 2] / mapFrontDiv;
|
||||
|
@ -328,7 +328,7 @@ void lightfx_prepare_light_list()
|
|||
mapCoord.y = _interactionMapY + tileOffsetY;
|
||||
interactionType = _interactionSpriteType;
|
||||
tileElement = RCT2_GLOBAL(0x9AC150, rct_tile_element*);
|
||||
#endif // LIGHTFX_UNKNOWN_PART_1
|
||||
# endif // LIGHTFX_UNKNOWN_PART_1
|
||||
|
||||
// RCT2_GLOBAL(0x9AC154, uint16_t) = VIEWPORT_INTERACTION_MASK_NONE;
|
||||
// RCT2_GLOBAL(0x9AC148, uint8_t) = 0;
|
||||
|
@ -933,9 +933,9 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b)
|
|||
|
||||
float overExpose = 0.0f;
|
||||
float lightAvg = (natLightR + natLightG + natLightB) / 3.0f;
|
||||
#ifdef LIGHTFX_UNKNOWN_PART_2
|
||||
# ifdef LIGHTFX_UNKNOWN_PART_2
|
||||
float lightMax = (natLightR + natLightG + natLightB) / 3.0f;
|
||||
#endif // LIGHTFX_UNKNOWN_PART_2
|
||||
# endif // LIGHTFX_UNKNOWN_PART_2
|
||||
|
||||
// overExpose += ((lightMax - lightAvg) / lightMax) * 0.01f;
|
||||
|
||||
|
@ -947,9 +947,9 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b)
|
|||
// overExpose += offset * 0.1f;
|
||||
}
|
||||
|
||||
#ifdef LIGHTFX_UNKNOWN_PART_2
|
||||
# ifdef LIGHTFX_UNKNOWN_PART_2
|
||||
lightAvg += (lightMax - lightAvg) * 0.6f;
|
||||
#endif // LIGHTFX_UNKNOWN_PART_2
|
||||
# endif // LIGHTFX_UNKNOWN_PART_2
|
||||
|
||||
if (lightAvg > 1.0f)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
|
||||
#include "../common.h"
|
||||
# include "../common.h"
|
||||
|
||||
struct LocationXY16;
|
||||
struct rct_drawpixelinfo;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#ifdef __SSE4_1__
|
||||
|
||||
#include <immintrin.h>
|
||||
# include <immintrin.h>
|
||||
|
||||
void mask_sse4_1(
|
||||
int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst,
|
||||
|
@ -58,9 +58,9 @@ void mask_sse4_1(
|
|||
|
||||
#else
|
||||
|
||||
#ifdef OPENRCT2_X86
|
||||
#error You have to compile this file with SSE4.1 enabled, when targetting x86!
|
||||
#endif
|
||||
# ifdef OPENRCT2_X86
|
||||
# error You have to compile this file with SSE4.1 enabled, when targetting x86!
|
||||
# endif
|
||||
|
||||
void mask_sse4_1(
|
||||
int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst,
|
||||
|
|
|
@ -9,23 +9,23 @@
|
|||
|
||||
#ifndef NO_TTF
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdocumentation"
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wdocumentation"
|
||||
# include <ft2build.h>
|
||||
# include FT_FREETYPE_H
|
||||
# pragma clang diagnostic pop
|
||||
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/LocalisationService.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "TTF.h"
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../localisation/Localisation.h"
|
||||
# include "../localisation/LocalisationService.h"
|
||||
# include "../platform/platform.h"
|
||||
# include "TTF.h"
|
||||
|
||||
static bool _ttfInitialised = false;
|
||||
|
||||
#define TTF_SURFACE_CACHE_SIZE 256
|
||||
#define TTF_GETWIDTH_CACHE_SIZE 1024
|
||||
# define TTF_SURFACE_CACHE_SIZE 256
|
||||
# define TTF_GETWIDTH_CACHE_SIZE 1024
|
||||
|
||||
struct ttf_cache_entry
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ void ttf_free_surface(TTFSurface* surface)
|
|||
|
||||
#else
|
||||
|
||||
#include "TTF.h"
|
||||
# include "TTF.h"
|
||||
|
||||
bool ttf_initialise()
|
||||
{
|
||||
|
|
|
@ -27,54 +27,54 @@ misrepresented as being the original software.
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
# include <cmath>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdocumentation"
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_OUTLINE_H
|
||||
#include FT_STROKER_H
|
||||
#include FT_GLYPH_H
|
||||
#include FT_TRUETYPE_IDS_H
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wdocumentation"
|
||||
# include <ft2build.h>
|
||||
# include FT_FREETYPE_H
|
||||
# include FT_OUTLINE_H
|
||||
# include FT_STROKER_H
|
||||
# include FT_GLYPH_H
|
||||
# include FT_TRUETYPE_IDS_H
|
||||
# pragma clang diagnostic pop
|
||||
|
||||
#include "TTF.h"
|
||||
# include "TTF.h"
|
||||
|
||||
#pragma warning(disable : 4018) // '<': signed / unsigned mismatch
|
||||
# pragma warning(disable : 4018) // '<': signed / unsigned mismatch
|
||||
|
||||
/* ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark) */
|
||||
#define UNICODE_BOM_NATIVE 0xFEFF
|
||||
#define UNICODE_BOM_SWAPPED 0xFFFE
|
||||
# define UNICODE_BOM_NATIVE 0xFEFF
|
||||
# define UNICODE_BOM_SWAPPED 0xFFFE
|
||||
|
||||
/* Set and retrieve the font style */
|
||||
#define TTF_STYLE_NORMAL 0x00
|
||||
#define TTF_STYLE_BOLD 0x01
|
||||
#define TTF_STYLE_ITALIC 0x02
|
||||
#define TTF_STYLE_UNDERLINE 0x04
|
||||
#define TTF_STYLE_STRIKETHROUGH 0x08
|
||||
# define TTF_STYLE_NORMAL 0x00
|
||||
# define TTF_STYLE_BOLD 0x01
|
||||
# define TTF_STYLE_ITALIC 0x02
|
||||
# define TTF_STYLE_UNDERLINE 0x04
|
||||
# define TTF_STYLE_STRIKETHROUGH 0x08
|
||||
|
||||
/* Set and retrieve FreeType hinter settings */
|
||||
#define TTF_HINTING_NORMAL 0
|
||||
#define TTF_HINTING_LIGHT 1
|
||||
#define TTF_HINTING_MONO 2
|
||||
#define TTF_HINTING_NONE 3
|
||||
# define TTF_HINTING_NORMAL 0
|
||||
# define TTF_HINTING_LIGHT 1
|
||||
# define TTF_HINTING_MONO 2
|
||||
# define TTF_HINTING_NONE 3
|
||||
|
||||
/* FIXME: Right now we assume the gray-scale renderer Freetype is using
|
||||
supports 256 shades of gray, but we should instead key off of num_grays
|
||||
in the result FT_Bitmap after the FT_Render_Glyph() call. */
|
||||
#define NUM_GRAYS 256
|
||||
# define NUM_GRAYS 256
|
||||
|
||||
/* Handy routines for converting from fixed point */
|
||||
#define FT_FLOOR(X) (((X) & -64) / 64)
|
||||
#define FT_CEIL(X) ((((X) + 63) & -64) / 64)
|
||||
# define FT_FLOOR(X) (((X) & -64) / 64)
|
||||
# define FT_CEIL(X) ((((X) + 63) & -64) / 64)
|
||||
|
||||
#define CACHED_METRICS 0x10
|
||||
#define CACHED_BITMAP 0x01
|
||||
#define CACHED_PIXMAP 0x02
|
||||
# define CACHED_METRICS 0x10
|
||||
# define CACHED_BITMAP 0x01
|
||||
# define CACHED_PIXMAP 0x02
|
||||
|
||||
/* Cached glyph information */
|
||||
struct c_glyph
|
||||
|
@ -137,31 +137,31 @@ struct _TTF_Font
|
|||
};
|
||||
|
||||
/* Handle a style only if the font does not already handle it */
|
||||
#define TTF_HANDLE_STYLE_BOLD(font) (((font)->style & TTF_STYLE_BOLD) && !((font)->face_style & TTF_STYLE_BOLD))
|
||||
#define TTF_HANDLE_STYLE_ITALIC(font) (((font)->style & TTF_STYLE_ITALIC) && !((font)->face_style & TTF_STYLE_ITALIC))
|
||||
#define TTF_HANDLE_STYLE_UNDERLINE(font) ((font)->style & TTF_STYLE_UNDERLINE)
|
||||
#define TTF_HANDLE_STYLE_STRIKETHROUGH(font) ((font)->style & TTF_STYLE_STRIKETHROUGH)
|
||||
# define TTF_HANDLE_STYLE_BOLD(font) (((font)->style & TTF_STYLE_BOLD) && !((font)->face_style & TTF_STYLE_BOLD))
|
||||
# define TTF_HANDLE_STYLE_ITALIC(font) (((font)->style & TTF_STYLE_ITALIC) && !((font)->face_style & TTF_STYLE_ITALIC))
|
||||
# define TTF_HANDLE_STYLE_UNDERLINE(font) ((font)->style & TTF_STYLE_UNDERLINE)
|
||||
# define TTF_HANDLE_STYLE_STRIKETHROUGH(font) ((font)->style & TTF_STYLE_STRIKETHROUGH)
|
||||
|
||||
/* Font styles that does not impact glyph drawing */
|
||||
#define TTF_STYLE_NO_GLYPH_CHANGE (TTF_STYLE_UNDERLINE | TTF_STYLE_STRIKETHROUGH)
|
||||
# define TTF_STYLE_NO_GLYPH_CHANGE (TTF_STYLE_UNDERLINE | TTF_STYLE_STRIKETHROUGH)
|
||||
|
||||
/* The FreeType font engine/library */
|
||||
static FT_Library library;
|
||||
static int TTF_initialized = 0;
|
||||
|
||||
#define TTF_SetError log_error
|
||||
# define TTF_SetError log_error
|
||||
|
||||
#define TTF_CHECKPOINTER(p, errval) \
|
||||
if (!TTF_initialized) \
|
||||
{ \
|
||||
TTF_SetError("Library not initialized"); \
|
||||
return errval; \
|
||||
} \
|
||||
if (!(p)) \
|
||||
{ \
|
||||
TTF_SetError("Passed a NULL pointer"); \
|
||||
return errval; \
|
||||
}
|
||||
# define TTF_CHECKPOINTER(p, errval) \
|
||||
if (!TTF_initialized) \
|
||||
{ \
|
||||
TTF_SetError("Library not initialized"); \
|
||||
return errval; \
|
||||
} \
|
||||
if (!(p)) \
|
||||
{ \
|
||||
TTF_SetError("Passed a NULL pointer"); \
|
||||
return errval; \
|
||||
}
|
||||
|
||||
/* Gets the top row of the underline. The outline
|
||||
is taken into account.
|
||||
|
@ -264,15 +264,15 @@ static void TTF_drawLine_Shaded(const TTF_Font* font, const TTFSurface* textbuf,
|
|||
|
||||
static void TTF_SetFTError(const char* msg, [[maybe_unused]] FT_Error error)
|
||||
{
|
||||
#ifdef USE_FREETYPE_ERRORS
|
||||
#undef FTERRORS_H
|
||||
#define FT_ERRORDEF(e, v, s) { e, s },
|
||||
# ifdef USE_FREETYPE_ERRORS
|
||||
# undef FTERRORS_H
|
||||
# define FT_ERRORDEF(e, v, s) { e, s },
|
||||
static const struct
|
||||
{
|
||||
int err_code;
|
||||
const char* err_msg;
|
||||
} ft_errors[] = {
|
||||
#include <freetype/fterrors.h>
|
||||
# include <freetype/fterrors.h>
|
||||
};
|
||||
int i;
|
||||
const char* err_msg;
|
||||
|
@ -292,9 +292,9 @@ static void TTF_SetFTError(const char* msg, [[maybe_unused]] FT_Error error)
|
|||
err_msg = "unknown FreeType error";
|
||||
}
|
||||
TTF_SetError("%s: %s", msg, err_msg);
|
||||
#else
|
||||
# else
|
||||
TTF_SetError("%s", msg);
|
||||
#endif /* USE_FREETYPE_ERRORS */
|
||||
# endif /* USE_FREETYPE_ERRORS */
|
||||
}
|
||||
|
||||
int TTF_Init(void)
|
||||
|
@ -489,14 +489,14 @@ static TTF_Font* TTF_OpenFontIndexRW(FILE* src, int freesrc, int ptsize, long in
|
|||
font->underline_height = 1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FONTS
|
||||
# ifdef DEBUG_FONTS
|
||||
printf("Font metrics:\n");
|
||||
printf("\tascent = %d, descent = %d\n", font->ascent, font->descent);
|
||||
printf("\theight = %d, lineskip = %d\n", font->height, font->lineskip);
|
||||
printf("\tunderline_offset = %d, underline_height = %d\n", font->underline_offset, font->underline_height);
|
||||
printf(
|
||||
"\tunderline_top_row = %d, strikethrough_top_row = %d\n", TTF_underline_top_row(font), TTF_strikethrough_top_row(font));
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Initialize the font face style */
|
||||
font->face_style = TTF_STYLE_NORMAL;
|
||||
|
@ -997,7 +997,7 @@ void TTF_CloseFont(TTF_Font* font)
|
|||
}
|
||||
|
||||
/* Gets a unicode value from a UTF-8 encoded string and advance the string */
|
||||
#define UNKNOWN_UNICODE 0xFFFD
|
||||
# define UNKNOWN_UNICODE 0xFFFD
|
||||
static uint32_t UTF8_getch(const char** src, size_t* srclen)
|
||||
{
|
||||
const uint8_t* p = *(const uint8_t**)src;
|
||||
|
@ -1172,7 +1172,7 @@ int TTF_SizeUTF8(TTF_Font* font, const char* text, int* w, int* h)
|
|||
x += delta.x >> 6;
|
||||
}
|
||||
|
||||
#if 0
|
||||
# if 0
|
||||
if ((ch == text) && (glyph->minx < 0)) {
|
||||
/* Fixes the texture wrapping bug when the first letter
|
||||
* has a negative minx value or horibearing value. The entire
|
||||
|
@ -1189,7 +1189,7 @@ int TTF_SizeUTF8(TTF_Font* font, const char* text, int* w, int* h)
|
|||
* */
|
||||
z -= glyph->minx;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
z = x + glyph->minx;
|
||||
if (minx > z)
|
||||
|
|
|
@ -125,8 +125,8 @@ void X8RainDrawer::Restore()
|
|||
}
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
#endif
|
||||
|
||||
X8DrawingEngine::X8DrawingEngine([[maybe_unused]] const std::shared_ptr<Ui::IUiContext>& uiContext)
|
||||
|
@ -462,7 +462,7 @@ void X8DrawingEngine::DrawDirtyBlocks(uint32_t x, uint32_t y, uint32_t columns,
|
|||
}
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
X8DrawingContext::X8DrawingContext(X8DrawingEngine* engine)
|
||||
|
|
|
@ -60,8 +60,8 @@ namespace OpenRCT2
|
|||
};
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_TYPES__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
#endif
|
||||
class X8DrawingEngine : public IDrawingEngine
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ namespace OpenRCT2
|
|||
void DrawDirtyBlocks(uint32_t x, uint32_t y, uint32_t columns, uint32_t rows);
|
||||
};
|
||||
#ifdef __WARN_SUGGEST_FINAL_TYPES__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
class X8DrawingContext final : public IDrawingContext
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#ifndef NO_TTF
|
||||
|
||||
#include <vector>
|
||||
# include <vector>
|
||||
|
||||
struct TTFFontSetDescriptor;
|
||||
|
||||
|
@ -26,11 +26,11 @@ extern TTFontFamily const TTFFamilyJapanese;
|
|||
extern TTFontFamily const TTFFamilyKorean;
|
||||
extern TTFontFamily const TTFFamilySansSerif;
|
||||
|
||||
#define FAMILY(x) x
|
||||
# define FAMILY(x) x
|
||||
|
||||
#else // NO_TTF
|
||||
|
||||
#define FAMILY(x) FAMILY_OPENRCT2_SPRITE
|
||||
# define FAMILY(x) FAMILY_OPENRCT2_SPRITE
|
||||
|
||||
#endif // NO_TTF
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ extern TTFFontSetDescriptor TTFFontGulim;
|
|||
extern TTFFontSetDescriptor TTFFontNanum;
|
||||
extern TTFFontSetDescriptor TTFFontArial;
|
||||
extern TTFFontSetDescriptor TTFFontArialUnicode;
|
||||
#define FONT(x) x
|
||||
# define FONT(x) x
|
||||
#else
|
||||
#define FONT(x) FONT_OPENRCT2_SPRITE
|
||||
# define FONT(x) FONT_OPENRCT2_SPRITE
|
||||
#endif // NO_TTF
|
||||
|
||||
void TryLoadFonts(OpenRCT2::Localisation::LocalisationService& localisationService);
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <thread>
|
||||
|
||||
#ifndef NO_TTF
|
||||
#include "../drawing/TTF.h"
|
||||
# include "../drawing/TTF.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
#include <limits.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
# include <windows.h>
|
||||
#elif defined(__ANDROID__)
|
||||
#include <SDL.h>
|
||||
#include <jni.h>
|
||||
# include <SDL.h>
|
||||
# include <jni.h>
|
||||
|
||||
#else
|
||||
#include <errno.h>
|
||||
#include <iconv.h>
|
||||
# include <errno.h>
|
||||
# include <iconv.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include "../Game.h"
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
|
||||
#ifdef __ENABLE_DISCORD__
|
||||
|
||||
#include "DiscordService.h"
|
||||
# include "DiscordService.h"
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../world/Park.h"
|
||||
#include "network.h"
|
||||
# include "../Context.h"
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../core/Console.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../localisation/Localisation.h"
|
||||
# include "../world/Park.h"
|
||||
# include "network.h"
|
||||
|
||||
#include <discord_rpc.h>
|
||||
# include <discord_rpc.h>
|
||||
|
||||
constexpr const char* APPLICATION_ID = "378612438200877056";
|
||||
constexpr const char* STEAM_APP_ID = nullptr;
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
#ifdef __ENABLE_DISCORD__
|
||||
|
||||
#include "../common.h"
|
||||
# include "../common.h"
|
||||
|
||||
#include <limits>
|
||||
# include <limits>
|
||||
|
||||
class DiscordService final
|
||||
{
|
||||
|
|
|
@ -16,16 +16,16 @@
|
|||
|
||||
#ifndef DISABLE_HTTP
|
||||
|
||||
#include "../Version.h"
|
||||
#include "../core/Console.hpp"
|
||||
# include "../Version.h"
|
||||
# include "../core/Console.hpp"
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
// cURL includes windows.h, but we don't need all of it.
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <curl/curl.h>
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <curl/curl.h>
|
||||
|
||||
#define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION
|
||||
# define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION
|
||||
|
||||
namespace OpenRCT2::Network::Http
|
||||
{
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
#ifndef DISABLE_HTTP
|
||||
|
||||
#include "../common.h"
|
||||
# include "../common.h"
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <string>
|
||||
# include <functional>
|
||||
# include <map>
|
||||
# include <string>
|
||||
|
||||
namespace OpenRCT2::Network::Http
|
||||
{
|
||||
|
|
|
@ -35,38 +35,38 @@ static int32_t _pickup_peep_old_x = LOCATION_NULL;
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "../Cheats.h"
|
||||
#include "../Game.h"
|
||||
#include "../ParkImporter.h"
|
||||
#include "../actions/GameAction.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/FileStream.hpp"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/MemoryStream.h"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../interface/Chat.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../object/ObjectManager.h"
|
||||
#include "../object/ObjectRepository.h"
|
||||
#include "../rct2/S6Exporter.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Park.h"
|
||||
#include "NetworkAction.h"
|
||||
# include "../Cheats.h"
|
||||
# include "../Game.h"
|
||||
# include "../ParkImporter.h"
|
||||
# include "../actions/GameAction.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../core/Console.hpp"
|
||||
# include "../core/FileStream.hpp"
|
||||
# include "../core/Json.hpp"
|
||||
# include "../core/Math.hpp"
|
||||
# include "../core/MemoryStream.h"
|
||||
# include "../core/Path.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../core/Util.hpp"
|
||||
# include "../interface/Chat.h"
|
||||
# include "../interface/Window.h"
|
||||
# include "../localisation/Date.h"
|
||||
# include "../localisation/Localisation.h"
|
||||
# include "../object/ObjectManager.h"
|
||||
# include "../object/ObjectRepository.h"
|
||||
# include "../rct2/S6Exporter.h"
|
||||
# include "../scenario/Scenario.h"
|
||||
# include "../util/Util.h"
|
||||
# include "../world/Park.h"
|
||||
# include "NetworkAction.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <cmath>
|
||||
#include <set>
|
||||
#include <string>
|
||||
# include <algorithm>
|
||||
# include <cerrno>
|
||||
# include <cmath>
|
||||
# include <set>
|
||||
# include <string>
|
||||
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
# pragma comment(lib, "Ws2_32.lib")
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
|
@ -699,9 +699,9 @@ bool Network::CheckSRAND(uint32_t tick, uint32_t srand0)
|
|||
// Check PRNG values and sprite hashes, if exist
|
||||
if ((srand0 != server_srand0) || sprites_mismatch)
|
||||
{
|
||||
#ifdef DEBUG_DESYNC
|
||||
# ifdef DEBUG_DESYNC
|
||||
dbg_report_desync(tick, srand0, server_srand0, client_sprite_hash, server_sprite_hash.c_str());
|
||||
#endif
|
||||
# endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1019,12 +1019,12 @@ void Network::BeginChatLog()
|
|||
auto directory = _env->GetDirectoryPath(DIRBASE::USER, DIRID::LOG_CHAT);
|
||||
_chatLogPath = BeginLog(directory, "", _chatLogFilenameFormat);
|
||||
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
# if defined(_WIN32) && !defined(__MINGW32__)
|
||||
auto pathW = std::unique_ptr<wchar_t>(utf8_to_widechar(_chatLogPath.c_str()));
|
||||
_chat_log_fs.open(pathW.get(), std::ios::out | std::ios::app);
|
||||
#else
|
||||
# else
|
||||
_chat_log_fs.open(_chatLogPath, std::ios::out | std::ios::app);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
void Network::AppendChatLog(const std::string& s)
|
||||
|
@ -1045,12 +1045,12 @@ void Network::BeginServerLog()
|
|||
auto directory = _env->GetDirectoryPath(DIRBASE::USER, DIRID::LOG_SERVER);
|
||||
_serverLogPath = BeginLog(directory, ServerName, _serverLogFilenameFormat);
|
||||
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
# if defined(_WIN32) && !defined(__MINGW32__)
|
||||
auto pathW = std::unique_ptr<wchar_t>(utf8_to_widechar(_serverLogPath.c_str()));
|
||||
_server_log_fs.open(pathW.get(), std::ios::out | std::ios::app);
|
||||
#else
|
||||
# else
|
||||
_server_log_fs.open(_serverLogPath, std::ios::out | std::ios::app);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
// Log server start event
|
||||
utf8 logMessage[256];
|
||||
|
@ -1424,7 +1424,7 @@ void Network::Server_Send_GAMEINFO(NetworkConnection& connection)
|
|||
{
|
||||
std::unique_ptr<NetworkPacket> packet(NetworkPacket::Allocate());
|
||||
*packet << (uint32_t)NETWORK_COMMAND_GAMEINFO;
|
||||
#ifndef DISABLE_HTTP
|
||||
# ifndef DISABLE_HTTP
|
||||
json_t* obj = json_object();
|
||||
json_object_set_new(obj, "name", json_string(gConfigNetwork.server_name));
|
||||
json_object_set_new(obj, "requiresPassword", json_boolean(_password.size() > 0));
|
||||
|
@ -1444,7 +1444,7 @@ void Network::Server_Send_GAMEINFO(NetworkConnection& connection)
|
|||
|
||||
packet->WriteString(json_dumps(obj, 0));
|
||||
json_decref(obj);
|
||||
#endif
|
||||
# endif
|
||||
connection.QueuePacket(std::move(packet));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkAction.h"
|
||||
# include "NetworkAction.h"
|
||||
|
||||
#include "../Game.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
# include "../Game.h"
|
||||
# include "../localisation/StringIds.h"
|
||||
|
||||
#include <algorithm>
|
||||
# include <algorithm>
|
||||
|
||||
int32_t NetworkActions::FindCommand(int32_t command)
|
||||
{
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkConnection.h"
|
||||
# include "NetworkConnection.h"
|
||||
|
||||
#include "../core/String.hpp"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "network.h"
|
||||
# include "../core/String.hpp"
|
||||
# include "../localisation/Localisation.h"
|
||||
# include "../platform/platform.h"
|
||||
# include "network.h"
|
||||
|
||||
constexpr size_t NETWORK_DISCONNECT_REASON_BUFFER_SIZE = 256;
|
||||
|
||||
|
@ -138,12 +138,12 @@ void NetworkConnection::ResetLastPacketTime()
|
|||
|
||||
bool NetworkConnection::ReceivedPacketRecently()
|
||||
{
|
||||
#ifndef DEBUG
|
||||
# ifndef DEBUG
|
||||
if (platform_get_ticks() > _lastPacketTime + 7000)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef DISABLE_NETWORK
|
||||
#include "../common.h"
|
||||
#include "NetworkKey.h"
|
||||
#include "NetworkPacket.h"
|
||||
#include "NetworkTypes.h"
|
||||
# include "../common.h"
|
||||
# include "NetworkKey.h"
|
||||
# include "NetworkPacket.h"
|
||||
# include "NetworkTypes.h"
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
# include <list>
|
||||
# include <memory>
|
||||
# include <vector>
|
||||
|
||||
interface ITcpSocket;
|
||||
class NetworkPlayer;
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkGroup.h"
|
||||
# include "NetworkGroup.h"
|
||||
|
||||
#include "NetworkAction.h"
|
||||
#include "NetworkTypes.h"
|
||||
# include "NetworkAction.h"
|
||||
# include "NetworkTypes.h"
|
||||
|
||||
NetworkGroup NetworkGroup::FromJson(const json_t* json)
|
||||
{
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkKey.h"
|
||||
# include "NetworkKey.h"
|
||||
|
||||
#include "../Diagnostic.h"
|
||||
#include "../core/Crypt.h"
|
||||
#include "../core/IStream.hpp"
|
||||
# include "../Diagnostic.h"
|
||||
# include "../core/Crypt.h"
|
||||
# include "../core/IStream.hpp"
|
||||
|
||||
#include <vector>
|
||||
# include <vector>
|
||||
|
||||
NetworkKey::NetworkKey()
|
||||
{
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "../common.h"
|
||||
# include "../common.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
# include <memory>
|
||||
# include <string>
|
||||
|
||||
interface IStream;
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkPacket.h"
|
||||
# include "NetworkPacket.h"
|
||||
|
||||
#include "NetworkTypes.h"
|
||||
# include "NetworkTypes.h"
|
||||
|
||||
#include <memory>
|
||||
# include <memory>
|
||||
|
||||
std::unique_ptr<NetworkPacket> NetworkPacket::Allocate()
|
||||
{
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkPlayer.h"
|
||||
# include "NetworkPlayer.h"
|
||||
|
||||
#include "../interface/Window.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "NetworkPacket.h"
|
||||
# include "../interface/Window.h"
|
||||
# include "../localisation/Localisation.h"
|
||||
# include "NetworkPacket.h"
|
||||
|
||||
void NetworkPlayer::SetName(const std::string& name)
|
||||
{
|
||||
|
|
|
@ -9,25 +9,25 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkServerAdvertiser.h"
|
||||
# include "NetworkServerAdvertiser.h"
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../management/Finance.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/Park.h"
|
||||
#include "Http.h"
|
||||
#include "network.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../core/Console.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../core/Util.hpp"
|
||||
# include "../localisation/Date.h"
|
||||
# include "../management/Finance.h"
|
||||
# include "../peep/Peep.h"
|
||||
# include "../platform/platform.h"
|
||||
# include "../util/Util.h"
|
||||
# include "../world/Map.h"
|
||||
# include "../world/Park.h"
|
||||
# include "Http.h"
|
||||
# include "network.h"
|
||||
|
||||
#include <string>
|
||||
# include <string>
|
||||
|
||||
#ifndef DISABLE_HTTP
|
||||
# ifndef DISABLE_HTTP
|
||||
|
||||
using namespace OpenRCT2::Network;
|
||||
|
||||
|
@ -260,7 +260,7 @@ INetworkServerAdvertiser* CreateServerAdvertiser(uint16_t port)
|
|||
return new NetworkServerAdvertiser(port);
|
||||
}
|
||||
|
||||
#else // DISABLE_HTTP
|
||||
# else // DISABLE_HTTP
|
||||
|
||||
class DummyNetworkServerAdvertiser final : public INetworkServerAdvertiser
|
||||
{
|
||||
|
@ -277,6 +277,6 @@ INetworkServerAdvertiser* CreateServerAdvertiser(uint16_t port)
|
|||
return new DummyNetworkServerAdvertiser();
|
||||
}
|
||||
|
||||
#endif // DISABLE_HTTP
|
||||
# endif // DISABLE_HTTP
|
||||
|
||||
#endif // DISABLE_NETWORK
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "NetworkUser.h"
|
||||
# include "NetworkUser.h"
|
||||
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../platform/platform.h"
|
||||
# include "../core/Console.hpp"
|
||||
# include "../core/Json.hpp"
|
||||
# include "../core/Path.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../platform/platform.h"
|
||||
|
||||
#include <unordered_set>
|
||||
# include <unordered_set>
|
||||
|
||||
constexpr const utf8* USER_STORE_FILENAME = "users.json";
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <future>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
# include <chrono>
|
||||
# include <cmath>
|
||||
# include <cstring>
|
||||
# include <future>
|
||||
# include <string>
|
||||
# include <thread>
|
||||
|
||||
// clang-format off
|
||||
// MSVC: include <math.h> here otherwise PI gets defined twice
|
||||
|
@ -58,13 +58,13 @@
|
|||
#endif // _WIN32
|
||||
// clang-format on
|
||||
|
||||
#include "TcpSocket.h"
|
||||
# include "TcpSocket.h"
|
||||
|
||||
constexpr auto CONNECT_TIMEOUT = std::chrono::milliseconds(3000);
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
static bool _wsaInitialised = false;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
class TcpSocket;
|
||||
|
||||
|
@ -279,10 +279,10 @@ public:
|
|||
|
||||
fd_set writeFD;
|
||||
FD_ZERO(&writeFD);
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4548) // expression before comma has no effect; expected expression with side-effect
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4548) // expression before comma has no effect; expected expression with side-effect
|
||||
FD_SET(_socket, &writeFD);
|
||||
#pragma warning(pop)
|
||||
# pragma warning(pop)
|
||||
timeval timeout{};
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
|
@ -384,7 +384,7 @@ public:
|
|||
else if (readBytes == SOCKET_ERROR)
|
||||
{
|
||||
*sizeReceived = 0;
|
||||
#ifndef _WIN32
|
||||
# ifndef _WIN32
|
||||
// Removing the check for EAGAIN and instead relying on the values being the same allows turning on of
|
||||
// -Wlogical-op warning.
|
||||
// This is not true on Windows, see:
|
||||
|
@ -395,7 +395,7 @@ public:
|
|||
EWOULDBLOCK == EAGAIN,
|
||||
"Portability note: your system has different values for EWOULDBLOCK "
|
||||
"and EAGAIN, please extend the condition below");
|
||||
#endif // _WIN32
|
||||
# endif // _WIN32
|
||||
if (LAST_SOCKET_ERROR() != EWOULDBLOCK)
|
||||
{
|
||||
return NETWORK_READPACKET_DISCONNECTED;
|
||||
|
@ -477,13 +477,13 @@ private:
|
|||
|
||||
static bool SetNonBlocking(SOCKET socket, bool on)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
u_long nonBlocking = on;
|
||||
return ioctlsocket(socket, FIONBIO, &nonBlocking) == 0;
|
||||
#else
|
||||
# else
|
||||
int32_t flags = fcntl(socket, F_GETFL, 0);
|
||||
return fcntl(socket, F_SETFL, on ? (flags | O_NONBLOCK) : (flags & ~O_NONBLOCK)) == 0;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
static bool SetTCPNoDelay(SOCKET socket, bool enabled)
|
||||
|
@ -499,7 +499,7 @@ ITcpSocket* CreateTcpSocket()
|
|||
|
||||
bool InitialiseWSA()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
if (!_wsaInitialised)
|
||||
{
|
||||
log_verbose("Initialising WSA");
|
||||
|
@ -512,20 +512,20 @@ bool InitialiseWSA()
|
|||
_wsaInitialised = true;
|
||||
}
|
||||
return _wsaInitialised;
|
||||
#else
|
||||
# else
|
||||
return true;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
void DisposeWSA()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN32
|
||||
if (_wsaInitialised)
|
||||
{
|
||||
WSACleanup();
|
||||
_wsaInitialised = false;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace Convert
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#ifdef DISABLE_TWITCH
|
||||
|
||||
#include "twitch.h"
|
||||
# include "twitch.h"
|
||||
|
||||
void twitch_update()
|
||||
{
|
||||
|
@ -17,31 +17,31 @@ void twitch_update()
|
|||
|
||||
#else
|
||||
|
||||
#ifdef DISABLE_HTTP
|
||||
#error HTTP must be enabled to use the TWITCH functionality.
|
||||
#endif
|
||||
# ifdef DISABLE_HTTP
|
||||
# error HTTP must be enabled to use the TWITCH functionality.
|
||||
# endif
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../Game.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../drawing/Drawing.h"
|
||||
#include "../interface/InteractiveConsole.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../management/NewsItem.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Http.h"
|
||||
#include "twitch.h"
|
||||
# include "../Context.h"
|
||||
# include "../Game.h"
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../core/Json.hpp"
|
||||
# include "../core/Math.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../drawing/Drawing.h"
|
||||
# include "../interface/InteractiveConsole.h"
|
||||
# include "../localisation/Localisation.h"
|
||||
# include "../management/NewsItem.h"
|
||||
# include "../peep/Peep.h"
|
||||
# include "../platform/platform.h"
|
||||
# include "../util/Util.h"
|
||||
# include "../world/Sprite.h"
|
||||
# include "Http.h"
|
||||
# include "twitch.h"
|
||||
|
||||
#include <jansson.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
# include <jansson.h>
|
||||
# include <memory>
|
||||
# include <vector>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Network;
|
||||
|
|
|
@ -52,26 +52,26 @@ namespace OpenRCT2
|
|||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
#include "../actions/GameAction.h"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/MemoryStream.h"
|
||||
#include "../core/Nullable.hpp"
|
||||
#include "NetworkConnection.h"
|
||||
#include "NetworkGroup.h"
|
||||
#include "NetworkKey.h"
|
||||
#include "NetworkPacket.h"
|
||||
#include "NetworkPlayer.h"
|
||||
#include "NetworkServerAdvertiser.h"
|
||||
#include "NetworkUser.h"
|
||||
#include "TcpSocket.h"
|
||||
# include "../actions/GameAction.h"
|
||||
# include "../core/Json.hpp"
|
||||
# include "../core/MemoryStream.h"
|
||||
# include "../core/Nullable.hpp"
|
||||
# include "NetworkConnection.h"
|
||||
# include "NetworkGroup.h"
|
||||
# include "NetworkKey.h"
|
||||
# include "NetworkPacket.h"
|
||||
# include "NetworkPlayer.h"
|
||||
# include "NetworkServerAdvertiser.h"
|
||||
# include "NetworkUser.h"
|
||||
# include "TcpSocket.h"
|
||||
|
||||
#include <array>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
# include <array>
|
||||
# include <fstream>
|
||||
# include <functional>
|
||||
# include <list>
|
||||
# include <map>
|
||||
# include <set>
|
||||
# include <vector>
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -697,8 +697,8 @@ bool Object::IsOpenRCT2OfficialObject()
|
|||
}
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
#endif
|
||||
|
||||
std::string Object::GetName() const
|
||||
|
@ -712,5 +712,5 @@ std::string Object::GetName(int32_t language) const
|
|||
}
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
@ -146,9 +146,9 @@ interface IReadObjectContext
|
|||
};
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_TYPES__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-types"
|
||||
# pragma GCC diagnostic ignored "-Wsuggest-final-methods"
|
||||
#endif
|
||||
class Object
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ public:
|
|||
rct_object_entry CreateHeader(const char name[9], uint32_t flags, uint32_t checksum);
|
||||
};
|
||||
#ifdef __WARN_SUGGEST_FINAL_TYPES__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
enum OBJECT_ERROR : uint32_t
|
||||
|
|
|
@ -238,9 +238,9 @@ void testpaint_ignore(uint8_t direction, uint8_t trackSequence);
|
|||
void testpaint_ignore_all();
|
||||
bool testpaint_is_ignored(uint8_t direction, uint8_t trackSequence);
|
||||
|
||||
#define TESTPAINT_IGNORE(direction, trackSequence) testpaint_ignore(direction, trackSequence)
|
||||
#define TESTPAINT_IGNORE_ALL() testpaint_ignore_all()
|
||||
# define TESTPAINT_IGNORE(direction, trackSequence) testpaint_ignore(direction, trackSequence)
|
||||
# define TESTPAINT_IGNORE_ALL() testpaint_ignore_all()
|
||||
#else
|
||||
#define TESTPAINT_IGNORE(direction, trackSequence)
|
||||
#define TESTPAINT_IGNORE_ALL()
|
||||
# define TESTPAINT_IGNORE(direction, trackSequence)
|
||||
# define TESTPAINT_IGNORE_ALL()
|
||||
#endif
|
||||
|
|
|
@ -3829,7 +3829,7 @@ void peep_handle_easteregg_name(rct_peep* peep)
|
|||
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||
void pathfind_logging_enable([[maybe_unused]] rct_peep* peep)
|
||||
{
|
||||
#if defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
# if defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
/* Determine if the pathfinding debugging is wanted for this peep. */
|
||||
format_string(gPathFindDebugPeepName, sizeof(gPathFindDebugPeepName), peep->name_string_idx, &(peep->id));
|
||||
|
||||
|
@ -3847,14 +3847,14 @@ void pathfind_logging_enable([[maybe_unused]] rct_peep* peep)
|
|||
{
|
||||
gPathFindDebug = strcmp(gPathFindDebugPeepName, "Mechanic Debug") == 0;
|
||||
}
|
||||
#endif // defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
# endif // defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
}
|
||||
|
||||
void pathfind_logging_disable()
|
||||
{
|
||||
#if defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
# if defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
gPathFindDebug = false;
|
||||
#endif // defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
# endif // defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
}
|
||||
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||
|
||||
|
|
|
@ -986,9 +986,9 @@ bool is_valid_path_z_and_direction(rct_tile_element* tileElement, int32_t curren
|
|||
int32_t guest_path_finding(rct_peep* peep);
|
||||
|
||||
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||
#define PATHFIND_DEBUG \
|
||||
0 // Set to 0 to disable pathfinding debugging;
|
||||
// Set to 1 to enable pathfinding debugging.
|
||||
# define PATHFIND_DEBUG \
|
||||
0 // Set to 0 to disable pathfinding debugging;
|
||||
// Set to 1 to enable pathfinding debugging.
|
||||
// Some variables used for the path finding debugging.
|
||||
extern bool gPathFindDebug; // Use to guard calls to log messages
|
||||
extern utf8 gPathFindDebugPeepName[256]; // Use to put the peep name in the log message
|
||||
|
|
|
@ -9,22 +9,22 @@
|
|||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../util/Util.h"
|
||||
#include "platform.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../localisation/Language.h"
|
||||
# include "../util/Util.h"
|
||||
# include "platform.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <jni.h>
|
||||
#include <wchar.h>
|
||||
# include <SDL.h>
|
||||
# include <jni.h>
|
||||
# include <wchar.h>
|
||||
|
||||
#ifndef NO_TTF
|
||||
# ifndef NO_TTF
|
||||
bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
||||
{
|
||||
STUB();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
uint16_t platform_get_locale_language()
|
||||
{
|
||||
|
|
|
@ -10,31 +10,31 @@
|
|||
#include "Crash.h"
|
||||
|
||||
#ifdef USE_BREAKPAD
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
# include <memory>
|
||||
# include <stdio.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <ShlObj.h>
|
||||
#include <breakpad/client/windows/handler/exception_handler.h>
|
||||
#include <string>
|
||||
#else
|
||||
#error Breakpad support not implemented yet for this platform
|
||||
#endif
|
||||
# if defined(_WIN32)
|
||||
# include <ShlObj.h>
|
||||
# include <breakpad/client/windows/handler/exception_handler.h>
|
||||
# include <string>
|
||||
# else
|
||||
# error Breakpad support not implemented yet for this platform
|
||||
# endif
|
||||
|
||||
#include "../Version.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../rct2/S6Exporter.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "platform.h"
|
||||
# include "../Version.h"
|
||||
# include "../core/Console.hpp"
|
||||
# include "../localisation/Language.h"
|
||||
# include "../rct2/S6Exporter.h"
|
||||
# include "../scenario/Scenario.h"
|
||||
# include "platform.h"
|
||||
|
||||
#define WSZ(x) L"" x
|
||||
# define WSZ(x) L"" x
|
||||
|
||||
#ifdef OPENRCT2_COMMIT_SHA1_SHORT
|
||||
# ifdef OPENRCT2_COMMIT_SHA1_SHORT
|
||||
const wchar_t* _wszCommitSha1Short = WSZ(OPENRCT2_COMMIT_SHA1_SHORT);
|
||||
#else
|
||||
# else
|
||||
const wchar_t* _wszCommitSha1Short = WSZ("");
|
||||
#endif
|
||||
# endif
|
||||
|
||||
// OPENRCT2_ARCHITECTURE is required to be defined in version.h
|
||||
const wchar_t* _wszArchitecture = WSZ(OPENRCT2_ARCHITECTURE);
|
||||
|
|
|
@ -13,28 +13,28 @@
|
|||
// Otherwise, they should be spun off into their own files.
|
||||
#if (defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ANDROID__)
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
# ifdef __FreeBSD__
|
||||
# include <sys/sysctl.h>
|
||||
# endif
|
||||
|
||||
#define OPENRCT2_MAX_COMMAND_LENGTH (2 * MAX_PATH)
|
||||
# define OPENRCT2_MAX_COMMAND_LENGTH (2 * MAX_PATH)
|
||||
|
||||
#include <cstring>
|
||||
#include <ctype.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#ifndef NO_TTF
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#endif // NO_TTF
|
||||
#include "../config/Config.h"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../util/Util.h"
|
||||
#include "platform.h"
|
||||
# include <cstring>
|
||||
# include <ctype.h>
|
||||
# include <dlfcn.h>
|
||||
# include <errno.h>
|
||||
# ifndef NO_TTF
|
||||
# include <fontconfig/fontconfig.h>
|
||||
# endif // NO_TTF
|
||||
# include "../config/Config.h"
|
||||
# include "../localisation/Language.h"
|
||||
# include "../localisation/StringIds.h"
|
||||
# include "../util/Util.h"
|
||||
# include "platform.h"
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <locale.h>
|
||||
#include <pwd.h>
|
||||
# include <fnmatch.h>
|
||||
# include <locale.h>
|
||||
# include <pwd.h>
|
||||
|
||||
uint16_t platform_get_locale_language()
|
||||
{
|
||||
|
@ -126,11 +126,11 @@ uint8_t platform_get_locale_currency()
|
|||
uint8_t platform_get_locale_measurement_format()
|
||||
{
|
||||
// LC_MEASUREMENT is GNU specific.
|
||||
#ifdef LC_MEASUREMENT
|
||||
# ifdef LC_MEASUREMENT
|
||||
const char* langstring = setlocale(LC_MEASUREMENT, "");
|
||||
#else
|
||||
# else
|
||||
const char* langstring = setlocale(LC_ALL, "");
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (langstring != nullptr)
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ bool platform_get_steam_path(utf8* outPath, size_t outSize)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifndef NO_TTF
|
||||
# ifndef NO_TTF
|
||||
bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
||||
{
|
||||
assert(buffer != nullptr);
|
||||
|
@ -250,6 +250,6 @@ bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
|||
FcFini();
|
||||
return found;
|
||||
}
|
||||
#endif // NO_TTF
|
||||
# endif // NO_TTF
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include "../core/Guard.hpp"
|
||||
#include "Platform2.h"
|
||||
# include "../core/Guard.hpp"
|
||||
# include "Platform2.h"
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
|
|
|
@ -9,22 +9,22 @@
|
|||
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__linux__) && !defined(__ANDROID__))
|
||||
|
||||
#include <limits.h>
|
||||
#include <pwd.h>
|
||||
#if defined(__FreeBSD__)
|
||||
#include <stddef.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
#endif // __FreeBSD__
|
||||
#if defined(__linux__)
|
||||
# include <limits.h>
|
||||
# include <pwd.h>
|
||||
# if defined(__FreeBSD__)
|
||||
# include <stddef.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/types.h>
|
||||
# endif // __FreeBSD__
|
||||
# if defined(__linux__)
|
||||
// for PATH_MAX
|
||||
#include <linux/limits.h>
|
||||
#endif // __linux__
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "Platform2.h"
|
||||
#include "platform.h"
|
||||
# include <linux/limits.h>
|
||||
# endif // __linux__
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../core/Path.hpp"
|
||||
# include "../core/Util.hpp"
|
||||
# include "Platform2.h"
|
||||
# include "platform.h"
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
|
@ -72,10 +72,10 @@ namespace Platform
|
|||
{
|
||||
static const char* SearchLocations[] = {
|
||||
"../share/openrct2",
|
||||
#ifdef ORCT2_RESOURCE_DIR
|
||||
# ifdef ORCT2_RESOURCE_DIR
|
||||
// defined in CMakeLists.txt
|
||||
ORCT2_RESOURCE_DIR,
|
||||
#endif // ORCT2_RESOURCE_DIR
|
||||
# endif // ORCT2_RESOURCE_DIR
|
||||
"/usr/local/share/openrct2",
|
||||
"/var/lib/openrct2",
|
||||
"/usr/share/openrct2",
|
||||
|
@ -140,26 +140,26 @@ namespace Platform
|
|||
std::string GetCurrentExecutablePath()
|
||||
{
|
||||
char exePath[PATH_MAX] = { 0 };
|
||||
#ifdef __linux__
|
||||
# ifdef __linux__
|
||||
auto bytesRead = readlink("/proc/self/exe", exePath, sizeof(exePath));
|
||||
if (bytesRead == -1)
|
||||
{
|
||||
log_fatal("failed to read /proc/self/exe");
|
||||
}
|
||||
#elif defined(__FreeBSD__)
|
||||
# elif defined(__FreeBSD__)
|
||||
const int32_t mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
|
||||
auto exeLen = sizeof(exePath);
|
||||
if (sysctl(mib, 4, exePath, &exeLen, nullptr, 0) == -1)
|
||||
{
|
||||
log_fatal("failed to get process path");
|
||||
}
|
||||
#elif defined(__OpenBSD__)
|
||||
# elif defined(__OpenBSD__)
|
||||
// There is no way to get the path name of a running executable.
|
||||
// If you are not using the port or package, you may have to change this line!
|
||||
strlcpy(exePath, "/usr/local/bin/", sizeof(exePath));
|
||||
#else
|
||||
#error "Platform does not support full path exe retrieval"
|
||||
#endif
|
||||
# else
|
||||
# error "Platform does not support full path exe retrieval"
|
||||
# endif
|
||||
return exePath;
|
||||
}
|
||||
} // namespace Platform
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
|
||||
|
||||
#include "../core/String.hpp"
|
||||
#include "Platform2.h"
|
||||
#include "platform.h"
|
||||
# include "../core/String.hpp"
|
||||
# include "Platform2.h"
|
||||
# include "platform.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <pwd.h>
|
||||
# include <cstdlib>
|
||||
# include <cstring>
|
||||
# include <ctime>
|
||||
# include <pwd.h>
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
|
|
|
@ -10,35 +10,35 @@
|
|||
#ifdef _WIN32
|
||||
|
||||
// Windows.h needs to be included first
|
||||
#include <windows.h>
|
||||
# include <windows.h>
|
||||
|
||||
// Then the rest
|
||||
#include <datetimeapi.h>
|
||||
#include <memory>
|
||||
#include <shlobj.h>
|
||||
#undef GetEnvironmentVariable
|
||||
# include <datetimeapi.h>
|
||||
# include <memory>
|
||||
# include <shlobj.h>
|
||||
# undef GetEnvironmentVariable
|
||||
|
||||
#if !defined(__MINGW32__) && ((NTDDI_VERSION >= NTDDI_VISTA) && !defined(_USING_V110_SDK71_) && !defined(_ATL_XP_TARGETING))
|
||||
#define __USE_SHGETKNOWNFOLDERPATH__
|
||||
#define __USE_GETDATEFORMATEX__
|
||||
#else
|
||||
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
|
||||
#endif
|
||||
# if !defined(__MINGW32__) && ((NTDDI_VERSION >= NTDDI_VISTA) && !defined(_USING_V110_SDK71_) && !defined(_ATL_XP_TARGETING))
|
||||
# define __USE_SHGETKNOWNFOLDERPATH__
|
||||
# define __USE_GETDATEFORMATEX__
|
||||
# else
|
||||
# define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
|
||||
# endif
|
||||
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "Platform2.h"
|
||||
#include "platform.h"
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../core/Path.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../core/Util.hpp"
|
||||
# include "Platform2.h"
|
||||
# include "platform.h"
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
#ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
# ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
static std::string WIN32_GetKnownFolderPath(REFKNOWNFOLDERID rfid);
|
||||
#else
|
||||
# else
|
||||
static std::string WIN32_GetFolderPath(int nFolder);
|
||||
#endif
|
||||
# endif
|
||||
static std::string WIN32_GetModuleFileNameW(HMODULE hModule);
|
||||
|
||||
uint32_t GetTicks()
|
||||
|
@ -87,11 +87,11 @@ namespace Platform
|
|||
case SPECIAL_FOLDER::USER_CONFIG:
|
||||
case SPECIAL_FOLDER::USER_DATA:
|
||||
{
|
||||
#ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
# ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
auto path = WIN32_GetKnownFolderPath(FOLDERID_Documents);
|
||||
#else
|
||||
# else
|
||||
auto path = WIN32_GetFolderPath(CSIDL_PERSONAL);
|
||||
#endif
|
||||
# endif
|
||||
if (path.empty())
|
||||
{
|
||||
path = GetFolderPath(SPECIAL_FOLDER::USER_HOME);
|
||||
|
@ -100,11 +100,11 @@ namespace Platform
|
|||
}
|
||||
case SPECIAL_FOLDER::USER_HOME:
|
||||
{
|
||||
#ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
# ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
auto path = WIN32_GetKnownFolderPath(FOLDERID_Profile);
|
||||
#else
|
||||
# else
|
||||
auto path = WIN32_GetFolderPath(CSIDL_PROFILE);
|
||||
#endif
|
||||
# endif
|
||||
if (path.empty())
|
||||
{
|
||||
path = GetHomePathViaEnvironment();
|
||||
|
@ -163,15 +163,15 @@ namespace Platform
|
|||
{
|
||||
SYSTEMTIME st = TimeToSystemTime(timestamp);
|
||||
|
||||
#ifdef __USE_GETDATEFORMATEX__
|
||||
# ifdef __USE_GETDATEFORMATEX__
|
||||
wchar_t date[20];
|
||||
GetDateFormatEx(LOCALE_NAME_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, date, sizeof(date), nullptr);
|
||||
std::string result = String::ToUtf8(std::wstring(date));
|
||||
#else
|
||||
# else
|
||||
char date[20];
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, date, sizeof(date));
|
||||
std::string result(date);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -180,15 +180,15 @@ namespace Platform
|
|||
{
|
||||
SYSTEMTIME st = TimeToSystemTime(timestamp);
|
||||
|
||||
#ifdef __USE_GETDATEFORMATEX__
|
||||
# ifdef __USE_GETDATEFORMATEX__
|
||||
wchar_t time[20];
|
||||
GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, 0, &st, nullptr, time, sizeof(time));
|
||||
std::string result = String::ToUtf8(std::wstring(time));
|
||||
#else
|
||||
# else
|
||||
char time[20];
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, nullptr, time, sizeof(time));
|
||||
std::string result(time);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ namespace Platform
|
|||
return isSupported;
|
||||
}
|
||||
|
||||
#ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
# ifdef __USE_SHGETKNOWNFOLDERPATH__
|
||||
static std::string WIN32_GetKnownFolderPath(REFKNOWNFOLDERID rfid)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -275,7 +275,7 @@ namespace Platform
|
|||
CoTaskMemFree(wpath);
|
||||
return path;
|
||||
}
|
||||
#else
|
||||
# else
|
||||
static std::string WIN32_GetFolderPath(int nFolder)
|
||||
{
|
||||
std::string path;
|
||||
|
@ -286,7 +286,7 @@ namespace Platform
|
|||
}
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
static std::string WIN32_GetModuleFileNameW(HMODULE hModule)
|
||||
{
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../core/Path.hpp"
|
||||
#include "Platform2.h"
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../core/Path.hpp"
|
||||
# include "Platform2.h"
|
||||
|
||||
// undefine `interface` and `abstract`, because it's causing conflicts with Objective-C's keywords
|
||||
#undef interface
|
||||
#undef abstract
|
||||
# undef interface
|
||||
# undef abstract
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <mach-o/dyld.h>
|
||||
# include <Foundation/Foundation.h>
|
||||
# include <mach-o/dyld.h>
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
|
|
|
@ -9,35 +9,35 @@
|
|||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
|
||||
|
||||
#include <cstring>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <fnmatch.h>
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#include <fts.h>
|
||||
#endif
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../util/Util.h"
|
||||
#include "platform.h"
|
||||
# include <cstring>
|
||||
# include <ctype.h>
|
||||
# include <dirent.h>
|
||||
# include <errno.h>
|
||||
# include <fcntl.h>
|
||||
# include <fnmatch.h>
|
||||
# ifndef __EMSCRIPTEN__
|
||||
# include <fts.h>
|
||||
# endif
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../localisation/Date.h"
|
||||
# include "../localisation/Language.h"
|
||||
# include "../util/Util.h"
|
||||
# include "platform.h"
|
||||
|
||||
#include <libgen.h>
|
||||
#include <locale.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
# include <libgen.h>
|
||||
# include <locale.h>
|
||||
# include <pwd.h>
|
||||
# include <stdlib.h>
|
||||
# include <sys/file.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
# include <unistd.h>
|
||||
// The name of the mutex used to prevent multiple instances of the game from running
|
||||
#define SINGLE_INSTANCE_MUTEX_NAME "openrct2.lock"
|
||||
# define SINGLE_INSTANCE_MUTEX_NAME "openrct2.lock"
|
||||
|
||||
#define FILE_BUFFER_SIZE 4096
|
||||
# define FILE_BUFFER_SIZE 4096
|
||||
|
||||
static utf8 _userDataDirectoryPath[MAX_PATH] = { 0 };
|
||||
|
||||
|
@ -195,7 +195,7 @@ bool platform_ensure_directory_exists(const utf8* path)
|
|||
|
||||
bool platform_directory_delete(const utf8* path)
|
||||
{
|
||||
#ifdef _FTS_H
|
||||
# ifdef _FTS_H
|
||||
log_verbose("Recursively deleting directory %s", path);
|
||||
|
||||
FTS* ftsp;
|
||||
|
@ -251,9 +251,9 @@ bool platform_directory_delete(const utf8* path)
|
|||
free(ourPath);
|
||||
fts_close(ftsp);
|
||||
|
||||
#else
|
||||
# else
|
||||
log_warning("OpenRCT2 was compiled without fts.h, deleting '%s' not done.", path);
|
||||
#endif // _FTS_H
|
||||
# endif // _FTS_H
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -402,11 +402,11 @@ time_t platform_file_get_modified_time(const utf8* path)
|
|||
uint8_t platform_get_locale_temperature_format()
|
||||
{
|
||||
// LC_MEASUREMENT is GNU specific.
|
||||
#ifdef LC_MEASUREMENT
|
||||
# ifdef LC_MEASUREMENT
|
||||
const char* langstring = setlocale(LC_MEASUREMENT, "");
|
||||
#else
|
||||
# else
|
||||
const char* langstring = setlocale(LC_ALL, "");
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (langstring != nullptr)
|
||||
{
|
||||
|
@ -454,11 +454,11 @@ utf8* platform_get_username()
|
|||
|
||||
bool platform_process_is_elevated()
|
||||
{
|
||||
#ifndef __EMSCRIPTEN__
|
||||
# ifndef __EMSCRIPTEN__
|
||||
return (geteuid() == 0);
|
||||
#else
|
||||
# else
|
||||
return false;
|
||||
#endif // __EMSCRIPTEN__
|
||||
# endif // __EMSCRIPTEN__
|
||||
}
|
||||
|
||||
std::string platform_get_rct2_steam_dir()
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#include "../common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "../Context.h"
|
||||
|
@ -32,11 +32,11 @@
|
|||
#include <time.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <mach/mach_time.h>
|
||||
#ifndef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||
#error Missing __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ define
|
||||
#endif
|
||||
# include <AvailabilityMacros.h>
|
||||
# include <mach/mach_time.h>
|
||||
# ifndef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||
# error Missing __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ define
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200)
|
||||
|
|
|
@ -9,43 +9,43 @@
|
|||
|
||||
#ifdef __MINGW32__
|
||||
// 0x0600 == vista
|
||||
#define WINVER 0x0600
|
||||
#define _WIN32_WINNT 0x0600
|
||||
# define WINVER 0x0600
|
||||
# define _WIN32_WINNT 0x0600
|
||||
#endif // __MINGW32__
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// Windows.h needs to be included first
|
||||
#include <windows.h>
|
||||
# include <windows.h>
|
||||
|
||||
// Then the rest
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../Version.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../rct2/RCT2.h"
|
||||
#include "../util/Util.h"
|
||||
#include "platform.h"
|
||||
# include "../OpenRCT2.h"
|
||||
# include "../Version.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../core/Util.hpp"
|
||||
# include "../localisation/Date.h"
|
||||
# include "../localisation/Language.h"
|
||||
# include "../rct2/RCT2.h"
|
||||
# include "../util/Util.h"
|
||||
# include "platform.h"
|
||||
|
||||
#include <lmcons.h>
|
||||
#include <psapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <sys/stat.h>
|
||||
# include <lmcons.h>
|
||||
# include <psapi.h>
|
||||
# include <shlobj.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
// Native resource IDs
|
||||
#include "../../../resources/resource.h"
|
||||
# include "../../../resources/resource.h"
|
||||
|
||||
// Enable visual styles
|
||||
#pragma comment( \
|
||||
linker, \
|
||||
"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
# pragma comment( \
|
||||
linker, \
|
||||
"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
|
||||
// The name of the mutex used to prevent multiple instances of the game from running
|
||||
#define SINGLE_INSTANCE_MUTEX_NAME "RollerCoaster Tycoon 2_GSKMUTEX"
|
||||
# define SINGLE_INSTANCE_MUTEX_NAME "RollerCoaster Tycoon 2_GSKMUTEX"
|
||||
|
||||
#define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
|
||||
# define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
|
||||
|
||||
static HMODULE _dllModule = nullptr;
|
||||
|
||||
|
@ -423,10 +423,11 @@ uint8_t platform_get_locale_date_format()
|
|||
return DATE_FORMAT_DAY_MONTH_YEAR;
|
||||
}
|
||||
|
||||
#ifndef NO_TTF
|
||||
# ifndef NO_TTF
|
||||
bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
||||
{
|
||||
#if !defined(__MINGW32__) && ((NTDDI_VERSION >= NTDDI_VISTA) && !defined(_USING_V110_SDK71_) && !defined(_ATL_XP_TARGETING))
|
||||
# if !defined(__MINGW32__) \
|
||||
&& ((NTDDI_VERSION >= NTDDI_VISTA) && !defined(_USING_V110_SDK71_) && !defined(_ATL_XP_TARGETING))
|
||||
wchar_t* fontFolder;
|
||||
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Fonts, 0, NULL, &fontFolder)))
|
||||
{
|
||||
|
@ -445,14 +446,14 @@ bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
# else
|
||||
log_warning("Compatibility hack: falling back to C:\\Windows\\Fonts");
|
||||
safe_strcpy(buffer, "C:\\Windows\\Fonts\\", size);
|
||||
safe_strcat_path(buffer, font->filename, size);
|
||||
return true;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif // NO_TTF
|
||||
# endif // NO_TTF
|
||||
|
||||
utf8* platform_get_absolute_path(const utf8* relativePath, const utf8* basePath)
|
||||
{
|
||||
|
@ -524,8 +525,8 @@ bool platform_process_is_elevated()
|
|||
// File association setup
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define SOFTWARE_CLASSES L"Software\\Classes"
|
||||
#define MUI_CACHE L"Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache"
|
||||
# define SOFTWARE_CLASSES L"Software\\Classes"
|
||||
# define MUI_CACHE L"Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache"
|
||||
|
||||
static void get_progIdName(wchar_t* dst, const utf8* extension)
|
||||
{
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../util/Util.h"
|
||||
#include "platform.h"
|
||||
# include "../config/Config.h"
|
||||
# include "../localisation/Language.h"
|
||||
# include "../util/Util.h"
|
||||
# include "platform.h"
|
||||
|
||||
// undefine `interface` and `abstract`, because it's causing conflicts with Objective-C's keywords
|
||||
#undef interface
|
||||
#undef abstract
|
||||
# undef interface
|
||||
# undef abstract
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <pwd.h>
|
||||
# import <AppKit/AppKit.h>
|
||||
# import <Foundation/Foundation.h>
|
||||
# include <mach-o/dyld.h>
|
||||
# include <pwd.h>
|
||||
|
||||
void macos_disallow_automatic_window_tabbing()
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ utf8* macos_str_decomp_to_precomp(utf8* input)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef NO_TTF
|
||||
# ifndef NO_TTF
|
||||
bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
@ -65,7 +65,7 @@ bool platform_get_font_path(TTFFontDescriptor* font, utf8* buffer, size_t size)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // NO_TTF
|
||||
# endif // NO_TTF
|
||||
|
||||
bool platform_has_matching_language(NSString* preferredLocale, uint16_t* languageIdentifier)
|
||||
{
|
||||
|
|
|
@ -19,17 +19,17 @@ struct TTFFontDescriptor;
|
|||
struct rct2_install_info;
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
# define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
#define INVALID_HANDLE (-1)
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PATH_SEPARATOR "\\"
|
||||
#define PLATFORM_NEWLINE "\r\n"
|
||||
# define PATH_SEPARATOR "\\"
|
||||
# define PLATFORM_NEWLINE "\r\n"
|
||||
#else
|
||||
#define PATH_SEPARATOR "/"
|
||||
#define PLATFORM_NEWLINE "\n"
|
||||
# define PATH_SEPARATOR "/"
|
||||
# define PLATFORM_NEWLINE "\n"
|
||||
#endif
|
||||
|
||||
struct resolution_t
|
||||
|
@ -134,16 +134,16 @@ void core_init();
|
|||
|
||||
// Windows specific definitions
|
||||
#ifdef _WIN32
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef CreateDirectory
|
||||
#undef CreateWindow
|
||||
#undef GetMessage
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# undef CreateDirectory
|
||||
# undef CreateWindow
|
||||
# undef GetMessage
|
||||
|
||||
void platform_setup_file_associations();
|
||||
void platform_remove_file_associations();
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
// malloc is very slow for large allocations in MSVC debug builds as it allocates
|
||||
// memory on a special debug heap and then initialises all the memory to 0xCC.
|
||||
#if defined(_WIN32) && defined(DEBUG)
|
||||
#define __USE_HEAP_ALLOC__
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
# define __USE_HEAP_ALLOC__
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
// Allow chunks to be uncompressed to a maximum of 16 MiB
|
||||
|
|
|
@ -24,7 +24,7 @@ struct rct_vehicle_colour
|
|||
};
|
||||
|
||||
#ifdef __TESTPAINT__
|
||||
#pragma pack(push, 1)
|
||||
# pragma pack(push, 1)
|
||||
#endif // __TESTPAINT__
|
||||
/**
|
||||
* Ride type vehicle structure.
|
||||
|
@ -88,7 +88,7 @@ struct rct_ride_entry_vehicle
|
|||
std::vector<int8_t> peep_loading_positions = {}; // previously 0x61 , 0x7B
|
||||
};
|
||||
#ifdef __TESTPAINT__
|
||||
#pragma pack(pop)
|
||||
# pragma pack(pop)
|
||||
#endif // __TESTPAINT__
|
||||
#ifdef PLATFORM_32BIT
|
||||
static_assert(offsetof(rct_ride_entry_vehicle, peep_loading_positions) % 4 == 0, "Invalid struct layout");
|
||||
|
|
|
@ -395,8 +395,8 @@ void scenario_update();
|
|||
|
||||
#ifdef DEBUG_DESYNC
|
||||
uint32_t dbg_scenario_rand(const char* file, const char* function, const uint32_t line, const void* data);
|
||||
#define scenario_rand() dbg_scenario_rand(__FILE__, __FUNCTION__, __LINE__, NULL)
|
||||
#define scenario_rand_data(data) dbg_scenario_rand(__FILE__, __FUNCTION__, __LINE__, data)
|
||||
# define scenario_rand() dbg_scenario_rand(__FILE__, __FUNCTION__, __LINE__, NULL)
|
||||
# define scenario_rand_data(data) dbg_scenario_rand(__FILE__, __FUNCTION__, __LINE__, data)
|
||||
void dbg_report_desync(uint32_t tick, uint32_t srand0, uint32_t server_srand0, const char* clientHash, const char* serverHash);
|
||||
#else
|
||||
uint32_t scenario_rand();
|
||||
|
|
|
@ -167,7 +167,7 @@ int32_t bitscanforward(int32_t source)
|
|||
int32_t success = __builtin_ffs(source);
|
||||
return success - 1;
|
||||
#else
|
||||
#pragma message "Falling back to iterative bitscan forward, consider using intrinsics"
|
||||
# pragma message "Falling back to iterative bitscan forward, consider using intrinsics"
|
||||
// This is a low-hanging optimisation boost, check if your compiler offers
|
||||
// any intrinsic.
|
||||
// cf. https://github.com/OpenRCT2/OpenRCT2/pull/2093
|
||||
|
@ -180,26 +180,26 @@ int32_t bitscanforward(int32_t source)
|
|||
}
|
||||
|
||||
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
|
||||
#include <cpuid.h>
|
||||
#define OpenRCT2_CPUID_GNUC_X86
|
||||
# include <cpuid.h>
|
||||
# define OpenRCT2_CPUID_GNUC_X86
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_X64) || defined(_M_IX86)) // VS2008
|
||||
#include <intrin.h>
|
||||
#include <nmmintrin.h>
|
||||
#define OpenRCT2_CPUID_MSVC_X86
|
||||
# include <intrin.h>
|
||||
# include <nmmintrin.h>
|
||||
# define OpenRCT2_CPUID_MSVC_X86
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_X86
|
||||
static bool cpuid_x86(uint32_t* cpuid_outdata, int32_t eax)
|
||||
{
|
||||
#if defined(OpenRCT2_CPUID_GNUC_X86)
|
||||
# if defined(OpenRCT2_CPUID_GNUC_X86)
|
||||
int ret = __get_cpuid(eax, &cpuid_outdata[0], &cpuid_outdata[1], &cpuid_outdata[2], &cpuid_outdata[3]);
|
||||
return ret == 1;
|
||||
#elif defined(OpenRCT2_CPUID_MSVC_X86)
|
||||
# elif defined(OpenRCT2_CPUID_MSVC_X86)
|
||||
__cpuid((int*)cpuid_outdata, (int)eax);
|
||||
return true;
|
||||
#else
|
||||
# else
|
||||
return false;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif // OPENRCT2_X86
|
||||
|
||||
|
@ -223,16 +223,16 @@ bool avx2_available()
|
|||
// https://github.com/gcc-mirror/gcc/commit/132fa33ce998df69a9f793d63785785f4b93e6f1
|
||||
// which causes it to ignore subleafs, but the new function is unavailable on Ubuntu's
|
||||
// prehistoric toolchains
|
||||
#if defined(OpenRCT2_CPUID_GNUC_X86) && (!defined(__FreeBSD__) || (__FreeBSD__ > 10))
|
||||
# if defined(OpenRCT2_CPUID_GNUC_X86) && (!defined(__FreeBSD__) || (__FreeBSD__ > 10))
|
||||
return __builtin_cpu_supports("avx2");
|
||||
#else
|
||||
# else
|
||||
// AVX2 support is declared as the 5th bit of EBX with CPUID(EAX = 7, ECX = 0).
|
||||
uint32_t regs[4] = { 0 };
|
||||
if (cpuid_x86(regs, 7))
|
||||
{
|
||||
return (regs[1] & (1 << 5));
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue