Update to latest dtk-template

This commit is contained in:
Luke Street 2024-09-04 22:03:20 -06:00
parent bc0fcbb7b3
commit 3efecd011f
7 changed files with 517 additions and 251 deletions

2
.gitattributes vendored
View File

@ -9,5 +9,5 @@
*.sh text eol=lf
*.sha1 text eol=lf
# DTK keeps these files with LF
# decomp-toolkit writes files with LF
config/**/*.txt text eol=lf

View File

@ -35,7 +35,8 @@ jobs:
run: |
python configure.py --map --version ${{ matrix.version }} \
--binutils /binutils --compilers /compilers
ninja all_source build/${{ matrix.version }}/progress.json
ninja all_source build/${{ matrix.version }}/progress.json \
build/${{ matrix.version }}/report.json
# Upload progress if we're on the main branch
- name: Upload progress
@ -55,3 +56,10 @@ jobs:
with:
name: ${{ matrix.version }}_maps
path: build/${{ matrix.version }}/**/*.MAP
# Upload progress report
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }}_report
path: build/${{ matrix.version }}/report.json

View File

@ -26,7 +26,7 @@ If you'd like to contribute, see [CONTRIBUTING.md](CONTRIBUTING.md).
Dependencies
============
Windows:
Windows
--------
On Windows, it's **highly recommended** to use native tooling. WSL or msys2 are **not** required.
@ -37,60 +37,73 @@ When running under WSL, [objdiff](#diffing) is unable to get filesystem notifica
- Download [ninja](https://github.com/ninja-build/ninja/releases) and add it to `%PATH%`.
- Quick install via pip: `pip install ninja`
macOS:
macOS
------
- Install [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages):
```
```sh
brew install ninja
```
- Install [wine-crossover](https://github.com/Gcenx/homebrew-wine):
```
```sh
brew install --cask --no-quarantine gcenx/wine/wine-crossover
```
After OS upgrades, if macOS complains about `Wine Crossover.app` being unverified, you can unquarantine it using:
```sh
sudo xattr -rd com.apple.quarantine '/Applications/Wine Crossover.app'
```
Linux:
Linux
------
- Install [ninja](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages).
- For non-x86(_64) platforms: Install wine from your package manager.
- For x86(_64), [WiBo](https://github.com/decompals/WiBo), a minimal 32-bit Windows binary wrapper, will be automatically downloaded and used.
- For x86(_64), [wibo](https://github.com/decompals/wibo), a minimal 32-bit Windows binary wrapper, will be automatically downloaded and used.
Building
========
- Clone the repository:
```
```sh
git clone https://github.com/PrimeDecomp/prime.git
```
- Update and Initialize submodules:
```
```sh
git submodule update --init --recursive
```
- Using [Dolphin Emulator](https://dolphin-emu.org/), extract your game to `orig/GM8E01_00` (or the appropriate version).
![](assets/dolphin-extract.png)
- To save space, the only necessary files are the following. Any others can be deleted.
- `sys/main.dol`
- `files/NESemuP.rel`
- Configure:
```
```sh
python configure.py
```
To use a version other than `GM8E01_00` (USA), specify `--version GM8E01_01` or similar.
- Build:
```
```sh
ninja
```
Diffing
=======
Once the initial build succeeds, an `objdiff.json` should exist in the project root.
Once the initial build succeeds, an `objdiff.json` should exist in the project root.
Download the latest release from [encounter/objdiff](https://github.com/encounter/objdiff). Under project settings, set `Project directory`. The configuration should be loaded automatically.
Download the latest release from [encounter/objdiff](https://github.com/encounter/objdiff). Under project settings, set `Project directory`. The configuration should be loaded automatically.
Select an object from the left sidebar to begin diffing. Changes to the project will rebuild automatically: changes to source files, headers, `configure.py`, `splits.txt` or `symbols.txt`.

View File

@ -16,14 +16,7 @@ import argparse
import sys
from pathlib import Path
from typing import Any, Dict, List
from tools.project import (
Object,
ProjectConfig,
calculate_progress,
generate_build,
is_windows,
)
from tools.project import *
# Game versions
DEFAULT_VERSION = 0
@ -79,11 +72,6 @@ parser.add_argument(
action="store_true",
help="generate map file(s)",
)
parser.add_argument(
"--no-asm",
action="store_true",
help="don't incorporate .s files from asm directory",
)
parser.add_argument(
"--debug",
action="store_true",
@ -102,6 +90,12 @@ parser.add_argument(
type=Path,
help="path to decomp-toolkit binary or source (optional)",
)
parser.add_argument(
"--objdiff",
metavar="BINARY | DIR",
type=Path,
help="path to objdiff-cli binary or source (optional)",
)
parser.add_argument(
"--sjiswrap",
metavar="EXE",
@ -128,6 +122,7 @@ version_num = VERSIONS.index(config.version)
# Apply arguments
config.build_dir = args.build_dir
config.dtk_path = args.dtk
config.objdiff_path = args.objdiff
config.binutils_path = args.binutils
config.compilers_path = args.compilers
config.debug = args.debug
@ -136,13 +131,15 @@ config.non_matching = args.non_matching
config.sjiswrap_path = args.sjiswrap
if not is_windows():
config.wrapper = args.wrapper
if args.no_asm:
# Don't build asm unless we're --non-matching
if not config.non_matching:
config.asm_dir = None
# Tool versions
config.binutils_tag = "2.42-1"
config.compilers_tag = "20231018"
config.dtk_tag = "v0.9.2"
config.compilers_tag = "20240706"
config.dtk_tag = "v0.9.5"
config.objdiff_tag = "v2.0.0-beta.5"
config.sjiswrap_tag = "v1.1.1"
config.wibo_tag = "0.6.11"
@ -159,7 +156,6 @@ config.asflags = [
config.ldflags = [
"-fp hardware",
"-nodefaults",
"-warn off",
]
config.progress_all = False
@ -272,7 +268,7 @@ cflags_rel = [
"-sdata 0",
"-sdata2 0",
"-str noreuse",
"-Cpp_exceptions off"
"-Cpp_exceptions off",
]
config.linker_version = "GC/1.3.2"
@ -327,9 +323,11 @@ def Rel(lib_name, objects):
}
Matching = True # Object matches and should be linked
NonMatching = False # Object does not match and should not be linked
Equivalent = config.non_matching # Object should be linked when configured with --non-matching
Matching = True # Object matches and should be linked
NonMatching = False # Object does not match and should not be linked
Equivalent = (
config.non_matching
) # Object should be linked when configured with --non-matching
config.warn_missing_config = True
config.warn_missing_source = False
@ -1338,17 +1336,23 @@ config.libs = [
Object(
Matching,
"NESemu/modwrapper.c",
),
),
],
),
]
# Optional extra categories for progress tracking
config.progress_categories = [
# ProgressCategory("game", "Game Code"),
# ProgressCategory("sdk", "SDK Code"),
]
config.progress_each_module = args.verbose
if args.mode == "configure":
# Write build.ninja and objdiff.json
generate_build(config)
elif args.mode == "progress":
# Print progress and write progress.json
config.progress_each_module = args.verbose
calculate_progress(config)
else:
sys.exit("Unknown mode: " + args.mode)

View File

@ -24,8 +24,8 @@ include_dirs = [
os.path.join(root_dir, "extern/musyx/include")
]
include_pattern = re.compile(r'^#include\s*[<"](.+?)[>"]$')
guard_pattern = re.compile(r"^#ifndef\s+(.*)$")
include_pattern = re.compile(r'^#\s*include\s*[<"](.+?)[>"]$')
guard_pattern = re.compile(r"^#\s*ifndef\s+(.*)$")
defines = set()

View File

@ -55,6 +55,21 @@ def dtk_url(tag: str) -> str:
repo = "https://github.com/encounter/decomp-toolkit"
return f"{repo}/releases/download/{tag}/dtk-{system}-{arch}{suffix}"
def objdiff_cli_url(tag: str) -> str:
uname = platform.uname()
suffix = ""
system = uname.system.lower()
if system == "darwin":
system = "macos"
elif system == "windows":
suffix = ".exe"
arch = uname.machine.lower()
if arch == "amd64":
arch = "x86_64"
repo = "https://github.com/encounter/objdiff"
return f"{repo}/releases/download/{tag}/objdiff-cli-{system}-{arch}{suffix}"
def sjiswrap_url(tag: str) -> str:
repo = "https://github.com/encounter/sjiswrap"
@ -70,6 +85,7 @@ TOOLS: Dict[str, Callable[[str], str]] = {
"binutils": binutils_url,
"compilers": compilers_url,
"dtk": dtk_url,
"objdiff-cli": objdiff_cli_url,
"sjiswrap": sjiswrap_url,
"wibo": wibo_url,
}

File diff suppressed because it is too large Load Diff