games/openrct2: move title-sequence and objects to the port, update to 0.2.2, fix build with big-endian architectures, change maintainer

Patch for big-endian compatibility taken from upstream at https://github.com/OpenRCT2/OpenRCT2/pull/8091

PR:		226897
Approved by:	mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D19941
This commit is contained in:
Piotr Kubaj 2019-05-03 08:45:27 +00:00
parent 65cec7913d
commit e107249311
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=500708
10 changed files with 746 additions and 83 deletions

View File

@ -3,8 +3,7 @@
PORTNAME= openrct2
DISTVERSIONPREFIX= v
DISTVERSION= 0.1.2
PORTREVISION= 2
DISTVERSION= 0.2.2
CATEGORIES= games
MAINTAINER= pkubaj@anongoth.pl
@ -19,28 +18,40 @@ LIB_DEPENDS= libpng.so:graphics/png \
libspeexdsp.so:audio/speexdsp \
libfontconfig.so:x11-fonts/fontconfig \
libcurl.so:ftp/curl \
libfreetype.so:print/freetype2
libfreetype.so:print/freetype2 \
libicuuc.so:devel/icu
USES= compiler:c++14-lang cmake desktop-file-utils iconv localbase:ldflags pkgconfig shared-mime-info ssl
USES= cmake compiler:c++17-lang desktop-file-utils gnome gl iconv \
localbase:ldflags pkgconfig sdl shared-mime-info ssl
USE_GITHUB= yes
GH_ACCOUNT= OpenRCT2
GH_PROJECT= OpenRCT2
GH_TUPLE= OpenRCT2:objects:v1.0.10:objects \
OpenRCT2:title-sequences:v0.1.2a:title_sequences
USE_GL= gl
USE_LDCONFIG= yes
USE_SDL= sdl2
INSTALLS_ICONS= yes
SUB_FILES= pkg-message
SUB_LIST= DISTVERSIONPREFIX=${DISTVERSIONPREFIX} \
DISTVERSION=${DISTVERSION} \
PORTNAME=${PORTNAME}
CMAKE_ON= BUILD_SHARED_LIBS
CMAKE_OFF= DOWNLOAD_TITLE_SEQUENCES
CMAKE_OFF= DOWNLOAD_TITLE_SEQUENCES \
DOWNLOAD_OBJECTS
CXXFLAGS+= -D_GNU_SOURCE
PORTDATA= *
PORTDOCS= changelog.txt contributors.md licence.txt readme.txt
INSTALLS_ICONS= yes
OPTIONS_DEFINE= DOCS
PORTDOCS= changelog.txt contributors.md licence.txt readme.txt
post-patch:
@${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}|' \
${WRKSRC}/src/openrct2/config/Config.cpp
post-install:
(cd ${WRKDIR}/title-sequences-0.1.2a; \
${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}/title)
(cd ${WRKDIR}/objects-1.0.10; \
${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}/object)
.include <bsd.port.mk>

View File

@ -1,3 +1,7 @@
TIMESTAMP = 1521471656
SHA256 (OpenRCT2-OpenRCT2-v0.1.2_GH0.tar.gz) = 358fc0ceff848734b399dc63c1d7a0c096a54a793afe4522d6f0dd00ba9328c7
SIZE (OpenRCT2-OpenRCT2-v0.1.2_GH0.tar.gz) = 6769785
TIMESTAMP = 1556126577
SHA256 (OpenRCT2-OpenRCT2-v0.2.2_GH0.tar.gz) = 4b7b003fc0cf365be8a43d8784827415dbba3335de59cb948ab720ec1ebcaa7b
SIZE (OpenRCT2-OpenRCT2-v0.2.2_GH0.tar.gz) = 8064579
SHA256 (OpenRCT2-objects-v1.0.10_GH0.tar.gz) = a79e3a40b59a79e024f76dd1eae70b6e5009a53c11fe3909609e4564fafdcf6c
SIZE (OpenRCT2-objects-v1.0.10_GH0.tar.gz) = 637654
SHA256 (OpenRCT2-title-sequences-v0.1.2a_GH0.tar.gz) = 83e935186435116d6ea79e48daeea99c1158800a3fa92069100cfb8dbd80c9d7
SIZE (OpenRCT2-title-sequences-v0.1.2a_GH0.tar.gz) = 21298525

View File

@ -0,0 +1,707 @@
--- src/openrct2-ui/input/KeyboardShortcuts.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2-ui/input/KeyboardShortcuts.cpp
@@ -19,6 +19,7 @@
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/localisation/Localisation.h>
+#include <openrct2/util/Endian.h>
using namespace OpenRCT2;
using namespace OpenRCT2::Input;
@@ -55,14 +56,14 @@ bool KeyboardShortcuts::Load()
if (File::Exists(path))
{
auto fs = FileStream(path, FILE_MODE_OPEN);
- uint16_t version = fs.ReadValue<uint16_t>();
+ uint16_t version = ORCT_SwapLEu16(fs.ReadValue<uint16_t>());
if (version == KeyboardShortcuts::CURRENT_FILE_VERSION)
{
int32_t numShortcutsInFile = (fs.GetLength() - sizeof(uint16_t)) / sizeof(uint16_t);
int32_t numShortcutsToRead = std::min<int32_t>(SHORTCUT_COUNT, numShortcutsInFile);
for (int32_t i = 0; i < numShortcutsToRead; i++)
{
- _keys[i] = fs.ReadValue<uint16_t>();
+ _keys[i] = ORCT_SwapLEu16(fs.ReadValue<uint16_t>());
}
result = true;
}
--- src/openrct2/audio/Audio.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/audio/Audio.cpp
@@ -23,6 +23,7 @@
#include "../peep/Peep.h"
#include "../ride/Ride.h"
#include "../ui/UiContext.h"
+#include "../util/Endian.h"
#include "../util/Util.h"
#include "AudioContext.h"
#include "AudioMixer.h"
@@ -350,7 +351,7 @@ void audio_init_ride_sounds_and_info()
try
{
auto fs = FileStream(path, FILE_MODE_OPEN);
- uint32_t head = fs.ReadValue<uint32_t>();
+ uint32_t head = ORCT_SwapLEu32(fs.ReadValue<uint32_t>());
if (head == 0x78787878)
{
rideMusicInfo.length = 0;
--- src/openrct2/common.h.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/common.h
@@ -75,6 +75,10 @@ const constexpr auto ror64 = ror<uint64_
# define RCT2_ENDIANESS __ORDER_LITTLE_ENDIAN__
# define LOBYTE(w) ((uint8_t)(w))
# define HIBYTE(w) ((uint8_t)(((uint16_t)(w) >> 8) & 0xFF))
+# else
+# define RCT2_ENDIANESS __ORDER_BIG_ENDIAN__
+# define HIBYTE(w) ((uint8_t)(w))
+# define LOBYTE(w) ((uint8_t)(((uint16_t)(w) >> 8) & 0xFF))
# endif // __BYTE_ORDER__
# ifndef RCT2_ENDIANESS
--- src/openrct2/core/FileIndex.hpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/core/FileIndex.hpp
@@ -10,6 +10,7 @@
#pragma once
#include "../common.h"
+#include "../util/Endian.h"
#include "Console.hpp"
#include "File.h"
#include "FileScanner.h"
@@ -265,6 +266,14 @@ private:
// Read header, check if we need to re-scan
auto header = fs.ReadValue<FileIndexHeader>();
+ header.HeaderSize = ORCT_SwapLEu32(header.HeaderSize);
+ header.MagicNumber = ORCT_SwapLEu32(header.MagicNumber);
+ header.LanguageId = ORCT_SwapLEu16(header.LanguageId);
+ header.NumItems = ORCT_SwapLEu32(header.NumItems);
+ header.Stats.TotalFiles = ORCT_SwapLEu32(header.Stats.TotalFiles);
+ header.Stats.TotalFileSize = ORCT_SwapLEu64(header.Stats.TotalFileSize);
+ header.Stats.FileDateModifiedChecksum = ORCT_SwapLEu32(header.Stats.FileDateModifiedChecksum);
+ header.Stats.PathChecksum = ORCT_SwapLEu32(header.Stats.PathChecksum);
if (header.HeaderSize == sizeof(FileIndexHeader) && header.MagicNumber == _magicNumber
&& header.VersionA == FILE_INDEX_VERSION && header.VersionB == _version && header.LanguageId == language
&& header.Stats.TotalFiles == stats.TotalFiles && header.Stats.TotalFileSize == stats.TotalFileSize
--- src/openrct2/drawing/Drawing.Sprite.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/drawing/Drawing.Sprite.cpp
@@ -16,6 +16,7 @@
#include "../platform/platform.h"
#include "../sprites.h"
#include "../ui/UiContext.h"
+#include "../util/Endian.h"
#include "../util/Util.h"
#include "Drawing.h"
@@ -237,6 +238,8 @@ bool gfx_load_g1(const IPlatformEnvironm
auto path = Path::Combine(env.GetDirectoryPath(DIRBASE::RCT2, DIRID::DATA), "g1.dat");
auto fs = FileStream(path, FILE_MODE_OPEN);
_g1.header = fs.ReadValue<rct_g1_header>();
+ _g1.header.num_entries = ORCT_SwapLEu32(_g1.header.num_entries);
+ _g1.header.total_size = ORCT_SwapLEu32(_g1.header.total_size);
log_verbose("g1.dat, number of entries: %u", _g1.header.num_entries);
@@ -309,6 +312,8 @@ bool gfx_load_g2()
{
auto fs = FileStream(path, FILE_MODE_OPEN);
_g2.header = fs.ReadValue<rct_g1_header>();
+ _g2.header.num_entries = ORCT_SwapLEu32(_g2.header.num_entries);
+ _g2.header.total_size = ORCT_SwapLEu32(_g2.header.total_size);
// Read element headers
_g2.elements.resize(_g2.header.num_entries);
--- src/openrct2/object/BannerObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/BannerObject.cpp
@@ -14,6 +14,7 @@
#include "../localisation/Language.h"
#include "../object/Object.h"
#include "../object/ObjectRepository.h"
+#include "../util/Endian.h"
#include "ObjectJsonHelpers.h"
#include "ObjectList.h"
@@ -22,13 +23,14 @@ void BannerObject::ReadLegacy(IReadObjec
stream->Seek(6, STREAM_SEEK_CURRENT);
_legacyType.banner.scrolling_mode = stream->ReadValue<uint8_t>();
_legacyType.banner.flags = stream->ReadValue<uint8_t>();
- _legacyType.banner.price = stream->ReadValue<int16_t>();
+ _legacyType.banner.price = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
_legacyType.banner.scenery_tab_id = stream->ReadValue<uint8_t>();
stream->Seek(1, STREAM_SEEK_CURRENT);
GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
+ sgEntry.flags = ORCT_SwapLEu32(sgEntry.flags);
SetPrimarySceneryGroup(&sgEntry);
GetImageTable().Read(context, stream);
--- src/openrct2/object/FootpathItemObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/FootpathItemObject.cpp
@@ -15,6 +15,7 @@
#include "../localisation/Localisation.h"
#include "../object/Object.h"
#include "../object/ObjectRepository.h"
+#include "../util/Endian.h"
#include "ObjectJsonHelpers.h"
#include "ObjectList.h"
@@ -23,16 +24,17 @@
void FootpathItemObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
{
stream->Seek(6, STREAM_SEEK_CURRENT);
- _legacyType.path_bit.flags = stream->ReadValue<uint16_t>();
+ _legacyType.path_bit.flags = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
_legacyType.path_bit.draw_type = stream->ReadValue<uint8_t>();
_legacyType.path_bit.tool_id = stream->ReadValue<uint8_t>();
- _legacyType.path_bit.price = stream->ReadValue<int16_t>();
+ _legacyType.path_bit.price = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
_legacyType.path_bit.scenery_tab_id = stream->ReadValue<uint8_t>();
stream->Seek(1, STREAM_SEEK_CURRENT);
GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
+ sgEntry.flags = ORCT_SwapLEu32(sgEntry.flags);
SetPrimarySceneryGroup(&sgEntry);
GetImageTable().Read(context, stream);
--- src/openrct2/object/ImageTable.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/ImageTable.cpp
@@ -11,6 +11,7 @@
#include "../OpenRCT2.h"
#include "../core/IStream.hpp"
+#include "../util/Endian.h"
#include "Object.h"
#include <algorithm>
@@ -37,8 +38,8 @@ void ImageTable::Read(IReadObjectContext
try
{
- uint32_t numImages = stream->ReadValue<uint32_t>();
- uint32_t imageDataSize = stream->ReadValue<uint32_t>();
+ uint32_t numImages = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
+ uint32_t imageDataSize = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
uint64_t headerTableSize = numImages * 16;
uint64_t remainingBytes = stream->GetLength() - stream->GetPosition() - headerTableSize;
@@ -63,15 +64,15 @@ void ImageTable::Read(IReadObjectContext
{
rct_g1_element g1Element;
- uintptr_t imageDataOffset = (uintptr_t)stream->ReadValue<uint32_t>();
+ uintptr_t imageDataOffset = ORCT_SwapLEu32((uintptr_t)stream->ReadValue<uint32_t>());
g1Element.offset = (uint8_t*)(imageDataBase + imageDataOffset);
- g1Element.width = stream->ReadValue<int16_t>();
- g1Element.height = stream->ReadValue<int16_t>();
- g1Element.x_offset = stream->ReadValue<int16_t>();
- g1Element.y_offset = stream->ReadValue<int16_t>();
- g1Element.flags = stream->ReadValue<uint16_t>();
- g1Element.zoomed_offset = stream->ReadValue<uint16_t>();
+ g1Element.width = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
+ g1Element.height = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
+ g1Element.x_offset = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
+ g1Element.y_offset = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
+ g1Element.flags = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
+ g1Element.zoomed_offset = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
newEntries.push_back(g1Element);
}
--- src/openrct2/object/LargeSceneryObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/LargeSceneryObject.cpp
@@ -16,6 +16,7 @@
#include "../drawing/Drawing.h"
#include "../interface/Cursors.h"
#include "../localisation/Language.h"
+#include "../util/Endian.h"
#include "../world/Banner.h"
#include "../world/Location.hpp"
#include "ObjectJsonHelpers.h"
@@ -28,8 +29,8 @@ void LargeSceneryObject::ReadLegacy(IRea
stream->Seek(6, STREAM_SEEK_CURRENT);
_legacyType.large_scenery.tool_id = stream->ReadValue<uint8_t>();
_legacyType.large_scenery.flags = stream->ReadValue<uint8_t>();
- _legacyType.large_scenery.price = stream->ReadValue<int16_t>();
- _legacyType.large_scenery.removal_price = stream->ReadValue<int16_t>();
+ _legacyType.large_scenery.price = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
+ _legacyType.large_scenery.removal_price = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
stream->Seek(5, STREAM_SEEK_CURRENT);
_legacyType.large_scenery.scenery_tab_id = 0xFF;
_legacyType.large_scenery.scrolling_mode = stream->ReadValue<uint8_t>();
@@ -38,6 +39,7 @@ void LargeSceneryObject::ReadLegacy(IRea
GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
+ sgEntry.flags = ORCT_SwapLEu32(sgEntry.flags);
SetPrimarySceneryGroup(&sgEntry);
if (_legacyType.large_scenery.flags & LARGE_SCENERY_FLAG_3D_TEXT)
@@ -112,10 +114,17 @@ void LargeSceneryObject::DrawPreview(rct
std::vector<rct_large_scenery_tile> LargeSceneryObject::ReadTiles(IStream* stream)
{
auto tiles = std::vector<rct_large_scenery_tile>();
+ // Note: no need to swap the value here...
while (stream->ReadValue<uint16_t>() != 0xFFFF)
{
stream->Seek(-2, STREAM_SEEK_CURRENT);
+
auto tile = stream->ReadValue<rct_large_scenery_tile>();
+ tile.x_offset = ORCT_SwapLEi16(tile.x_offset);
+ tile.y_offset = ORCT_SwapLEi16(tile.y_offset);
+ tile.z_offset = ORCT_SwapLEi16(tile.z_offset);
+ tile.z_clearance = ORCT_SwapLEi16(tile.z_clearance);
+ tile.flags = ORCT_SwapLEi16(tile.flags);
tiles.push_back(tile);
}
tiles.push_back({ -1, -1, -1, 255, 0xFFFF });
--- src/openrct2/object/ObjectFactory.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/ObjectFactory.cpp
@@ -20,6 +20,7 @@
#include "../core/String.hpp"
#include "../core/Zip.h"
#include "../rct12/SawyerChunkReader.h"
+#include "../util/Endian.h"
#include "BannerObject.h"
#include "EntranceObject.h"
#include "FootpathItemObject.h"
--- src/openrct2/object/ObjectRepository.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/ObjectRepository.cpp
@@ -29,6 +29,7 @@
#include "../rct12/SawyerChunkReader.h"
#include "../rct12/SawyerChunkWriter.h"
#include "../scenario/ScenarioRepository.h"
+#include "../util/Endian.h"
#include "../util/SawyerCoding.h"
#include "../util/Util.h"
#include "Object.h"
@@ -161,6 +162,7 @@ protected:
ObjectRepositoryItem item;
item.ObjectEntry = stream->ReadValue<rct_object_entry>();
+ item.ObjectEntry.flags = ORCT_SwapLEu32(item.ObjectEntry.flags);
item.Path = stream->ReadStdString();
item.Name = stream->ReadStdString();
auto sourceLength = stream->ReadValue<uint8_t>();
@@ -186,11 +188,12 @@ protected:
break;
case OBJECT_TYPE_SCENERY_GROUP:
{
- auto numEntries = stream->ReadValue<uint16_t>();
+ auto numEntries = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
item.SceneryGroupInfo.Entries = std::vector<rct_object_entry>(numEntries);
for (size_t i = 0; i < numEntries; i++)
{
item.SceneryGroupInfo.Entries[i] = stream->ReadValue<rct_object_entry>();
+ item.SceneryGroupInfo.Entries[i].flags = ORCT_SwapLEu32(item.SceneryGroupInfo.Entries[i].flags);
}
break;
}
@@ -363,6 +366,7 @@ public:
// Check if we already have this object
rct_object_entry entry = stream->ReadValue<rct_object_entry>();
+ entry.flags = ORCT_SwapLEu32(entry.flags);
if (FindObject(&entry) != nullptr)
{
chunkReader.SkipChunk();
@@ -622,6 +626,7 @@ private:
// Read object data from file
auto fs = FileStream(item->Path, FILE_MODE_OPEN);
auto fileEntry = fs.ReadValue<rct_object_entry>();
+ fileEntry.flags = ORCT_SwapLEu32(fileEntry.flags);
if (!object_entry_compare(entry, &fileEntry))
{
throw std::runtime_error("Header found in object file does not match object to pack.");
--- src/openrct2/object/RideObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/RideObject.cpp
@@ -22,6 +22,7 @@
#include "../ride/RideGroupManager.h"
#include "../ride/ShopItem.h"
#include "../ride/Track.h"
+#include "../util/Endian.h"
#include "ObjectJsonHelpers.h"
#include "ObjectRepository.h"
@@ -34,7 +35,7 @@ using namespace OpenRCT2;
void RideObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
{
stream->Seek(8, STREAM_SEEK_CURRENT);
- _legacyType.flags = stream->ReadValue<uint32_t>();
+ _legacyType.flags = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
for (auto& rideType : _legacyType.ride_type)
{
rideType = stream->ReadValue<uint8_t>();
@@ -59,7 +60,7 @@ void RideObject::ReadLegacy(IReadObjectC
_legacyType.intensity_multiplier = stream->ReadValue<int8_t>();
_legacyType.nausea_multiplier = stream->ReadValue<int8_t>();
_legacyType.max_height = stream->ReadValue<uint8_t>();
- _legacyType.enabledTrackPieces = stream->ReadValue<uint64_t>();
+ _legacyType.enabledTrackPieces = ORCT_SwapLEu64(stream->ReadValue<uint64_t>());
_legacyType.category[0] = stream->ReadValue<uint8_t>();
_legacyType.category[1] = stream->ReadValue<uint8_t>();
_legacyType.shop_item = stream->ReadValue<uint8_t>();
@@ -94,7 +95,7 @@ void RideObject::ReadLegacy(IReadObjectC
uint16_t numPeepLoadingPositions = stream->ReadValue<uint8_t>();
if (numPeepLoadingPositions == 255)
{
- numPeepLoadingPositions = stream->ReadValue<uint16_t>();
+ numPeepLoadingPositions = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
}
if (_legacyType.vehicles[i].flags & VEHICLE_ENTRY_FLAG_LOADING_WAYPOINTS)
@@ -116,7 +117,7 @@ void RideObject::ReadLegacy(IReadObjectC
entry[1].y = stream->ReadValue<int8_t>();
entry[2].x = stream->ReadValue<int8_t>();
entry[2].y = stream->ReadValue<int8_t>();
- stream->ReadValue<uint16_t>(); // Skip blanks
+ stream->ReadValue<uint16_t>(); // Skip blanks, no need to swap endianess
_peepLoadingWaypoints[i].push_back(entry);
}
@@ -412,19 +413,19 @@ void RideObject::SetRepositoryItem(Objec
void RideObject::ReadLegacyVehicle(
[[maybe_unused]] IReadObjectContext* context, IStream* stream, rct_ride_entry_vehicle* vehicle)
{
- vehicle->rotation_frame_mask = stream->ReadValue<uint16_t>();
+ vehicle->rotation_frame_mask = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
stream->Seek(2 * 1, STREAM_SEEK_CURRENT);
- vehicle->spacing = stream->ReadValue<uint32_t>();
- vehicle->car_mass = stream->ReadValue<uint16_t>();
+ vehicle->spacing = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
+ vehicle->car_mass = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
vehicle->tab_height = stream->ReadValue<int8_t>();
vehicle->num_seats = stream->ReadValue<uint8_t>();
- vehicle->sprite_flags = stream->ReadValue<uint16_t>();
+ vehicle->sprite_flags = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
vehicle->sprite_width = stream->ReadValue<uint8_t>();
vehicle->sprite_height_negative = stream->ReadValue<uint8_t>();
vehicle->sprite_height_positive = stream->ReadValue<uint8_t>();
vehicle->animation = stream->ReadValue<uint8_t>();
- vehicle->flags = stream->ReadValue<uint32_t>();
- vehicle->base_num_frames = stream->ReadValue<uint16_t>();
+ vehicle->flags = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
+ vehicle->base_num_frames = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
stream->Seek(15 * 4, STREAM_SEEK_CURRENT);
vehicle->no_seating_rows = stream->ReadValue<uint8_t>();
vehicle->spinning_inertia = stream->ReadValue<uint8_t>();
--- src/openrct2/object/SceneryGroupObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/SceneryGroupObject.cpp
@@ -18,6 +18,7 @@
#include "../drawing/Drawing.h"
#include "../localisation/Language.h"
#include "../peep/Staff.h"
+#include "../util/Endian.h"
#include "ObjectJsonHelpers.h"
#include "ObjectManager.h"
#include "ObjectRepository.h"
@@ -34,7 +35,7 @@ void SceneryGroupObject::ReadLegacy(IRea
_legacyType.pad_107 = stream->ReadValue<uint8_t>();
_legacyType.priority = stream->ReadValue<uint8_t>();
_legacyType.pad_109 = stream->ReadValue<uint8_t>();
- _legacyType.entertainer_costumes = stream->ReadValue<uint32_t>();
+ _legacyType.entertainer_costumes = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);
_items = ReadItems(stream);
@@ -126,6 +127,7 @@ std::vector<rct_object_entry> SceneryGro
{
stream->Seek(-1, STREAM_SEEK_CURRENT);
auto entry = stream->ReadValue<rct_object_entry>();
+ entry.flags = ORCT_SwapLEu32(entry.flags);
items.push_back(entry);
}
return items;
--- src/openrct2/object/SmallSceneryObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/SmallSceneryObject.cpp
@@ -17,6 +17,7 @@
#include "../drawing/Drawing.h"
#include "../interface/Cursors.h"
#include "../localisation/Language.h"
+#include "../util/Endian.h"
#include "../world/Scenery.h"
#include "../world/SmallScenery.h"
#include "ObjectJsonHelpers.h"
@@ -26,20 +27,21 @@
void SmallSceneryObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
{
stream->Seek(6, STREAM_SEEK_CURRENT);
- _legacyType.small_scenery.flags = stream->ReadValue<uint32_t>();
+ _legacyType.small_scenery.flags = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
_legacyType.small_scenery.height = stream->ReadValue<uint8_t>();
_legacyType.small_scenery.tool_id = stream->ReadValue<uint8_t>();
- _legacyType.small_scenery.price = stream->ReadValue<int16_t>();
- _legacyType.small_scenery.removal_price = stream->ReadValue<int16_t>();
+ _legacyType.small_scenery.price = ORCT_SwapLEu16(stream->ReadValue<int16_t>());
+ _legacyType.small_scenery.removal_price = ORCT_SwapLEu16(stream->ReadValue<int16_t>());
stream->Seek(4, STREAM_SEEK_CURRENT);
- _legacyType.small_scenery.animation_delay = stream->ReadValue<uint16_t>();
- _legacyType.small_scenery.animation_mask = stream->ReadValue<uint16_t>();
- _legacyType.small_scenery.num_frames = stream->ReadValue<uint16_t>();
+ _legacyType.small_scenery.animation_delay = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
+ _legacyType.small_scenery.animation_mask = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
+ _legacyType.small_scenery.num_frames = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
_legacyType.small_scenery.scenery_tab_id = 0xFF;
GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
+ sgEntry.flags = ORCT_SwapLEu32(sgEntry.flags);
SetPrimarySceneryGroup(&sgEntry);
if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS))
--- src/openrct2/object/WallObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/WallObject.cpp
@@ -13,6 +13,7 @@
#include "../drawing/Drawing.h"
#include "../interface/Cursors.h"
#include "../localisation/Language.h"
+#include "../util/Endian.h"
#include "../world/Banner.h"
#include "ObjectJsonHelpers.h"
@@ -23,13 +24,14 @@ void WallObject::ReadLegacy(IReadObjectC
_legacyType.wall.flags = stream->ReadValue<uint8_t>();
_legacyType.wall.height = stream->ReadValue<uint8_t>();
_legacyType.wall.flags2 = stream->ReadValue<uint8_t>();
- _legacyType.wall.price = stream->ReadValue<uint16_t>();
+ _legacyType.wall.price = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
_legacyType.wall.scenery_tab_id = stream->ReadValue<uint8_t>();
_legacyType.wall.scrolling_mode = stream->ReadValue<uint8_t>();
GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
+ sgEntry.flags = ORCT_SwapLEu16(sgEntry.flags);
SetPrimarySceneryGroup(&sgEntry);
GetImageTable().Read(context, stream);
--- src/openrct2/object/WaterObject.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/object/WaterObject.cpp
@@ -15,6 +15,7 @@
#include "../core/IStream.hpp"
#include "../localisation/Language.h"
#include "../localisation/StringIds.h"
+#include "../util/Endian.h"
#include "ObjectJsonHelpers.h"
#include <memory>
@@ -22,7 +23,7 @@
void WaterObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
{
stream->Seek(14, STREAM_SEEK_CURRENT);
- _legacyType.flags = stream->ReadValue<uint16_t>();
+ _legacyType.flags = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
GetStringTable().Read(context, stream, OBJ_STRING_ID_NAME);
GetImageTable().Read(context, stream);
--- src/openrct2/rct12/SawyerChunkReader.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/rct12/SawyerChunkReader.cpp
@@ -10,6 +10,7 @@
#include "SawyerChunkReader.h"
#include "../core/IStream.hpp"
+#include "../util/Endian.h"
// 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.
@@ -52,6 +53,7 @@ void SawyerChunkReader::SkipChunk()
try
{
auto header = _stream->ReadValue<sawyercoding_chunk_header>();
+ header.length = ORCT_SwapLEu32(header.length);
_stream->Seek(header.length, STREAM_SEEK_CURRENT);
}
catch (const std::exception&)
@@ -68,6 +70,7 @@ std::shared_ptr<SawyerChunk> SawyerChunk
try
{
auto header = _stream->ReadValue<sawyercoding_chunk_header>();
+ header.length = ORCT_SwapLEu32(header.length);
switch (header.encoding)
{
case CHUNK_ENCODING_NONE:
--- src/openrct2/rct12/SawyerEncoding.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/rct12/SawyerEncoding.cpp
@@ -10,6 +10,7 @@
#include "SawyerEncoding.h"
#include "../core/IStream.hpp"
+#include "../util/Endian.h"
#include <algorithm>
@@ -44,7 +45,7 @@ namespace SawyerEncoding
} while (dataSize != 0);
// Read file checksum
- uint32_t fileChecksum = stream->ReadValue<uint32_t>();
+ uint32_t fileChecksum = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
// Rewind back to original position
stream->SetPosition(initialPosition);
--- src/openrct2/ride/TrackDesignRepository.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/ride/TrackDesignRepository.cpp
@@ -22,6 +22,7 @@
#include "../localisation/LocalisationService.h"
#include "../object/ObjectRepository.h"
#include "../object/RideObject.h"
+#include "../util/Endian.h"
#include "RideGroupManager.h"
#include "TrackDesign.h"
@@ -114,7 +115,7 @@ protected:
item.Path = stream->ReadStdString();
item.RideType = stream->ReadValue<uint8_t>();
item.ObjectEntry = stream->ReadStdString();
- item.Flags = stream->ReadValue<uint32_t>();
+ item.Flags = ORCT_SwapLEu32(stream->ReadValue<uint32_t>());
return item;
}
--- src/openrct2/scenario/ScenarioRepository.cpp.orig 2019-03-13 20:51:10 UTC
+++ src/openrct2/scenario/ScenarioRepository.cpp
@@ -25,6 +25,7 @@
#include "../localisation/LocalisationService.h"
#include "../platform/platform.h"
#include "../rct12/SawyerChunkReader.h"
+#include "../util/Endian.h"
#include "Scenario.h"
#include "ScenarioSources.h"
@@ -182,17 +183,17 @@ protected:
scenario_index_entry item;
stream->Read(item.path, sizeof(item.path));
- item.timestamp = stream->ReadValue<uint64_t>();
+ item.timestamp = ORCT_SwapLEu64(stream->ReadValue<uint64_t>());
item.category = stream->ReadValue<uint8_t>();
item.source_game = stream->ReadValue<uint8_t>();
- item.source_index = stream->ReadValue<int16_t>();
- item.sc_id = stream->ReadValue<uint16_t>();
+ item.source_index = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
+ item.sc_id = ORCT_SwapLEu16(stream->ReadValue<uint16_t>());
item.objective_type = stream->ReadValue<uint8_t>();
item.objective_arg_1 = stream->ReadValue<uint8_t>();
- item.objective_arg_2 = stream->ReadValue<int32_t>();
- item.objective_arg_3 = stream->ReadValue<int16_t>();
+ item.objective_arg_2 = ORCT_SwapLEi32(stream->ReadValue<int32_t>());
+ item.objective_arg_3 = ORCT_SwapLEi16(stream->ReadValue<int16_t>());
item.highscore = nullptr;
stream->Read(item.internal_name, sizeof(item.internal_name));
@@ -587,7 +588,7 @@ private:
try
{
auto fs = FileStream(path, FILE_MODE_OPEN);
- uint32_t fileVersion = fs.ReadValue<uint32_t>();
+ uint32_t fileVersion = ORCT_SwapLEu32(fs.ReadValue<uint32_t>());
if (fileVersion != 1)
{
Console::Error::WriteLine("Invalid or incompatible highscores file.");
@@ -596,14 +597,14 @@ private:
ClearHighscores();
- uint32_t numHighscores = fs.ReadValue<uint32_t>();
+ uint32_t numHighscores = ORCT_SwapLEu32(fs.ReadValue<uint32_t>());
for (uint32_t i = 0; i < numHighscores; i++)
{
scenario_highscore_entry* highscore = InsertHighscore();
highscore->fileName = fs.ReadString();
highscore->name = fs.ReadString();
- highscore->company_value = fs.ReadValue<money32>();
- highscore->timestamp = fs.ReadValue<datetime64>();
+ highscore->company_value = ORCT_SwapLEi32(fs.ReadValue<money32>());
+ highscore->timestamp = ORCT_SwapLEu64(fs.ReadValue<datetime64>());
}
}
catch (const std::exception&)
@@ -647,6 +648,10 @@ private:
{
// Read legacy entry
auto scBasic = fs.ReadValue<rct_scores_entry>();
+ scBasic.objectiveArg2 = ORCT_SwapLEi32(scBasic.objectiveArg2);
+ scBasic.objectiveArg3 = ORCT_SwapLEi16(scBasic.objectiveArg3);
+ scBasic.Flags = ORCT_SwapLEi32(scBasic.Flags);
+ scBasic.CompanyValue = ORCT_SwapLEi32(scBasic.CompanyValue);
// Ignore non-completed scenarios
if (scBasic.Flags & SCENARIO_FLAGS_COMPLETED)
--- src/openrct2/util/Endian.h.orig 2019-04-04 08:21:55 UTC
+++ src/openrct2/util/Endian.h
@@ -0,0 +1,70 @@
+#include <cstdint>
+
+#pragma once
+
+// Based on SDL2
+
+#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
+
+static inline uint16_t ORCT_Swapu16(uint16_t x)
+{
+ return static_cast<uint16_t>((x << 8) | (x >> 8));
+}
+
+static inline uint32_t ORCT_Swapu32(uint32_t x)
+{
+ return static_cast<uint32_t>(((x << 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x >> 24)));
+}
+
+static inline uint64_t ORCT_Swapu64(uint64_t x)
+{
+ uint32_t hi, lo;
+
+ /* Separate into high and low 32-bit values and swap them */
+ lo = static_cast<uint32_t>(x & 0xFFFFFFFF);
+ x >>= 32;
+ hi = static_cast<uint32_t>(x & 0xFFFFFFFF);
+ x = ORCT_Swapu32(lo);
+ x <<= 32;
+ x |= ORCT_Swapu32(hi);
+ return (x);
+}
+
+static inline int16_t ORCT_Swapi16(int16_t x)
+{
+ return static_cast<uint16_t>((x << 8) | (x >> 8));
+}
+
+static inline int32_t ORCT_Swapi32(int32_t x)
+{
+ return static_cast<uint32_t>(((x << 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x >> 24)));
+}
+
+static inline int64_t ORCT_Swapi64(int64_t x)
+{
+ uint32_t hi, lo;
+
+ /* Separate into high and low 32-bit values and swap them */
+ lo = static_cast<uint32_t>(x & 0xFFFFFFFF);
+ x >>= 32;
+ hi = static_cast<uint32_t>(x & 0xFFFFFFFF);
+ x = ORCT_Swapu32(lo);
+ x <<= 32;
+ x |= ORCT_Swapu32(hi);
+ return (x);
+}
+
+# define ORCT_SwapLEi16(X) ORCT_Swapi16(X)
+# define ORCT_SwapLEi32(X) ORCT_Swapi32(X)
+# define ORCT_SwapLEi64(X) ORCT_Swapi64(X)
+# define ORCT_SwapLEu16(X) ORCT_Swapu16(X)
+# define ORCT_SwapLEu32(X) ORCT_Swapu32(X)
+# define ORCT_SwapLEu64(X) ORCT_Swapu64(X)
+#else
+# define ORCT_SwapLEi16(X) (X)
+# define ORCT_SwapLEi32(X) (X)
+# define ORCT_SwapLEi64(X) (X)
+# define ORCT_SwapLEu16(X) (X)
+# define ORCT_SwapLEu32(X) (X)
+# define ORCT_SwapLEu64(X) (X)
+#endif

View File

@ -1,6 +1,6 @@
--- src/openrct2/config/Config.cpp.orig 2018-03-18 20:26:14 UTC
--- src/openrct2/config/Config.cpp.orig 2018-08-26 20:20:13 UTC
+++ src/openrct2/config/Config.cpp
@@ -602,6 +602,9 @@ namespace Config
@@ -650,6 +650,9 @@ namespace Config
*/
static std::string FindRCT2Path()
{
@ -9,4 +9,4 @@
+
log_verbose("config_find_rct2_path(...)");
static constexpr const utf8 * searchLocations[] =
static constexpr const utf8* searchLocations[] = {

View File

@ -1,14 +0,0 @@
--- src/openrct2/platform/Platform.Linux.cpp.orig 2018-03-18 20:26:14 UTC
+++ src/openrct2/platform/Platform.Linux.cpp
@@ -16,6 +16,11 @@
#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__linux__) && !defined(__ANDROID__))
+#ifdef __FreeBSD__
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
#include <limits.h>
#include <pwd.h>
#include "../core/Path.hpp"

View File

@ -1,11 +0,0 @@
--- src/openrct2/util/Util.cpp.orig 2018-03-18 20:26:14 UTC
+++ src/openrct2/util/Util.cpp
@@ -222,7 +222,7 @@ 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)
+#if defined(OpenRCT2_CPUID_GNUC_X86) && (!defined(__FreeBSD__) || (__FreeBSD__ > 10))
return __builtin_cpu_supports("avx2");
#else
// AVX2 support is declared as the 5th bit of EBX with CPUID(EAX = 7, ECX = 0).

View File

@ -1,10 +0,0 @@
================================================================================
To complete the installation of this port, you need to download the file
https://github.com/OpenRCT2/title-sequences/releases/download/%%DISTVERSIONPREFIX%%%%DISTVERSION%%/title-sequence-%%DISTVERSIONPREFIX%%%%DISTVERSION%%.zip
and unpack it to %%PREFIX%%/share/%%PORTNAME%%/title.
You need to follow https://openrct2.website/getting-started/index.html
to finish installation.
================================================================================

View File

@ -1,4 +1,4 @@
An open-source re-implementation of RollerCoaster Tycoon 2. A construction and
management simulation video game that simulates amusement park management.
WWW: https://openrct2.website/
WWW: https://openrct2.io

View File

@ -0,0 +1,6 @@
================================================================================
You need to follow https://openrct2.io/getting-started/index.html to finish
installation.
================================================================================

View File

@ -17,33 +17,3 @@ share/icons/hicolor/96x96/apps/openrct2.png
share/icons/hicolor/scalable/apps/openrct2.svg
share/metainfo/openrct2.appdata.xml
share/mime/packages/openrct2.xml
%%DATADIR%%/g2.dat
%%DATADIR%%/language/ar-EG.txt
%%DATADIR%%/language/ca-ES.txt
%%DATADIR%%/language/cs-CZ.txt
%%DATADIR%%/language/de-DE.txt
%%DATADIR%%/language/en-GB.txt
%%DATADIR%%/language/en-US.txt
%%DATADIR%%/language/es-ES.txt
%%DATADIR%%/language/fi-FI.txt
%%DATADIR%%/language/fr-FR.txt
%%DATADIR%%/language/hu-HU.txt
%%DATADIR%%/language/it-IT.txt
%%DATADIR%%/language/ja-JP.txt
%%DATADIR%%/language/ko-KR.txt
%%DATADIR%%/language/nb-NO.txt
%%DATADIR%%/language/nl-NL.txt
%%DATADIR%%/language/pl-PL.txt
%%DATADIR%%/language/pt-BR.txt
%%DATADIR%%/language/ru-RU.txt
%%DATADIR%%/language/sv-SE.txt
%%DATADIR%%/language/zh-CN.txt
%%DATADIR%%/language/zh-TW.txt
%%DATADIR%%/shaders/applypalette.frag
%%DATADIR%%/shaders/applypalette.vert
%%DATADIR%%/shaders/applytransparency.frag
%%DATADIR%%/shaders/applytransparency.vert
%%DATADIR%%/shaders/drawline.frag
%%DATADIR%%/shaders/drawline.vert
%%DATADIR%%/shaders/drawrect.frag
%%DATADIR%%/shaders/drawrect.vert