forked from rosebudai/OpenRCT2-Web
Make browser build playable and serve it from Ceph S3
This commit is contained in:
1 parent
e318fec283
commit
1634a4b3ca
22 files changed
+332
-14
No files matched your search
@@ -327,3 +327,10 @@ discord-rpc
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Local browser bundles and purchased game data
|
||||
assets.zip
|
||||
assets-*.zip
|
||||
rct2-content.zip
|
||||
web-assets/
|
||||
web-assets-v0431/
|
||||
@@ -344,6 +344,10 @@ else ()
|
||||
# Compiler flags
|
||||
set(DEBUG_LEVEL 0 CACHE STRING "Select debug level for compilation. Use value in range 0–3.")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstrict-aliasing -Werror -Wundef -Wmissing-declarations -Winit-self -Wall -Wextra -Wshadow")
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "16")
|
||||
OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
|
||||
endif ()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas -Wno-missing-braces -Wno-comment -Wnonnull -Wno-unused-parameter -Wno-attributes")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG=${DEBUG_LEVEL}")
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# OpenRCT2 browser deployment
|
||||
|
||||
This deployment serves the locally built browser files from the homelab Ceph
|
||||
object gateway. Traefik supplies HTTPS and the response headers needed by the
|
||||
WebAssembly thread build. There is no game container or CI pipeline.
|
||||
|
||||
## Rebuild on the laptop
|
||||
|
||||
The Emscripten build uses the fork's pinned build container and the browser
|
||||
page in `rosebud/static`:
|
||||
|
||||
```sh
|
||||
./rosebud/docker/clone-deps.sh
|
||||
podman build -t openrct2-emscripten-local -f rosebud/docker/Dockerfile rosebud/docker
|
||||
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
|
||||
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
|
||||
(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_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.
|
||||
|
||||
## 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/`.
|
||||
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`.
|
||||
3. Run `./deploy/publish.sh` from the repository. It reads the Rook-generated
|
||||
credentials into environment variables for `rclone`, creates the
|
||||
`openrct2-web` bucket, dry-runs and performs `rclone sync`, and applies a
|
||||
public-read policy. It does not write credentials into the repository or
|
||||
rclone configuration.
|
||||
4. Apply the route with `kubectl apply -f deploy/route.yaml`. ExternalDNS
|
||||
creates the `rct.brunner.ninja` DNS record. Open
|
||||
`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.
|
||||
Do not commit it, `assets.zip`, or generated `build/` and `dist/` folders.
|
||||
|
||||
For a later update, rebuild locally and rerun `deploy/publish.sh` before
|
||||
reapplying the route only if its configuration changed. `rclone sync` deletes
|
||||
objects that no longer appear in `build/www/`; review its dry run output.
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "ReadGameFiles",
|
||||
"Effect": "Allow",
|
||||
"Principal": "*",
|
||||
"Action": "s3:GetObject",
|
||||
"Resource": "arn:aws:s3:::openrct2-web/*"
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
site_dir="$repo_root/build/www"
|
||||
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
|
||||
echo "Missing browser build or game resources in $site_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(kubectl config current-context)" != "kubernetes-admin@kubernetes" ]]; then
|
||||
echo "Expected homelab Kubernetes context" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export RCLONE_CONFIG_RCT_TYPE=s3
|
||||
export RCLONE_CONFIG_RCT_PROVIDER=Ceph
|
||||
export RCLONE_CONFIG_RCT_ENV_AUTH=false
|
||||
export RCLONE_CONFIG_RCT_ENDPOINT="$endpoint"
|
||||
export RCLONE_CONFIG_RCT_ACCESS_KEY_ID
|
||||
export RCLONE_CONFIG_RCT_SECRET_ACCESS_KEY
|
||||
RCLONE_CONFIG_RCT_ACCESS_KEY_ID="$(kubectl -n rook-ceph get secret "$secret" -o go-template='{{index .data "AccessKey"}}' | base64 -d)"
|
||||
RCLONE_CONFIG_RCT_SECRET_ACCESS_KEY="$(kubectl -n rook-ceph get secret "$secret" -o go-template='{{index .data "SecretKey"}}' | base64 -d)"
|
||||
|
||||
export AWS_ACCESS_KEY_ID="$RCLONE_CONFIG_RCT_ACCESS_KEY_ID"
|
||||
export AWS_SECRET_ACCESS_KEY="$RCLONE_CONFIG_RCT_SECRET_ACCESS_KEY"
|
||||
export AWS_DEFAULT_REGION=us-east-1
|
||||
|
||||
rclone mkdir "rct:$bucket"
|
||||
rclone sync --dry-run "$site_dir/" "rct:$bucket/"
|
||||
rclone sync --progress "$site_dir/" "rct:$bucket/"
|
||||
aws --endpoint-url "$endpoint" s3api put-bucket-policy \
|
||||
--bucket "$bucket" \
|
||||
--policy "file://$repo_root/deploy/bucket-policy.json"
|
||||
|
||||
echo "Published $(rclone lsf "rct:$bucket/" | wc -l) top-level files to $bucket"
|
||||
@@ -0,0 +1,64 @@
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: openrct2-index
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
replacePath:
|
||||
path: /openrct2-web/index.html
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: openrct2-files
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
addPrefix:
|
||||
prefix: /openrct2-web
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: openrct2-browser-headers
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
headers:
|
||||
customResponseHeaders:
|
||||
Cross-Origin-Opener-Policy: same-origin
|
||||
Cross-Origin-Embedder-Policy: require-corp
|
||||
Cross-Origin-Resource-Policy: cross-origin
|
||||
Cache-Control: no-cache
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: openrct2
|
||||
namespace: rook-ceph
|
||||
annotations:
|
||||
external-dns.brunner.ninja/enabled: "true"
|
||||
external-dns.kubernetes.io/target: brunner.ninja
|
||||
spec:
|
||||
entryPoints:
|
||||
- websecure
|
||||
routes:
|
||||
- kind: Rule
|
||||
match: Host(`rct.brunner.ninja`) && Path(`/`)
|
||||
priority: 100
|
||||
middlewares:
|
||||
- name: openrct2-index
|
||||
- name: openrct2-browser-headers
|
||||
services:
|
||||
- name: rook-ceph-rgw-my-store
|
||||
port: 80
|
||||
passHostHeader: false
|
||||
- kind: Rule
|
||||
match: Host(`rct.brunner.ninja`) && PathPrefix(`/`)
|
||||
priority: 10
|
||||
middlewares:
|
||||
- name: openrct2-files
|
||||
- name: openrct2-browser-headers
|
||||
services:
|
||||
- name: rook-ceph-rgw-my-store
|
||||
port: 80
|
||||
passHostHeader: false
|
||||
tls: {}
|
||||
@@ -0,0 +1,10 @@
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephObjectStoreUser
|
||||
metadata:
|
||||
name: openrct2-publisher
|
||||
namespace: rook-ceph
|
||||
labels:
|
||||
app.kubernetes.io/name: openrct2-web
|
||||
spec:
|
||||
store: my-store
|
||||
displayName: OpenRCT2 web publisher
|
||||
+5
-2
@@ -258,8 +258,11 @@ var EmscriptenDeps = {
|
||||
GetLocaleCurrencyCode: () => {
|
||||
// There is no way to get this directly from javascript! Assume based off of user country
|
||||
const localeToCurrencyMap = {AD:"EUR",AE:"AED",AF:"AFN",AG:"XCD",AI:"XCD",AL:"ALL",AM:"AMD",AN:"ANG",AO:"AOA",AQ:"USD",AR:"ARS",AS:"USD",AT:"EUR",AU:"AUD",AW:"AWG",AX:"EUR",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BF:"XOF",BG:"BGN",BH:"BHD",BI:"BIF",BJ:"XOF",BL:"EUR",BM:"BMD",BN:"BND",BO:"BOB",BQ:"USD",BR:"BRL",BS:"BSD",BT:"BTN",BV:"NOK",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CC:"AUD",CD:"CDF",CF:"XAF",CG:"XAF",CH:"CHF",CI:"XOF",CK:"NZD",CL:"CLP",CM:"XAF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CW:"ANG",CX:"AUD",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DM:"XCD",DO:"DOP",DZ:"DZD",EC:"USD",EE:"EUR",EG:"EGP",EH:"MAD",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FM:"USD",FO:"DKK",FR:"EUR",GA:"XAF",GB:"GBP",GD:"XCD",GE:"GEL",GF:"EUR",GG:"GBP",GH:"GHS",GI:"GIP",GL:"DKK",GM:"GMD",GN:"GNF",GP:"EUR",GQ:"XAF",GR:"EUR",GS:"FKP",GT:"GTQ",GU:"USD",GW:"XOF",GY:"GYD",HK:"HKD",HM:"AUD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IM:"GBP",IN:"INR",IO:"USD",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JE:"GBP",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KI:"AUD",KM:"KMF",KN:"XCD",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LC:"XCD",LI:"CHF",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MF:"EUR",MG:"MGA",MH:"USD",MK:"MKD",ML:"XOF",MM:"MMK",MN:"MNT",MO:"MOP",MP:"USD",MQ:"EUR",MR:"MRU",MS:"XCD",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NC:"XPF",NE:"XOF",NF:"AUD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NR:"AUD",NU:"NZD",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PF:"XPF",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PM:"EUR",PN:"NZD",PR:"USD",PS:"ILS",PT:"EUR",PW:"USD",PY:"PYG",QA:"QAR",RE:"EUR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SJ:"NOK",SK:"EUR",SL:"SLE",SM:"EUR",SN:"XOF",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"USD",SX:"ANG",SY:"SYP",SZ:"SZL",TC:"USD",TD:"XAF",TF:"EUR",TG:"XOF",TH:"THB",TJ:"TJS",TK:"NZD",TL:"USD",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TV:"AUD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",UM:"USD",US:"USD",UY:"UYU",UZ:"UZS",VA:"EUR",VC:"XCD",VE:"VED",VG:"USD",VI:"USD",VN:"VND",VU:"VUV",WF:"XPF",WS:"WST",XK:"EUR",YE:"YER",YT:"EUR",ZA:"ZAR",ZM:"ZMW",ZW:"ZWG"};
|
||||
const country = Intl.DateTimeFormat().resolvedOptions().locale.split("-").pop();
|
||||
const code = localeToCurrencyMap[country];
|
||||
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
|
||||
const country = new Intl.Locale(locale).region;
|
||||
// Language-only locales (such as "en") have no country, so the lookup
|
||||
// must always supply a valid string to Emscripten's UTF-8 conversion.
|
||||
const code = localeToCurrencyMap[country] || "USD";
|
||||
return stringToNewUTF8(code);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,8 @@ RUN dnf update -y && dnf install -y \
|
||||
bzip2-devel \
|
||||
ccache \
|
||||
cmake \
|
||||
diffutils \
|
||||
gcc-c++ \
|
||||
git \
|
||||
json-devel \
|
||||
libicu-devel \
|
||||
|
||||
@@ -10,12 +10,20 @@ cd $START_DIR
|
||||
|
||||
cd speexdsp
|
||||
emmake ./autogen.sh
|
||||
emmake ./configure --enable-shared --disable-neon
|
||||
emmake ./configure --host=wasm32-unknown-emscripten --enable-shared --disable-neon
|
||||
emmake make -j$(nproc)
|
||||
cd $START_DIR
|
||||
|
||||
mkdir -p icu-native
|
||||
cd icu-native
|
||||
../icu/icu4c/source/configure --enable-release --disable-tests --disable-samples --disable-extras --disable-layoutex
|
||||
make -j"$(nproc)"
|
||||
cd $START_DIR
|
||||
|
||||
cd icu/icu4c/source
|
||||
ac_cv_namespace_ok=yes icu_cv_host_frag=mh-linux emmake ./configure \
|
||||
--host=wasm32-unknown-emscripten \
|
||||
--with-cross-build=/ext/icu-native \
|
||||
--enable-release \
|
||||
--enable-shared \
|
||||
--disable-icu-config \
|
||||
@@ -25,7 +33,9 @@ ac_cv_namespace_ok=yes icu_cv_host_frag=mh-linux emmake ./configure \
|
||||
--disable-tools \
|
||||
--disable-tests \
|
||||
--disable-samples
|
||||
emmake make -j$(nproc)
|
||||
mkdir -p lib
|
||||
emmake make -C stubdata -j"$(nproc)"
|
||||
emmake make -C common -j"$(nproc)"
|
||||
cd $START_DIR
|
||||
|
||||
cd zlib
|
||||
|
||||
@@ -12,6 +12,7 @@ class CrossOriginIsolatedHandler(SimpleHTTPRequestHandler):
|
||||
self.send_header("Cross-Origin-Opener-Policy", "same-origin")
|
||||
self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
|
||||
self.send_header("Cross-Origin-Resource-Policy", "cross-origin")
|
||||
self.send_header("Cache-Control", "no-cache")
|
||||
super().end_headers()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
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.
|
||||
@@ -2,8 +2,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenRCT2</title>
|
||||
<link rel="icon" href="data:,">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<script src="https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js" crossorigin=anonymous></script>
|
||||
<script src="jszip.min.js"></script>
|
||||
<style>
|
||||
* { padding: 0; margin: 0; }
|
||||
body {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
let assets;
|
||||
try
|
||||
{
|
||||
let req = await fetch("openrct2.zip");
|
||||
let req = await fetch("openrct2.zip", { cache: "no-store" });
|
||||
if (!req.ok) {
|
||||
throw new Error("Response is not ok!")
|
||||
}
|
||||
@@ -101,10 +101,12 @@
|
||||
Module.FS.mount(Module.FS.filesystems.IDBFS, {autoPersist: true}, '/persistent');
|
||||
|
||||
Module.FS.mkdir("/RCT");
|
||||
Module.FS.mount(Module.FS.filesystems.IDBFS, {autoPersist: true}, '/RCT');
|
||||
// The original RCT files are bundled locally. Persisting hundreds of
|
||||
// megabytes through IDBFS stalls the renderer after startup.
|
||||
|
||||
Module.FS.mkdir("/OpenRCT2");
|
||||
Module.FS.mount(Module.FS.filesystems.IDBFS, {autoPersist: true}, '/OpenRCT2');
|
||||
// Engine assets are supplied by assets.zip. Keep them out of IDBFS too;
|
||||
// only the small /persistent user directory needs browser storage.
|
||||
|
||||
await new Promise(res => Module.FS.syncfs(true, res));
|
||||
|
||||
@@ -117,9 +119,8 @@
|
||||
|
||||
let changelog = "";
|
||||
try {
|
||||
const request = await fetch("https://api.github.com/repos/OpenRCT2/OpenRCT2/releases/latest");
|
||||
const json = JSON.parse(await request.text());
|
||||
changelog = json.body;
|
||||
const request = await fetch("changelog.txt");
|
||||
if (request.ok) changelog = await request.text();
|
||||
} catch(e) {
|
||||
console.log("Failed to fetch changelog with error:", e);
|
||||
}
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
/*!
|
||||
|
||||
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
|
||||
<http://stuartk.com/jszip>
|
||||
|
||||
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
||||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
||||
|
||||
JSZip uses the library pako released under the MIT license :
|
||||
https://github.com/nodeca/pako/blob/main/LICENSE
|
||||
*/
|
||||
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=e()}}(function(){return function s(a,o,h){function u(r,e){if(!o[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return u(t||e)},i,i.exports,s,a,o,h)}return o[r].exports}for(var l="function"==typeof require&&require,e=0;e<h.length;e++)u(h[e]);return u}({1:[function(e,t,r){"use strict";var d=e("./utils"),c=e("./support"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,i,s,a,o,h=[],u=0,l=e.length,f=l,c="string"!==d.getTypeOf(e);u<e.length;)f=l-u,n=c?(t=e[u++],r=u<l?e[u++]:0,u<l?e[u++]:0):(t=e.charCodeAt(u++),r=u<l?e.charCodeAt(u++):0,u<l?e.charCodeAt(u++):0),i=t>>2,s=(3&t)<<4|r>>4,a=1<f?(15&r)<<2|n>>6:64,o=2<f?63&n:64,h.push(p.charAt(i)+p.charAt(s)+p.charAt(a)+p.charAt(o));return h.join("")},r.decode=function(e){var t,r,n,i,s,a,o=0,h=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var l,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===p.charAt(64)&&f--,e.charAt(e.length-2)===p.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=c.uint8array?new Uint8Array(0|f):new Array(0|f);o<e.length;)t=p.indexOf(e.charAt(o++))<<2|(i=p.indexOf(e.charAt(o++)))>>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),l[h++]=t,64!==s&&(l[h++]=r),64!==a&&(l[h++]=n);return l}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),a=e("./stream/GenericWorker"),o=n?"uint8array":"array";function h(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(Line truncated
|
||||
@@ -28,7 +28,7 @@ emcmake cmake ../ \
|
||||
-DZSTD_LIBRARIES="$ZSTD_ROOT/build/build/lib/libzstd.a" \
|
||||
-DEMSCRIPTEN_FLAGS="-s USE_SDL=2 -s USE_ZLIB=1 -s USE_BZIP2=1 -s USE_LIBPNG=1 -pthread -O3" \
|
||||
-DEMSCRIPTEN_EXPORTED_FUNCTIONS="_GetVersion,_main" \
|
||||
-DEMSCRIPTEN_LDFLAGS="-Wno-pthreads-mem-growth -s SAFE_HEAP=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s INITIAL_MEMORY=2GB -s STACK_SIZE=8388608 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s PTHREAD_POOL_SIZE=120 -pthread -s EXPORTED_RUNTIME_METHODS=ccall,FS,callMain,UTF8ToString,stringToNewUTF8 -lidbfs.js --use-preload-plugins -s MODULARIZE=1 -s 'EXPORT_NAME=\"OPENRCT2_WEB\"' -Wl,--export-if-defined=LoadGameCallback"
|
||||
-DEMSCRIPTEN_LDFLAGS="-Wno-pthreads-mem-growth -s SAFE_HEAP=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s INITIAL_MEMORY=2GB -s STACK_SIZE=8388608 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s PTHREAD_POOL_SIZE=8 -pthread -s EXPORTED_RUNTIME_METHODS=ccall,FS,callMain,UTF8ToString,stringToNewUTF8 -lidbfs.js --use-preload-plugins -s MODULARIZE=1 -s 'EXPORT_NAME=\"OPENRCT2_WEB\"' -Wl,--export-if-defined=LoadGameCallback"
|
||||
|
||||
emmake ninja
|
||||
|
||||
@@ -36,5 +36,5 @@ rm -rf www/
|
||||
mkdir -p www/
|
||||
cd www/
|
||||
cp -r ../openrct2.* ./
|
||||
cp -r ../../emscripten/static/* ./
|
||||
cp -r ../../rosebud/static/* ./
|
||||
zip -r openrct2.zip ../openrct2.*
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/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
|
||||
@@ -198,6 +198,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
_preview = {};
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// Loading scenario metadata synchronously can stall the browser's
|
||||
// main thread. The preview is optional; selection still works.
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (_highlightedScenario == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -63,8 +63,11 @@ 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();
|
||||
}
|
||||
|
||||
@@ -831,7 +831,9 @@ namespace OpenRCT2
|
||||
OpenProgress(asScenario ? STR_LOADING_SCENARIO : STR_LOADING_SAVED_GAME);
|
||||
SetProgress(0, 100, STR_STRING_M_PERCENT);
|
||||
|
||||
LOG_INFO("Browser park load: reading scenario stream");
|
||||
auto result = parkImporter->LoadFromStream(stream, info.Type == FileType::scenario, false, path.c_str());
|
||||
LOG_INFO("Browser park load: scenario stream read");
|
||||
SetProgress(10, 100, STR_STRING_M_PERCENT);
|
||||
|
||||
// From this point onwards the currently loaded park will be corrupted if loading fails
|
||||
@@ -839,13 +841,17 @@ namespace OpenRCT2
|
||||
loadTitleScreenFirstOnFail = true;
|
||||
|
||||
GameUnloadScripts();
|
||||
LOG_INFO("Browser park load: loading objects");
|
||||
_objectManager->LoadObjects(result.RequiredObjects, true);
|
||||
LOG_INFO("Browser park load: objects loaded");
|
||||
SetProgress(90, 100, STR_STRING_M_PERCENT);
|
||||
|
||||
MapAnimations::ClearAll();
|
||||
// TODO: Have a separate GameState and exchange once loaded.
|
||||
auto& gameState = ::getGameState();
|
||||
LOG_INFO("Browser park load: importing park");
|
||||
parkImporter->Import(gameState);
|
||||
LOG_INFO("Browser park load: park imported");
|
||||
SetProgress(100, 100, STR_STRING_M_PERCENT);
|
||||
|
||||
// Reset viewport rendering inhibition
|
||||
@@ -881,7 +887,9 @@ namespace OpenRCT2
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO("Browser park load: starting scenario");
|
||||
ScenarioBegin(gameState);
|
||||
LOG_INFO("Browser park load: scenario started");
|
||||
#ifndef DISABLE_NETWORK
|
||||
if (_network.GetMode() == Network::Mode::server)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#if defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
// Object jobs read Emscripten's JavaScript filesystem. Running those jobs on
|
||||
// pthreads while the browser main thread waits for them can deadlock.
|
||||
static constexpr bool kJobPoolSingleThreaded = true;
|
||||
#else
|
||||
static constexpr bool kJobPoolSingleThreaded = false;
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
exec python3 rosebud/serve.py --port "${1:-8080}"
|
||||
Reference in new issue
Block a user