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/gbi.h b/gbi.h index 27d710f..de25523 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. */