* buffers: refresh 15 and revert to base decomp * behavior script * color helper functions * extended bounds * egeo_layout * fixed model ids * camera conf improved * message panel ucode small * graph node * level script * mathutil updates * mathutil updates (allow unused funcs) * behaviors a - beta_fish * Add librtc and fix some data declarations * Move GRUCODE define to proper location in makefile * Refresh 15 * extra * Make ROM name smaller and change messages printed on build a bit * Fix console (lol) * Update UNF to latest master * Make ucode load from .o's (and also fix Super3D) * Fix crash with rumble + custom mario model * graph node and mathutil * removed behaviors * Ldtob documentation * _Putfld labeling * area * behavior actions * camera * debug updates * bubbles * envfx snow * farcall helpers * game init * geo misc * hud * only check if VC on render init * ingame menu * revert goddard to base decomp * insn disasm * interaction documentation * level geo * level update defines * macro special objects formatting changes * main.h documentation * map parser documentation & formatting * airborne documentation * mario actions automatic documentation * mario actions cutscene documentation * mario actions moving documentation and options * mario actions object documentation and options * mario stationary documentation * mario submerged documentation * mario misc documentation * mario step: ledge grab fixes and documentation * mario documentation * memory.h documentation * moving textures * object behaviors * object collision * fix flamethrower bug * object helpers * object list processor documentation * paintings * platform displacement * print / printf * puppycam absf * puppyprint updates and formatting changes * rendering graph node performance optimizations * rumble opt and doc * hqvm back to ultrasm64 * save file documentation and unlock defines * s2d engine * reset various files to ultrasm64 * file select * intro geo documentation * screen transition documentation * segment2.h * shadow overhaul * skybox refactor * sound init: clean up define usage + documentation * spawn object optimizations and documentation * spawn sound cleanup * sram to ultrasm64 * star select cleanup * title screen cleanup * dialogs / text * rename stomp smoke * stomp smoke -> small water splash * updated README * compilation flags * optimized file positions + support function/data sections * surface collision performance improvements * surface load optimizations * camera conf documentation * Allow easier command for opening puppyprint debug * Rearranged framebuffers & fixed puppyprint console printing * Fix shadow scaling and shifting * Fix SILHOUETTE, OBJECTS_REJ, and ucode loading, also clean up render phase system a bit. * Fixed build with BETTER_HANGING off * Clean up OBJECTS_REJ ifdefs * Fix duplicate comment & graph render layers/flags bitmask * Fixed build with BETTER_HANGING off * Fix Fast64 importing by reverting sSegmentTable change * Readded missing functions that caused build errors with Mario head enabled * Fixed clang compilation issues * Add INTER mode for geo_update_layer_transparency * Fix build warnings * bugfix: miscalculation in obj_turn_toward_object * Some puppytech fixes * Further Puppycamera fixes * Fix BUGFIX_DIALOG_TIME_STOP Fixes #136 * Fix sliding platform bparams * Add LEGACY_SHADOW_IDS define for Fast64 compatibility * Apply suggested changes * Better find_in_bounds_yaw_wdw_bob_thi ifdef * Fix build warnings for unused functions * Fixed stale reference bug from obj_mark_for_deletion change * Fixed incorrect digit for 100s #145 * Change groundpound-fix define and functionality to just disable bonking * Fixed puppyroll #134 * Adjust height value for terrain angle to kick in * fixed hi score flashing * Remove menudata backup (#131) Not considered important enough to keep * Fix fread() build warning * Add COURSE_NUM_TO_INDEX to save_file_get_star_flags check in bhv_unagi_init * Fix approach_s16 return value * Use boolean defines for oCapDoScaleVertically * Make the door lock a part of the key door model to eliminate z-fighting, also reduce z fighting on numbered doors with AUTO_LOD enabled. * Move flames to LAYER_TRANSPARENT_INTER * Resolved some compiler warnings and added FALL_THROUGH define (#168) * Address some more compiler warnings with different define toggles * Remove unnecessary fallthrough attribute * fixed geo_process_billboard floating point exception * Allow water to face any direction * Initialize focOffset so that BBH doesn't crash * Removed superfluous RDP commands when switching microcodes which would override scissor * Set OBJ_FLAG_DONT_CALC_COLL_DIST on bhvUkikiCage * Fix rumble build * Fixed UNLOCK_FPS strobing * Update src/game/object_helpers.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Update src/game/object_helpers.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Fix LEGACY_SHADOW_IDS id conflict * Use the vanilla default value for rotating fire bars if bparam2 is 0 * START_LEVEL safeguard * Fix some drawing distance issues caused by AUTO_COLLISION_DISTANCE * Fix rumble build * Fixed spline poll code using the wrong values for keyframes * Update readme with better credits Better credits for individual contributors * add arthur * added falco and moose * add fazana * le funny typo * added S2DEX engine to credits * silhouette + axo + ratio * remove specific callouts + add auto col distance * Update data/behavior_data.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Update data/behavior_data.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Update data/behavior_data.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Revert formatting changes to match vanilla decomp * Re-implement Y buffer for find_ceil * Re-implement POWER_STARS_HEAL for normal Power Stars * Start level comment & exit course comment/collapse * utilize reonucam technique for FAST_VERTICAL_CAMERA_MOVEMENT * Fix "MAX_REFERENCED_WALLS" typo * Allow stop_and_set_height_to_floor to work at any height if Mario is teleporting (#213) * Revert stop_and_set_height_to_floor to vanilla Fixes #208 * Fixed sAudioEnabled so that it disables audio CPU processing as well * Fixed puppyprint debug RDP us calculations * Renamed sAudioEnabled to gAudioEnabled * Replaced mtxf_to_mtx_asm with an equivalent implementation that supports WORLD_SCALE * Moved extended bounds and world scale configuration to a new config_world.h file * Default all objects to non-rej (#227) Fixes #221 (Default all objects to non-rej) * Fix #221 * Fix VISUAL_DEBUG breaking/crashing when OBJECTS_REJ is disabled (#211) * Fix VISUAL_DEBUG breaking/crashing when OBJECTS_REJ is disabled * Change vtl decrement in visual_surface_display from 6 to 3 Fixes #207 * Make area in SL igloo wider to prevent a softlock (#233) Fixes #210 * Fix coin formation coins being deleted if they spawn in the middle of a floor, also fix TTM slide coin position (#232) Fixes #201 * Make UNLOCK_ALL apply to more things * Fix wrong ifdef/ifndef in bhv_invisible_objects_under_bridge_init * Change chain chomp load/unload distances depending on number of segments (#237) Fixes #192 * added WATER_PLUNGE_UPWARP define * Add reonucam patch (#239) * added reonucam patch Fixes #218 * Fix how shadows handle water/transparency/height (#228) * Fix how shadows handle water/transparency/height * Change shadow check for flying carpets from a level specific check to a oPlatformOnTrackType check Fixes #179 * added reonucam credit * delete unnecesary patches * Apply suggested changes * murdered more patches * UNLOCK_ALL unlocks the cap boxes * UNLOCK_ALL unlocks cap boxes (slightly more epic edition) * revert ceil buffer * Renamed HD_INTRO_TEXTURES define, separated intro floombas * prevent double definition of floombas * actually prevent floomba redefinition * Develop/refactor default defines (#242) * Changed default config options * Added build dir to includePaths for pngs * disable NO_SLEEP by default * Disable puppyprint by default Sorry fazana 😔 * fix typos * add comment about BETTER_REVERB console perf * disable blue coin switch retry by default * Update config_audio.h Co-authored-by: Reonu <danileon95@gmail.com> Co-authored-by: Mr-Wiseguy <68165316+Mr-Wiseguy@users.noreply.github.com> * revert air step line to vanilla to fix bitfs scaling platform issue (#247) Fixes #200 * Fix stuttering on thin slopes (#248) * Fix stuttering on thin slopes * Revert vec3f_find_ceil calls to vanilla * Rename vec3f_find_ceil to find_mario_ceil * Update src/engine/surface_collision.h Fixes #249 * Swap static and dynamic surface checks back to vanilla order (#253) * Swap static and dynamic surface checks back to vanilla order * re-enable DISABLE_ALL config Fixes #251 #252 * Fixed save and quitting while in widescreen (#257) * Fixed save and quitting while in widescreen * use define for the level * all my homies hate ifdefs * skip wall offsets < 0 (#255) Fixes #255 * #264: Document non-stop stars' issues (#267) * #264: Document non-stop stars' issues * Update include/config/config_game.h * nonstop vanilla comment * derive margin_radius from radius after capping at 200 (#266) Fixes #259 * Config cleanup/refactor (#269) * Moved puppyprint define to graphics / rearranged some debug defines for ease of access * Moved compatibility safeguards to config_safeguards.h * spacing and comment formatting * #272 Move GFX_POOL_SIZE to config_graphics.h * disable EASIER_DIALOG_TRIGGER by default * prevent redefining warnings * small ifdef typo * changed ifndef to undefs Fixes #262 Fixes #272 * Improved movement config documentation related to turning around (#271) Fixes #270 * rename CUSTOM_DEBUG, add comments (#275) * Update README.md (#277) * v2.0.0 Co-authored-by: CrashOveride95 <crashoveride953@gmail.com> Co-authored-by: Arceveti <73617174+Arceveti@users.noreply.github.com> Co-authored-by: n64 <n64> Co-authored-by: Fazana <52551480+FazanaJ@users.noreply.github.com> Co-authored-by: Mr-Wiseguy <mrwiseguyromhacking@gmail.com> Co-authored-by: aglab2 <aglab3@gmail.com> Co-authored-by: gheskett <gheskett@gmail.com> Co-authored-by: Reonu <danileon95@gmail.com> Co-authored-by: Axollyon <20480418+Axollyon@users.noreply.github.com> Co-authored-by: Mr-Wiseguy <68165316+Mr-Wiseguy@users.noreply.github.com>
HackerSM64 
AFTER CLONING THE REPO, CHECK OUT THE include/config FOLDER BEFORE ANYTHING ELSE! THERE'S A LOT OF STUFF IN THIS REPO THAT CAN BE TOGGLED THERE.
HackerSM64 now has a discord server! https://discord.gg/brETAakcXr
This repo requires BOTH a US ROM and a JP ROM in order to build. Place baserom.us.z64 in the repo as usual and ALSO include baserom.jp.z64.
This repo needs gcc in order to be able to build it. To install it, run sudo apt install gcc-mips-linux-gnu
This is a fork of the ultrasm64 repo by CrashOveride which includes the following commonly used patches (patches marked with * are toggleable in the config files):
Credits
- ArcticJaguar725: Most audio configuration and layout changes, colored ia4 text, floombas, various bugfixes, and more
- CowQuack: Adjustable skybox sizes, area-specific skybox function
- thecozies: Water surface types, general maintenance, and time
- MrComit: General use object defines, JUMP_KICK_FIX, LEDGE_GRABS_CHECK_SLOPE_ANGLE
- aglab2: Bugfixes (particularly puppycam), refactor stuff
- someone2639: math.s and crash screen disam, stack trace, map packing, shiftable segments 2, S2DEX engine
- Arthurtilly: Platform Displacement 2
- Fazana: PuppyLib, ucode swapping, audio load time optimisations (with Arctic), general hacker qol improvements, visual debug
- Reonu: Starting the project/repo, widescreen, reonucam, various defines for hacker QoL
- JoshDuMan: Decomp guy, general assistance
- Arceveti: Silhouette, shadow optimisation, better hanging, breath meter
- axollyon: Console testing, bugfixes, idea-guying, and had a hand in silhouettes
- Wiseguy: World scale reimplementation, silhouette, graph node optimisations, instant input patch, cake screen fix, segmented code support, and various optimizations/fixes
- Kaze: Graph node optimisations, automatic optimal collision distance
- Pyro Jay: Texture improvements, repo banner art, some QoL stuff
- CrashOveride: creating the ultrasm64 repo
- falcobuster: Original coordinate overflow fix (world scale), ASM version of extended bounds
- anonymous_moose: porting falco's extended bounds to decomp
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). Instructions on how to use it are in the readme of that branch.
- Alternatively, the main repo has
Puppylightsavailable, which is a more lightweight, but limited lighting library intended to be used to modify existing light properties. You can look atpuppylights.cto find out how to use it.
Puppycam
- Puppycam is available on the master branch now, you can toggle it in
config/config_camera.h. *
Collision:
- Slope fix and exposed ceilings fix
- No false ledgegrabs fix *
- Jump kick fix *
- Configurable wallkick angle, in degrees *
- Possibility of disabling BLJs *
- Hanging fix (Mario can grab hangable ceilings from any state, instead of only jump or double jump) *
- Increased maximum pole length (The game will read bparam1 and bparam2 together as a single value, so you can have a very long pole) *
- Platform Displacement 2 by Arthurtilly *
- Water Surface Type patch by thecozies
- Better wall collision with rounded corners by FramePerfection, merged by Cheezepin & Arceveti
- Automatically calculate the optimal collision distance for an object based on its vertices, by Kaze *
Common Hack Changes:
- Better extended boundaries by anonymous_moose
- Mario head skip *
- Peach letter cutscene skip *
- Exit course while moving *
- Toggle to disable fall damage and the fall damage sound *
- Nonstop stars *
- Removed course-specific camera processing *
- You can increase the number of frames that you have to perform a firsty *
- Ability to set Mario's movement speed when hanging from a ceiling *
- Tighter hanging controls (Mario will face the direction of the analog stick directly while hanging from a ceiling) *
- reonucam3: custom camera by Reonu. This is included as a .patch file in the enhancements folder, you need to apply it if you want this camera. This video shows a rundown of the features: https://youtu.be/TQNkznX9Z3k
- Ability to disable Mario getting suck in snow or sand
Hacker QOL:
- Global, non-level based, star IDs (off by default) *
- Debug mode: prints mario's coordinates, angle and speed, and a FPS counter.
- Automatic console/emulator detection. If emulator is detected, LODs are disabled. *
- Ability to configure whether there's a 100 coin star at all and how many coins are required to spawn it *
- Ability to easily change the warp that EXIT COURSE takes you to via
config/config_menu.h, or disable it entirely. * - 16 bit model IDs by someone2639. This means you can have up to 65536 models (lol). You can set the maximum number of model IDs in
config/config_game.h. - Apply_patch.sh improved
- Removed the ifdef hell in
file_select.candingame_menu.c - Added Blake's custom function for object model stuff:
obj_set_modelandobj_has_model - Added function to get the model ID from an object:
obj_get_model_id(by Arceveti) - The "far" variable is now u16, allowing you to increase the farclip (the max distance at which geometry is rendered). However, when increasing the farclip, make sure to increase the nearclip by the same ratio, or rendering will break on console and LLE plugins.
- Many general use defines for object struct members, meant for use in custom object behaviors. Check
include/object_fields.hfor more info on this. (By MrComit) - Included
actors/group0.cinbehavior_data.c - The internal ROM name is now set with a define in
config/config_rom.hto make it simpler - There is a
gIsConsolevariable that is 1 when running on console and 0 when running on emulator. This way you can wrap your code in a console check. - Expanded audio heap allows for a larger concurrent note count and the importing of more m64 sequences and sound banks (By ArcticJaguar725) *
- You can set a test level in
config/config_debug.hin order to boot straight into it, so you can quickly test the level you're working on. * - Allow all surfaces in the game to have a
forceparameter. Activating this doesn't REQUIRE you to setforcefor every surface: If you don't set, it will default to 0x0000 rather than crashing. Increases RAM usage of collision. * - The clown font includes the entire English alphabet.
- Colored ia4 text support. Format:
"@XXXXXXXX[YOUR TEXT]@--------"(By ArcticJaguar725)- Example Text:
"@FF0000FFRED @00FF00FFGREEN @0000FFFFBLUE @FFFFFF00INVISIBLE @--------NORMAL" - NOTE: It is not mandatory to reset the text color with
"@--------", but text will need to be recolored each time it scrolls in a dialog box, or the custom color will reset.
- Example Text:
- Toggle visiblity of collision surfaces and object hitboxes with Visual Surface Debug.
config/config_debug.hhas VISUAL_DEBUG which can be turned on to enable this feature. - Workaround for infinite death loops caused by using the wrong warp type for death warps. Mario's HP will be restored when being warped to any warp if (and only if) he was warped while dead. *
Other Bugfixes:
- Castle music fix (fixes the castle music sometimes triggering after getting a dialog) *
- bparam4 fix (the game no longer uses bparam4 to check if an object is Mario and therefore you can safely use it)
- Instant warp offset fix (makes the instant warp offset work even when warping to a different area) *
- haveyourcake, also known as cake screen fix. Made by Wiseguy and ported/PR'd by Cheezepin
- Tree particle fix (Whether a tree uses snow particles or not is decided via the model IDs instead of the course number) *
- Adjustable world scale. You can change the geometry scaling of your level, which allow large levels to render correctly on console and LLE emulators while not hurting anything on HLE plugins.
- A couple vanilla texture fixes
- Smoke fix (the smoke texture uses the correct texture format)
Neat Misc. Changes:
- Instant Input patch by Wiseguy (Removes all input lag caused by plugins supporting framebuffer)
- This means that you'll have to do your framebuffer effects on buffer 0 for emulator, but NOT for console. You can use the
gIsConsolevariable to check for console when doing your framebuffer effects.
- This means that you'll have to do your framebuffer effects on buffer 0 for emulator, but NOT for console. You can use the
- Widescreen (16:9) support toggleable by pressing
Lin the pause menu. * - S2DEX engine by someone2639! To use it, compile with
make TEXT_ENGINE=s2dex_text_engineor just setTEXT_ENGINEtos2dex_text_enginein the makefile. - ia8 (64x64) coins, the vanilla coin texture is upgraded to accomodate. *
- ia8 (64x64) 30 FPS coins (Textures by InTheBeef, cleaned up by Arceveti). *
- Floombas! Simply just retextured goombas with customizable behaviors (does not overwrite standard goombas). *
- HD texture support for intro splash screen (with floombas if enabled). *
- Mario's silhouette is shown when behind most surfaces (By Frame#5375, Axollyon, AloXado320, Wiseguy, Arceveti) *
- Skybox size modifier. You can have 2x, 3x and 4x size skyboxes (you can select the skybox size in
config/config_graphics.h.) Please note that this might affect console performance, especially 4x mode. 2x or 3x mode is recommended if aiming for console. By CowQuack * - You can set the black border size to different values for console and emulator. It's set to 0 by default for both. *
- This repo supports a much better implementation of reverb over vanilla's fake echo reverb. Great for caves or eerie levels, as well as just a better audio experience in general. See
audio/synthesis.cfor more details and configuration info. (By ArcticJaguar725) * - Fazana's "puppyprint" text engine. *
- Use
print_small_textto print normal text. The two last params are aligment and how many characters to print (-1 means PRINT_ALL). - Use
render_multi_imageto draw large texture rectangles consisting of multiple images on the screen. - More info in
puppyprint.c
- Use
- Wiseguy's Farcall TLB mapping allows to store executable code inside uncompressed segments, that can be loaded and ran as needed, instead of it having to be loaded at all times. See
farcall.hin the include folder for instructions and details.
UltraSM64
- This repo contains a full decompilation of Super Mario 64 (J), (U), (E), and (SH).
- Naming and documentation of the source code and data structures are in progress.
- It has been edited to allow for the usage of the final "N64 OS" library, version
2.0L - Shindou Rumble Pak code is on for all regions.
- Targeting the iQue Player is supported.
- Saving to 32kbyte/256kbit SRAM is supported.
- Newer compression options are supported.
- UNFLoader (flashcart USB library) is supported, allowing for debugging on EverDrive/64Drive.
- It has been patched with someone2639's shiftable segments patch
- Wiseguy's instant input patch has been added to allow for less input lag on emulation (Does not affect console) 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
gIsConsolevariable 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.
Additional Prerequisites
BinPNG (the CI texture converter) requires some python3 dependencies. Use pip to install them.
pip install pypng bitstring
UNFLoader support
The repository supports UNFLoader for debugging.
To build with UNF, run make with UNF=1.
Further instructions can be found at the official repository
NOTE: Closing the UNFLoader window will result in your game eventually hanging due to lacking a USB device to send messages to, so beware of that
Multi-Save support
The repository supports SRAM in addition to EEPROM. The standard save data functions are #ifdef'd to accommedate this.
To build with SRAM support, run make with SAVETYPE=sram.
I may attempt FlashRAM in the future.
Multi-Console support
The repository supports targeting the iQue Player in addition to the N64. The iQue libultra is NOT compatible with N64 in many ways, so it is currently NOT possible to have one build for both consoles.
To target iQue, run make with the CONSOLE=bb argument.
Compression
The repo also supports RNC (Rob Northen Compression). RNC has two methods.
Method 1 is designed to compress as small as possible, while method 2 is designed so that decompression is as fast as possible.
Method 1 is the current default, and is the best all-rounder in terms of speed and ratio.
Both methods are fast. Method 1 has better compression than 2, so I suggest using method 1 if using RNC.
To switch to RNC, run make with either COMPRESS=rnc1 or COMPRESS=rnc2, depending on preferred method.
The repository also supports using DEFLATE compression. This boasts a better compression ratio, but at a slight cost to load times. On average I'd estimate that the bottleneck on decompression is about 1-2 seconds.
To switch to gzip, run make with the COMPRESS=gzip argument.
The repo also supports gziping with libdeflate-gzip. This compresses at a slightly better ratio than standard gzip, with no real downside from a decompression standpoint.
To use libdeflate-gzip, first clone the repo, then make and make install it.
Then run make for sm64 with GZIPVER=libdef in addition to COMPRESS=gzip
The repo also supports building a ROM with no compression.
This is not recommended as it increases ROM size significantly, with little point other than load times decreased to almost nothing.
To switch to no compression, run make with the COMPRESS=uncomp argument.
FAQ
Q: Why in the hell are you bundling your own build of ld?
A: Newer binutils (Like the one bundled with Ubuntu, 2.34) break linking with libultra builds due to local asm symbols.
This puts me at a crossroads of either touching leaked code and requiring GCC, or just using an older linker that works just fine.
I went with the latter. Thanks to "someone2639" for this hacky-ass idea
Q: Will this allow me to use FlashRAM/Transfer Pak/microcode swapping/Other Cool N64 Features?
A: Theoretically, all yes.
Installation help
Go read the original SM64 repo README.md