Switch build system to use ninja and dtk and support multiple versions (#127)

* Start dtk project based on oot-gc-dtk

* Add asm_processor build rules

* Encode shift-JIS strings

* Generate build for all versions at the same time

* Update diff.py for new build layout

* Implement per-version object completion

* Add ce-u and match emu files

* Fix config/ce-j/build.sha1

* Add dol-diff, dol-apply, and format scripts

* Add configure.py --non-matching

* Delete old build system

* Reorganize library files

* Make diff.py multi-version but remove target line-number support

* Update README for new build system

* Change diff.py build command to ninja

* ./dol-apply ce-u

* Recommend ./diff.py -mwo3

* Upgrade to dtk v0.8.3, use block_relocations instead of noreloc

* Mark soundGCN.c as matched
This commit is contained in:
cadmic
2024-05-20 17:27:48 -07:00
committed by GitHub
parent 84acc4a4f9
commit 65e87efb32
45 changed files with 11312 additions and 2039 deletions
+6
View File
@@ -6,14 +6,20 @@ tools/elf2dol/elf2dol
# Build artifacts
build/
build.ninja
objdiff.json
.ninja_*
*.o
*.obj
*.dol
*.elf
*.exe
*.map
# Python artifacts
__pycache__/
.venv/
.mypy_cache
# IDE artifacts
.vscode/
-175
View File
@@ -1,175 +0,0 @@
NON_MATCHING := 0
#-------------------------------------------------------------------------------
# Files
#-------------------------------------------------------------------------------
TARGET_COL := gamecube
TARGET := SIM
BUILD_DIR := build/$(TARGET)
SRC_DIRS := $(shell find src -type d)
ASM_DIRS := $(shell find asm -type d -not -path "asm/non_matchings*")
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
# Inputs
LDSCRIPT := $(BUILD_DIR)/ldscript.lcf
# Outputs
ELF := $(BUILD_DIR)/$(TARGET).elf
MAP := $(ELF:.elf=.map)
DOL := $(ELF:.elf=.dol)
COMPARE_TO := $(ELF:.elf=_S.elf)
# Object files in link order
include obj_files.mk
#-------------------------------------------------------------------------------
# Tools
#-------------------------------------------------------------------------------
MWCC_VERSION := GC/1.1
# revision build year, 2002 for MQ, 2003 for CE
DOLPHIN_REVISION := 2003
# Programs
ifeq ($(OS),Windows_NT)
WINE :=
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
WINE := wibo
else ifeq ($(UNAME_S),Darwin)
WINE := wine
else
$(error Unknown OS: $(OS))
endif
endif
PPC_BIN_PREFIX := tools/binutils/powerpc-eabi-
AS := $(PPC_BIN_PREFIX)as
OBJCOPY := $(PPC_BIN_PREFIX)objcopy
OBJDUMP := $(PPC_BIN_PREFIX)objdump
MWCC_DIR := tools/mwcc_compiler/$(MWCC_VERSION)
CC := $(WINE) $(MWCC_DIR)/mwcceppc.exe
LD := $(WINE) $(MWCC_DIR)/mwldeppc.exe
DOLPHIN_MWCC_DIR := tools/mwcc_compiler/GC/1.2.5n
DOLPHIN_CC := $(WINE) $(DOLPHIN_MWCC_DIR)/mwcceppc.exe
CC_CHECK := gcc
CC_CHECK_WARNINGS := \
-Wall \
-Wextra \
-Werror=strict-prototypes \
-Werror=implicit-function-declaration \
-Wno-cast-function-type \
-Wno-incompatible-pointer-types \
-Wno-pointer-to-int-cast \
-Wno-return-type \
-Wno-sequence-point \
-Wno-sign-compare \
-Wno-unknown-pragmas \
-Wno-unused-but-set-variable \
-Wno-unused-function \
-Wno-unused-parameter \
-Wno-unused-variable
SHA1SUM := sha1sum
PYTHON := python3
ELF2DOL := tools/elf2dol/elf2dol
ASM_PROCESSOR_DIR := tools/asm_processor
ASM_PROCESSOR := $(ASM_PROCESSOR_DIR)/compile.sh
POSTPROC := tools/postprocess.py
# Options
INCLUDES := -Iinclude -Ilibc
ASFLAGS := -mgekko -I include -I libc
LDFLAGS := -map $(MAP) -fp hardware -nodefaults -warn off
CFLAGS := -Cpp_exceptions off -proc gekko -fp hardware -fp_contract on -enum int -align powerpc -nosyspath -RTTI off -str reuse -multibyte -O4,p -sym on -nodefaults -msgstyle gcc $(INCLUDES) -DDOLPHIN_REV=$(DOLPHIN_REVISION)
INLINE_CFLAGS := -inline auto
CC_CHECK_FLAGS := -fno-builtin -fsyntax-only -std=gnu99 -I include -I libc $(CC_CHECK_WARNINGS) -DNON_MATCHING -DDOLPHIN_REV=$(DOLPHIN_REVISION)
ifneq ($(NON_MATCHING),0)
CFLAGS += -DNON_MATCHING
endif
# elf2dol needs to know these in order to calculate sbss correctly.
SDATA_PDHR := 9
SBSS_PDHR := 10
#-------------------------------------------------------------------------------
# Recipes
#-------------------------------------------------------------------------------
### Default target ###
default: all
# Compare to the checksum of a stripped original
all: $(ELF)
ifneq ($(NON_MATCHING),1)
@md5sum $(COMPARE_TO)
@md5sum -c checksum.md5
endif
setup:
# Build/download tools
$(MAKE) -C tools
# Patch linker
tools/patch_linker.sh $(MWCC_DIR)/mwldeppc.exe
# Strip debugging sections and .mwcats.text section so only the important sections remain
# Tested to ensure it doesn't crash at least on Dolphin
$(OBJCOPY) SIM_original.elf SIM.elf -R .mwcats.text -g
# Copy again to strip symbols since we don't want to diff those
$(OBJCOPY) SIM.elf SIM_S.elf -S
clean:
rm -f -d -r build
distclean:
rm -f -r SIM.elf SIM_S.elf
$(MAKE) -C tools clean
format:
find include libc src -name '*.h' -o -name '*.c' | xargs clang-format -i
# Note: this is meant for testing/modding purposes as a dol is easier to package and run than the original elf
dol: all $(DOL)
.PHONY: all setup clean format dol distclean
ALL_DIRS := build $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS))
# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)
$(ELF): $(O_FILES) ldscript.lcf
$(RM) -rf $(ASM_PROCESSOR_DIR)/tmp
$(LD) $(LDFLAGS) -o $@ -lcf ldscript.lcf $(O_FILES)
$(OBJCOPY) $(ELF) $(COMPARE_TO) -S
$(DOL): $(ELF)
$(ELF2DOL) $< $@ $(SDATA_PDHR) $(SBSS_PDHR) $(TARGET_COL)
$(BUILD_DIR)/src/dolphin/%.o: CC := $(DOLPHIN_CC)
$(BUILD_DIR)/src/emulator/%.o: INLINE_CFLAGS := -inline auto,deferred
$(BUILD_DIR)/src/emulator/THP%.o: INLINE_CFLAGS := -inline auto
$(BUILD_DIR)/src/emulator/THPRead.o: INLINE_CFLAGS := -inline auto,deferred
$(BUILD_DIR)/%.o: %.s
$(AS) $(ASFLAGS) -o $@ $<
$(BUILD_DIR)/%.o: %.c
ifneq ($(CC_CHECK),)
$(CC_CHECK) $(CC_CHECK_FLAGS) $<
endif
$(ASM_PROCESSOR) "$(CC) $(CFLAGS) $(INLINE_CFLAGS)" "$(AS) $(ASFLAGS)" $@ $<
+49 -39
View File
@@ -1,41 +1,38 @@
# oot-gc
This repo contains a WIP decompilation of the N64 Emulator ELF executable intended for use with the Gamecube releases of The Legend of Zelda Ocarina of Time. Currently the decompilation specifically targets the version shipped with the Japanese Zelda Collector's Edition disk as symbols and other debugging information was left unstripped.
A work-in-progress decompilation of the N64 emulator used in the GameCube releases of The Legend of Zelda: Ocarina of Time.
It builds the following ELF executables:
Supported versions:
SIM.elf : `md5: 64428C7350B31E0AAD3DDE221C5B18A5`
SIM_S.elf : `md5: EDDD2DED9906AD2312F7EC585B3D72CE`
- `mq-j`: Master Quest - Japan
- `mq-u`: Master Quest - North America
- `mq-e`: Master Quest - Europe/Australia
- `ce-j`: Collector's Edition - Japan
- `ce-u`: Collector's Edition - North America
- `ce-e`: Collector's Edition - Europe/Australia
SIM_S is a version of the build with stripped symbols which when diffed against a similarly stripped original matches byte for byte if assembled and linked, which is the most realistic goal for verifying the accuracy of the decompilation.
Currently the decompilation mainly targets the `ce-j` version, as the
Collector's Edition disks also contain an ELF file where symbols and other
debugging information were left unstripped.
## Building
### Requirements
You will need the following dependencies:
* gcc or clang
* make
* git
* ninja
* python3
* wibo (Linux) or wine (macOS)
* wget
* unzip
* wine (for macOS or non-x86 Linux)
* clang-format (optional)
#### Ubuntu/Debian
In order to install `wibo`, you will need to [download it](https://github.com/decompals/wibo/releases) and run:
```
sudo install wibo /usr/bin
```
You can install the dependencies with the following commands:
```
sudo apt-get update
sudo apt-get install build-essential git python3 wget unzip
sudo apt-get install git ninja python3
```
#### macOS
@@ -43,15 +40,45 @@ sudo apt-get install build-essential git python3 wget unzip
You can install dependencies via Homebrew with the following command:
```
brew install coreutils python3 wget wine
brew install git ninja python3
brew install --cask --no-quarantine gcenx/wine/wine-crossover
```
### Instructions
1. Obtain the original ELF executable found in the `120903_zelda.tgc` file on the Japanese Collector's Edition disk and place it in the base working directory and name it `SIM_original.elf`
2. Run `make setup` and `make`
1. Clone the repo using `git clone https://github.com/zeldaret/oot-gc`.
## Development
2. Extract the following TGC archive containing the N64 emulator from the disc of the version you want to build:
* `mq-j`: `zlj_f.tgc`
* `mq-u`: `zlj_f.tgc`
* `mq-e`: `zlj_f.tgc`
* `ce-j`: `120903_zelda.tgc`
* `ce-u`: `zelda_ENG_090903.tgc`
* `ce-e`: `zelda_PAL_093003.tgc`
Then, extract the DOL file from the TGC archive and place it in the repo as `orig/<version>/main.dol`.
You can use [Dolphin](https://dolphin-emu.org) to perform both of these extraction steps:
right click on the file you want to extract from, select `Properties`, and go to the `Filesystem` tab.
3. Run `python3 configure.py`.
4. Run `ninja` to build the `ce-j` version, or run `ninja <version>` to build another version.
## Development Tools
### Scripts
* `./dol-diff <version>` will run `dtk dol diff` to show the first differing symbol if the build does not match.
* `./dol-apply <version>` will run `dtk dol apply` to sync symbols (e.g. if a function was renamed in the repo).
* `./format` will format all source files with `clang-format`.
### objdiff
For local decompilation testing, start the objdiff GUI and open this directory as the project directory.
Currently `objdiff` may not work properly on files using asm-processor (i.e. files with `asm_processor=True` in `configure.py`).
### asm-differ (diff.py)
First, copy a matching build to the `expected/` directory to diff against:
@@ -60,15 +87,7 @@ mkdir expected
cp -r build expected/
```
### Diff tools
For locally diffing the current build against the expected build:
* `objdiff`: Start the objdiff GUI and open this directory as the project directory.
* `diff.py` (`asm-differ`): Run e.g. `./diff.py -mwo3 xlMain` to diff a function.
* `vbindiff`: Run `vbindiff SIM_S.elf build/SIM/SIM_S.elf` to directly diff the
ELF files to debug tricky matching issues, using the ELF section headers and
the linker map file to locate the diffs in the code.
Then run e.g. `./diff.py -mwo3 xlMain` to diff a function for `ce-j`, or e.g. `./diff.py -mwo3 xlMain -v mq-j` to diff a function for another version.
### decomp.me
@@ -92,12 +111,3 @@ correctly, for example by explicitly marking auto-inlined functions as `inline`.
The files in the `debug/` directory contain a dump of the DWARF debugging information in the original ELF. Functions marked as `// Erased`
were present at one time but have been stripped by the linker, because they were either unused or inlined at all call sites.
### Migrating a file to C
All emulator files have been migrated to C, but some SDK and standard library files are still built from the disassembly. Before decompiling
one of these files:
* In `obj_files.mk`, replace `$(BUILD_DIR)/asm/<path>.o` with `$(BUILD_DIR)/src/<path>.o` to link the new object file
* Add an entry in `objdiff.json`
* Run `cp expected/build/SIM/asm/<path>.o expected/build/SIM/src/<path>.o` to create a base to diff against
+1
View File
@@ -0,0 +1 @@
aed1c15af4d667a3cffd8621a6bb3fd08b4c3b04 build/ce-j/oot-gc.dol
+102
View File
@@ -0,0 +1,102 @@
# See config.example.yml for documentation.
name: oot-gc
object: orig/ce-j/main.dol
hash: aed1c15af4d667a3cffd8621a6bb3fd08b4c3b04
symbols: config/ce-j/symbols.txt
splits: config/ce-j/splits.txt
mw_comment_version: 8
extract:
# xlCoreGCN.c
- symbol: gTgPcTPL
header: gTgPcTPL.inc
# simGCN.c
- symbol: gcoverOpen
header: gcoverOpen.inc
- symbol: gnoDisk
header: gnoDisk.inc
- symbol: gretryErr
header: gretryErr.inc
- symbol: gfatalErr
header: gfatalErr.inc
- symbol: gwrongDisk
header: gwrongDisk.inc
- symbol: greadingDisk
header: greadingDisk.inc
- symbol: gbar
header: gbar.inc
- symbol: gyes
header: gyes.inc
- symbol: gno
header: gno.inc
- symbol: gmesgOK
header: gmesgOK.inc
block_relocations:
# systemSetupGameALL
- source: 0x8002E15C
- source: 0x8002E184
- source: 0x8002E1B0
- source: 0x8002E1D8
- source: 0x8002E234
- source: 0x8002E254
- source: 0x8002E280
- source: 0x8002E2A4
- source: 0x8002E794
- source: 0x8002E7BC
- source: 0x8002E7E4
- source: 0x8002E80C
- source: 0x8002E834
- source: 0x8002E85C
- source: 0x8002E884
- source: 0x8002E8AC
- source: 0x8002E8D4
- source: 0x8002E8F8
- source: 0x8002E91C
- source: 0x8002EC04
- source: 0x8002ED24
- source: 0x8002EE14
- source: 0x8002EE38
- source: 0x8002EE5C
- source: 0x8002EE88
- source: 0x8002EEAC
- source: 0x8002EED0
- source: 0x8002F010
- source: 0x8002F038
- source: 0x8002F060
- source: 0x8002F0A0
- source: 0x8002F0C4
- source: 0x8002F0F0
- source: 0x8002F130
- source: 0x8002F154
- source: 0x8002F180
- source: 0x8002F2EC
- source: 0x8002F314
- source: 0x8002F86C
- source: 0x8002F894
- source: 0x8002F8BC
- source: 0x8002F8E0
- source: 0x8002F908
- source: 0x8002FA94
- source: 0x8002FAFC
- source: 0x8002FB20
- source: 0x8002FB4C
- source: 0x8002FB70
- source: 0x8002FC60
- source: 0x8002FDB0
- source: 0x8002FDF8
- source: 0x8002FF2C
- source: 0x8002FF74
- source: 0x8002FF9C
# cpuFindFunction
- source: 0x800333E4
- source: 0x800333F0
- source: 0x80033B80
- source: 0x80033BB0
- source: 0x80033BB4
- source: 0x80033BE8
- source: 0x80033BFC
- source: 0x80033C3C
- source: 0x80033C40
- source: 0x80033C74
- source: 0x80033C88
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
eaec2d80639095b751c68d9371f7aac7e5c7dbc7 build/ce-u/oot-gc.dol
+102
View File
@@ -0,0 +1,102 @@
# See config.example.yml for documentation.
name: oot-gc
object: orig/ce-u/main.dol
hash: eaec2d80639095b751c68d9371f7aac7e5c7dbc7
symbols: config/ce-u/symbols.txt
splits: config/ce-u/splits.txt
mw_comment_version: 8
extract:
# xlCoreGCN.c
- symbol: gTgPcTPL
header: gTgPcTPL.inc
# simGCN.c
- symbol: gcoverOpen
header: gcoverOpen.inc
- symbol: gnoDisk
header: gnoDisk.inc
- symbol: gretryErr
header: gretryErr.inc
- symbol: gfatalErr
header: gfatalErr.inc
- symbol: gwrongDisk
header: gwrongDisk.inc
- symbol: greadingDisk
header: greadingDisk.inc
- symbol: gbar
header: gbar.inc
- symbol: gyes
header: gyes.inc
- symbol: gno
header: gno.inc
- symbol: gmesgOK
header: gmesgOK.inc
block_relocations:
# systemSetupGameALL
- source: 0x8002E168
- source: 0x8002E190
- source: 0x8002E1BC
- source: 0x8002E1E4
- source: 0x8002E240
- source: 0x8002E260
- source: 0x8002E28C
- source: 0x8002E2B0
- source: 0x8002E7A0
- source: 0x8002E7C8
- source: 0x8002E7F0
- source: 0x8002E818
- source: 0x8002E840
- source: 0x8002E868
- source: 0x8002E890
- source: 0x8002E8B8
- source: 0x8002E8E0
- source: 0x8002E904
- source: 0x8002E928
- source: 0x8002EC10
- source: 0x8002ED30
- source: 0x8002EE20
- source: 0x8002EE44
- source: 0x8002EE68
- source: 0x8002EE94
- source: 0x8002EEB8
- source: 0x8002EEDC
- source: 0x8002F01C
- source: 0x8002F044
- source: 0x8002F06C
- source: 0x8002F0AC
- source: 0x8002F0D0
- source: 0x8002F0FC
- source: 0x8002F13C
- source: 0x8002F160
- source: 0x8002F18C
- source: 0x8002F2F8
- source: 0x8002F320
- source: 0x8002F878
- source: 0x8002F8A0
- source: 0x8002F8C8
- source: 0x8002F8EC
- source: 0x8002F914
- source: 0x8002FAA0
- source: 0x8002FB08
- source: 0x8002FB2C
- source: 0x8002FB58
- source: 0x8002FB7C
- source: 0x8002FC6C
- source: 0x8002FDBC
- source: 0x8002FE04
- source: 0x8002FF38
- source: 0x8002FF80
- source: 0x8002FFA8
# cpuFindFunction
- source: 0x80033460
- source: 0x8003346C
- source: 0x80033BFC
- source: 0x80033C2C
- source: 0x80033C30
- source: 0x80033C64
- source: 0x80033C78
- source: 0x80033CB8
- source: 0x80033CBC
- source: 0x80033CF0
- source: 0x80033D04
+224
View File
@@ -0,0 +1,224 @@
Sections:
.init type:code align:32
.text type:code align:32
.ctors type:rodata align:32
.dtors type:rodata align:32
.rodata type:rodata align:32
.data type:data align:32
.bss type:bss align:32
.sdata type:data align:32
.sbss type:bss align:32
.sdata2 type:rodata align:32
emulator/xlCoreGCN.c:
.text start:0x800055A0 end:0x80005E04
.data start:0x800D37A0 end:0x800DB860
.bss start:0x800F63E0 end:0x800F64A0
.sbss start:0x80137A80 end:0x80137AA0
.sdata2 start:0x80138200 end:0x80138218
emulator/xlPostGCN.c:
.text start:0x80005E04 end:0x80005E68
emulator/xlFileGCN.c:
.text start:0x80005E68 end:0x80006280
.data start:0x800DB860 end:0x800DB880
.sdata start:0x801371E0 end:0x801371E8
.sbss start:0x80137AA0 end:0x80137AA8
emulator/xlList.c:
.text start:0x80006280 end:0x80006648
.bss start:0x800F64A0 end:0x800F64B0
emulator/xlHeap.c:
.text start:0x80006648 end:0x80007BC0
.bss start:0x800F64B0 end:0x800F6A40
.sbss start:0x80137AA8 end:0x80137AC8
emulator/xlObject.c:
.text start:0x80007BC0 end:0x80007F80
.sbss start:0x80137AC8 end:0x80137AD0
emulator/simGCN.c:
.text start:0x80007F80 end:0x8000F7D8
.rodata start:0x800D3060 end:0x800D31B0
.data start:0x800DB880 end:0x800EC6C8
.bss start:0x800F6A40 end:0x800FBBE0
.sdata start:0x801371E8 end:0x801372B0
.sbss start:0x80137AD0 end:0x80137B10
.sdata2 start:0x80138218 end:0x80138270
emulator/movie.c:
.text start:0x8000F7D8 end:0x8000F89C
.data start:0x800EC6C8 end:0x800EC6F0
.sbss start:0x80137B10 end:0x80137B18
emulator/THPPlayer.c:
.text start:0x8000F89C end:0x80010DA8
.data start:0x800EC6F0 end:0x800EC990
.bss start:0x800FBBE0 end:0x800FC350
.sdata start:0x801372B0 end:0x801372B8
.sbss start:0x80137B18 end:0x80137B38
.sdata2 start:0x80138270 end:0x80138278
emulator/THPAudioDecode.c:
.text start:0x80010DA8 end:0x80011144
.data start:0x800EC990 end:0x800EC9B8
.bss start:0x800FC350 end:0x800FD6C0
.sbss start:0x80137B38 end:0x80137B40
emulator/THPDraw.c:
.text start:0x80011144 end:0x80011944
.sdata2 start:0x80138278 end:0x801382A0
emulator/THPRead.c:
.text start:0x80011944 end:0x80012F2C
.rodata start:0x800D31B0 end:0x800D3240
.data start:0x800EC9B8 end:0x800ECA28
.bss start:0x800FD6C0 end:0x800FEAF0
.sbss start:0x80137B40 end:0x80137B58
.sdata2 start:0x801382A0 end:0x801382D8
emulator/THPVideoDecode.c:
.text start:0x80012F2C end:0x8001344C
.data start:0x800ECA28 end:0x800ECA50
.bss start:0x800FEAF0 end:0x800FFE60
.sbss start:0x80137B58 end:0x80137B60
emulator/mcardGCN.c:
.text start:0x8001344C end:0x8001C450
.data start:0x800ECA50 end:0x800ECCC8
.bss start:0x800FFE60 end:0x8010A680
.sdata start:0x801372B8 end:0x801372C0
.sbss start:0x80137B60 end:0x80137B80
emulator/codeGCN.c:
.text start:0x8001C450 end:0x8001C4A4
.data start:0x800ECCC8 end:0x800ECCD8
.sdata start:0x801372C0 end:0x801372C8
.sbss start:0x80137B80 end:0x80137B88
emulator/soundGCN.c:
.text start:0x8001C4A4 end:0x8001D358
.data start:0x800ECCD8 end:0x800ECD38
.bss start:0x8010A680 end:0x8010AAA0
.sdata start:0x801372C8 end:0x801372D8
.sdata2 start:0x801382D8 end:0x80138300
emulator/frame.c:
.text start:0x8001D358 end:0x8002CA20
.rodata start:0x800D3240 end:0x800D3280
.data start:0x800ECD38 end:0x800ED800
.bss start:0x8010AAA0 end:0x80132DE0
.sdata start:0x801372D8 end:0x80137360
.sbss start:0x80137B88 end:0x80137BD8
.sdata2 start:0x80138300 end:0x80138490
emulator/system.c:
.text start:0x8002CA20 end:0x80030EEC
.data start:0x800ED800 end:0x800EDB60
.bss start:0x80132DE0 end:0x80132F58
.sdata start:0x80137360 end:0x801375A8
.sbss start:0x80137BD8 end:0x80137BE0
.sdata2 start:0x80138490 end:0x801384A0
emulator/cpu.c:
.text start:0x80030EEC end:0x8006BEE4
.data start:0x800EDB60 end:0x800EFBC0
.bss start:0x80132F58 end:0x80133150
.sdata start:0x801375A8 end:0x80137768
.sbss start:0x80137BE0 end:0x80137C60
.sdata2 start:0x801384A0 end:0x801384D0
emulator/pif.c:
.text start:0x8006BEE4 end:0x8006CE14
.data start:0x800EFBC0 end:0x800EFBD0
.sdata start:0x80137768 end:0x80137770
emulator/ram.c:
.text start:0x8006CE14 end:0x8006D428
.data start:0x800EFBD0 end:0x800EFDF0
.sdata start:0x80137770 end:0x80137778
emulator/rom.c:
.text start:0x8006D428 end:0x8006FF3C
.data start:0x800EFDF0 end:0x800F0448
.sdata start:0x80137778 end:0x801377B0
.sbss start:0x80137C60 end:0x80137C70
.sdata2 start:0x801384D0 end:0x80138508
emulator/rdp.c:
.text start:0x8006FF3C end:0x8007164C
.data start:0x800F0448 end:0x800F06B8
.sdata start:0x801377B0 end:0x801377B8
.sbss start:0x80137C70 end:0x80137C88
.sdata2 start:0x80138508 end:0x80138538
emulator/rdb.c:
.text start:0x8007164C end:0x80071C34
.data start:0x800F06B8 end:0x800F0728
.sdata start:0x801377B8 end:0x801377C0
emulator/rsp.c:
.text start:0x80071C34 end:0x8008D2C4
.data start:0x800F0728 end:0x800F0BD8
.sdata start:0x801377C0 end:0x801377E8
.sbss start:0x80137C88 end:0x80137CB0
.sdata2 start:0x80138538 end:0x80138578
emulator/mips.c:
.text start:0x8008D2C4 end:0x8008D804
.data start:0x800F0BD8 end:0x800F0C50
.sdata start:0x801377E8 end:0x801377F0
emulator/disk.c:
.text start:0x8008D804 end:0x8008DA98
.data start:0x800F0C50 end:0x800F0C60
.sdata start:0x801377F0 end:0x801377F8
emulator/flash.c:
.text start:0x8008DA98 end:0x8008E1B4
.data start:0x800F0C60 end:0x800F0C70
.sdata start:0x801377F8 end:0x80137800
emulator/sram.c:
.text start:0x8008E1B4 end:0x8008E524
.data start:0x800F0C70 end:0x800F0C80
.sdata start:0x80137800 end:0x80137808
emulator/audio.c:
.text start:0x8008E524 end:0x8008E91C
.data start:0x800F0C80 end:0x800F0D78
.sdata start:0x80137808 end:0x80137818
emulator/video.c:
.text start:0x8008E91C end:0x8008EE9C
.data start:0x800F0D78 end:0x800F0F30
.sdata start:0x80137818 end:0x80137820
emulator/serial.c:
.text start:0x8008EE9C end:0x8008F170
.data start:0x800F0F30 end:0x800F1008
.sdata start:0x80137820 end:0x80137828
emulator/library.c:
.text start:0x8008F170 end:0x80097818
.data start:0x800F1008 end:0x800F24B8
.sdata start:0x80137828 end:0x80137870
.sdata2 start:0x80138578 end:0x801385D8
emulator/peripheral.c:
.text start:0x80097818 end:0x80097E18
.data start:0x800F24B8 end:0x800F2660
emulator/_frameGCNcc.c:
.text start:0x80097E18 end:0x80098720
.data start:0x800F2660 end:0x800F2968
.sdata start:0x80137870 end:0x80137900
emulator/_buildtev.c:
.text start:0x80098720 end:0x8009BB38
.data start:0x800F2968 end:0x800F2B30
.bss start:0x80133150 end:0x80133420
.sdata start:0x80137900 end:0x80137910
.sdata2 start:0x801385D8 end:0x801385E0
File diff suppressed because it is too large Load Diff
Executable
+520
View File
File diff suppressed because it is too large Load Diff
+8 -6
View File
@@ -1,11 +1,13 @@
def add_custom_arguments(parser):
parser.add_argument("-v", "--version", help="Emulator version to diff", default="ce-j")
def apply(config, args):
config["baseimg"] = "SIM_S.elf"
config["myimg"] = "build/SIM/SIM_S.elf"
config["mapfile"] = "build/SIM/SIM.map"
version = args.version
config["make_command"] = ["ninja"]
config["mapfile"] = f"build/{version}/oot-gc.elf.MAP"
config["source_directories"] = ["src", "include"]
config["arch"] = "ppc"
config["map_format"] = "mw" # gnu, mw, ms
config["build_dir"] = "build/SIM/" # only needed for mw and ms map format
config["objdump_executable"] = "tools/objdump_wrapper.py"
config["build_dir"] = f"build/{version}/src" # only needed for mw and ms map formats
config["objdump_executable"] = "build/binutils/powerpc-eabi-objdump"
config["show_line_numbers_default"] = True
config["show_target_line_numbers_default"] = True
Executable
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# Wrapper for `dtk dol apply` to automatically update dtk symbols from the elf.
# Usage: ./dol-apply [VERSION]
# If VERSION is not provided, it defaults to ce-j.
set -euo pipefail
VERSION=${1:-ce-j}
ninja "build/$VERSION/ok"
build/tools/dtk dol apply "config/$VERSION/config.yml" "build/$VERSION/oot-gc.elf"
Executable
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# Wrapper for `dtk dol diff` to locate the first diff in the dol.
# Usage: ./dol-diff [VERSION]
# If VERSION is not provided, it defaults to ce-j.
set -euo pipefail
VERSION=${1:-ce-j}
ninja "build/$VERSION/oot-gc.elf"
build/tools/dtk dol diff "config/$VERSION/config.yml" "build/$VERSION/oot-gc.elf"
Executable
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
find include libc src -name '*.h' -o -name '*.c' | xargs clang-format -i
+8
View File
@@ -1,6 +1,14 @@
#ifndef _MACROS_H
#define _MACROS_H
// The VERSION macro will be set to one of these version numbers.
#define MQ_J 1
#define MQ_U 2
#define MQ_E 3
#define CE_J 4
#define CE_U 5
#define CE_E 6
#define ALIGNAS(N) __attribute__((aligned(N)))
#define ALIGN_PREV(X, N) ((X) & ~((N) - 1))
#define ALIGN_NEXT(X, N) ALIGN_PREV(((X) + (N) - 1), N)
-25
View File
@@ -1,25 +0,0 @@
MEMORY {
text : origin = 0x80003100
}
SECTIONS {
GROUP:{
.init ALIGN(0x20):{}
.text ALIGN(0x20):{}
.ctors ALIGN(0x20):{}
.dtors ALIGN(0x20):{}
.rodata ALIGN(0x20):{}
.data ALIGN(0x20):{}
.bss ALIGN(0x20):{}
.sdata ALIGN(0x20):{}
.sbss ALIGN(0x20):{}
.sdata2 ALIGN(0x20):{}
.sbss2 ALIGN(0x20):{}
.stack ALIGN(0x100):{}
} > text
_stack_addr = (_f_sbss2 + SIZEOF(.sbss2) + 65536 + 0x7) & ~0x7;
_stack_end = _f_sbss2 + SIZEOF(.sbss2);
_db_stack_addr = (_stack_addr + 0x2000);
_db_stack_end = _stack_addr;
__ArenaLo = (_db_stack_addr + 0x1f) & ~0x1f;
__ArenaHi = 0x81700000 ;
}
-184
View File
@@ -1,184 +0,0 @@
# Linker order for every file, passed to the Metrowerks linker.
O_FILES := \
$(BUILD_DIR)/src/emulator/xlCoreGCN.o \
$(BUILD_DIR)/src/emulator/xlPostGCN.o \
$(BUILD_DIR)/src/emulator/xlFileGCN.o \
$(BUILD_DIR)/src/emulator/xlList.o \
$(BUILD_DIR)/src/emulator/xlHeap.o \
$(BUILD_DIR)/src/emulator/xlObject.o \
$(BUILD_DIR)/src/emulator/simGCN.o \
$(BUILD_DIR)/src/emulator/movie.o \
$(BUILD_DIR)/src/emulator/THPPlayer.o \
$(BUILD_DIR)/src/emulator/THPAudioDecode.o \
$(BUILD_DIR)/src/emulator/THPDraw.o \
$(BUILD_DIR)/src/emulator/THPRead.o \
$(BUILD_DIR)/src/emulator/THPVideoDecode.o \
$(BUILD_DIR)/src/emulator/mcardGCN.o \
$(BUILD_DIR)/src/emulator/codeGCN.o \
$(BUILD_DIR)/src/emulator/soundGCN.o \
$(BUILD_DIR)/src/emulator/frame.o \
$(BUILD_DIR)/src/emulator/system.o \
$(BUILD_DIR)/src/emulator/cpu.o \
$(BUILD_DIR)/src/emulator/pif.o \
$(BUILD_DIR)/src/emulator/ram.o \
$(BUILD_DIR)/src/emulator/rom.o \
$(BUILD_DIR)/src/emulator/rdp.o \
$(BUILD_DIR)/src/emulator/rdb.o \
$(BUILD_DIR)/src/emulator/rsp.o \
$(BUILD_DIR)/src/emulator/mips.o \
$(BUILD_DIR)/src/emulator/disk.o \
$(BUILD_DIR)/src/emulator/flash.o \
$(BUILD_DIR)/src/emulator/sram.o \
$(BUILD_DIR)/src/emulator/audio.o \
$(BUILD_DIR)/src/emulator/video.o \
$(BUILD_DIR)/src/emulator/serial.o \
$(BUILD_DIR)/src/emulator/library.o \
$(BUILD_DIR)/src/emulator/peripheral.o \
$(BUILD_DIR)/src/emulator/_frameGCNcc.o \
$(BUILD_DIR)/src/emulator/_buildtev.o \
$(BUILD_DIR)/src/dolphin/base/PPCArch.o \
$(BUILD_DIR)/src/dolphin/os/OS.o \
$(BUILD_DIR)/src/dolphin/os/OSAlarm.o \
$(BUILD_DIR)/src/dolphin/os/OSAlloc.o \
$(BUILD_DIR)/src/dolphin/os/OSArena.o \
$(BUILD_DIR)/src/dolphin/os/OSAudioSystem.o \
$(BUILD_DIR)/src/dolphin/os/OSCache.o \
$(BUILD_DIR)/src/dolphin/os/OSContext.o \
$(BUILD_DIR)/src/dolphin/os/OSError.o \
$(BUILD_DIR)/src/dolphin/os/OSFont.o \
$(BUILD_DIR)/src/dolphin/os/OSInterrupt.o \
$(BUILD_DIR)/src/dolphin/os/OSLink.o \
$(BUILD_DIR)/src/dolphin/os/OSMessage.o \
$(BUILD_DIR)/src/dolphin/os/OSMemory.o \
$(BUILD_DIR)/src/dolphin/os/OSMutex.o \
$(BUILD_DIR)/src/dolphin/os/OSReboot.o \
$(BUILD_DIR)/src/dolphin/os/OSReset.o \
$(BUILD_DIR)/src/dolphin/os/OSResetSW.o \
$(BUILD_DIR)/src/dolphin/os/OSRtc.o \
$(BUILD_DIR)/src/dolphin/os/OSSync.o \
$(BUILD_DIR)/src/dolphin/os/OSThread.o \
$(BUILD_DIR)/src/dolphin/os/OSTime.o \
$(BUILD_DIR)/src/dolphin/os/__start.o \
$(BUILD_DIR)/src/dolphin/os/__ppc_eabi_init.o \
$(BUILD_DIR)/asm/EXIBios.o \
$(BUILD_DIR)/asm/EXIUart.o \
$(BUILD_DIR)/asm/SIBios.o \
$(BUILD_DIR)/asm/SISamplingRate.o \
$(BUILD_DIR)/asm/vi.o \
$(BUILD_DIR)/asm/db.o \
$(BUILD_DIR)/asm/mtx.o \
$(BUILD_DIR)/asm/mtxvec.o \
$(BUILD_DIR)/asm/mtx44.o \
$(BUILD_DIR)/asm/GXInit.o \
$(BUILD_DIR)/asm/GXFifo.o \
$(BUILD_DIR)/asm/GXAttr.o \
$(BUILD_DIR)/asm/GXMisc.o \
$(BUILD_DIR)/asm/GXGeometry.o \
$(BUILD_DIR)/asm/GXFrameBuf.o \
$(BUILD_DIR)/asm/GXLight.o \
$(BUILD_DIR)/asm/GXTexture.o \
$(BUILD_DIR)/asm/GXBump.o \
$(BUILD_DIR)/asm/GXTev.o \
$(BUILD_DIR)/asm/GXPixel.o \
$(BUILD_DIR)/asm/GXTransform.o \
$(BUILD_DIR)/asm/GXPerf.o \
$(BUILD_DIR)/asm/Padclamp.o \
$(BUILD_DIR)/asm/Pad.o \
$(BUILD_DIR)/asm/dvdlow.o \
$(BUILD_DIR)/asm/dvdfs.o \
$(BUILD_DIR)/asm/dvd.o \
$(BUILD_DIR)/asm/dvdqueue.o \
$(BUILD_DIR)/asm/dvderror.o \
$(BUILD_DIR)/asm/dvdidutils.o \
$(BUILD_DIR)/asm/dvdFatal.o \
$(BUILD_DIR)/asm/fstload.o \
$(BUILD_DIR)/asm/DEMOInit.o \
$(BUILD_DIR)/asm/DEMOPuts.o \
$(BUILD_DIR)/asm/DEMOFont.o \
$(BUILD_DIR)/asm/DEMOPad.o \
$(BUILD_DIR)/asm/DEMOStats.o \
$(BUILD_DIR)/asm/ai.o \
$(BUILD_DIR)/asm/ar.o \
$(BUILD_DIR)/asm/dsp.o \
$(BUILD_DIR)/asm/dsp_debug.o \
$(BUILD_DIR)/asm/dsp_task.o \
$(BUILD_DIR)/asm/CARDBios.o \
$(BUILD_DIR)/asm/CARDUnlock.o \
$(BUILD_DIR)/asm/CARDRdwr.o \
$(BUILD_DIR)/asm/CARDBlock.o \
$(BUILD_DIR)/asm/CARDDir.o \
$(BUILD_DIR)/asm/CARDCheck.o \
$(BUILD_DIR)/asm/CARDMount.o \
$(BUILD_DIR)/asm/CARDFormat.o \
$(BUILD_DIR)/asm/CARDOpen.o \
$(BUILD_DIR)/asm/CARDCreate.o \
$(BUILD_DIR)/asm/CARDRead.o \
$(BUILD_DIR)/asm/CARDWrite.o \
$(BUILD_DIR)/asm/CARDDelete.o \
$(BUILD_DIR)/asm/CARDStat.o \
$(BUILD_DIR)/asm/CARDNet.o \
$(BUILD_DIR)/asm/THPDec.o \
$(BUILD_DIR)/asm/THPAudio.o \
$(BUILD_DIR)/asm/texPalette.o \
$(BUILD_DIR)/asm/mainloop.o \
$(BUILD_DIR)/asm/nubevent.o \
$(BUILD_DIR)/asm/nubinit.o \
$(BUILD_DIR)/asm/msg.o \
$(BUILD_DIR)/asm/msgbuf.o \
$(BUILD_DIR)/asm/serpoll.o \
$(BUILD_DIR)/asm/usr_put.o \
$(BUILD_DIR)/asm/dispatch.o \
$(BUILD_DIR)/asm/msghndlr.o \
$(BUILD_DIR)/asm/support.o \
$(BUILD_DIR)/asm/mutex_TRK.o \
$(BUILD_DIR)/asm/notify.o \
$(BUILD_DIR)/asm/flush_cache.o \
$(BUILD_DIR)/asm/mem_TRK.o \
$(BUILD_DIR)/asm/__exception.o \
$(BUILD_DIR)/asm/targimpl.o \
$(BUILD_DIR)/asm/dolphin_trk.o \
$(BUILD_DIR)/asm/mpc_7xx_603e.o \
$(BUILD_DIR)/asm/main_TRK.o \
$(BUILD_DIR)/asm/dolphin_trk_glue.o \
$(BUILD_DIR)/asm/targcont.o \
$(BUILD_DIR)/asm/__mem.o \
$(BUILD_DIR)/asm/__va_arg.o \
$(BUILD_DIR)/asm/global_destructor_chain.o \
$(BUILD_DIR)/asm/runtime.o \
$(BUILD_DIR)/asm/abort_exit.o \
$(BUILD_DIR)/asm/ansi_files.o \
$(BUILD_DIR)/asm/ansi_fp.o \
$(BUILD_DIR)/asm/buffer_io.o \
$(BUILD_DIR)/asm/critical_regions.ppc_eabi.o \
$(BUILD_DIR)/asm/ctype.o \
$(BUILD_DIR)/asm/direct_io.o \
$(BUILD_DIR)/asm/errno.o \
$(BUILD_DIR)/asm/mbstring.o \
$(BUILD_DIR)/asm/mem.o \
$(BUILD_DIR)/asm/mem_funcs.o \
$(BUILD_DIR)/asm/misc_io.o \
$(BUILD_DIR)/asm/printf.o \
$(BUILD_DIR)/asm/scanf.o \
$(BUILD_DIR)/asm/string.o \
$(BUILD_DIR)/asm/strtoul.o \
$(BUILD_DIR)/asm/uart_console_io.o \
$(BUILD_DIR)/asm/float.o \
$(BUILD_DIR)/asm/wchar_io.o \
$(BUILD_DIR)/asm/e_asin.o \
$(BUILD_DIR)/asm/e_pow.o \
$(BUILD_DIR)/asm/fminmaxdim.o \
$(BUILD_DIR)/asm/s_ceil.o \
$(BUILD_DIR)/asm/s_copysign.o \
$(BUILD_DIR)/asm/s_floor.o \
$(BUILD_DIR)/asm/s_frexp.o \
$(BUILD_DIR)/asm/s_ldexp.o \
$(BUILD_DIR)/asm/w_pow.o \
$(BUILD_DIR)/asm/hyperbolicsf.o \
$(BUILD_DIR)/asm/log10f.o \
$(BUILD_DIR)/asm/trigf.o \
$(BUILD_DIR)/asm/math_inlines.o \
$(BUILD_DIR)/asm/common_float_tables.o \
$(BUILD_DIR)/asm/AmcExi2Stubs.o \
$(BUILD_DIR)/asm/DebuggerDriver.o \
$(BUILD_DIR)/asm/odenotstub.o \
-844
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More