From 47eb1ae9ac77afdfa09a9f2b2148a2299c6f9ca4 Mon Sep 17 00:00:00 2001 From: Sauraen Date: Sat, 21 Oct 2023 15:24:26 -0700 Subject: [PATCH] Move to HackerN64 org --- Makefile | 65 +++++------------ README.md | 73 ++++++++++--------- build.sh | 6 +- custom.mk | 5 -- f3dex2.s => f3dex3.s | 0 restore.sh | 8 --- ucodes_database.mk | 165 ------------------------------------------- 7 files changed, 60 insertions(+), 262 deletions(-) delete mode 100644 custom.mk rename f3dex2.s => f3dex3.s (100%) delete mode 100644 restore.sh delete mode 100644 ucodes_database.mk diff --git a/Makefile b/Makefile index f5ceb72..1ef9d45 100644 --- a/Makefile +++ b/Makefile @@ -2,49 +2,11 @@ MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-variables .SUFFIXES: -default: - @echo 'How to use this Makefile' - @echo 'Method 1) Select a microcode, just run e.g. `make F3DZEX_NoN_2.06H`' - @echo 'Method 2) `make ok`, builds all ucodes which have MD5 sums, to check if :OK:' - @echo 'Method 3) `make all`, builds all ucodes in database' - @echo 'Method 4) Custom microcode build via custom.mk file. Create a file custom.mk' - @echo 'with contents like this:' - @echo 'NAME := your_custom_ucode_name' - @echo 'DESCRIPTION := Your Romhack Name' - @echo 'ID_STR := Modded F3DZEX by _your_name_, real N64 hardware or RSP LLE is required' - @echo ' ^ (this must be the exact number of characters)' - @echo 'OPTIONS := CFG_NoN CFG_POINT_LIGHTING etc.' - @echo 'Then run `make your_custom_ucode_name`. See the Makefile for the list of options.' +default: F3DEX3_BrZ F3DEX3_BrW -# With the defaults--all of these options unset--you get 2.08 (Banjo-Tooie), -# which has none of the bugs / the latest versions of everything, except -# G_BRANCH_Z (F3DEX2), no point lighting, and no NoN. Enabling the different -# BUG_ options *gives* you the bugs--the default is always with the bugs fixed. -# If you are modding and adding options, you just have to add them here, and -# in the options list for your custom configuration. +# List of all compile-time options supported by the microcode source. ALL_OPTIONS := \ - CFG_G_BRANCH_W \ - CFG_XBUS \ - CFG_NoN \ - CFG_POINT_LIGHTING \ - CFG_OLD_TRI_WRITE \ - CFG_EXTRA_0A_BEFORE_ID_STR \ - CFG_G_SPECIAL_1_IS_RECALC_MVP \ - CFG_CLIPPING_SUBDIVIDE_DESCENDING \ - CFG_DONT_SKIP_FIRST_INSTR_NEW_UCODE \ - BUG_CLIPPING_FAIL_WHEN_SUM_ZERO \ - BUG_NO_CLAMP_SCREEN_Z_POSITIVE \ - BUG_TEXGEN_LINEAR_CLOBBER_S_T \ - BUG_WRONG_INIT_VZERO \ - BUG_FAIL_IF_CARRY_SET_AT_INIT \ - MOD_GENERAL \ - MOD_RDP_BUFS_2_TRIS \ - MOD_CMD_JUMP_TABLE \ - MOD_ATTR_OFFSETS \ - MOD_CLIP_CHANGES \ - MOD_CLIP_SUBDIVIDE \ - MOD_CLIP_EXPERIM \ - MOD_VL_REWRITE + CFG_G_BRANCH_W ARMIPS ?= armips PARENT_OUTPUT_DIR ?= ./build @@ -120,7 +82,7 @@ define ucode_rule -strequ DATA_FILE $$(DATA_FILE) \ $$(OPTIONS_EQU) \ $$(OFF_OPTIONS_EQU) \ - f3dex2.s \ + f3dex3.s \ -sym2 $$(SYM_FILE) \ -temp $$(TEMP_FILE) # Microcode target @@ -148,7 +110,7 @@ define ucode_rule $$(CODE_FILE): CODE_FILE:=$$(CODE_FILE) $$(CODE_FILE): DATA_FILE:=$$(DATA_FILE) # Target recipe - $$(CODE_FILE): ./f3dex2.s ./rsp/* ucodes_database.mk $(EXTRA_DEPS) | $$(UCODE_OUTPUT_DIR) + $$(CODE_FILE): ./f3dex3.s ./rsp/* $(EXTRA_DEPS) | $$(UCODE_OUTPUT_DIR) @printf "$(INFO)Building microcode: $(NAME): $(DESCRIPTION)$(NO_COL)\n" @$(ARMIPS) -strequ ID_STR "$(ID_STR)" $$(ARMIPS_CMDLINE) ifneq ($(MD5_CODE),) @@ -162,13 +124,18 @@ endef $(eval $(call reset_vars)) -ifneq ("$(wildcard custom.mk)","") - include custom.mk - EXTRA_DEPS := custom.mk - $(eval $(call ucode_rule)) -endif +NAME := F3DEX3_BrZ +DESCRIPTION := Will make you want to finally ditch HLE (G_BRANCH_Z version) +ID_STR := F3DEX3 by Sauraen & Nintendo, G_BRANCH_Z version______________________ +OPTIONS := +$(eval $(call ucode_rule)) -include ucodes_database.mk +NAME := F3DEX3_BrW +DESCRIPTION := Will make you want to finally ditch HLE (G_BRANCH_W version) +ID_STR := F3DEX3 by Sauraen & Nintendo, G_BRANCH_W version______________________ +OPTIONS := \ + CFG_G_BRANCH_W +$(eval $(call ucode_rule)) .PHONY: default ok all clean diff --git a/README.md b/README.md index fd151b4..013cb0f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# F3DEX3 has moved! - -**Please go to https://github.com/HackerN64/F3DEX3. This branch is deprecated.** +# F3DEX3 Modern microcode for N64 romhacks. Will make you want to finally ditch HLE. +Heavily modified version of F3DEX2, partially rewritten from scratch. + +**F3DEX3 is in alpha. It is not stable yet for use in romhacks. If you try it, +you should expect crashes and graphical issues.** ## Features @@ -105,6 +107,9 @@ Modern microcode for N64 romhacks. Will make you want to finally ditch HLE. ## Bounding vertices system +**This system is planned to be removed--Kaze does not believe it will bring +much extra performance--and replaced with a new occlusion plane system.** + The features of this system are easiest to understand with an example. Suppose you have five houses in a scene, and each house has a chimney. The following display list draws the chimneys, but culls each one if it is offscreen or too @@ -212,31 +217,32 @@ For an OoT codebase, only a few minor changes are required to use F3DEX3. However, more changes are recommended to increase performance and enable new features. -There is only one build-time option for F3DEX3: enable `CFG_G_BRANCH_W` if the -microcode is replacing F3DZEX (i.e. OoT or MM), otherwise do not enable this -option if the microcode is replacing F3DEX2 or an earlier F3D version (i.e. -SM64). Enabling this option makes `SPBranchLessZ*` use the vertex's W -coordinate, otherwise it uses the screen Z coordinate. New display lists should -use the bounding vertices system instead of `SPBranchLessZ*`, so this only -matters for vanilla display lists used in your romhack. +There is only one build-time option for F3DEX3: `make F3DEX3_BrW` if the +microcode is replacing F3DZEX (i.e. OoT or MM), otherwise `make F3DEX3_BrZ` if +the microcode is replacing F3DEX2 or an earlier F3D version (i.e. SM64). This +controls whether `SPBranchLessZ*` uses the vertex's W coordinate or screen Z +coordinate. New display lists should use the bounding vertices system instead of +`SPBranchLessZ*`, so this only matters for vanilla display lists used in your +romhack. How to modify the microcode in your HackerOoT based romhack (steps may be similar for other games): - Replace `include/ultra64/gbi.h` in your romhack with `gbi.h` from this repo. - Make the "Required Changes" listed below. -- Build this repo (`make F3DEX3`). -- Copy the microcode binaries (`build/F3DEX3/F3DEX3.code` and - `build/F3DEX3/F3DEX3.data`) to somewhere in your romhack repo, e.g. `data`. +- Build this repo: install the latest version of `armips`, then `make + F3DEX3_BrZ` or `make F3DEX3_BrW` (see above). +- Copy the microcode binaries (`build/F3DEX3_X/F3DEX3_X.code` and + `build/F3DEX3_X/F3DEX3_X.data`) to somewhere in your romhack repo, e.g. `data`. - In `data/rsp.rodata.s`, change the line between `fifoTextStart` and - `fifoTextEnd` to `.incbin "data/F3DEX3.code"` (or wherever you put the + `fifoTextEnd` to `.incbin "data/F3DEX3_X.code"` (or wherever you put the binary), and similarly change the line between `fifoDataStart` and - `fifoDataEnd` to `.incbin "data/F3DEX3.data"`. After both the `fifoTextEnd` + `fifoDataEnd` to `.incbin "data/F3DEX3_X.data"`. After both the `fifoTextEnd` and `fifoDataEnd` labels, add a line `.balign 16`. - If you are planning to ever update the microcode binaries in the future, add the following to the Makefile of your romhack, after the section starting with `build/data/%.o` (i.e. two lines after that, with a blank line before - and after): `build/data/rsp.rodata.o: data/F3DEX3.code data/F3DEX3.data`. It - is not a mistake that this new line you are adding won't have a second + and after): `build/data/rsp.rodata.o: data/F3DEX3_X.code data/F3DEX3_X.data`. + It is not a mistake that this new line you are adding won't have a second indented line after it; it is like the `message_data_static` lines below that. This will tell `make` to rebuild `rsp.rodata.o`, which includes the microcode binaries, whenever they are changed. @@ -279,22 +285,24 @@ similar for other games): - Avoid using `G_MTX_MUL` in `SPMatrix`. That is, make sure your game engine computes a matrix stack on the CPU and sends the final matrix for each object / limb to the RSP, rather than multiplying matrices on the RSP. OoT already - does the former for precision / accuracy reasons and only uses `G_MTX_MUL` in - a couple obscure places; it is okay to leave those. This change is recommended - because the `G_MTX_MUL` mode of `SPMatrix` has been moved to Overlay 4 in - F3DEX3 (see below), making it substantially slower than it was in F3DEX2. It - still functions the same though so you can use it if it's really needed. + usually does the former for precision / accuracy reasons and only uses + `G_MTX_MUL` in a couple places; it is okay to leave those. This change is + recommended because the `G_MTX_MUL` mode of `SPMatrix` has been moved to + Overlay 4 in F3DEX3 (see below), making it substantially slower than it was in + F3DEX2. It still functions the same though so you can use it if it's really + needed. - Re-export as many display lists (scenes, objects, skeletons, etc.) as possible with fast64 set to F3DEX3 mode, to take advantage of the substantially larger vertex buffer, triangle packing commands, "hints" system, etc. - Once everything in your romhack is ported to F3DEX3 and everything is stable, - `#define NO_SYNCS_IN_TEXTURE_LOADS` and fix any crashes or graphical issues - that arise. Display lists exported from fast64 already do not contain these - syncs, but vanilla display lists or custom ones using the texture loading - multi-command macros do. Disabling the syncs saves a few percent of RDP cycles - for each material setup; what percentage this is of the total RDP time depends - on how many triangles are typically drawn between each material change. For - more information, see the GBI documentation near this define. + `#define NO_SYNCS_IN_TEXTURE_LOADS` (at the top of, or before including, the + GBI) and fix any crashes or graphical issues that arise. Display lists + exported from fast64 already do not contain these syncs, but vanilla display + lists or custom ones using the texture loading multi-command macros do. + Disabling the syncs saves a few percent of RDP cycles for each material setup; + what percentage this is of the total RDP time depends on how many triangles + are typically drawn between each material change. For more information, see + the GBI documentation near this define. ### Recommended Changes (Lighting) @@ -493,9 +501,10 @@ two tris, saving a substantial amount of DMEM. ## Credits -F3DEX3 modifications from F3DEX2 by Sauraen. If you use F3DEX3 in a romhack, -please credit "F3DEX3 Microcode - Sauraen" in your project's in-game Staff Roll -or wherever other contributors to your project are credited. +F3DEX3 modifications from F3DEX2 are by Sauraen and are dedicated to the public +domain. If you use F3DEX3 in a romhack, please credit "F3DEX3 Microcode - +Sauraen" in your project's in-game Staff Roll or wherever other contributors to +your project are credited. Other credits: - Wiseguy: large chunk of F3DEX2 disassembly documentation and first version of diff --git a/build.sh b/build.sh index cf92b49..b03ff45 100644 --- a/build.sh +++ b/build.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e -make F3DEX3 -cp build/F3DEX3/F3DEX3.code ../../Mods/HackerOoT/data/F3DEX3.code -cp build/F3DEX3/F3DEX3.data ../../Mods/HackerOoT/data/F3DEX3.data +make F3DEX3_BrW +cp build/F3DEX3_BrW/F3DEX3_BrW.code ../../Mods/HackerOoT/data/F3DEX3_BrW.code +cp build/F3DEX3_BrW/F3DEX3_BrW.data ../../Mods/HackerOoT/data/F3DEX3_BrW.data make -C ../../Mods/HackerOoT -j12 cp ../../Mods/HackerOoT/HackerOoT.z64 /media/`whoami`/SOME2/ printf "\n====\nDone\n====\n" diff --git a/custom.mk b/custom.mk deleted file mode 100644 index f6156ef..0000000 --- a/custom.mk +++ /dev/null @@ -1,5 +0,0 @@ -NAME := F3DEX3 -DESCRIPTION := Will make you want to finally ditch HLE -ID_STR := F3DEX3 by Sauraen & Nintendo, G_BRANCH_W version______________________ -OPTIONS := \ - CFG_G_BRANCH_W diff --git a/f3dex2.s b/f3dex3.s similarity index 100% rename from f3dex2.s rename to f3dex3.s diff --git a/restore.sh b/restore.sh deleted file mode 100644 index f9f8c0f..0000000 --- a/restore.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e -cp ../../Mods/HackerOOT/origucode_text.bin ../../Mods/HackerOOT/moducode_text.bin -cp ../../Mods/HackerOOT/origucode_data.bin ../../Mods/HackerOOT/moducode_data.bin -touch ../../Mods/HackerOOT/data/rsp.rodata.s -make -C ../../Mods/HackerOOT -j12 -cp ../../Mods/HackerOOT/HackerOoT.z64 /media/`whoami`/SOME2/ -printf "\n====\nDone\n====\n" diff --git a/ucodes_database.mk b/ucodes_database.mk deleted file mode 100644 index 31b96f9..0000000 --- a/ucodes_database.mk +++ /dev/null @@ -1,165 +0,0 @@ -NAME := F3DEX2_2.04H -DESCRIPTION := Kirby 64, Smash 64 -ID_STR := RSP Gfx ucode F3DEX fifo 2.04H Yoshitaka Yasumoto 1998 Nintendo. -MD5_CODE := d3a58568fa7cf042de370912a47c3b5f -MD5_DATA := 6639b2fd15a73c5446aff592bb599983 -OPTIONS := \ - CFG_OLD_TRI_WRITE \ - CFG_EXTRA_0A_BEFORE_ID_STR \ - CFG_G_SPECIAL_1_IS_RECALC_MVP \ - CFG_CLIPPING_SUBDIVIDE_DESCENDING \ - CFG_DONT_SKIP_FIRST_INSTR_NEW_UCODE \ - BUG_CLIPPING_FAIL_WHEN_SUM_ZERO \ - BUG_NO_CLAMP_SCREEN_Z_POSITIVE \ - BUG_TEXGEN_LINEAR_CLOBBER_S_T \ - BUG_FAIL_IF_CARRY_SET_AT_INIT -$(eval $(call ucode_rule)) - -NAME := F3DEX2_NoN_2.04H -DESCRIPTION := Not in retail games; NoN added to F3DEX2_2.04H -ID_STR := RSP Gfx ucode F3DEX.NoN fifo 2.04H Yoshitaka Yasumoto 1998 Nintendo. -OPTIONS := \ - CFG_NoN \ - CFG_OLD_TRI_WRITE \ - CFG_EXTRA_0A_BEFORE_ID_STR \ - CFG_G_SPECIAL_1_IS_RECALC_MVP \ - CFG_CLIPPING_SUBDIVIDE_DESCENDING \ - CFG_DONT_SKIP_FIRST_INSTR_NEW_UCODE \ - BUG_CLIPPING_FAIL_WHEN_SUM_ZERO \ - BUG_NO_CLAMP_SCREEN_Z_POSITIVE \ - BUG_TEXGEN_LINEAR_CLOBBER_S_T \ - BUG_FAIL_IF_CARRY_SET_AT_INIT -$(eval $(call ucode_rule)) - -NAME := F3DEX2_2.07 -DESCRIPTION := Rocket: Robot on Wheels -ID_STR := RSP Gfx ucode F3DEX fifo 2.07 Yoshitaka Yasumoto 1998 Nintendo. -MD5_CODE := 1523b8e38a9eae698b48909a0c0c0279 -MD5_DATA := 25be72ec04e2e6a23dfa7666645f0662 -OPTIONS := \ - BUG_FAIL_IF_CARRY_SET_AT_INIT -$(eval $(call ucode_rule)) - -NAME := F3DEX2_2.07_XBUS -DESCRIPTION := Lode Runner 3-D -ID_STR := RSP Gfx ucode F3DEX xbus 2.07 Yoshitaka Yasumoto 1998 Nintendo. -MD5_CODE := b882f402e115ffaf05a9ee44f354c441 -MD5_DATA := 71436bdc62d9263d5c2fefa783cffd4f -OPTIONS := \ - CFG_XBUS \ - BUG_FAIL_IF_CARRY_SET_AT_INIT -$(eval $(call ucode_rule)) - -NAME := F3DEX2_NoN_2.07 -DESCRIPTION := Not in retail games; NoN added to F3DEX2_2.07 -ID_STR := RSP Gfx ucode F3DEX.NoN fifo 2.07 Yoshitaka Yasumoto 1998 Nintendo. -OPTIONS := \ - CFG_NoN \ - BUG_FAIL_IF_CARRY_SET_AT_INIT -$(eval $(call ucode_rule)) - -NAME := F3DEX2_2.08 -DESCRIPTION := Banjo-Tooie -ID_STR := RSP Gfx ucode F3DEX fifo 2.08 Yoshitaka Yasumoto 1999 Nintendo. -MD5_CODE := 6ccf5fc392e440fb23bc7d7f7d71047c -MD5_DATA := 3a3a406acb4295d33fa6e918dd3a7ae4 -OPTIONS := -$(eval $(call ucode_rule)) - -NAME := F3DEX2_2.08_XBUS -DESCRIPTION := Power Rangers -ID_STR := RSP Gfx ucode F3DEX xbus 2.08 Yoshitaka Yasumoto 1999 Nintendo. -MD5_CODE := 38cbd8ef2cd168141347047cf7ec4fba -MD5_DATA := dcb9a145381557d146683ddb853c6cfd -OPTIONS := \ - CFG_XBUS -$(eval $(call ucode_rule)) - -NAME := F3DEX2_NoN_2.08 -DESCRIPTION := Not in retail games; NoN added to F3DEX2_2.08 -ID_STR := RSP Gfx ucode F3DEX.NoN fifo 2.08 Yoshitaka Yasumoto 1999 Nintendo. -MD5_CODE := b5c366b55a032f232aa309cda21be3d7 -MD5_DATA := 2c8dedc1b1e2fe6405c9895c4290cf2b -OPTIONS := \ - CFG_NoN -$(eval $(call ucode_rule)) - -NAME := F3DEX2_2.08PL -DESCRIPTION := Paper Mario -ID_STR := RSP Gfx ucode F3DEX fifo 2.08 Yoshitaka Yasumoto/Kawasedo 1999. -MD5_CODE := 6a5117e62e51d87020fb81dc493efcb6 -MD5_DATA := 1a6b826322aab9c93da61356af5ead40 -OPTIONS := \ - CFG_POINT_LIGHTING -$(eval $(call ucode_rule)) - -NAME := F3DEX2_NoN_2.08PL -DESCRIPTION := Not in retail games; NoN added to F3DEX2_2.08PL -ID_STR := RSP Gfx ucode F3DEX fifo 2.08 Yoshitaka Yasumoto/Kawasedo 1999. -OPTIONS := \ - CFG_NoN \ - CFG_POINT_LIGHTING -$(eval $(call ucode_rule)) - -NAME := F3DZEX_2.06H -DESCRIPTION := Not in retail games; nearclipping added to F3DZEX_NoN_2.06H -ID_STR := RSP Gfx ucode F3DZEX.NoN fifo 2.06H Yoshitaka Yasumoto 1998 Nintendo. -OPTIONS := \ - CFG_G_BRANCH_W \ - CFG_OLD_TRI_WRITE \ - BUG_WRONG_INIT_VZERO \ - BUG_FAIL_IF_CARRY_SET_AT_INIT -$(eval $(call ucode_rule)) - -NAME := F3DZEX_NoN_2.06H -DESCRIPTION := Ocarina of Time -ID_STR := RSP Gfx ucode F3DZEX.NoN fifo 2.06H Yoshitaka Yasumoto 1998 Nintendo. -MD5_CODE := 96a1a7a8eab45e0882aab9e4d8ccbcc3 -MD5_DATA := e48c7679f1224b7c0947dcd5a4d0c713 -OPTIONS := \ - CFG_G_BRANCH_W \ - CFG_NoN \ - CFG_OLD_TRI_WRITE \ - BUG_WRONG_INIT_VZERO \ - BUG_FAIL_IF_CARRY_SET_AT_INIT -$(eval $(call ucode_rule)) - -NAME := F3DZEX_2.08I -DESCRIPTION := Not in retail games; nearclipping added to F3DZEX_NoN_2.08I -ID_STR := RSP Gfx ucode F3DZEX.NoN fifo 2.08I Yoshitaka Yasumoto/Kawasedo 1999. -OPTIONS := \ - CFG_G_BRANCH_W \ - CFG_POINT_LIGHTING \ - BUG_WRONG_INIT_VZERO -$(eval $(call ucode_rule)) - -NAME := F3DZEX_NoN_2.08I -DESCRIPTION := Majora's Mask -ID_STR := RSP Gfx ucode F3DZEX.NoN fifo 2.08I Yoshitaka Yasumoto/Kawasedo 1999. -MD5_CODE := ca0a31df36dbeda69f09e9850e68c7f7 -MD5_DATA := d31cea0e173c6a4a09e4dfe8f259c91b -OPTIONS := \ - CFG_G_BRANCH_W \ - CFG_NoN \ - CFG_POINT_LIGHTING \ - BUG_WRONG_INIT_VZERO -$(eval $(call ucode_rule)) - -NAME := F3DZEX_2.08J -DESCRIPTION := Not in retail games; nearclipping added to F3DZEX_NoN_2.08J -ID_STR := RSP Gfx ucode F3DZEX.NoN fifo 2.08J Yoshitaka Yasumoto/Kawasedo 1999. -OPTIONS := \ - CFG_G_BRANCH_W \ - CFG_POINT_LIGHTING -$(eval $(call ucode_rule)) - -NAME := F3DZEX_NoN_2.08J -DESCRIPTION := Animal Forest -ID_STR := RSP Gfx ucode F3DZEX.NoN fifo 2.08J Yoshitaka Yasumoto/Kawasedo 1999. -MD5_CODE := a7f45433a67950cdd239ee40f1dd36c1 -MD5_DATA := f17544afa0dce84d589ec3d8c38254c7 -OPTIONS := \ - CFG_G_BRANCH_W \ - CFG_NoN \ - CFG_POINT_LIGHTING -$(eval $(call ucode_rule))