mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Merge pull request #5157 from IntelOrca/fix/windows-tests-assert
Allow control of assertion behaviour
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
652076321E22EFE7000D0C04 /* Imaging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 652076301E22EFE7000D0C04 /* Imaging.cpp */; };
|
||||
652747EC1E41CE1B000F36FD /* SawyerEncoding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 652747EA1E41CE1B000F36FD /* SawyerEncoding.cpp */; };
|
||||
658F3D911E44A6C200388550 /* ParkImporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 658F3D8F1E44A6C200388550 /* ParkImporter.cpp */; };
|
||||
656F6C8E1E45BFC200E0F770 /* Version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656F6C8C1E45BFC200E0F770 /* Version.cpp */; };
|
||||
791166FB1D7486EF005912EA /* NetworkServerAdvertiser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 791166F91D7486EF005912EA /* NetworkServerAdvertiser.cpp */; };
|
||||
85060FD31D8C17CC00DFA2B3 /* track_data_old.c in Sources */ = {isa = PBXBuildFile; fileRef = 8594C05F1D885CF600235E93 /* track_data_old.c */; };
|
||||
8594C0601D885CF600235E93 /* track_data_old.c in Sources */ = {isa = PBXBuildFile; fileRef = 8594C05F1D885CF600235E93 /* track_data_old.c */; };
|
||||
@@ -466,7 +467,6 @@
|
||||
D4A8B4B41DB41873007A2F29 /* libpng16.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D4A8B4B31DB41873007A2F29 /* libpng16.dylib */; };
|
||||
D4A8B4B51DB4188D007A2F29 /* libpng16.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D4A8B4B31DB41873007A2F29 /* libpng16.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
D4B21B6F1E343AF1004982C7 /* lightfx.c in Sources */ = {isa = PBXBuildFile; fileRef = D4B21B6D1E343AF1004982C7 /* lightfx.c */; };
|
||||
D4CA88661D4E64C800060C11 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = D4CA88651D4E64C800060C11 /* version.c */; };
|
||||
D4EC48E61C2637710024B507 /* g2.dat in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E31C2637710024B507 /* g2.dat */; };
|
||||
D4EC48E71C2637710024B507 /* language in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E41C2637710024B507 /* language */; };
|
||||
D4EC48E81C2637710024B507 /* title in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E51C2637710024B507 /* title */; };
|
||||
@@ -527,6 +527,8 @@
|
||||
652747EB1E41CE1B000F36FD /* SawyerEncoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SawyerEncoding.h; path = rct12/SawyerEncoding.h; sourceTree = "<group>"; };
|
||||
658F3D8F1E44A6C200388550 /* ParkImporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParkImporter.cpp; sourceTree = "<group>"; };
|
||||
658F3D901E44A6C200388550 /* ParkImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParkImporter.h; sourceTree = "<group>"; };
|
||||
656F6C8C1E45BFC200E0F770 /* Version.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Version.cpp; sourceTree = "<group>"; };
|
||||
656F6C8D1E45BFC200E0F770 /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Version.h; sourceTree = "<group>"; };
|
||||
791166F91D7486EF005912EA /* NetworkServerAdvertiser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkServerAdvertiser.cpp; sourceTree = "<group>"; };
|
||||
791166FA1D7486EF005912EA /* NetworkServerAdvertiser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkServerAdvertiser.h; sourceTree = "<group>"; };
|
||||
8594C05F1D885CF600235E93 /* track_data_old.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = track_data_old.c; sourceTree = "<group>"; };
|
||||
@@ -896,7 +898,6 @@
|
||||
D442718A1CC81B3200D84D28 /* sawyercoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sawyercoding.h; sourceTree = "<group>"; };
|
||||
D442718B1CC81B3200D84D28 /* util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = util.c; sourceTree = "<group>"; };
|
||||
D442718C1CC81B3200D84D28 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
|
||||
D442718D1CC81B3200D84D28 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; };
|
||||
D442718F1CC81B3200D84D28 /* about.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = about.c; sourceTree = "<group>"; };
|
||||
D44271901CC81B3200D84D28 /* banner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = banner.c; sourceTree = "<group>"; };
|
||||
D44271911CC81B3200D84D28 /* changelog.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = changelog.c; sourceTree = "<group>"; };
|
||||
@@ -1212,7 +1213,6 @@
|
||||
D4A8B4B31DB41873007A2F29 /* libpng16.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libpng16.dylib; sourceTree = "<group>"; };
|
||||
D4B21B6D1E343AF1004982C7 /* lightfx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lightfx.c; sourceTree = "<group>"; };
|
||||
D4B21B6E1E343AF1004982C7 /* lightfx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lightfx.h; sourceTree = "<group>"; };
|
||||
D4CA88651D4E64C800060C11 /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = "<group>"; };
|
||||
D4EC48E31C2637710024B507 /* g2.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = g2.dat; path = data/g2.dat; sourceTree = SOURCE_ROOT; };
|
||||
D4EC48E41C2637710024B507 /* language */ = {isa = PBXFileReference; lastKnownFileType = folder; name = language; path = data/language; sourceTree = SOURCE_ROOT; };
|
||||
D4EC48E51C2637710024B507 /* title */ = {isa = PBXFileReference; lastKnownFileType = folder; name = title; path = data/title; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1582,8 +1582,8 @@
|
||||
D442716C1CC81B3200D84D28 /* rct2.h */,
|
||||
D433A5031E4A862F00D9A6DF /* rct12.h */,
|
||||
D44271851CC81B3200D84D28 /* sprites.h */,
|
||||
D4CA88651D4E64C800060C11 /* version.c */,
|
||||
D442718D1CC81B3200D84D28 /* version.h */,
|
||||
656F6C8C1E45BFC200E0F770 /* Version.cpp */,
|
||||
656F6C8D1E45BFC200E0F770 /* Version.h */,
|
||||
);
|
||||
name = Sources;
|
||||
path = src/openrct2;
|
||||
@@ -2786,7 +2786,6 @@
|
||||
D44272931CC81B3200D84D28 /* top_toolbar.c in Sources */,
|
||||
D43407DA1D0E14BE00C2B3D4 /* FillRectShader.cpp in Sources */,
|
||||
D464FEBE1D31A66E00CBABAC /* MemoryStream.cpp in Sources */,
|
||||
D4CA88661D4E64C800060C11 /* version.c in Sources */,
|
||||
D44271F61CC81B3200D84D28 /* audio.c in Sources */,
|
||||
D442728A1CC81B3200D84D28 /* tile_inspector.c in Sources */,
|
||||
D43407D91D0E14BE00C2B3D4 /* DrawLineShader.cpp in Sources */,
|
||||
@@ -2900,6 +2899,7 @@
|
||||
D44272041CC81B3200D84D28 /* Stopwatch.cpp in Sources */,
|
||||
D43407D81D0E14BE00C2B3D4 /* DrawImageShader.cpp in Sources */,
|
||||
007A05D01CFB2C8B00F419C3 /* NetworkGroup.cpp in Sources */,
|
||||
656F6C8E1E45BFC200E0F770 /* Version.cpp in Sources */,
|
||||
C686F9491CDBC3B7009F9BFC /* chairlift.c in Sources */,
|
||||
C686F9501CDBC3B7009F9BFC /* log_flume.c in Sources */,
|
||||
D464FEE81D31A6AA00CBABAC /* FootpathObject.cpp in Sources */,
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SolutionDir Condition="'$(SolutionDir)'==''">..\..\</SolutionDir>
|
||||
<Config Condition="'$(Configuration)'=='Debug' OR '$(Configuration)'=='DebugTests'">Debug</Config>
|
||||
<Config Condition="'$(Configuration)'=='Release' OR '$(Configuration)'=='ReleaseTests'">Release</Config>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@@ -16,13 +14,13 @@
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\$(Config)_$(Platform)\</IntDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\</IntDir>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug'">
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release'">
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
@@ -56,7 +54,7 @@
|
||||
<AdditionalOptions>/OPT:NOLBR /ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Config)'=='Debug'">
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
@@ -68,7 +66,7 @@
|
||||
<LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Config)'=='Release'">
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@@ -85,16 +83,6 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='DebugTests'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>__TEST__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='ReleaseTests'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;__TEST__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<!-- Debug|Win32 is reserved for RCT2 interop builds, this means it has to be a DLL -->
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'!='Debug|Win32'">
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "scenario/ScenarioRepository.h"
|
||||
#include "title/TitleScreen.h"
|
||||
#include "title/TitleSequenceManager.h"
|
||||
#include "Version.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -44,7 +45,6 @@ extern "C"
|
||||
#include "platform/platform.h"
|
||||
#include "rct1.h"
|
||||
#include "rct2/interop.h"
|
||||
#include "version.h"
|
||||
}
|
||||
|
||||
// The game update inverval in milliseconds, (1000 / 40fps) = 25ms
|
||||
@@ -76,7 +76,6 @@ extern "C"
|
||||
namespace OpenRCT2
|
||||
{
|
||||
static IPlatformEnvironment * _env = nullptr;
|
||||
static std::string _versionInfo;
|
||||
static bool _isWindowMinimised;
|
||||
static uint32 _isWindowMinimisedLastCheckTick;
|
||||
static uint32 _lastTick;
|
||||
@@ -85,7 +84,6 @@ namespace OpenRCT2
|
||||
/** If set, will end the OpenRCT2 game loop. Intentially private to this module so that the flag can not be set back to false. */
|
||||
static bool _finished;
|
||||
|
||||
static void SetVersionInfoString();
|
||||
static bool ShouldRunVariableFrame();
|
||||
static void RunGameLoop();
|
||||
static void RunFixedFrame();
|
||||
@@ -98,11 +96,7 @@ extern "C"
|
||||
{
|
||||
void openrct2_write_full_version_info(utf8 * buffer, size_t bufferSize)
|
||||
{
|
||||
if (OpenRCT2::_versionInfo.empty())
|
||||
{
|
||||
OpenRCT2::SetVersionInfoString();
|
||||
}
|
||||
String::Set(buffer, bufferSize, OpenRCT2::_versionInfo.c_str());
|
||||
String::Set(buffer, bufferSize, Version::GetInfo().c_str());
|
||||
}
|
||||
|
||||
static void openrct2_set_exe_path()
|
||||
@@ -380,29 +374,6 @@ namespace OpenRCT2
|
||||
return env;
|
||||
}
|
||||
|
||||
static void SetVersionInfoString()
|
||||
{
|
||||
utf8 buffer[256];
|
||||
size_t bufferSize = sizeof(buffer);
|
||||
String::Set(buffer, bufferSize, OPENRCT2_NAME ", v" OPENRCT2_VERSION);
|
||||
if (!String::IsNullOrEmpty(gGitBranch))
|
||||
{
|
||||
String::AppendFormat(buffer, bufferSize, "-%s", gGitBranch);
|
||||
}
|
||||
if (!String::IsNullOrEmpty(gCommitSha1Short))
|
||||
{
|
||||
String::AppendFormat(buffer, bufferSize, " build %s", gCommitSha1Short);
|
||||
}
|
||||
if (!String::IsNullOrEmpty(gBuildServer))
|
||||
{
|
||||
String::AppendFormat(buffer, bufferSize, " provided by %s", gBuildServer);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
String::AppendFormat(buffer, bufferSize, " (DEBUG)", gBuildServer);
|
||||
#endif
|
||||
_versionInfo = buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the main game loop until the finished flag is set.
|
||||
*/
|
||||
|
||||
85
src/openrct2/Version.cpp
Normal file
85
src/openrct2/Version.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include <string>
|
||||
#include "core/String.hpp"
|
||||
#include "Version.h"
|
||||
|
||||
#ifdef OPENRCT2_BUILD_INFO_HEADER
|
||||
#include OPENRCT2_BUILD_INFO_HEADER
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_BUILD_NUMBER
|
||||
const char *gBuildNumber = OPENRCT2_BUILD_NUMBER;
|
||||
#else
|
||||
const char *gBuildNumber = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_BUILD_SERVER
|
||||
const char *gBuildServer = OPENRCT2_BUILD_SERVER;
|
||||
#else
|
||||
const char *gBuildServer = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_BRANCH
|
||||
const char *gGitBranch = OPENRCT2_BRANCH;
|
||||
#else
|
||||
const char *gGitBranch = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_COMMIT_SHA1
|
||||
const char *gCommitSha1 = OPENRCT2_COMMIT_SHA1;
|
||||
#else
|
||||
const char *gCommitSha1 = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_COMMIT_SHA1_SHORT
|
||||
const char *gCommitSha1Short = OPENRCT2_COMMIT_SHA1_SHORT;
|
||||
#else
|
||||
const char *gCommitSha1Short = "";
|
||||
#endif
|
||||
|
||||
namespace Version
|
||||
{
|
||||
static std::string _info;
|
||||
|
||||
std::string GetInfo()
|
||||
{
|
||||
if (_info.empty())
|
||||
{
|
||||
utf8 buffer[256];
|
||||
size_t bufferSize = sizeof(buffer);
|
||||
String::Set(buffer, bufferSize, OPENRCT2_NAME ", v" OPENRCT2_VERSION);
|
||||
if (!String::IsNullOrEmpty(gGitBranch))
|
||||
{
|
||||
String::AppendFormat(buffer, bufferSize, "-%s", gGitBranch);
|
||||
}
|
||||
if (!String::IsNullOrEmpty(gCommitSha1Short))
|
||||
{
|
||||
String::AppendFormat(buffer, bufferSize, " build %s", gCommitSha1Short);
|
||||
}
|
||||
if (!String::IsNullOrEmpty(gBuildServer))
|
||||
{
|
||||
String::AppendFormat(buffer, bufferSize, " provided by %s", gBuildServer);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
String::AppendFormat(buffer, bufferSize, " (DEBUG)", gBuildServer);
|
||||
#endif
|
||||
_info = std::string(buffer);
|
||||
}
|
||||
return _info;
|
||||
}
|
||||
}
|
||||
@@ -14,61 +14,68 @@
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef _VERSION_H_
|
||||
#define _VERSION_H_
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define OPENRCT2_NAME "OpenRCT2"
|
||||
#define OPENRCT2_VERSION "0.0.7"
|
||||
#define OPENRCT2_NAME "OpenRCT2"
|
||||
#define OPENRCT2_VERSION "0.0.7"
|
||||
|
||||
#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)
|
||||
#define OPENRCT2_ARCHITECTURE "ARMv7"
|
||||
#define OPENRCT2_ARCHITECTURE "ARMv7"
|
||||
#elif defined(__powerpc__) || defined(_M_PPC)
|
||||
#define OPENRCT2_ARCHITECTURE "PowerPC"
|
||||
#define OPENRCT2_ARCHITECTURE "PowerPC"
|
||||
#endif
|
||||
|
||||
#ifndef OPENRCT2_ARCHITECTURE
|
||||
#error "OPENRCT2_ARCHITECTURE is undefined. Please add identification."
|
||||
#error "OPENRCT2_ARCHITECTURE is undefined. Please add identification."
|
||||
#endif
|
||||
|
||||
// Platform
|
||||
#ifdef __WINDOWS__
|
||||
#define OPENRCT2_PLATFORM "Windows"
|
||||
#define OPENRCT2_PLATFORM "Windows"
|
||||
#endif
|
||||
#ifdef __LINUX__
|
||||
#define OPENRCT2_PLATFORM "Linux"
|
||||
#define OPENRCT2_PLATFORM "Linux"
|
||||
#endif
|
||||
#ifdef __MACOSX__
|
||||
#define OPENRCT2_PLATFORM "macOS"
|
||||
#define OPENRCT2_PLATFORM "macOS"
|
||||
#endif
|
||||
#ifdef __FREEBSD__
|
||||
#define OPENRCT2_PLATFORM "FreeBSD"
|
||||
#define OPENRCT2_PLATFORM "FreeBSD"
|
||||
#endif
|
||||
#ifndef OPENRCT2_PLATFORM
|
||||
#error Unknown platform!
|
||||
#error Unknown platform!
|
||||
#endif
|
||||
|
||||
#define OPENRCT2_TIMESTAMP __DATE__ " " __TIME__
|
||||
#define OPENRCT2_TIMESTAMP __DATE__ " " __TIME__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
// The following constants are for automated build servers
|
||||
extern const char *gBuildNumber;
|
||||
extern const char *gBuildServer;
|
||||
extern const char *gGitBranch;
|
||||
extern const char *gCommitSha1;
|
||||
extern const char *gCommitSha1Short;
|
||||
// The following constants are for automated build servers
|
||||
extern const char *gBuildNumber;
|
||||
extern const char *gBuildServer;
|
||||
extern const char *gGitBranch;
|
||||
extern const char *gCommitSha1;
|
||||
extern const char *gCommitSha1Short;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Version
|
||||
{
|
||||
std::string GetInfo();
|
||||
}
|
||||
#endif
|
||||
@@ -31,6 +31,7 @@ extern "C"
|
||||
#include "../network/network.h"
|
||||
#include "../object/ObjectRepository.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../Version.h"
|
||||
#include "CommandLine.hpp"
|
||||
|
||||
#ifdef USE_BREAKPAD
|
||||
|
||||
@@ -142,8 +142,6 @@ char *strndup(const char *src, size_t size);
|
||||
#define MAP_ANONYMOUS MAP_ANON
|
||||
#endif
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#define OPENRCT2_MASTER_SERVER_URL "https://servers.openrct2.website"
|
||||
|
||||
// Time (represented as number of 100-nanosecond intervals since 0001-01-01T00:00:00Z)
|
||||
|
||||
@@ -18,20 +18,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef GetMessage
|
||||
#endif
|
||||
|
||||
#include "../Version.h"
|
||||
#include "Console.hpp"
|
||||
#include "Diagnostics.hpp"
|
||||
#include "Guard.hpp"
|
||||
#include "String.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../OpenRCT2.h"
|
||||
|
||||
void openrct2_assert(bool expression, const char * message, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -44,6 +46,32 @@ extern "C"
|
||||
|
||||
namespace Guard
|
||||
{
|
||||
constexpr const utf8 * ASSERTION_MESSAGE = "An assertion failed, please report this to the OpenRCT2 developers.";
|
||||
|
||||
// The default behaviour when an assertion is raised.
|
||||
static ASSERT_BEHAVIOUR _assertBehaviour =
|
||||
#ifdef __WINDOWS__
|
||||
ASSERT_BEHAVIOUR::MESSAGE_BOX
|
||||
#else
|
||||
ASSERT_BEHAVIOUR::CASSERT
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
static void GetAssertMessage(char * buffer, size_t bufferSize, const char * formattedMessage);
|
||||
static void ForceCrash();
|
||||
#endif
|
||||
|
||||
ASSERT_BEHAVIOUR GetAssertBehaviour()
|
||||
{
|
||||
return _assertBehaviour;
|
||||
}
|
||||
|
||||
void SetAssertBehaviour(ASSERT_BEHAVIOUR behaviour)
|
||||
{
|
||||
_assertBehaviour = behaviour;
|
||||
}
|
||||
|
||||
void Assert(bool expression, const char * message, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -56,47 +84,44 @@ namespace Guard
|
||||
{
|
||||
if (expression) return;
|
||||
|
||||
Console::Error::WriteLine(ASSERTION_MESSAGE);
|
||||
Console::Error::WriteLine("Version: %s", Version::GetInfo().c_str());
|
||||
|
||||
// This is never freed, but acceptable considering we are about to crash out
|
||||
utf8 * formattedMessage = nullptr;
|
||||
if (message != nullptr)
|
||||
{
|
||||
Console::Error::WriteLine("Assertion failed:");
|
||||
Console::Error::WriteLine_VA(message, args);
|
||||
formattedMessage = String::Format_VA(message, args);
|
||||
Console::Error::WriteLine(formattedMessage);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
Debug::Break();
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
char version[128];
|
||||
openrct2_write_full_version_info(version, sizeof(version));
|
||||
|
||||
char buffer[512];
|
||||
strcpy(buffer, "An assertion failed, please report this to the OpenRCT2 developers.\r\n\r\nVersion: ");
|
||||
strcat(buffer, version);
|
||||
if (message != nullptr)
|
||||
{
|
||||
strcat(buffer, "\r\n");
|
||||
char *bufend = (char *)strchr(buffer, 0);
|
||||
vsnprintf(bufend, sizeof(buffer) - (bufend - buffer), message, args);
|
||||
}
|
||||
#ifdef __TEST__
|
||||
// Abort if we are building for testing
|
||||
abort();
|
||||
#else
|
||||
// Show message box if we are not building for testing
|
||||
sint32 result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION);
|
||||
if (result == IDABORT)
|
||||
{
|
||||
#ifdef USE_BREAKPAD
|
||||
// Force a crash that breakpad will handle allowing us to get a dump
|
||||
*((void**)0) = 0;
|
||||
#else
|
||||
switch (_assertBehaviour) {
|
||||
case ASSERT_BEHAVIOUR::ABORT:
|
||||
abort();
|
||||
break;
|
||||
default:
|
||||
case ASSERT_BEHAVIOUR::CASSERT:
|
||||
assert(false);
|
||||
#endif
|
||||
break;
|
||||
#ifdef __WINDOWS__
|
||||
case ASSERT_BEHAVIOUR::MESSAGE_BOX:
|
||||
{
|
||||
// Show message box if we are not building for testing
|
||||
char buffer[512];
|
||||
GetAssertMessage(buffer, sizeof(buffer), formattedMessage);
|
||||
sint32 result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION);
|
||||
if (result == IDABORT)
|
||||
{
|
||||
ForceCrash();
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Fail(const char * message, ...)
|
||||
@@ -111,4 +136,29 @@ namespace Guard
|
||||
{
|
||||
Assert_VA(false, message, args);
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
static void GetAssertMessage(char * buffer, size_t bufferSize, const char * formattedMessage)
|
||||
{
|
||||
String::Set(buffer, bufferSize, ASSERTION_MESSAGE);
|
||||
String::Append(buffer, bufferSize, "\r\n\r\n");
|
||||
String::Append(buffer, bufferSize, "Version: ");
|
||||
String::Append(buffer, bufferSize, Version::GetInfo().c_str());
|
||||
if (formattedMessage != nullptr)
|
||||
{
|
||||
String::Append(buffer, bufferSize, "\r\n");
|
||||
String::Append(buffer, bufferSize, formattedMessage);
|
||||
}
|
||||
}
|
||||
|
||||
static void ForceCrash()
|
||||
{
|
||||
#ifdef USE_BREAKPAD
|
||||
// Force a crash that breakpad will handle allowing us to get a dump
|
||||
*((void**)0) = 0;
|
||||
#else
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -27,11 +27,21 @@ void openrct2_assert(bool expression, const char * message, ...);
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
enum class ASSERT_BEHAVIOUR
|
||||
{
|
||||
ABORT,
|
||||
CASSERT,
|
||||
MESSAGE_BOX,
|
||||
};
|
||||
|
||||
/**
|
||||
* Utility methods for asserting function parameters.
|
||||
*/
|
||||
namespace Guard
|
||||
{
|
||||
ASSERT_BEHAVIOUR GetAssertBehaviour();
|
||||
void SetAssertBehaviour(ASSERT_BEHAVIOUR behaviour);
|
||||
|
||||
void Assert(bool expression, const char * message = nullptr, ...);
|
||||
void Assert_VA(bool expression, const char * message, va_list args);
|
||||
void Fail(const char * message = nullptr, ...);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "../rct2.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
#include "../util/util.h"
|
||||
#include "../Version.h"
|
||||
#include "../world/banner.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/park.h"
|
||||
|
||||
@@ -336,7 +336,7 @@
|
||||
<ClCompile Include="world\particle.c" />
|
||||
<ClCompile Include="util\sawyercoding.c" />
|
||||
<ClCompile Include="util\util.c" />
|
||||
<ClCompile Include="version.c" />
|
||||
<ClCompile Include="Version.cpp" />
|
||||
<ClCompile Include="windows\about.c" />
|
||||
<ClCompile Include="windows\banner.c" />
|
||||
<ClCompile Include="windows\cheats.c" />
|
||||
|
||||
@@ -26,10 +26,11 @@ void http_dispose() { }
|
||||
|
||||
#else
|
||||
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../Version.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
// cURL includes windows.h, but we don't need all of it.
|
||||
|
||||
@@ -47,6 +47,7 @@ extern "C" {
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#include "../Version.h"
|
||||
#include "NetworkTypes.h"
|
||||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
@@ -39,6 +39,7 @@ extern "C"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../rct2/S6Exporter.h"
|
||||
#include "../Version.h"
|
||||
|
||||
#define WSZ(x) L"" x
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "../rct2.h"
|
||||
#include "../title/TitleScreen.h"
|
||||
#include "../util/util.h"
|
||||
#include "../Version.h"
|
||||
#include "../world/climate.h"
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
@@ -30,10 +30,12 @@
|
||||
#include <shlobj.h>
|
||||
#include <SDL_syswm.h>
|
||||
#include <sys/stat.h>
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../localisation/language.h"
|
||||
#include "../util/util.h"
|
||||
|
||||
#include "../config.h"
|
||||
#include "../localisation/language.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../util/util.h"
|
||||
#include "../Version.h"
|
||||
#include "platform.h"
|
||||
|
||||
// Native resource IDs
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifdef OPENRCT2_BUILD_INFO_HEADER
|
||||
#include OPENRCT2_BUILD_INFO_HEADER
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_BUILD_NUMBER
|
||||
const char *gBuildNumber = OPENRCT2_BUILD_NUMBER;
|
||||
#else
|
||||
const char *gBuildNumber = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_BUILD_SERVER
|
||||
const char *gBuildServer = OPENRCT2_BUILD_SERVER;
|
||||
#else
|
||||
const char *gBuildServer = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_BRANCH
|
||||
const char *gGitBranch = OPENRCT2_BRANCH;
|
||||
#else
|
||||
const char *gGitBranch = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_COMMIT_SHA1
|
||||
const char *gCommitSha1 = OPENRCT2_COMMIT_SHA1;
|
||||
#else
|
||||
const char *gCommitSha1 = "";
|
||||
#endif
|
||||
|
||||
#ifdef OPENRCT2_COMMIT_SHA1_SHORT
|
||||
const char *gCommitSha1Short = OPENRCT2_COMMIT_SHA1_SHORT;
|
||||
#else
|
||||
const char *gCommitSha1Short = "";
|
||||
#endif
|
||||
@@ -81,6 +81,7 @@ set(LANGUAGEPACK_TEST_SOURCES
|
||||
"../../src/openrct2/localisation/format_codes.c"
|
||||
"../../src/openrct2/localisation/utf8.c"
|
||||
"../../src/openrct2/util/util.c"
|
||||
"../../src/openrct2/Version.cpp"
|
||||
)
|
||||
add_executable(test_languagepack ${LANGUAGEPACK_TEST_SOURCES})
|
||||
target_link_libraries(test_languagepack ${GTEST_LIBRARIES} dl z SDL2 SDL2_ttf ssl crypto)
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <openrct2/core/Guard.hpp>
|
||||
|
||||
int main(int argc, char * * argv)
|
||||
{
|
||||
// Abort on an assertions so the tests do not hang
|
||||
Guard::SetAssertBehaviour(ASSERT_BEHAVIOUR::ABORT);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user