forked from rosebudai/OpenRCT2-Web
Enable RCT1 defaults and assets in OpenRCT2 0.5.7 browser build
This commit is contained in:
1 parent
90c3af78c0
commit
c833500039
7 files changed
+102
-86
No files matched your search
+16
-10
@@ -15,26 +15,31 @@ podman build -t openrct2-emscripten-local -f rosebud/docker/Dockerfile rosebud/d
|
||||
podman run --rm -v "$PWD:/src" -w /src localhost/openrct2-emscripten-local:latest bash ./scripts/build-emscripten
|
||||
```
|
||||
|
||||
Bundle the matching installed OpenRCT2 assets and your Steam RCT2 files. Run
|
||||
Bundle the matching installed OpenRCT2 0.5.7 assets and your Steam RCT1 and RCT2 files. Run
|
||||
these commands from the repository root:
|
||||
|
||||
```sh
|
||||
repo_root="$PWD"
|
||||
steam_rct2="$HOME/.steam/steam/steamapps/common/Rollercoaster Tycoon 2"
|
||||
rm -f build/www/assets.zip build/www/rct2-content.zip
|
||||
steam_rct1="$HOME/.steam/steam/steamapps/common/RollerCoaster Tycoon Deluxe"
|
||||
rm -f build/www/assets.zip build/www/rct1-content.zip build/www/rct2-content.zip
|
||||
(cd /usr/share/openrct2 && zip -qr "$repo_root/build/www/assets.zip" assetpack fonts.dat g2.dat language object palettes.dat scenario_patches sequence shaders tracks.dat)
|
||||
python3 scripts/patch-browser-title-sequence.py
|
||||
(cd "$steam_rct1" && zip -qr "$repo_root/build/www/rct1-content.zip" Data Scenarios Tracks)
|
||||
(cd "$steam_rct2" && zip -qr "$repo_root/build/www/rct2-content.zip" Data ObjData Scenarios Tracks 'Saved Games')
|
||||
```
|
||||
|
||||
The title sequence patch keeps the title park from cycling into a blocking
|
||||
park load in this browser build. The `build/www` directory is the upload source.
|
||||
The original RCT1 and OpenRCT2 title sequences are left intact. The browser
|
||||
selects the RCT1 title sequence, which starts at Diamond Heights and then
|
||||
cycles through the original RCT1 parks.
|
||||
The browser sets the RCT1 paths, German, Euro, RCT1 title music, and the RCT1
|
||||
UI theme once per browser profile, preserving later changes made in game.
|
||||
The `build/www` directory is the upload source.
|
||||
|
||||
## Deploy
|
||||
|
||||
1. Build the browser game locally. Put the purchased RCT2 game resources in
|
||||
`build/www/rct2-content.zip`; `assets.zip` and the engine files must also be
|
||||
present in `build/www/`.
|
||||
1. Build the browser game locally. Put the purchased game resources in
|
||||
`build/www/rct1-content.zip` and `build/www/rct2-content.zip`; `assets.zip`
|
||||
and the engine files must also be present in `build/www/`.
|
||||
2. With the homelab Kubernetes context selected, create the dedicated S3 user:
|
||||
`kubectl apply -f deploy/s3-user.yaml`. Wait for it to be ready and for
|
||||
`rook-ceph-object-user-my-store-openrct2-publisher` to appear in `rook-ceph`.
|
||||
@@ -48,8 +53,9 @@ park load in this browser build. The `build/www` directory is the upload source.
|
||||
`https://rct.brunner.ninja/` in Brave.
|
||||
|
||||
The public-read policy grants only object reads, so a browser can download the
|
||||
game files but cannot list or change the bucket. `rct2-content.zip` includes
|
||||
assets from the purchased game and is publicly downloadable at this address.
|
||||
game files but cannot list or change the bucket. `rct1-content.zip` and
|
||||
`rct2-content.zip` include assets from the purchased games and are publicly
|
||||
downloadable at this address.
|
||||
Do not commit it, `assets.zip`, or generated `build/` and `dist/` folders.
|
||||
|
||||
For a later update, rebuild locally and rerun `deploy/publish.sh` before
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ bucket="openrct2-web"
|
||||
endpoint="https://s3.brunner.ninja"
|
||||
secret="rook-ceph-object-user-my-store-openrct2-publisher"
|
||||
|
||||
if [[ ! -s "$site_dir/index.html" || ! -s "$site_dir/rct2-content.zip" || ! -s "$site_dir/assets.zip" ]]; then
|
||||
if [[ ! -s "$site_dir/index.html" || ! -s "$site_dir/rct1-content.zip" || ! -s "$site_dir/rct2-content.zip" || ! -s "$site_dir/assets.zip" ]]; then
|
||||
echo "Missing browser build or game resources in $site_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
0.4.31 (2026-02-01)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: [#25844] The sprite builder now also supports adding JSON-based palettes.
|
||||
- Improved: [#3788] Self-intersecting track designs can now be placed.
|
||||
- Improved: [#25719] The weather change dropdown now shows icons next to the weather types for easier selection.
|
||||
- Improved: [#25765] The ‘View options’ and ‘Special track elements’ dropdowns no longer need click-and-hold.
|
||||
- Improved: [#25858] macOS now supports the onboarding menu.
|
||||
- Improved: [#25882] Maze construction now auto-removes trees.
|
||||
- Improved: [objects#421] The vehicle tab of some rides now shows more of the vehicle.
|
||||
- Change: [#25018] Add upkeep cost to booster pieces.
|
||||
- Fix: [#4643, #25167] Many metal supports draw with a filled in top when they didn’t in vanilla, causing some slight misalignment and glitching.
|
||||
- Fix: [#15009] Landscaping tools do not display estimates when the game is paused (original bug).
|
||||
- Fix: [#18441] Replacing footpaths sometimes results in a spurious “Footpath in the way” error (original bug).
|
||||
- Fix: [#20620] In-game console caret does not update when pasting.
|
||||
- Fix: [#20652] Twister Roller Coaster design ‘u(0241)’ has no preview and cannot be built (bug in track design).
|
||||
- Fix: [#23859] Wrong banner text displayed after loading a different park.
|
||||
- Fix: [#25221] When trying to cancel game file discovery, the prompt reappears.
|
||||
- Fix: [#25703, #25889] Crash when scanning scenarios with packed objects in parallel.
|
||||
- Fix: [#25739] Game freezes when a tab in the New Ride window contains more than 384 items.
|
||||
- Fix: [#25745] Crash when a player connection is aborted early.
|
||||
- Fix: [#25775] Network download sizes are in bytes instead of the listed kibibytes.
|
||||
- Fix: [#25799] The animated options tab icon of the news window does not always redraw.
|
||||
- Fix: [#25850] Guests do not have their happiness penalised by low energy, high hunger, high thirst, high toilet.
|
||||
- Fix: [#25850] Ride nausea generation is different compared to vanilla.
|
||||
- Fix: [#25854] When a guest is at 0 happiness or energy, the game draws too big of a bar in the guest stats window.
|
||||
- Fix: [#25862] Diagonal and inclined brakes are not counted when calculating upkeep cost.
|
||||
- Fix: [#25873] Repainting a banner in OpenRCT2-specific colours results in an error message.
|
||||
- Fix: [#25879] Guest window viewport doesn’t follow vehicle when they board a ride.
|
||||
- Fix: [#25908] Crash from use-after-free in banner text formatting during multithreaded rendering.
|
||||
- Fix: [objects#419] Alignment of RCT2 red, yellow and green queue previews is off.
|
||||
- Fix: [objects#424] Jet Aeroplane decor has a hole in it.
|
||||
- Fix: [objects#425] Capacity of ‘Blob from outer space ride’ is incorrectly listed.
|
||||
+83
-2
@@ -105,6 +105,7 @@
|
||||
// megabytes through IDBFS stalls the renderer after startup.
|
||||
|
||||
Module.FS.mkdir("/OpenRCT2");
|
||||
Module.FS.mkdir("/RCT1");
|
||||
// Engine assets are supplied by assets.zip. Keep them out of IDBFS too;
|
||||
// only the small /persistent user directory needs browser storage.
|
||||
|
||||
@@ -143,6 +144,25 @@
|
||||
setProgress(90, "Ride data loaded");
|
||||
}
|
||||
|
||||
setProgress(90, "Checking RollerCoaster Tycoon 1 data...");
|
||||
if (!fileExists("/RCT1/Data/CSG1.DAT") || !fileExists("/RCT1/Scenarios/sc0.sc4"))
|
||||
{
|
||||
const response = await fetch("rct1-content.zip");
|
||||
if (!response.ok)
|
||||
{
|
||||
setError(`Error loading RCT1 data (status: ${response.status}).`);
|
||||
return;
|
||||
}
|
||||
await extractZip(await response.blob(), () => "/RCT1/");
|
||||
}
|
||||
if (!fileExists("/RCT1/Data/CSG1.DAT") || !fileExists("/RCT1/Scenarios/sc0.sc4"))
|
||||
{
|
||||
setError("RCT1 data is incomplete. Check rct1-content.zip.");
|
||||
return;
|
||||
}
|
||||
|
||||
configureRCT1Defaults();
|
||||
|
||||
setProgress(95, "Preparing your park...");
|
||||
if (typeof dismissOverlay === 'function') {
|
||||
dismissOverlay();
|
||||
@@ -154,6 +174,65 @@
|
||||
Module.callMain(["--user-data-path=/persistent/", "--openrct2-data-path=/OpenRCT2/"]);
|
||||
})();
|
||||
|
||||
function configureRCT1Defaults() {
|
||||
const marker = "/persistent/.rct1-0.5.7-defaults";
|
||||
if (fileExists(marker)) return;
|
||||
|
||||
const configPath = "/persistent/config.ini";
|
||||
let config = "";
|
||||
if (fileExists(configPath)) {
|
||||
config = Module.FS.readFile(configPath, {encoding: "utf8"});
|
||||
}
|
||||
const defaults = {
|
||||
general: {
|
||||
game_path: '"/RCT"',
|
||||
rct1_path: '"/RCT1"',
|
||||
language: "de-DE",
|
||||
currency_format: "EUR"
|
||||
},
|
||||
interface: {
|
||||
current_theme: '"*RCT1"',
|
||||
current_title_sequence: '"*RCT1"',
|
||||
random_title_sequence: "false"
|
||||
},
|
||||
sound: { title_theme: "3" }
|
||||
};
|
||||
const lines = config.split(/\r?\n/);
|
||||
const seen = {};
|
||||
let section = "";
|
||||
const output = [];
|
||||
function finishSection() {
|
||||
if (!defaults[section]) return;
|
||||
for (const [key, value] of Object.entries(defaults[section])) {
|
||||
if (!seen[section]?.has(key)) output.push(`${key} = ${value}`);
|
||||
}
|
||||
}
|
||||
for (const line of lines) {
|
||||
const heading = line.match(/^\s*\[([^\]]+)\]\s*$/);
|
||||
if (heading) {
|
||||
finishSection();
|
||||
section = heading[1].toLowerCase();
|
||||
seen[section] = new Set();
|
||||
}
|
||||
const setting = line.match(/^\s*([a-z_]+)\s*=/i);
|
||||
if (setting && defaults[section]?.[setting[1].toLowerCase()] !== undefined) {
|
||||
const key = setting[1].toLowerCase();
|
||||
output.push(`${key} = ${defaults[section][key]}`);
|
||||
seen[section].add(key);
|
||||
} else {
|
||||
output.push(line);
|
||||
}
|
||||
}
|
||||
finishSection();
|
||||
for (const [name, settings] of Object.entries(defaults)) {
|
||||
if (seen[name]) continue;
|
||||
output.push(`[${name}]`);
|
||||
for (const [key, value] of Object.entries(settings)) output.push(`${key} = ${value}`);
|
||||
}
|
||||
Module.FS.writeFile(configPath, output.join("\n") + "\n");
|
||||
Module.FS.writeFile(marker, "1");
|
||||
}
|
||||
|
||||
async function updateAssets() {
|
||||
let currentVersion = "";
|
||||
try {
|
||||
@@ -171,9 +250,11 @@ async function updateAssets() {
|
||||
|
||||
// If key files are missing, force a refresh even when version matches.
|
||||
const hasRequiredAssets = fileExists("/OpenRCT2/language/en-US.txt")
|
||||
&& fileExists("/OpenRCT2/language/de-DE.txt")
|
||||
&& fileExists("/OpenRCT2/g2.dat")
|
||||
&& fileExists("/OpenRCT2/object/official/footpath_surface/openrct2.footpath_surface.invisible.json")
|
||||
&& fileExists("/OpenRCT2/sequence/openrct2.parkseq");
|
||||
&& fileExists("/OpenRCT2/sequence/openrct2.parkseq")
|
||||
&& fileExists("/OpenRCT2/sequence/rct1.parkseq");
|
||||
if (!hasRequiredAssets)
|
||||
{
|
||||
console.warn("OpenRCT2 data files are incomplete, forcing an asset refresh.");
|
||||
@@ -188,7 +269,7 @@ async function updateAssets() {
|
||||
await clearDatabase("/OpenRCT2/");
|
||||
|
||||
// Fetch the assets.zip file
|
||||
const response = await fetch("assets.zip");
|
||||
const response = await fetch("assets.zip", { cache: "no-store" });
|
||||
if (!response.ok) {
|
||||
if (response.status === 404) {
|
||||
setError("Error! Assets file not found (404).");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
mkdir -p build
|
||||
@@ -37,4 +38,5 @@ mkdir -p www/
|
||||
cd www/
|
||||
cp -r ../openrct2.* ./
|
||||
cp -r ../../rosebud/static/* ./
|
||||
cp ../../distribution/changelog.txt ./changelog.txt
|
||||
zip -r openrct2.zip ../openrct2.*
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Keep the browser title scene on one park to avoid a blocking park swap."""
|
||||
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
from tempfile import NamedTemporaryFile
|
||||
from zipfile import ZipFile
|
||||
|
||||
|
||||
assets_path = Path(__file__).resolve().parents[1] / "build/www/assets.zip"
|
||||
title_script = (
|
||||
b"# Browser title sequence\n"
|
||||
b"LOAD Kahuna Point by Enrico Dandolo & Kyphii & RobMan.park\n"
|
||||
b"ZOOM 0\n"
|
||||
b"LOCATION 97 54\n"
|
||||
+ b"WAIT 60000\n" * 1000
|
||||
)
|
||||
|
||||
with ZipFile(assets_path) as assets:
|
||||
sequence_bytes = assets.read("sequence/openrct2.parkseq")
|
||||
|
||||
sequence_output = BytesIO()
|
||||
with ZipFile(BytesIO(sequence_bytes)) as source, ZipFile(sequence_output, "w") as target:
|
||||
for entry in source.infolist():
|
||||
target.writestr(entry, title_script if entry.filename == "script.txt" else source.read(entry))
|
||||
|
||||
with NamedTemporaryFile(dir=assets_path.parent, suffix=".zip", delete=False) as temporary:
|
||||
temporary_path = Path(temporary.name)
|
||||
|
||||
try:
|
||||
with ZipFile(assets_path) as source, ZipFile(temporary_path, "w") as target:
|
||||
for entry in source.infolist():
|
||||
data = sequence_output.getvalue() if entry.filename == "sequence/openrct2.parkseq" else source.read(entry)
|
||||
target.writestr(entry, data)
|
||||
temporary_path.replace(assets_path)
|
||||
except BaseException:
|
||||
temporary_path.unlink(missing_ok=True)
|
||||
raise
|
||||
@@ -64,11 +64,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
static void WindowTitleMenuScenarioselectCallback(const utf8* path)
|
||||
{
|
||||
LOG_INFO("Browser scenario load: %s", path);
|
||||
GameNotifyMapChange();
|
||||
LOG_INFO("Browser scenario load: loading park");
|
||||
GetContext()->LoadParkFromFile(path, false, true);
|
||||
LOG_INFO("Browser scenario load: park loaded");
|
||||
GameLoadScripts();
|
||||
GameNotifyMapChanged();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user