build: offload binary assets to TRX-data

This commit is contained in:
Marcin Kurczewski 2025-04-22 10:34:36 +02:00
parent b912917d81
commit 953f30205e
63 changed files with 119 additions and 727 deletions

View file

@ -32,6 +32,10 @@ jobs:
name: Prepare variables name: Prepare variables
run: echo "version=$(just output-current-version 1)" >> $GITHUB_OUTPUT run: echo "version=$(just output-current-version 1)" >> $GITHUB_OUTPUT
- name: Download large assets
if: ${{ inputs.target == 'release' }}
run: just download-assets 1
- name: Package asset (${{ inputs.platform }}) - name: Package asset (${{ inputs.platform }})
run: just tr1-package-${{ inputs.platform }} ${{ inputs.target }} run: just tr1-package-${{ inputs.platform }} ${{ inputs.target }}

View file

@ -32,6 +32,10 @@ jobs:
name: Prepare variables name: Prepare variables
run: echo "version=$(just output-current-version 2)" >> $GITHUB_OUTPUT run: echo "version=$(just output-current-version 2)" >> $GITHUB_OUTPUT
- name: Download large assets
if: ${{ inputs.target == 'release' }}
run: just download-assets 2
- name: Package asset (${{ inputs.platform }}) - name: Package asset (${{ inputs.platform }})
run: just tr2-package-${{ inputs.platform }} ${{ inputs.target }} run: just tr2-package-${{ inputs.platform }} ${{ inputs.target }}

4
.gitignore vendored
View file

@ -35,3 +35,7 @@ Release/
**/subprojects/dwarfstack-*/ **/subprojects/dwarfstack-*/
src/tr1/subprojects/dwarfstack.wrap src/tr1/subprojects/dwarfstack.wrap
src/tr2/subprojects/dwarfstack.wrap src/tr2/subprojects/dwarfstack.wrap
data/tr1/ship/data/images/
data/tr2/ship/data/images/
data/tr2/ship/music/

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 689 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

View file

@ -371,6 +371,16 @@ less like this (click to expand):
</pre> </pre>
</details> </details>
## Dev snapshots
To ease the load on our infrastructure, the binary assets such as images and music files are not included in pre-releases and pull request preview builds - they only ship with the full release builds.
However, you can easily download them manually from these urls:
- https://lostartefacts.dev/aux/tr1x/main.zip (main assets)
- https://lostartefacts.dev/aux/tr1x/music.zip (music files)
- https://lostartefacts.dev/aux/tr1x/trub-music.zip (TR: Unfinished Business expansion pack with fan-patched music)
- https://lostartefacts.dev/aux/tr1x/trub-vanilla.zip (TR: Unfinished Business expansion pack in its original form)
## Improvements over original game ## Improvements over original game
Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for details. Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for details.

View file

@ -156,6 +156,15 @@ as Notepad.
4. Find TR2X in your Applications folder. Right-click it and click "Show Package Contents". 4. Find TR2X in your Applications folder. Right-click it and click "Show Package Contents".
5. Copy your Tomb Raider 2 game data files into `Contents/Resources`. 5. Copy your Tomb Raider 2 game data files into `Contents/Resources`.
## Dev snapshots
To ease the load on our infrastructure, the binary assets such as images and music files are not included in pre-releases and pull request preview builds - they only ship with the full release builds.
However, you can easily download them manually from these urls:
- https://lostartefacts.dev/aux/tr2x/main.zip (main assets)
- https://lostartefacts.dev/aux/tr2x/music.zip (music files)
- https://lostartefacts.dev/aux/tr2x/trgm.zip (TR: The Golden Mask expansion pack)
## Improvements over original game ## Improvements over original game
#### UI #### UI

View file

@ -49,6 +49,9 @@ push-image-win: (image-win "0") (_docker_push "rrdash/trx-win")
import "justfile.tr1" import "justfile.tr1"
import "justfile.tr2" import "justfile.tr2"
download-assets tr_version='all':
tools/download_assets {{tr_version}}
output-release-name tr_version: output-release-name tr_version:
tools/output_release_name {{tr_version}} tools/output_release_name {{tr_version}}

View file

@ -24,6 +24,8 @@ def filter_files(
files: Iterable[Path], ignored_patterns: list[str] | None, debug: bool files: Iterable[Path], ignored_patterns: list[str] | None, debug: bool
) -> Iterable[Path]: ) -> Iterable[Path]:
for path in files: for path in files:
if not path.exists():
continue
if path.is_dir(): if path.is_dir():
continue continue
if is_binary_file(path): if is_binary_file(path):

83
tools/download_assets Executable file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env python3
import argparse
import shutil
import sys
import tempfile
from pathlib import Path
from urllib.request import Request, urlopen
from zipfile import ZipFile
from shared.paths import PROJECT_PATHS
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description=(
"Downloads large binary assets into local "
"data/*/ship/ directories."
)
)
parser.add_argument(
"game_version", choices=["1", "2", "all"], default="all", nargs="?"
)
return parser.parse_args()
def download_to_file(url: str, path: Path) -> None:
print(f"Downloading {url}...")
req = Request(url, headers={"User-Agent": "download_assets"})
with urlopen(req) as response:
if getattr(response, "status", None) not in (None, 200):
sys.exit(
f"Error: failed to download {url}. Status: {response.status}"
)
with path.open("wb") as f:
shutil.copyfileobj(response, f)
def extract_zip(zip_path: Path, dest_dir: Path) -> None:
print(f"Extracting {zip_path} to {dest_dir}...")
dest_dir.mkdir(parents=True, exist_ok=True)
with ZipFile(zip_path) as z:
z.extractall(dest_dir)
def download_assets(assets: list[tuple[str, Path]]) -> None:
with tempfile.TemporaryDirectory() as tmpdir_str:
tmpdir = Path(tmpdir_str)
for url, dest in assets:
filename = Path(url).name
local_zip = tmpdir / filename
download_to_file(url, local_zip)
extract_zip(local_zip, dest)
print("Asset download and extraction complete.")
def main() -> None:
args = parse_args()
assets: dict[int, list[tuple[str, Path]]] = {
1: [
(
"https://lostartefacts.dev/aux/tr1x/main.zip",
Path("data/tr1/ship"),
)
],
2: [
(
"https://lostartefacts.dev/aux/tr2x/main.zip",
Path("data/tr2/ship"),
)
],
}
match str(args.game_version):
case "1":
download_assets(assets[1])
case "2":
download_assets(assets[2])
case "all":
download_assets(assets[1])
download_assets(assets[2])
if __name__ == "__main__":
main()