Merge pull request #368 from Cuyler36/add_orthrus

Replace yaz0 with orthrus, automatically [de]compress.
This commit is contained in:
Cuyler36
2024-07-03 22:52:49 -04:00
committed by GitHub
9 changed files with 36 additions and 25 deletions
+1
View File
@@ -13,6 +13,7 @@ dump/*
*.arc
*.ctx
ctx.*
!tools/orthrus.exe
build.ninja
ac-decomp.code-workspace
assets/
+19 -25
View File
@@ -17,41 +17,35 @@ 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, 1.3.2r, and 1.2.5n compilers](https://files.decomp.dev/compilers_latest.zip) and extract them to *tools/1.3.2/*, *tools/1.3.2r/*, and *tools/1.2.5n/*, respectively.
4. Install Docker.
5. Build the Docker image (`docker build -t ac-decomp .`).
6. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`).
7. 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, 1.3.2r, and 1.2.5n compilers](https://files.decomp.dev/compilers_latest.zip) and extract them to *tools/1.3.2/*, *tools/1.3.2r/*, and *tools/1.2.5n/*, respectively.
4. Install Python, pip, and [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages#package-managers) using your package manager of choice.
5. Install Python modules from requirements.txt (`pip install -r requirements.txt`).
6. Install version 0.6.13 of [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.
- Download [version 0.6.13 GitHub release](https://github.com/decompals/wibo/releases/tag/0.6.13) and run `install ./wibo /usr/bin` to install it to your system.
7. 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).
8. 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**.
9. Run `python3 configure.py`.
10. Run `python3 build.py`.
## Quick Guides
- [Dumping Game Files](./docs/extract_game.md)
+10
View File
@@ -3,6 +3,7 @@ import sys
import os
import hashlib
import argparse
import common as c
# List of Ninja build targets
NINJA_BUILD_TARGETS = [ ['src/data/bin1', 'out/forest_1st.arc', 'dump/forest_1st.arc'], ['src/data/bin2', 'out/forest_2nd.arc', 'dump/forest_2nd.arc'] ]
@@ -92,10 +93,19 @@ if __name__ == "__main__":
else:
print(f"No changes in {target[0]}, skipping build.")
try:
# 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):
print("Decompressing foresta.rel.szs to foresta.rel")
subprocess.call([f'./{c.ORTHRUS}', 'ncompress', 'yaz0', '-d', c.REL_SZS, c.REL])
if args.v:
subprocess.run(['ninja', '-v'], check=True)
else:
subprocess.run(['ninja'], check=True)
# Compress foresta.rel
if os.path.exists(c.REL_OUT):
print("Compressing foresta.rel to foresta.rel.szs")
subprocess.call([f'./{c.ORTHRUS}', 'ncompress', 'yaz0', '-c', c.REL_OUT, c.REL_SZS_OUT])
except subprocess.CalledProcessError as e:
print(f"Error running Ninja build")
sys.exit(1)
+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"
+1
View File
@@ -905,6 +905,7 @@ n.build(
inputs = c.REL_SHA,
implicit = [c.REL_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.