diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 11c511a915e..63c9def15a3 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -253,7 +253,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`open-adventure`](open-adventure/) | Open Adventure | 1.22 | https://gitlab.com/esr/open-adventure/ | | [`OpenJDK`](OpenJDK/) | OpenJDK | 17.0.6 | https://openjdk.java.net/ | | [`openjpeg`](openjpeg/) | OpenJPEG | 2.5.4 | https://www.openjpeg.org/ | -| [`openrct2`](openrct2/) | OpenRCT2 | 0.4.9 | https://openrct2.org/ | +| [`openrct2`](openrct2/) | OpenRCT2 | 0.5.6 | https://openrct2.org/ | | [`openssh`](openssh/) | OpenSSH | 10.6p1 | https://github.com/openssh/openssh-portable | | [`openssl`](openssl/) | OpenSSL | 4.1.0 | https://www.openssl.org/ | | [`openttd`](openttd/) | OpenTTD | 15.3 | https://www.openttd.org/ | diff --git a/Ports/openrct2/package.sh b/Ports/openrct2/package.sh index 8b4e0abe93e..810dbf4a93f 100755 --- a/Ports/openrct2/package.sh +++ b/Ports/openrct2/package.sh @@ -1,6 +1,6 @@ #!/usr/bin/env -S bash ../.port_include.sh port='openrct2' -version='0.4.9' +version='0.5.6' depends=( 'curl' 'flac' @@ -18,8 +18,8 @@ depends=( 'zlib' ) files=( - "https://github.com/OpenRCT2/OpenRCT2/archive/refs/tags/v${version}.tar.gz#d9eb7bb99923152122716707888a6182491662e106bef91b86106fa7b45b4309" - "https://github.com/OpenRCT2/OpenRCT2/releases/download/v${version}/OpenRCT2-${version}-linux-jammy-x86_64.tar.gz#f388d46956f32755a504df1582fea7b800a8c100333667cb3f9c495c5c9d7201" + "https://github.com/OpenRCT2/OpenRCT2/archive/refs/tags/v${version}.tar.gz#f4732724c1a709cfaff02ddff7fe3b6d027ad7827b343bf6f2a254114d32128b" + "https://github.com/OpenRCT2/OpenRCT2/releases/download/v${version}/OpenRCT2-v${version}-Linux-noble-x86_64.tar.gz#2220407872ed9aba2c7c67dbf46bb321bb7b88b4b526123d8f075938cc4c6c02" ) useconfigure='true' workdir="OpenRCT2-${version}" @@ -27,28 +27,34 @@ icon_file='resources/logo/icon.ico' launcher_name='OpenRCT2' launcher_category='&Games' launcher_command='/usr/local/bin/openrct2' +configopts=( + "-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt" + '-DCMAKE_BUILD_TYPE=Release' + '-DDISABLE_DISCORD_RPC=ON' + '-DDISABLE_GOOGLE_BENCHMARK=ON' + '-DWITH_TESTS=OFF' + '-DDISABLE_OPENGL=ON' + '-DDOWNLOAD_TITLE_SEQUENCES=OFF' + '-DDOWNLOAD_OBJECTS=OFF' + '-DDOWNLOAD_OPENSFX=OFF' + '-DDOWNLOAD_OPENMUSIC=OFF' +) configure() { - mkdir -p "${PORT_BUILD_DIR}/OpenRCT2-${version}-build" - cd "${PORT_BUILD_DIR}/OpenRCT2-${version}-build" - cmake \ - -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE="${SERENITY_BUILD_DIR}/CMakeToolchain.txt" \ - -DCMAKE_BUILD_TYPE='Release' \ - -DDISABLE_DISCORD_RPC='ON' \ - -DDISABLE_GOOGLE_BENCHMARK='ON' \ - -DWITH_TESTS='OFF' \ - -DDISABLE_OPENGL='ON' \ - "${PORT_BUILD_DIR}/OpenRCT2-${version}" + run cmake -G Ninja -B build -S . "${configopts[@]}" } build() { - cd "${PORT_BUILD_DIR}/OpenRCT2-${version}-build" - [ -f 'g2.dat' ] || mv "${PORT_BUILD_DIR}/OpenRCT2/data/g2.dat" '.' - ninja + for data_file in g2 fonts palettes tracks; do + [ -f "${workdir}/build/${data_file}.dat" ] || cp "${PORT_BUILD_DIR}/OpenRCT2/data/${data_file}.dat" "${workdir}/build/" + done + run cmake --build build } install() { - cd "${PORT_BUILD_DIR}/OpenRCT2-${version}-build" - ninja install + run cmake --install build + for data_dir in assetpack sequence object; do + mkdir -p "${DESTDIR}/usr/local/share/openrct2/${data_dir}" + cp -a "${PORT_BUILD_DIR}/OpenRCT2/data/${data_dir}/." "${DESTDIR}/usr/local/share/openrct2/${data_dir}/" + done } diff --git a/Ports/openrct2/patches/0001-Add-SerenityOS-platform-detection.patch b/Ports/openrct2/patches/0001-Add-SerenityOS-platform-detection.patch index ad664f0cc83..b7cd802ac8c 100644 --- a/Ports/openrct2/patches/0001-Add-SerenityOS-platform-detection.patch +++ b/Ports/openrct2/patches/0001-Add-SerenityOS-platform-detection.patch @@ -9,16 +9,16 @@ We teach OpenRCT2 about the name of our platform. 1 file changed, 3 insertions(+) diff --git a/src/openrct2/Version.h b/src/openrct2/Version.h -index 14c26ea19956318a1a82d21d69a63c6a2cebdbe6..07df815d073a4e623ac9ae5ff01936e1055a9891 100644 +index 19251d1e4aa6cce3323d642b791690de2e250869..939858ccb4fb71f5ff102ec66ce586cdd238facd 100644 --- a/src/openrct2/Version.h +++ b/src/openrct2/Version.h -@@ -70,6 +70,9 @@ - #ifdef __EMSCRIPTEN__ - # define OPENRCT2_PLATFORM "Emscripten" +@@ -75,6 +75,9 @@ + #ifdef __HAIKU__ + #define OPENRCT2_PLATFORM "Haiku" #endif +#ifdef __serenity__ -+# define OPENRCT2_PLATFORM "SerenityOS" ++ #define OPENRCT2_PLATFORM "SerenityOS" +#endif #ifndef OPENRCT2_PLATFORM - # error Unknown platform! + #error Unknown platform! #endif diff --git a/Ports/openrct2/patches/0002-Read-the-executable-path-from-proc-self-exe.patch b/Ports/openrct2/patches/0002-Read-the-executable-path-from-proc-self-exe.patch index 708b05108eb..cc88bead4d6 100644 --- a/Ports/openrct2/patches/0002-Read-the-executable-path-from-proc-self-exe.patch +++ b/Ports/openrct2/patches/0002-Read-the-executable-path-from-proc-self-exe.patch @@ -9,15 +9,15 @@ When looking for the executable path, we behave exactly like Linux. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/platform/Platform.Linux.cpp b/src/openrct2/platform/Platform.Linux.cpp -index 516c126cfea262448e94a9e883e5b0ea88e4036e..3f3f48b949fd9c6b24a09f8f88b51266c74462f2 100644 +index d8c48bcd3df5c75c6f9f5a87288d88cb04df872a..ac5357dba07442a508c71e52a9636d06b79acc6e 100644 --- a/src/openrct2/platform/Platform.Linux.cpp +++ b/src/openrct2/platform/Platform.Linux.cpp -@@ -129,7 +129,7 @@ namespace Platform +@@ -182,7 +182,7 @@ namespace OpenRCT2::Platform std::string GetCurrentExecutablePath() { char exePath[PATH_MAX] = { 0 }; --# ifdef __linux__ -+# if defined(__linux__) || defined(__serenity__) +- #ifdef __linux__ ++ #if defined(__linux__) || defined(__serenity__) auto bytesRead = readlink("/proc/self/exe", exePath, sizeof(exePath)); if (bytesRead == -1) { diff --git a/Ports/openrct2/patches/0004-Add-compile-options-to-CMakeLists.txt.patch b/Ports/openrct2/patches/0003-Add-compile-options-to-CMakeLists.txt.patch similarity index 91% rename from Ports/openrct2/patches/0004-Add-compile-options-to-CMakeLists.txt.patch rename to Ports/openrct2/patches/0003-Add-compile-options-to-CMakeLists.txt.patch index 9ab3a3aa9bd..85abc65bc11 100644 --- a/Ports/openrct2/patches/0004-Add-compile-options-to-CMakeLists.txt.patch +++ b/Ports/openrct2/patches/0003-Add-compile-options-to-CMakeLists.txt.patch @@ -9,10 +9,10 @@ This irons out some compiler warnings that turned into errors when compiling a r 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0f62a0bb62ebb1ea867898f3eb18e819d6a513ac..6a5da9dd95fb23f2063e79951b0df29032f9dcc0 100644 +index 871e16c966c0aaaff76a47fae20b3e9b096b41ff..4db8be809c63b25f71bc60d199c63735698e107b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -304,6 +304,8 @@ else () +@@ -318,6 +318,8 @@ else () # unused-const-variable[=2] would check for unused values from headers as well ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_UNUSED_CONST_VARIABLE -Wunused-const-variable=1) ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WNO_CLOBBERED -Wno-clobbered) @@ -21,7 +21,7 @@ index 0f62a0bb62ebb1ea867898f3eb18e819d6a513ac..6a5da9dd95fb23f2063e79951b0df290 # Disabled due to problems compiling OpenSSL on macOS. # ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_DOCUMENTATION -Wdocumentation) -@@ -313,7 +315,7 @@ else () +@@ -327,7 +329,7 @@ else () ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls) # Currently used MinGW w/GCC 7.2 doesn't provide sane error messages for this diff --git a/Ports/openrct2/patches/0003-Remove-use-of-strptime.patch b/Ports/openrct2/patches/0003-Remove-use-of-strptime.patch deleted file mode 100644 index ab06d7c95ee..00000000000 --- a/Ports/openrct2/patches/0003-Remove-use-of-strptime.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= -Date: Tue, 7 Feb 2023 21:36:54 +0100 -Subject: [PATCH] Remove use of strptime() - -This is a hack to patch out strptime() from duktape, which is not being used by this project. ---- - src/thirdparty/duktape/duk_config.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/thirdparty/duktape/duk_config.h b/src/thirdparty/duktape/duk_config.h -index 4ac2e1d54dfc5da74136effbcb0e569c6ddea50a..b676781634c55ecb6c45f6cf01c0e9d1ee2afc75 100644 ---- a/src/thirdparty/duktape/duk_config.h -+++ b/src/thirdparty/duktape/duk_config.h -@@ -221,7 +221,7 @@ - - /* Generic Unix (includes Cygwin) */ - #if defined(__unix) || defined(__unix__) || defined(unix) || \ -- defined(DUK_F_LINUX) || defined(DUK_F_BSD) -+ defined(DUK_F_LINUX) || defined(DUK_F_BSD) || defined(__serenity__) - #define DUK_F_UNIX - #endif - -@@ -840,7 +840,7 @@ - /* --- Generic UNIX --- */ - #define DUK_USE_DATE_NOW_GETTIMEOFDAY - #define DUK_USE_DATE_TZO_GMTIME_R --#define DUK_USE_DATE_PRS_STRPTIME -+#undef DUK_USE_DATE_PRS_STRPTIME - #define DUK_USE_DATE_FMT_STRFTIME - #include - #include diff --git a/Ports/openrct2/patches/0005-Disable-locale-detection-for-writing-the-default-con.patch b/Ports/openrct2/patches/0004-Disable-locale-detection-for-writing-the-default-con.patch similarity index 84% rename from Ports/openrct2/patches/0005-Disable-locale-detection-for-writing-the-default-con.patch rename to Ports/openrct2/patches/0004-Disable-locale-detection-for-writing-the-default-con.patch index d3568327f16..922720a4cf5 100644 --- a/Ports/openrct2/patches/0005-Disable-locale-detection-for-writing-the-default-con.patch +++ b/Ports/openrct2/patches/0004-Disable-locale-detection-for-writing-the-default-con.patch @@ -9,10 +9,10 @@ At the time of writing, locale support in Serenity is not great. We always retur 1 file changed, 2 insertions(+) diff --git a/src/openrct2/platform/Platform.Linux.cpp b/src/openrct2/platform/Platform.Linux.cpp -index 3f3f48b949fd9c6b24a09f8f88b51266c74462f2..ce5acb00a19b00c5adc2d7be07db42e4c49eebc6 100644 +index ac5357dba07442a508c71e52a9636d06b79acc6e..1a311fec87f325be6519ef7379115861198a70d2 100644 --- a/src/openrct2/platform/Platform.Linux.cpp +++ b/src/openrct2/platform/Platform.Linux.cpp -@@ -178,6 +178,7 @@ namespace Platform +@@ -243,6 +243,7 @@ namespace OpenRCT2::Platform uint16_t GetLocaleLanguage() { @@ -20,7 +20,7 @@ index 3f3f48b949fd9c6b24a09f8f88b51266c74462f2..ce5acb00a19b00c5adc2d7be07db42e4 const char* langString = setlocale(LC_MESSAGES, ""); if (langString != nullptr) { -@@ -238,6 +239,7 @@ namespace Platform +@@ -303,6 +304,7 @@ namespace OpenRCT2::Platform } } } diff --git a/Ports/openrct2/patches/0005-Add-SerenityOS-support-to-bundled-QuickJS.patch b/Ports/openrct2/patches/0005-Add-SerenityOS-support-to-bundled-QuickJS.patch new file mode 100644 index 00000000000..5334f2ab67b --- /dev/null +++ b/Ports/openrct2/patches/0005-Add-SerenityOS-support-to-bundled-QuickJS.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Sat, 24 Oct 2026 18:06:36 +0100 +Subject: [PATCH] Add SerenityOS support to bundled QuickJS + +--- + src/thirdparty/quickjs-ng/quickjs-amalgam.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/thirdparty/quickjs-ng/quickjs-amalgam.c b/src/thirdparty/quickjs-ng/quickjs-amalgam.c +index d90b64cda990646505282182ebabaa7da9fbaf28..44b365488518dc2015f0efb34033df44dc7c4135 100644 +--- a/src/thirdparty/quickjs-ng/quickjs-amalgam.c ++++ b/src/thirdparty/quickjs-ng/quickjs-amalgam.c +@@ -8687,6 +8687,11 @@ JS_EXTERN uintptr_t js_std_cmd(int cmd, ...); + #define NO_TM_GMTOFF + #endif + ++#if defined(__serenity__) ++#include ++#define NO_TM_GMTOFF ++#endif ++ + // atomic_store etc. are completely busted in recent versions of tcc; + // somehow the compiler forgets to load |ptr| into %rdi when calling + // the __atomic_*() helpers in its lib/stdatomic.c and lib/atomic.S diff --git a/Ports/openrct2/patches/0006-Disable-g2.dat-target.patch b/Ports/openrct2/patches/0006-Disable-g2.dat-target.patch deleted file mode 100644 index a68af76dd6d..00000000000 --- a/Ports/openrct2/patches/0006-Disable-g2.dat-target.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= -Date: Wed, 8 Feb 2023 12:27:59 +0100 -Subject: [PATCH] Disable g2.dat target - -Normally, the build system uses one of the compiled binaries to pack assets into `g2.dat`. However, since we cross-compile this binary for Serenity, we can't do this on the host system. Instead, we download the latest Linux build of OpenRCT2 and copy its `g2.dat` into the disk image. ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6a5da9dd95fb23f2063e79951b0df29032f9dcc0..aff9e6bed903b3701fff69c098adf619326f92c4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -395,7 +395,7 @@ endif () - - - # g2 --if (NOT (MACOS_BUNDLE AND (NOT CMAKE_OSX_ARCHITECTURES MATCHES "${SYSTEM_MACOS_ARCH}"))) -+if (NOT (MACOS_BUNDLE AND (NOT CMAKE_OSX_ARCHITECTURES MATCHES "${SYSTEM_MACOS_ARCH}")) AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SerenityOS") - add_custom_command( - OUTPUT g2.dat - COMMAND ./openrct2-cli sprite build ${CMAKE_BINARY_DIR}/g2.dat ${ROOT_DIR}/resources/g2/sprites.json diff --git a/Ports/openrct2/patches/0006-Include-alloca.h-on-SerenityOS.patch b/Ports/openrct2/patches/0006-Include-alloca.h-on-SerenityOS.patch new file mode 100644 index 00000000000..9101273c43c --- /dev/null +++ b/Ports/openrct2/patches/0006-Include-alloca.h-on-SerenityOS.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Sat, 24 Oct 2026 18:09:39 +0100 +Subject: [PATCH] Include alloca.h on SerenityOS + +--- + src/openrct2/core/String.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/openrct2/core/String.cpp b/src/openrct2/core/String.cpp +index 89143081e0101dee1fd4cc8064da1fd97812bf99..bd1a37a1f0ee585e327f6a5f5d51d7a038e5f5d0 100644 +--- a/src/openrct2/core/String.cpp ++++ b/src/openrct2/core/String.cpp +@@ -19,7 +19,7 @@ + #include + + #ifndef _WIN32 +- #if defined(__linux__) || defined(__sun) ++ #if defined(__linux__) || defined(__sun) || defined(__serenity__) + #include + #endif + #include diff --git a/Ports/openrct2/patches/0007-Use-the-SDL-software-renderer.patch b/Ports/openrct2/patches/0007-Use-the-SDL-software-renderer.patch new file mode 100644 index 00000000000..4812194cd3c --- /dev/null +++ b/Ports/openrct2/patches/0007-Use-the-SDL-software-renderer.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Sat, 24 Oct 2026 18:10:29 +0100 +Subject: [PATCH] Use the SDL software renderer + +--- + .../drawing/engines/HardwareDisplayDrawingEngine.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp +index 9037b47b51e2a6b41b3b440fc225a1ca84f5d31d..bc2a22430ea65163674799edd7cec2218ac31bf8 100644 +--- a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp ++++ b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp +@@ -75,7 +75,7 @@ public: + + void Initialise() override + { +- _sdlRenderer = SDL_CreateRenderer(_window, -1, SDL_RENDERER_ACCELERATED | (_useVsync ? SDL_RENDERER_PRESENTVSYNC : 0)); ++ _sdlRenderer = SDL_CreateRenderer(_window, -1, SDL_RENDERER_SOFTWARE | (_useVsync ? SDL_RENDERER_PRESENTVSYNC : 0)); + } + + void SetVSync(bool vsync) override diff --git a/Ports/openrct2/patches/0008-Fix-black-screen-with-16-bit-SDL-textures.patch b/Ports/openrct2/patches/0008-Fix-black-screen-with-16-bit-SDL-textures.patch new file mode 100644 index 00000000000..593cc6b1802 --- /dev/null +++ b/Ports/openrct2/patches/0008-Fix-black-screen-with-16-bit-SDL-textures.patch @@ -0,0 +1,94 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Linus Groh +Date: Sat, 24 Oct 2026 18:31:06 +0100 +Subject: [PATCH] Fix black screen with 16-bit SDL textures + +CopyBitsToTexture calculated row padding as pitch - width * 4, assuming +every texture pixel is 4 bytes. SDL's software renderer gives OpenRCT2 an +RGB565 texture instead, where each pixel is 2 bytes, so the padding was +negative and none of the copy loops matched. The texture stayed empty and +the window was black. + +The 16-bit copy loop also read two palette indices per output pixel. It was +never reached because of the padding bug, but it would have produced a +corrupted image. + +Calculate padding from the texture format's actual bytes per pixel and write +one mapped palette color per pixel. + +--- +--- a/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp ++++ b/src/openrct2-ui/drawing/engines/HardwareDisplayDrawingEngine.cpp +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -278,48 +279,26 @@ + { + void* pixels; + int32_t pitch; +- if (SDL_LockTexture(texture, nullptr, &pixels, &pitch) == 0) ++ if (SDL_LockTexture(texture, nullptr, &pixels, &pitch) != 0) + { +- int32_t padding = pitch - (width * 4); +- if (pitch == width * 4) +- { +- uint32_t* dst = static_cast(pixels); +- for (int32_t i = width * height; i > 0; i--) +- { +- *dst++ = palette[EnumValue(*src++)]; +- } +- } +- else ++ return; ++ } ++ ++ const int32_t bytesPerPixel = _screenTextureFormat->BytesPerPixel; ++ const int32_t padding = pitch - (width * bytesPerPixel); ++ auto* dst = static_cast(pixels); ++ for (int32_t y = 0; y < height; y++) ++ { ++ for (int32_t x = 0; x < width; x++) + { +- if (pitch == (width * 2) + padding) +- { +- uint16_t* dst = static_cast(pixels); +- for (int32_t y = height; y > 0; y--) +- { +- for (int32_t x = width; x > 0; x--) +- { +- const uint8_t lower = *reinterpret_cast(&palette[EnumValue(*src++)]); +- const uint8_t upper = *reinterpret_cast(&palette[EnumValue(*src++)]); +- *dst++ = (lower << 8) | upper; +- } +- dst = reinterpret_cast(reinterpret_cast(dst) + padding); +- } +- } +- else if (pitch == width + padding) +- { +- uint8_t* dst = static_cast(pixels); +- for (int32_t y = height; y > 0; y--) +- { +- for (int32_t x = width; x > 0; x--) +- { +- *dst++ = *reinterpret_cast(&palette[EnumValue(*src++)]); +- } +- dst += padding; +- } +- } ++ const uint32_t pixel = palette[EnumValue(*src++)]; ++ std::memcpy(dst, &pixel, bytesPerPixel); ++ dst += bytesPerPixel; + } +- SDL_UnlockTexture(texture); ++ dst += padding; + } ++ ++ SDL_UnlockTexture(texture); + } + + uint32_t GetDirtyVisualTime(uint32_t x, uint32_t y) diff --git a/Ports/openrct2/patches/ReadMe.md b/Ports/openrct2/patches/ReadMe.md index 16b12cfaa22..74ec1458e1f 100644 --- a/Ports/openrct2/patches/ReadMe.md +++ b/Ports/openrct2/patches/ReadMe.md @@ -12,27 +12,37 @@ Read the executable path from /proc/self/exe When looking for the executable path, we behave exactly like Linux. -## `0003-Remove-use-of-strptime.patch` - -Remove use of strptime() - -This is a hack to patch out strptime() from duktape, which is not being used by this project. - -## `0004-Add-compile-options-to-CMakeLists.txt.patch` +## `0003-Add-compile-options-to-CMakeLists.txt.patch` Add compile options to CMakeLists.txt This irons out some compiler warnings that turned into errors when compiling a release build. -## `0005-Disable-locale-detection-for-writing-the-default-con.patch` +## `0004-Disable-locale-detection-for-writing-the-default-con.patch` Disable locale detection for writing the default config.ini At the time of writing, locale support in Serenity is not great. We always returned the "C" locale, which this code interpreted wrong. Since this is just used for writing a default value to the game config (which can be changed later), we just default to English. -## `0006-Disable-g2.dat-target.patch` +## `0005-Add-SerenityOS-support-to-bundled-QuickJS.patch` -Disable g2.dat target +Add SerenityOS support to bundled QuickJS + + +## `0006-Include-alloca.h-on-SerenityOS.patch` + +Include alloca.h on SerenityOS + + +## `0007-Use-the-SDL-software-renderer.patch` + +Use the SDL software renderer + + +## `0008-Fix-black-screen-with-16-bit-SDL-textures.patch` + +Fix black screen with 16-bit SDL textures + +`CopyBitsToTexture` calculated row padding assuming 4-byte pixels. The SDL software renderer selects an RGB565 texture, so no copy loop matched and the screen stayed black. Use the texture's actual bytes per pixel and write one mapped palette colour per pixel. -Normally, the build system uses one of the compiled binaries to pack assets into `g2.dat`. However, since we cross-compile this binary for Serenity, we can't do this on the host system. Instead, we download the latest Linux build of OpenRCT2 and copy its `g2.dat` into the disk image.