diff --git a/Makefile b/Makefile index 393c4e6..9b67a5e 100644 --- a/Makefile +++ b/Makefile @@ -30,20 +30,32 @@ ifeq ($(PARENT_OUTPUT_DIR),.) endif # Find the N64 toolchain, for creating object files. +ifneq (, $(shell which mips64-linux-gnuabi64-as)) + AS := mips64-linux-gnuabi64-as +else ifneq (, $(shell which mips64-linux-gnu-as)) AS := mips64-linux-gnu-as else ifneq (, $(shell which mips64-ultra-elf-as)) AS := mips64-ultra-elf-as else +ifneq (, $(shell which mips64-elf-as)) + AS := mips64-elf-as +else ifneq (, $(shell which mips64-as)) AS := mips64-as +else +ifneq (, $(shell which mips-linux-gnu-as)) + AS := mips-linux-gnu-as else $(warning Could not find N64 linker, not building object files) AS := endif endif endif +endif +endif +endif NO_COL := \033[0m RED := \033[0;31m diff --git a/docs/Documentation/Porting your Romhack.md b/docs/Documentation/Porting your Romhack.md index f42e36b..3a7c6db 100644 --- a/docs/Documentation/Porting your Romhack.md +++ b/docs/Documentation/Porting your Romhack.md @@ -37,6 +37,13 @@ similar for other games): Both OoT and SM64: +- In any place where your game creates a viewport (whether statically or + dynamically) (search for `Vp` case-sensitive, `SPViewport`, and `G_MAXZ`), + change the maximum Z value from `G_MAXZ` to `G_NEW_MAXZ` and negate the + Y scale. For more information, see the comment next to `G_MAXZ` in the GBI. + Note that your romhack codebase may have the constant hardcoded, usually as + `511` which is supposed to be `(G_MAXZ/2)`, instead of actually writing + `G_MAXZ`; you need to change these too, there are several of these in SM64. - Remove uses of internal GBI features which have been removed in F3DEX3 (see @ref compatibility for full list). In OoT, the only changes needed are: - In `src/code/ucode_disas.c`, remove the switch statement cases for diff --git a/f3dex3.s b/f3dex3.s index 051542c..f35cd74 100644 --- a/f3dex3.s +++ b/f3dex3.s @@ -2806,6 +2806,7 @@ G_POPMTX_handler: lw $2, OSTask + OSTask_dram_stack // Top of the stack sub cmd_w1_dram, $11, cmd_w1_dram // Decrease pointer by amount in command sub $1, cmd_w1_dram, $2 // Is it still valid / within the stack? + sb $zero, dirLightsXfrmValid // Mark lights as needing recompute bgez $1, @@skip // If so, skip the failsafe sh $zero, mvpValid // and dirLightsXfrmValid; mark both mtx and dir lts invalid move cmd_w1_dram, $2 // Use the top of the stack as the new pointer diff --git a/gbi.h b/gbi.h index 69fc7de..9cdf737 100644 --- a/gbi.h +++ b/gbi.h @@ -16,10 +16,20 @@ #ifndef F3DEX3_H #define F3DEX3_H +/* Don't remove this line which defines F3DEX3 as F3DEX2. Other headers in your +romhack codebase will likely assume that if the microcode is not F3DEX2, it is +F3DEX1 or older, thus breaking F3DEX3 compatibility even more. */ #define F3DEX_GBI_2 1 #define F3DEX_GBI_PL 1 #define F3DEX_GBI_3 1 +/* This is only included to check correctness of OS_YIELD_DATA_SIZE. If you are +sure this is correct in your project, you can remove this include. */ +#include "ultra64/sptask.h" +#if OS_YIELD_DATA_SIZE != 0xC00 +#error "F3DEX3 requires OS_YIELD_DATA_SIZE == 0xC00" +#endif + #ifdef REQUIRE_SEMICOLONS_AFTER_GBI_COMMANDS /* OoT style, semicolons required after using macros, cleaner code. If modding SM64, will have to fix a few places the codebase omits the semicolons. */