Replace yaz0 with orthrus, automatically [de]compress.

This commit is contained in:
Cuyler36
2024-07-01 18:10:34 -04:00
parent 2274c005df
commit c8af224c66
8 changed files with 36 additions and 24 deletions
+1
View File
@@ -13,6 +13,7 @@ dump/*
*.arc
*.ctx
ctx.*
!tools/orthrus.exe
build.ninja
ac-decomp.code-workspace
assets/
+20 -24
View File
@@ -17,41 +17,37 @@ Use `--recursive` when cloning to have ppcdis in the repository.
### Docker
1. [Dump a copy of the game](./docs/extract_game.md) and extract **main.dol** and **foresta.rel.szs**.
2. Decompress **foresta.rel.szs** with yaz0 found in *tools/* (`yaz0 -d foresta.rel.szs foresta.rel`).
3. Place **main.dol** and **foresta.rel** in *dump/*.
4. Place **forest_1st.arc** and **forest_2nd.arc** in *dump/*.
5. Download the [CodeWarrior 1.3.2 and 1.2.5n compilers](https://files.decomp.dev/compilers_20230715.zip) and extract them to *tools/1.3.2/* and *tools/1.2.5n/*, respectively.
6. Download the [CodeWarrior 1.3.2r compiler](https://mega.nz/file/WuBFTCLT#TmB5R4-1mEFkk4G1Vjn9_cHXRD9wOIH9CtOLaVSWEas) and extract it to *tools/1.3.2r/*.
7. Install Docker.
8. Build the Docker image (`docker build -t ac-decomp .`).
9. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`).
10. Run build.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 build.py`).
1. [Dump a copy of the game](./docs/extract_game.md) and extract all files.
2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*.
3. Download the [CodeWarrior 1.3.2 and 1.2.5n compilers](https://files.decomp.dev/compilers_20230715.zip) and extract them to *tools/1.3.2/* and *tools/1.2.5n/*, respectively.
4. Download the [CodeWarrior 1.3.2r compiler](https://mega.nz/file/WuBFTCLT#TmB5R4-1mEFkk4G1Vjn9_cHXRD9wOIH9CtOLaVSWEas) and extract it to *tools/1.3.2r/*.
5. Install Docker.
6. Build the Docker image (`docker build -t ac-decomp .`).
7. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`).
8. Run build.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 build.py`).
### Build manually
> ️ When building manually from a work directory originally used for Docker, you will need to run `sudo ninja -t clean` for the build to execute properly.
1. [Dump a copy of the game](./docs/extract_game.md) and extract **main.dol** and **foresta.rel.szs**.
2. Decompress **foresta.rel.szs** with yaz0 found in *tools/* (`yaz0 -d foresta.rel.szs foresta.rel`).
3. Place **main.dol** and **foresta.rel** in *dump/*.
4. Place **forest_1st.arc** and **forest_2nd.arc** in *dump/*.
5. Download the [CodeWarrior 1.3.2 and 1.2.5n compilers](https://files.decomp.dev/compilers_20230715.zip) and extract them to *tools/1.3.2/* and *tools/1.2.5n/*, respectively.
6. Download the [CodeWarrior 1.3.2r compiler](https://mega.nz/file/WuBFTCLT#TmB5R4-1mEFkk4G1Vjn9_cHXRD9wOIH9CtOLaVSWEas) and extract it to *tools/1.3.2r/*.
7. Install Python, pip, and [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages#package-managers) using your package manager of choice.
8. Install Python modules from requirements.txt (`pip install -r requirements.txt`).
9. Install [wibo](https://github.com/decompals/wibo)
1. [Dump a copy of the game](./docs/extract_game.md) and extract all files.
2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*.
3. Download the [CodeWarrior 1.3.2 and 1.2.5n compilers](https://files.decomp.dev/compilers_20230715.zip) and extract them to *tools/1.3.2/* and *tools/1.2.5n/*, respectively.
4. Download the [CodeWarrior 1.3.2r compiler](https://mega.nz/file/WuBFTCLT#TmB5R4-1mEFkk4G1Vjn9_cHXRD9wOIH9CtOLaVSWEas) and extract it to *tools/1.3.2r/*.
5. Install Python, pip, and [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages#package-managers) using your package manager of choice.
6. Install Python modules from requirements.txt (`pip install -r requirements.txt`).
7. Install [wibo](https://github.com/decompals/wibo)
- Wibo is a lightweight Wine replacement that's tailor-made for use with decomp projects. Regular Wine can be used if preferred, but for the purposes of this guide, these instructions will use wibo.
- Download [the latest GitHub release](https://github.com/decompals/wibo/releases/latest) and run `install ./wibo /usr/bin` to install it to your system.
10. Install devkitPPC.
8. Install devkitPPC.
- To get devkitPPC, you'll need [devkitPro Pacman](https://devkitpro.org/wiki/devkitPro_pacman#Installing_devkitPro_Pacman).
- Run `dkp-pacman -S devkitPPC` once dkp-pacman is installed to install devkitPPC.
- Set the `DEVKITPPC` environment variable to */opt/devkitpro/devkitPPC*.
11. Set the `N64_SDK` environment variable to the path of your libultra or equivalent headers. If you need headers, you can use the ones from [ultralib](https://github.com/decompals/ultralib).
9. Set the `N64_SDK` environment variable to the path of your libultra or equivalent headers. If you need headers, you can use the ones from [ultralib](https://github.com/decompals/ultralib).
- Headers should be located at `$N64_SDK/ultra/usr/include`.
- You may need to modify `Gpopmtx`'s `param` member to be `unsigned int` in **gbi.h**.
12. Run `python3 configure.py`.
13. Run `python3 build.py`.
- You must modify `Gpopmtx`'s `param` member to be `unsigned int` in **gbi.h**.
10. Run `python3 configure.py`.
11. Run `python3 build.py`.
## Quick Guides
- [Dumping Game Files](./docs/extract_game.md)
+5
View File
@@ -209,6 +209,7 @@ FORCEFILESGEN = f"{PYTHON} {PPCDIS}/forcefilesgen.py"
TOOLS = "tools"
CODEWARRIOR = os.path.join(TOOLS, "1.3.2")
CODEWARRIOR_RODATA_POOL_FIX = os.path.join(TOOLS, "1.3.2r")
ORTHRUS = os.path.join(TOOLS, "orthrus")
SDK_CW = os.path.join(TOOLS, "1.2.5n")
CC = os.path.join(CODEWARRIOR, "mwcceppc.exe")
CC_R = os.path.join(CODEWARRIOR_RODATA_POOL_FIX, "mwcceppc.exe")
@@ -219,6 +220,8 @@ if platform != "win32":
CC_R = f"wibo {CC_R}"
OCC = f"wibo {OCC}"
LD = f"wibo {LD}"
else:
ORTHRUS = os.path.join(TOOLS, "orthrus.exe")
# DevkitPPC
DEVKITPPC = os.environ.get("DEVKITPPC")
@@ -255,6 +258,7 @@ REL_DISASM_OVERRIDES = f"{CONFIG}/rel_disasm_overrides.yml"
# Binaries
DOL = f"{ORIG}/static.dol" # read in python code
REL = f"{ORIG}/foresta.rel" # read in python code
REL_SZS = f"{ORIG}/foresta.rel.szs"
DOL_YML = f"{CONFIG}/dol.yml"
REL_YML = f"{CONFIG}/rel.yml"
DOL_SHA = f"{ORIG}/static.dol.sha1"
@@ -288,6 +292,7 @@ DOL_ELF = f"{BUILDDIR}/static.elf"
REL_PLF = f"{BUILDDIR}/foresta.plf"
DOL_OUT = f"{OUTDIR}/static.dol"
REL_OUT = f"{OUTDIR}/foresta.rel"
REL_SZS_OUT = f"{OUTDIR}/foresta.rel.szs"
DOL_MAP = f"{OUTDIR}/static.map"
REL_MAP = f"{OUTDIR}/foresta.map"
+10
View File
@@ -11,6 +11,7 @@ import pickle
import re
from io import StringIO
import subprocess
from sys import executable as PYTHON, platform
from typing import List, Tuple
from ninja_syntax import Writer
@@ -30,6 +31,10 @@ assert os.path.exists("tools/1.3.2/mwcceppc.exe") and \
os.path.exists("tools/1.2.5n/mwcceppc.exe"), \
"Error: Codewarrior not found!"
# Check if foresta.rel.szs exists but not foresta.rel, and if so, decompress
if not os.path.exists(c.REL) and os.path.exists(c.REL_SZS):
subprocess.call([f'./{c.ORTHRUS}', 'ncompress', 'yaz0', '-d', c.REL_SZS, c.REL])
# Check binaries were added
assert os.path.exists(c.DOL) and os.path.exists(c.REL), \
"Error: Base binaries not found!"
@@ -905,6 +910,11 @@ n.build(
inputs = c.REL_SHA,
implicit = [c.REL_OUT]
)
# Compress foresta.rel
if os.path.exists(c.REL_OUT):
subprocess.call([f'./{c.ORTHRUS}', 'ncompress', 'yaz0', '-c', c.REL_OUT, c.REL_SZS_OUT])
n.default(c.REL_OK)
# Optional full binary disassembly
Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.