Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
2365d35
F3DZEX to object file
Jul 3, 2024
99ab140
Microcode selection to config_graphics.h
Jul 3, 2024
ac508b6
Remove build options display.
Jul 3, 2024
d708e61
Microcode massacre
Jul 3, 2024
9ae367b
Total HVQM death
Jul 3, 2024
bf86d4e
Remove S2DEX engine
Jul 3, 2024
2ad4031
Use enumatered F3DEX selector
Jul 3, 2024
ed382ea
ditto
Jul 3, 2024
c5979e0
Fix F3DEX build
Jul 3, 2024
1736a99
Remove hvqm remnants
Jul 3, 2024
dc100c2
fix mislabeled config safeguard entry
Jul 3, 2024
d682a8d
Rename L3DZEX2
Jul 3, 2024
7bfd7ed
Add preliminary F3DEX3 support
Jul 3, 2024
371878c
.
Jul 3, 2024
d9c1ad2
Simplify grucode pointers
Jul 3, 2024
e2038c2
Decringify i guess?
Jul 3, 2024
326f93e
Remove gs2dex includes
Jul 3, 2024
14195ae
.
Jul 3, 2024
e84c7d6
fixed newlines in cfg
Jul 3, 2024
731cd26
Fix lighting direction for F3DEX3
Jul 4, 2024
10cc802
Add WIP F3DEX3 performance profiler
Jul 4, 2024
22d5d09
wtf
Jul 4, 2024
9c6e4eb
Fix config issues
Jul 5, 2024
b2e8f8b
Move F3DEX3 CPU functionality to a dedicated file
Jul 5, 2024
e3d7871
Readme credit
Jul 5, 2024
aac5cc7
Use new profiler controls
Jul 9, 2024
8c2d9bd
Restore config
Jul 9, 2024
da6cea3
update ex3 version + fix lvp error
Nov 21, 2024
5c1fba0
F3DEX3 update (real)
Nov 21, 2024
c78af91
Fix area.c viewport
Jan 7, 2025
22bae3a
add buffer clear optimizations
Jan 7, 2025
cf9da2e
fix non ex3 viewport
Jan 7, 2025
8af3114
goddard fixes
Jan 7, 2025
ae47349
fix memset in game_init.c label
Jan 7, 2025
3dbca60
ending screen viewport fix
Jan 7, 2025
999d092
finish goddard for now
Jan 14, 2025
0e7eac0
Remove redundant check for lookat calculation
Jan 14, 2025
a6eb26e
Add gSPCameraWorld for ingame graphics
Jan 14, 2025
79382a4
Use G_LIGHTING_SPECULAR for reflective surfaces
Jan 14, 2025
0f86221
add define for ex3 memclear, more specular changes
Jan 15, 2025
b7f084b
Add disable instant input config
Jan 15, 2025
6a11806
cfb clear coverage reset
Jan 15, 2025
17a1dc7
workaround for memclear cfb oddity
Jan 15, 2025
097c55f
Add specular shading to DDD
Jan 15, 2025
a60c070
fix framebuffer garbage on goddard load
Jan 15, 2025
75af330
ditto
Jan 16, 2025
8139d63
ditto
Jan 16, 2025
f19b3ed
fix goddard renderer typo in cameraworld apply
Jan 16, 2025
7c6577b
cleanup lookat code
Jan 18, 2025
c429527
Merge pull request #3 from mountainflaw/testingg
mountainflaw Jan 18, 2025
34933c5
Merge branch 'develop/3.0.0' into ucode_to_cfg
mountainflaw Jan 18, 2025
20e2f0c
Update config.h
mountainflaw Jan 18, 2025
7a8ec2d
ttc speculars
Jan 18, 2025
8e04820
Add simple F3DEX3 lighting engine
Jan 22, 2025
09077f3
Sort linked list before render to render closest to mario point light…
Jan 22, 2025
6b0041b
fix lightnum bug
Jan 22, 2025
5181c0f
code cleanup
Jan 22, 2025
d9df6ec
fix ex2 build
Jan 22, 2025
12a8906
Update lighting engine info
Jan 22, 2025
668b4f7
Remove F3DEX support
Jan 22, 2025
c5970a3
use bcopy for struct data transfer in lighting engine
Jan 22, 2025
aad6fcc
delete debug stuff for lighting engine
Jan 22, 2025
86e91cc
Remove RSP memclear
Jan 22, 2025
da9f1f1
lighting engine: stop early with no lights
Jan 22, 2025
76ac54b
Add F3DEX3 lighting engine documentation
Jan 22, 2025
be4543d
Fix end credits
Jan 22, 2025
ae338f2
Merge pull request #4 from mountainflaw/testingg
mountainflaw Jan 22, 2025
64f1a13
remove actor specular
Jan 22, 2025
f3aef6c
level unspecularize
Jan 22, 2025
bde273d
Merge pull request #5 from mountainflaw/testingg
mountainflaw Jan 22, 2025
c4ef74b
despecularized segment2
Jan 22, 2025
b0be4c2
Merge pull request #6 from mountainflaw/testingg
mountainflaw Jan 22, 2025
700032a
restore config
Jan 23, 2025
72a709d
defuck spacing
Jan 23, 2025
e5cdea5
ditto
Jan 23, 2025
80421a2
game
Jan 23, 2025
3f15721
bring back the cringe
Jan 23, 2025
ba3cafb
cleanup goddard lookat
Jan 23, 2025
6f16075
Fix lighting engine bug
Jul 28, 2025
de6ac1a
beta
Jul 28, 2025
3168141
remove instant input global def
Jul 28, 2025
5cc9673
reduce ifdefs in sm64.ld
Jul 29, 2025
d9735b3
goddard clean
Aug 1, 2025
bb242af
fixed it for you aglab
Aug 1, 2025
a96fa7d
a
Aug 1, 2025
3d46772
fix warning with profiler enabled
Aug 2, 2025
4b7970c
opsie
Aug 2, 2025
06dcbe8
fix nits
Aug 2, 2025
da9c5ca
remove the most useless fucking folder ever
Aug 2, 2025
ea28355
Merge branch 'develop/3.0.0' into ucode_to_cfg
mountainflaw Aug 2, 2025
270d2ce
makefile cleanup
Aug 2, 2025
3b90744
opsie2
Aug 2, 2025
cebb959
more profiler changes from zelda, add flush
Aug 3, 2025
a863282
Fix tools makefile
Aug 4, 2025
3aa49e3
github conversations go brrrr
Aug 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2157,8 +2157,6 @@ lib/libs2d_engine.a
!/lib/n64/*.a
!/lib/ique/*.a

!/lib/PR/hvqm/*.o

# .orig files
*.orig

Expand Down
73 changes: 5 additions & 68 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ CONSOLE ?= n64
$(eval $(call validate-option,CONSOLE,n64 bb))

ifeq ($(CONSOLE),n64)
INCLUDE_DIRS += include/n64
LIBS_DIR := lib/n64
else ifeq ($(CONSOLE),bb)
INCLUDE_DIRS += include/ique
LIBS_DIR := lib/ique
DEFINES += BBPLAYER=1
endif
Expand Down Expand Up @@ -94,42 +92,6 @@ DEBUG_MAP_STACKTRACE_FLAG := -D DEBUG_MAP_STACKTRACE

TARGET := sm64


# GRUCODE - selects which RSP microcode to use.
# f3dex -
# f3dex2 -
# l3dex2 - F3DEX2 version that only renders in wireframe
# f3dzex - newer, experimental microcode used in Animal Crossing
# super3d - extremely experimental version of Fast3D lacking many features for speed
GRUCODE ?= f3dzex
$(eval $(call validate-option,GRUCODE,f3dex f3dex2 f3dex2pl f3dzex super3d l3dex2))

ifeq ($(GRUCODE),f3dex) # Fast3DEX
DEFINES += F3DEX_GBI=1 F3DEX_GBI_SHARED=1
else ifeq ($(GRUCODE),f3dex2) # Fast3DEX2
DEFINES += F3DEX_GBI_2=1 F3DEX_GBI_SHARED=1
else ifeq ($(GRUCODE),l3dex2) # Line3DEX2
DEFINES += L3DEX2_GBI=1 L3DEX2_ALONE=1 F3DEX_GBI_2=1 F3DEX_GBI_SHARED=1
else ifeq ($(GRUCODE),f3dex2pl) # Fast3DEX2_PosLight
DEFINES += F3DEX2PL_GBI=1 F3DEX_GBI_2=1 F3DEX_GBI_SHARED=1
else ifeq ($(GRUCODE),f3dzex) # Fast3DZEX (2.08J / Animal Forest - Dōbutsu no Mori)
DEFINES += F3DZEX_NON_GBI_2=1 F3DEX_GBI_2=1 F3DEX_GBI_SHARED=1
else ifeq ($(GRUCODE),super3d) # Super3D
$(warning Super3D is experimental. Try at your own risk.)
DEFINES += SUPER3D_GBI=1 F3D_NEW=1
endif

# TEXT ENGINES
# s2dex_text_engine - Text Engine by someone2639
TEXT_ENGINE := none
$(eval $(call validate-option,TEXT_ENGINE,none s2dex_text_engine))

ifeq ($(TEXT_ENGINE), s2dex_text_engine)
DEFINES += S2DEX_GBI_2=1 S2DEX_TEXT_ENGINE=1
SRC_DIRS += src/s2d_engine
endif
# add more text engines here

#==============================================================================#
# Optimization flags #
#==============================================================================#
Expand Down Expand Up @@ -243,15 +205,6 @@ else
DEFINES += _FINALROM=1 NDEBUG=1 OVERWRITE_OSPRINT=0
endif

# HVQM - whether to use HVQM fmv library
# 1 - includes code in ROM
# 0 - does not
HVQM ?= 0
$(eval $(call validate-option,HVQM,0 1))
ifeq ($(HVQM),1)
DEFINES += HVQM=1
SRC_DIRS += src/hvqm
endif

# LIBPL - whether to include libpl library for interfacing with Parallel Launcher
# (library will be pulled into repo after building with this enabled for the first time)
Expand Down Expand Up @@ -422,8 +375,7 @@ SOUND_SEQUENCE_FILES := \
O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \
$(foreach file,$(CPP_FILES),$(BUILD_DIR)/$(file:.cpp=.o)) \
$(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o)) \
$(foreach file,$(GENERATED_C_FILES),$(file:.c=.o)) \
lib/PR/hvqm/hvqm2sp1.o lib/PR/hvqm/hvqm2sp2.o
$(foreach file,$(GENERATED_C_FILES),$(file:.c=.o))

LIBZ_O_FILES := $(foreach file,$(LIBZ_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
GODDARD_O_FILES := $(foreach file,$(GODDARD_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
Expand Down Expand Up @@ -454,7 +406,7 @@ else
$(error Unable to detect a suitable MIPS toolchain installed)
endif

LIBRARIES := nustd hvqm2 z goddard
LIBRARIES := nustd z goddard

LINK_LIBRARIES = $(foreach i,$(LIBRARIES),-l$(i))

Expand Down Expand Up @@ -492,15 +444,10 @@ ifeq ($(LD), tools/mips64-elf-ld)
endif
endif

ifeq ($(TARGET_N64),1)
TARGET_CFLAGS := -nostdinc -DTARGET_N64 -D_LANGUAGE_C
CC_CFLAGS := -fno-builtin
endif
TARGET_CFLAGS := -nostdinc -DTARGET_N64 -D_LANGUAGE_C
CC_CFLAGS := -fno-builtin

INCLUDE_DIRS += include $(BUILD_DIR) $(BUILD_DIR)/include src . include/hvqm
ifeq ($(TARGET_N64),1)
INCLUDE_DIRS += include/libc
endif
INCLUDE_DIRS := include include/n64 include/libc $(BUILD_DIR) $(BUILD_DIR)/include src .

C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
Expand Down Expand Up @@ -598,10 +545,6 @@ endef
all: $(ROM)
@$(SHA1SUM) $(ROM)
@$(PRINT) "${BLINK}Build succeeded.\n$(NO_COL)"
@$(PRINT) "==== Build Options ====$(NO_COL)\n"
@$(PRINT) "${GREEN}Version: $(BLUE)$(VERSION)$(NO_COL)\n"
@$(PRINT) "${GREEN}Microcode: $(BLUE)$(GRUCODE)$(NO_COL)\n"
@$(PRINT) "${GREEN}Console: $(BLUE)$(CONSOLE)$(NO_COL)\n"

clean:
$(RM) -r $(BUILD_DIR_BASE)
Expand Down Expand Up @@ -643,7 +586,6 @@ patch: $(ROM)
$(BUILD_DIR)/asm/ipl3.o: $(IPL3_RAW_FILES)
$(BUILD_DIR)/src/game/crash_screen.o: $(CRASH_TEXTURE_C_FILES)
$(BUILD_DIR)/src/game/version.o: $(BUILD_DIR)/src/game/version_data.h
$(BUILD_DIR)/lib/aspMain.o: $(BUILD_DIR)/rsp/audio.bin
$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl $(SOUND_BIN_DIR)/sound_data.tbl $(SOUND_BIN_DIR)/sequences.bin $(SOUND_BIN_DIR)/bank_sets
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h

Expand Down Expand Up @@ -846,11 +788,6 @@ $(BUILD_DIR)/%.o: %.s
$(call print,Assembling:,$<,$@)
$(V)$(CROSS)gcc -c $(ASMFLAGS) $(foreach i,$(INCLUDE_DIRS),-Wa,-I$(i)) -x assembler-with-cpp -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<

# Assemble RSP assembly code
$(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s
$(call print,Assembling:,$<,$@)
$(V)$(RSPASM) -sym $@.sym $(RSPASMFLAGS) -strequ CODE_FILE $(BUILD_DIR)/rsp/$*.bin -strequ DATA_FILE $(BUILD_DIR)/rsp/$*_data.bin $<

# Run linker script through the C preprocessor
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) $(BUILD_DIR)/goddard.txt
$(call print,Preprocessing linker script:,$<,$@)
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin
- **anonymous_moose**: porting falco's extended bounds to decomp
- **tuxlovesyou**: `LOAD_MIO0_TEXTURE` macro and moral support
- **devwizard**: the PJ64 pre-v3.0 detection part of the emulator detector
- **Sauraen**: Creating the F3DEX3 microcode. HackerSM64 implementation by red.

Thanks to Frame#5375 and AloXado320 for also helping with silhouette stuff

**Lighting Engine by Wiseguy**
- Lighting Engine is available on a separate branch ([base/lighting-engine](https://github.com/Reonu/HackerSM64/tree/base/lighting-engine)). Instructions on how to use it are in the readme of that branch.
**Lighting Engine by red**
- A new lighting engine for the F3DEX3 is included with the repository. Enable `F3DEX3_LIGHTING_ENGINE` within `config_graphics.h` to use.
- Improvements to the older lighting engine by wiseguy:
- Support for variable number of directional lights at once.
- Support for vanilla actors.
- Limits you to up to 7 extra lights when setup this way (`gLightNumBase = NUMLIGHTS_3`), but for scenes tailored specifically for a lighting engine (`gLightNumBase = NUMLIGHTS_1`), you can have up to 9 variable lights.
- Ambient light does not count towards the light limit.
- F3DEX3 fixes point lights with kc < 8, allowing for more expressive lighting.
- F3DEX3 also fixes point light behavior when close to triangles.
- See `src/game/f3dex3.c` for more details.

**Puppycam**
- Puppycam is available on the master branch now, you can toggle it in `config/config_camera.h`. *
Expand Down Expand Up @@ -137,7 +146,6 @@ Thanks to Frame#5375 and AloXado320 for also helping with silhouette stuff
This does mean that any framebuffer effects will have to be done on buffer 0 if targeting emulators
- Automatic console and emulator detection: Use the `gEmulator` variable to wrap your code in an emulator check.
- Separate defines for emulator and console black border height.
- Getting HVQM FMV support to work with the game is WIP.

Requirements are the same as regular SM64, however a GCC MIPS cross compiler is also required. If you're on Debian-like Linux, you can use the ``gcc-mips-linux-gnu`` package. The toolchain that comes with my SDK is also supported.

Expand Down
7 changes: 0 additions & 7 deletions data/capcom.s

This file was deleted.

6 changes: 6 additions & 0 deletions include/config/config_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@
* Intentionally crash the game whenever a runtime assertion fails (also invoked by the DEBUG define in the Makefile).
*/
#define DEBUG_ASSERTIONS

/**
* Enable F3DEX3 profiling tool. Hold L + C Down to display and cycle through profiler views.
* Using pages 2, 3, and 4 can disable certain F3DEX3 features. Read the F3DEX3 README for more information.
*/
// #define DEBUG_F3DEX3_PROFILER
27 changes: 27 additions & 0 deletions include/config/config_graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,30 @@
* Only use this if you can test the difference of your hack with and without this change on console.
*/
// #define USE_FRUSTRATIO2

/**
* Primary graphics microcode selection
* Define F3DEX_VERSION as one of the following to select the primary graphics microcode:
* 2 - F3DZEX2 - (Majora's Mask version). HLE emulator compatible, good console performance.
* 3 - F3DEX3 - Created by Sauraen. Better console performance in most situations.
* All microcodes provided by HackerSM64 use the "NoN" (no near-field clipping) variants.
* A built-in profiler is available for F3DEX3 and can be enabled inside config/config_debug.h
* under DEBUG_F3DEX3_PROFILER.
*/
#define F3DEX_VERSION 2

/**
* Enables usage of the line microcode. It can be loaded with gSPLoadUcode within a display list.
* This feature is not available for use with F3DEX3.
*/

// #define ENABLE_LINE_UCODE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, is there any legitimate reason to not just ship this by default with EX2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean it would be an extra 8 KB of RAM wasted

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But is 8kb really worth an entire config define? That's 2 textures.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not just in the makefile isnt that where it was before


/**
* Enables F3DEX3 point lighting engine.
* Replaces the lighting engine branch.
* See README.md and src/game/f3dex3.c for more details.
* NOTE: Game looks visually identical if not setup.
*/
#define F3DEX3_LIGHTING_ENGINE

37 changes: 37 additions & 0 deletions include/config/config_safeguards.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@
#undef BETTER_REVERB
#endif

/*****************
* config_graphics.h
*/

#ifdef F3DEX_VERSION
#if F3DEX_VERSION == 2
#define F3DEX_GBI_2
#elif F3DEX_VERSION == 3
#define F3DEX_GBI_3
#else
#error "Invalid microcode selection. Valid options are 2-3 inclusive."
#endif
#else
#error "F3DEX_VERSION is not defined in config/config_graphics.h"
#endif

#ifdef ENABLE_LINE_UCODE
#if F3DEX_VERSION > 2
#undef ENABLE_LINE_UCODE
#warning "F3DEX3 does not support ENABLE_LINE_UCODE, so it will be disabled."
#endif
#endif

#if !defined(F3DEX_GBI_3) && defined(F3DEX3_LIGHTING_ENGINE)
#undef F3DEX3_LIGHTING_ENGINE
#endif // F3DEX3_LIGHTING_ENGINE

/*****************
* config_debug.h
*/
Expand Down Expand Up @@ -112,6 +139,15 @@
#define UNLOCK_ALL
#endif // COMPLETE_SAVE_FILE

#ifdef DEBUG_F3DEX3_PROFILER
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be undef'd whenever DISABLE_ALL is enabled

#ifdef F3DEX_GBI_3
#undef PUPPYPRINT
#define PUPPYPRINT
#else
#undef DEBUG_F3DEX3_PROFILER
#endif
#endif // DEBUG_F3DEX3_PROFILER

#ifdef DEBUG
#undef DEBUG_ASSERTIONS
#define DEBUG_ASSERTIONS
Expand Down Expand Up @@ -206,3 +242,4 @@
#undef BORDER_HEIGHT_EMULATOR
#define BORDER_HEIGHT_EMULATOR 0
#endif // !TARGET_N64

Loading