Improvements to a few scripts & renamed a couple files.

This commit is contained in:
David Benepe
2021-06-13 14:48:10 -05:00
parent eaafb65603
commit 63b9300dd8
163 changed files with 728 additions and 505 deletions
+20 -3
View File
@@ -4,11 +4,21 @@
SHELL := /bin/bash
########################### Version ##########################
################## Preprocessor definitions ##################
# Currently, only US 1.0 is supported.
VERSION := us_1.0
NON_MATCHING ?= 0
$(eval $(call validate-option,NON_MATCHING,0 1))
ifeq ($(VERSION),us_1.0)
DEFINES += VERSION_US_1_0=1
endif
ifeq ($(NON_MATCHING),1)
DEFINES += NON_MATCHING=1
endif
############################ Setup ###########################
# Don't do setup checks if cleaning.
@@ -123,9 +133,12 @@ OBJCOPY = $(CROSS)objcopy --pad-to=0xC00000 --gap-fill=0xFF
MIPSISET := -mips1
OPT_FLAGS := -O2
ASFLAGS = -mtune=vr4300 -march=vr4300 $(INCLUDE_FLAGS)
C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
ASFLAGS = -mtune=vr4300 -march=vr4300 $(foreach d,$(DEFINES),--defsym $(d))
INCLUDE_CFLAGS := -I include -I $(BUILD_DIR) -I $(BUILD_DIR)/include -I src -I .
CFLAGS = -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(MIPSISET)
CFLAGS = -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
LDFLAGS = undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/dkr.map
####################### Other Tools #########################
@@ -445,7 +458,11 @@ $(BUILD_DIR)/$(TARGET).z64: $(BUILD_DIR)/$(TARGET).bin | $(ALL_ASSETS_BUILT)
cp $< $@
$(FIXCHECKSUMS)
$(N64CRC) $@
ifeq ($(NON_MATCHING),0)
sha1sum -c sha1/dkr.$(VERSION).sha1
else
@echo "Build complete!"
endif
$(BUILD_DIR)/$(TARGET).hex: $(BUILD_DIR)/$(TARGET).z64
xxd $< > $@
+78 -13
View File
@@ -27,6 +27,16 @@ Currently, only the US 1.0 version of the game is supported. US 1.1, EU 1.0, EU
3. Run `make` in the main directory.
**a.** Use the `-jN` argument to use `N` number of threads to speed up building. For example, if you have a system with 4 cores / 4 threads, you should do `make -j4`.
## Modding
If you are modifying the code in the repo, then you should add `NON_MATCHING=1` to the make command: `make NON_MATCHING=1 -j4`
## Style Guide
This repo is following the same style guide as the SM64 decomp project, which can be found here: https://docs.google.com/document/d/1T_6dUj32QOscrMOMDsr7bY0esohswEAstKCO4gFn6t0
If you see variables/functions/structs/etc. that doesn't follow these rules, then file an issue and we'll try to fix them.
## Scripts
There are some useful scripts that should be kept in mind when working on this repo.
@@ -37,25 +47,29 @@ There are some useful scripts that should be kept in mind when working on this r
This script will extract all the assets from a DKR ROM and place them into `/assets/` folder according to the config file within the `/extract-ver/` folder. The version parameter should either be `us_1.0`, `us_1.1`, `eu_1.0`, `eu_1.1`, or `jp`.
---
#### `./rename_sym.sh <old_symbol> <new_symbol>`
This script will rename an existing symbol within the repo with a new one.
Example: `./rename_sym.sh D_A4001000 SP_IMEM`
Example: `./extract.sh us_1.0`
---
#### `./score.sh`
#### `./diff.sh <function_name>`
Prints out the current completion percentage of the decomp. You do need to have an `OK` build for this to work properly.
Compares the assembly output of a function from a built ROM to the base ROM. Useful for decompiling.
Example: `./diff.sh menu_init`
---
#### `./rename.sh <old_name> <new_name>`
This script will rename an existing symbol, file name, and/or folder name within the repo with a new one.
Example: `./rename.sh D_A4001000 SP_IMEM`
---
#### `./get_symbol.sh <ram_address>`
Will return the symbol associated with the RAM address within `undefined_syms.txt`. The RAM address must be in base 16. The `0x` prefix is not required.
Will return the symbol associated with the RAM address found in `/build/us_1.0/dkr.map`. The RAM address must be in base 16. The `0x` prefix is not required.
Example:
```
@@ -65,25 +79,76 @@ Example:
---
## TODO list
#### `./score.sh`
TODO: Add more things to the TODO list.
Prints out the current completion percentage of the decomp. You do need to have an `OK` build for this to work properly.
The scoring is split into 2 sections:
1. Assembly to C Decompilation (Adventure One)
2. Cleanup and Documentation (Adventure Two)
Show scores for Adventure One & Adventure Two: `./score.sh`
Show score for Adventure One only: `./score.sh -a 1`
Show score for Adventure Two only: `./score.sh -a 2`
Show top 10 files remaining: `./score.sh -t 10`
To make progress in Adventure 2, a function must be properly named (must not start with `func_`) and also include a doxygen comment above it.
For example:
```c
/**
* Returns 1 if Drumstick is avaliable to use, or 0 if not.
*/
s32 is_drumstick_unlocked(void) {
return gActiveMagicCodes & 2;
}
```
As of June 13th 2021, this is our current score:
```
=======================================================
ADVENTURE ONE (ASM -> C Decompilation)
------------------- 9.15% Complete -------------------
# Decompiled functions: 677
# GLOBAL_ASM remaining: 1076
--------------------- Game Status ---------------------
Balloons: 6/47, Keys: 1/4, Trophies: 0/5
T.T. Amulets: 0/4, Wizpig Amulets: 0/4
-------------------------------------------------------
We are racing in Jungle Falls. (Lap 1/3)
=======================================================
ADVENTURE TWO (Cleanup & Documentation)
------------------- 0.01% Complete -------------------
# Documented functions: 4
# Undocumented remaining: 1749
--------------------- Game Status ---------------------
Balloons: 0/47, Keys: 0/4, Trophies: 0/5
T.T. Amulets: 0/4, Wizpig Amulets: 0/4
-------------------------------------------------------
We are collecting the first balloon on Timber's Island.
=======================================================
```
---
## TODO list
### Major
What should be focused on.
* Decompiling the asm files into matching c files.
* Documenting variables & functions
### Minor
What can be done, but not essential.
* Figuring out the formats for the assets in the /assets/ folder.
* Creating tools to modify assets
### Future
These features won't be complete anytime soon.
* Make the ROM fully shiftable.
* Add support for the other 4 versions.

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