mirror of
https://github.com/zeldaret/ph
synced 2026-07-02 03:50:14 -04:00
Add option to build with nonmatching functions
This commit is contained in:
+13
@@ -5,6 +5,7 @@ Contents:
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Build the ROM](#build-the-rom)
|
||||
- [Matching the base ROM](#matching-the-base-rom)
|
||||
- [Building with non-matching code](#building-with-non-matching-code)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -55,3 +56,15 @@ ARM7 BIOS in the root directory of this repository, and verify that your dumped
|
||||
| `arm7_bios.bin` | `6ee830c7f552c5bf194c20a2c13d5bb44bdb5c03` |
|
||||
|
||||
Now, `make` should automatically detect the ARM7 BIOS and will build a matching ROM.
|
||||
|
||||
## Building with non-matching code
|
||||
Due to challenges with decompilation, some functions are not decompiled to 100% match the original assembly. Such functions are
|
||||
marked with `NONMATCH` before the function declaration.
|
||||
|
||||
While non-matching functions do not contribute to getting a matching ROM, they can provide useful information (e.g. updates to
|
||||
structs/classes) or encourage collaboration to match the function.
|
||||
|
||||
By default, non-matching functions are compiled with **inline assembly** so that the built ROM can still match the base ROM.
|
||||
However, by running `make NONMATCHING=1`, non-matching functions are compiled as **C++** instead of inline assembly.
|
||||
|
||||
As a result, the built ROM will not match and is not guaranteed to function identically to the base ROM.
|
||||
|
||||
@@ -45,6 +45,10 @@ ASM_FLAGS := -proc arm5te -d $(REGION) -i asm -msgstyle gcc
|
||||
CC_FLAGS := -O2 -enum int -i include -nolink -d $(REGION)
|
||||
LD_FLAGS := -proc arm946e -nostdlib -interworking -nodead -m Entry -map closure,unused -o main.bin -msgstyle gcc
|
||||
|
||||
ifeq ($(NONMATCHING),1)
|
||||
CC_FLAGS += -DNONMATCHING
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: tools rom
|
||||
sha1sum $(NDS_FILE)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef PH_GLOBAL_H
|
||||
#define PH_GLOBAL_H
|
||||
|
||||
#ifdef NONMATCHING
|
||||
#define NONMATCH
|
||||
#else
|
||||
#define NONMATCH asm
|
||||
#endif
|
||||
|
||||
// Prevent the IDE from reporting errors that the compiler/linker won't report
|
||||
#ifdef __INTELLISENSE__
|
||||
#define NONMATCH
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user