Compare commits

..

84 Commits

Author SHA1 Message Date
someone2639
93a0816b6c Add system capabilities variable that tracks individual features instead of broad emulator support (#907)
Also implements check for FBE.

* start implementing selftest

* add some more

* gSupportsLibpl destroyed

* SYS_SUPPORTS -> SYSCAP

* add emux check

* make it compile

* play around with it until it writes the ASM i want

* format

* explain what im doing

* hopefully guard emux

* one feedback

* two feedback

* better libpl check

* better comment

* resolve some feedbackg

* add FBE check

* dont need to skip this check if its only for the first frame'

* skip framebuffer check if on a system that we know supports it.

* document that nothing in the repo has emux yet

* goodbye emux

* feed1

* various detectable

---------

Co-authored-by: someone2639 <someone2639@gmail.com>
2026-01-17 01:52:48 -05:00
Gregory Heskett
85b72619e4 Bugfix: Floating platform in JRB rises instead of sinks when Mario stands on its edge (#924)
This was introduced back in 2021 by some very absolutely quite small changes :)
2026-01-17 01:51:24 -05:00
LucretiaArc
9500f7a8d7 Fix build errors and warnings (#926)
* Close .assets-local.txt before attempting to remove it in extract_assets.py
* Bare $(MAKE) doesn't work if the path to make has spaces, so quote it
* Suppress warning for unused parameter in Flips.cpp
* Don't override OS environment variable, since it broke MinGW
* Specify extension for aiff_extract_codebook target, fixes dependency order for MinGW
2026-01-17 01:51:06 -05:00
someone2639
e206d4477c Fix getGoddardSize so that any arbitrary build folder can be used (#915)
* fix getGoddardSize

* newline

* HOW did this get in here

---------

Co-authored-by: someone2639 <someone2639@gmail.com>
2026-01-17 01:50:46 -05:00
Gregory Heskett
63250a04fb Replace render_multi_image() with draw_sprite() (#914)
* Replace render_multi_image() with draw_sprite()

This function is more stable and can handle more use cases than render_multi_image() could. It can handle fractional scaling and also doesn't suffer from the seams that ParaLLEl displays when upscaling texrects.

It does have some minor drawbacks though, mainly that it doesn't handle the complete displaylist for the user (mainly to allow customization of primitives outside of the function). It also isn't currently as optimized as render_multi_image() was for combiner and render modes (also copy mode does not render correctly).

Neither function supports rendering of CI textures still.

* Add additional comments and documentation to draw_sprite function
2026-01-17 01:50:23 -05:00
Denis Kopyrin
d20112107c Fixed incorrect RDP sync in act select menu (#920)
DPRenderMode is not allowed to be changed before DPPipeSync is done.
This causes crashes on act select with F3DEX3 during tri draw before.
2026-01-08 14:53:24 -05:00
arthurtilly
29a402dbb1 Change optimization flags (#916)
This saves about 90KB of RAM in the code segment

When Kaze found out we still use Ofast his response was "LOL"

Never listen to Fazana ever again

I did this PR through github file editor out of spite
2025-11-19 01:14:37 -05:00
Gregory Heskett
8bb943d533 Tie Bowser key celebration to key model rather than course ID (#913)
This should allow people to put course-exiting ordinary stars into Bowser courses without playing a key animation. Similarly, this will allow Bowser fights to exist in ordinary levels without playing the standard star animation on level exit. Save flags for keys still need to be handled manually in these cases though.
2025-11-07 09:22:28 -05:00
someone2639
76559c07f7 fish behavior level check -> param check (#906)
* Make fish SA check into a bparam2 flag

* light docs; rename the bp flag

* actually rename the thing

---------

Co-authored-by: Arceveti <73617174+Arceveti@users.noreply.github.com>
Co-authored-by: someone2639 <someone2639@gmail.com>
2025-11-06 23:44:00 -05:00
Gregory Heskett
83426bae74 Do not apply config_local.h if DISABLE_ALL is active (#909)
It does not make sense to apply a config that doesn't even exist upstream for a release build.
2025-11-06 23:39:17 -05:00
Denis Kopyrin
233d105662 Fix deflate buffers overrunning decompressor context (#897)
* Fix deflate buffers overrunning decompressor context

* Add NULL checks

---------

Co-authored-by: Gregory Heskett <gheskett@gmail.com>
2025-11-06 03:54:21 -05:00
LucretiaArc
cf88d09f5e Debug fly improvements (#908)
* Prevent interference between debug fly and other uses of dpad, dejank debug fly camera transitions

* Better whitespace

* Move extern to puppyprint.h

* This bothered Arctic
2025-11-05 18:07:04 -05:00
Anoliah
533d1ddaa2 Add vanilla cam processing ifdef to vanilla camera trigger arrays (#912) 2025-11-05 02:38:20 -05:00
bicyclesoda
e513c7272f Enforce gnu17 standard (#875)
Supported by both GCC and clang (https://clang.llvm.org/docs/UsersManual.html#extensions-supported-by-clang).

Currently, C23 cannot build this repo and apparently the consensus is to support C/gnu17 for the time being anyways.
2025-11-05 02:12:44 -05:00
someone2639
6589012fe5 Only run ROM extraction tools once on every make invocation (#902)
* add makefile util function to extract all assets

* indent

* start leveraging multiple-export functionality in extract_assets

* find-rom util; use the native hash library in detect-baseroms

* look back on my variable naming decisions with shame

* more docs; remove debug prints

* what if i just have detect_baseroms list the roms

* beef up usage string in extract_assets

* only one python invocation now; fix failure condition

* remove commented hashlib

* give it a last documentation pass

* warning fix that doesnt happen on my end

* long

---------

Co-authored-by: someone2639 <someone2639@gmail.com>
2025-11-02 19:39:34 -05:00
Christopher Dieringer
3af936f6de fix: more resilient toolchain detection (#901) 2025-11-01 04:26:49 -04:00
Anoliah
cbd0c05447 rework vanilla camera overrides (#873) 2025-10-31 15:20:47 +13:00
LuigiXHero
8f4b5b99c9 Stopgap readme fix (#871)
* Update README.md

Replaces the super out of date build instructions with a link to the wiki. As a stopgap before the readme rewrite.

* Restore UNFLoader section

Arctic said to

* Change rom requirements in readme
2025-10-30 11:24:00 +13:00
Gregory Heskett
94bfaff1ae Fix deflate warnings for the last time hopefully (#895)
Missed this one
2025-07-07 22:14:23 -04:00
someone2639
da18d323f4 fix armips compile error (#894)
* fix armips

* oops

---------

Co-authored-by: someone2639 <someone2639@gmail.com>
2025-07-04 01:04:59 -04:00
Denis Kopyrin
2dd4171fee Remove more gzip complaining lines (#893) 2025-07-03 13:20:08 -04:00
Denis Kopyrin
3c65ad1fed Fixed gzip to work with gcc15 & macOS ARM (#892) 2025-07-03 20:55:47 +08:00
Denis Kopyrin
39d0ccb412 Add new GZIP DEFLATE decompressor/compressor (#850) 2025-07-02 00:37:50 -04:00
Gregory Heskett
a334872dec Move all music samples to instruments folder and add instrument compatibility tables for legacy and Refresh 16 (#883)
Placing all music samples in the same folder allows for samples like Bowser organ and the course_select 'la' samples to be used among other samples (extended soundbank should be updated eventually to take advantage of this). Compatibility tables additionally allow for use of both legacy soundbanks and those designed around Refresh 16 (instruments folder only).
2025-07-01 02:42:58 -04:00
Gregory Heskett
e8e4210406 Fix uninitialized variable warning with GCC 14 (#884) 2025-07-01 02:40:25 -04:00
Denis Kopyrin
72f200653b Fixed gcc15 build (#891) 2025-07-01 02:39:47 -04:00
Gregory Heskett
e43749b254 Add debug asserts for exceeding GFX and audio pool sizes (#876) 2025-06-21 03:27:44 -04:00
Gregory Heskett
67ab8512b7 Switch to the ED header to support UNFLoader save type autodetection + newer flashcarts (#858)
* Force save type for UNFLoader

This fixes save type not being autodetected on SC64 with EEP4K due to the non-ED cartridge ID. Changing from SM to ED is a last resort, as emulators or other flashcarts have no means of autodetecting whether a ROM is an SM64 hack otherwise.

* Rely on ED header for UNFLoader autodetection of save type instead
2025-06-21 03:24:19 -04:00
Fallden4
2c15b0e642 Infinite stairs warp is disabled when UNLOCK_ALL is defined (#881)
* Make it so the infinite stairs warp is disabled when UNLOCK_ALL is defined

* match indentation

* Infinite stairs music is not played if UNLOCK_ALL is defined

* Address requested changes

---------

Co-authored-by: htauk <htauktechy@proton.me>
Co-authored-by: Gregory Heskett <gheskett@gmail.com>
2025-06-21 02:44:51 -04:00
Matt Pharoah
3edf4bc593 Add support for realtime clock (#889) 2025-06-20 14:09:07 -04:00
Matt Pharoah
48ecd1da98 Fixed make patch (#870) 2025-02-25 18:26:26 -05:00
arthurtilly
e1486216d7 Clean up and simplify emutest.c, and change instant input to a whitelist (#868)
* Simplify emutest.c

* add mupen check back

* change return type

* some more cleanup

* changed gEmulator to u8
2025-02-16 02:14:09 -05:00
LucretiaArc
50b773d9ed Fix chuckya grab escape 2025-02-05 00:31:27 -05:00
Gregory Heskett
a4f6c95360 Add support for variadic debug assertions (#857)
Additionally clean up some crash screen display issues and add automatic newlining to assertions when they run past the edge of the screen
2025-01-29 20:36:19 -05:00
LucretiaArc
dc212c24f7 Add geo command for cylindrical billboarding (#856)
* Add cylindrical billboard geo command

* oops

* add room for layers

* Make cylindrical billboarding part of GEO_CMD_NODE_BILLBOARD, remove node pos option

* use the correct billboarding type this time, formatting

* Rename GEO_BILLBOARD mode parameter, combine mtxf_billboard variants

* funny register

* Adjust comments to better explain cylindrical billboarding, debug assert to check axis when using it
2025-01-25 16:00:27 -05:00
Gregory Heskett
aef3252921 Bugfix (Vanilla): Warping to cake screen in area other than Area 1 crashes the game (#844)
This also simultaneously fixes same-area exit course crashes, although that has already been dealt with by enforcing level warps (which is probably the preferred solution anyway).
2025-01-19 18:16:30 -05:00
Gregory Heskett
d3a104ac39 Bugfix: Sign range half of what it was in vanilla (#855)
Also fix a compiler warning in lz4tpack.c
2025-01-19 18:16:02 -05:00
Denis Kopyrin
8281d4bc23 Remove use of math inline assembly that can be generated with fast math (#853) 2025-01-19 06:25:14 -05:00
Matt Pharoah
bb60f2d851 Update libpl1 (#851) 2025-01-19 06:19:38 -05:00
Fazana
3f579629c8 Add support for building on ARM64 MacOS (#854)
* preliminary attempt

* simplify a bit

* oops

* Move declaration

* error out if you try to make patch

* style fix

* Update Makefile

* I hate makefile

* Update Makefile
2025-01-19 06:17:45 -05:00
Denis Kopyrin
d43157c82c Added racing DMA LZ4 & LZ4T implementations (#824)
* compression: added racing DMA LZ4 & LZ4T implementations

* debug: added reworked level load time measurement

* Get rid of LZ4, updated LZ4T to latest version

* lz4t: remove LIKELY/UNLIKLELY use, optimized slow decompressor for size

* lz4t: remove pointless goto

* lz4t: remove function macros, use static inlines instead

* perf: rework measurements for level loads to be more accurate

* perf: avoid hardcoded constants in time calculations
2024-12-29 19:33:28 +08:00
Gregory Heskett
ff82298b31 Place stack canaries behind DEBUG_ASSERTIONS instead of DEBUG (#843) 2024-11-11 01:33:05 -05:00
LucretiaArc
c46fa2d090 Support pre word-swapped textures, fix puppyprint rendering for lowercase z and tilde, minor font fixes (#838)
* Fix puppyprint rendering lowercase z and tilde, minor font fixes

* Add support for generating pre word swapped textures

* Use image for fasttext font texture

* Adjustments to fasttext font and puppyprint outline font
2024-11-04 21:11:01 -05:00
Lila
c4c18b3d0e Check for opensuse's cross mips gcc package (#842)
Makes it possible to rely on the official repo.
Ideally the following instructions would also be added to the wiki for opensuse:
```
sudo zypper install cross-mips-binutils git capstone pkgconf python311 cross-mips-gcc14
# install packages under devel_basis, equivalent to build-essential in deb
sudo zypper install --type pattern devel_basis
```
2024-10-31 14:08:08 -04:00
thecozies
7298e94a1f reset adjacent rooms when loading a new area (#704) 2024-09-05 01:48:26 -04:00
Gregory Heskett
27d328f86a Dialogs in dialogs.h no longer have to be in order (#832) 2024-09-05 01:13:05 -04:00
Gregory Heskett
27372fe74a Merge pull request #795 from gheskett/develop/2.3.0_update-unf
Update to newest UNF (d5f2ad100b76e372036453f8d25f9b6fbbbd2d1a) (November 22, 2023)
2024-09-05 01:07:23 -04:00
Reonu
3f1f7f41be Add Arthurtilly to the CODEOWNERS file (#821)
* Add Arthurtilly to the CODEOWNERS file

* Update CODEOWNERS file to list each global owner on the same line

This should (allegedly) fix the issues of only the last entry being treated as an owner for reviews.

* Remove thecozies from CODEOWNERS file :(

---------

Co-authored-by: Gregory Heskett <gheskett@gmail.com>
2024-09-04 23:24:02 -04:00
Denis Kopyrin
bf70500b4d Merge pull request #825 from Lilaa3/fast64-repo-settings
Add Fast64 repo settings file (fast64.json)
2024-09-05 07:51:25 +08:00
Lila
27fedee76f Update fast64.json 2024-09-04 10:38:21 +01:00
Lila
a918785a92 Aglab requested change 2024-08-25 19:26:57 +01:00
Lila
10720ea056 Fall back on fast64 default draw layers 2024-08-24 13:05:36 +01:00
Lila
8dc47095e2 Add repo settings file
Allows fast64 to know a repo's ideal settings as soon as decomp path is picked.
Settings are the default except for:
Matstack is on
Microcode is set to EX2
Force Extended RAM is off because hackersm64 already has it enabled by default
Refresh is set to Refresh 13
2024-08-19 15:44:53 +01:00
Gregory Heskett
e3472e05cf Add option for .local/share/HackerSM64/UNFLoader-dir.txt
This allows referencing a custom UNFLoader path to be used, ideally for placing on the C drive for WSL instances. UNFLoader tends to hang for an unbearably long time when saved somewhere within the WSL directory structure, and simply using the Linux build isn't an option because it can't access Windows USB devices trivially.
2024-08-03 19:57:50 -04:00
Gregory Heskett
74cb8ce062 Update to newest UNF (d5f2ad100b76e372036453f8d25f9b6fbbbd2d1a) (November 22 2023) 2024-08-03 19:33:09 -04:00
Gregory Heskett
9ef945296b HackerSM64 Release: v2.3.0
Merge pull request #815 from HackerN64/develop/2.3.0
2024-07-03 23:05:21 -04:00
Gregory Heskett
e1c00d4bef HackerSM64 v2.3.0 2024-07-03 22:50:27 -04:00
Reonu
aacf2c5e6d Add more audio banks and add some occasional mappings for audio macros (#777)
* Add more audio banks and add some occasional mappings for audio macros

* Remove config define for extra sound banks

---------

Co-authored-by: gheskett <gheskett@gmail.com>
2024-07-03 22:50:27 -04:00
Gregory Heskett
4500ffb579 Bugfix: assemble_sound.py build corruption issues (#813) 2024-07-03 22:50:27 -04:00
Gregory Heskett
a6782e6912 Fix seg faulting issue with MinGW build system, most likely caused by use of execl (#812) 2024-07-03 22:50:27 -04:00
Denis Kopyrin
750ba10cb1 Fixed audiofile warnings properly (#814)
* Revert "Fixed audiofile warnings (#811)"

This reverts commit 500507509b.

* Fixed audiofile warnings properly
2024-07-03 22:50:01 -04:00
Denis Kopyrin
500507509b Fixed audiofile warnings (#811) 2024-07-01 21:53:54 -04:00
Gregory Heskett
7381e35db4 Bugfix: Surfaces not able to be placed at the beginning of a partition (#805)
* Bugfix: Surfaces not able to be placed at the beginning of a partition

* Replace clear_spacial_partition calls with a bzero
2024-07-01 21:48:26 -04:00
Gregory Heskett
6a3e7e7a87 Bugfix: Missed purging of debug box flags that no longer exist in Puppycam (#804) 2024-07-01 21:47:38 -04:00
Gregory Heskett
9adb8c6de8 EASIER_LONG_JUMPS: only long jump with A+Z while running (#801)
Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
2024-07-01 21:47:15 -04:00
Gregory Heskett
03ba81b5e3 Improve DEATH_ON_EXIT_COURSE define (#808) 2024-07-01 21:46:46 -04:00
Gregory Heskett
98b6231216 Pressing L in debug fly mode heals Mario (#809) 2024-07-01 21:46:12 -04:00
Denis Kopyrin
252a900b91 Added support for windows MinGW build (#800) 2024-07-01 21:45:36 -04:00
Denis Kopyrin
92822c6412 fixlights: added support for ripgrep (#802) 2024-07-01 21:44:54 -04:00
1ted59
0221d4ddf0 Fix spawned coins not being collectible until after the peak of their arc (#806)
If a spawned coin lands on the same frame it hits the peak of its arc, it will never have vertical speed < 0, so it will never be collectible.

Making this also set the coin to tangible if it has 0 speed fixes this issue.
2024-06-14 16:16:10 -04:00
Gregory Heskett
dcd58b2aad Restart music upon set_background_music() call if BETTER_REVERB preset changes (#797) 2024-06-01 10:55:58 -04:00
Denis Kopyrin
7ffa9a3bd7 Fixed fixlights.py compile error on python 3.12 (#798)
* Fixed fixlights.py compile error on python 3.12

* Fixed assemble_sound.py compile error on python 3.12
2024-05-22 13:48:24 -04:00
lolbinarycat
dbba4871e1 Add mips64-none-elf- to automatically detected prefixes (#799)
Co-authored-by: binarycat <binarycat@envs.net>
2024-05-18 02:11:10 -04:00
Gregory Heskett
520a6f3aed Bugfix: Blue coin duplication (#787)
Blue coins can be collected more than once if collected on the final frame of the switch timer when BLUE_COIN_SWITCH_RETRY is enabled. Fixing this on its own isn't enough though, as the blue coin switch also doesn't check for whether that coin was collected when it resets.
2024-05-03 01:54:43 -04:00
bicyclesoda
4d260f6885 Use G_TF_POINT on 3D billboard numbers (#791)
This matches the HUD filtering and just looks better IMO.
2024-04-30 23:19:20 -04:00
Gregory Heskett
aedae64e8b Remove destination warp node requirement (#788)
Also add assertions for common warp crashes and remove the hardcoded get_mario_spawn_type table size
2024-04-30 23:10:58 -04:00
bicyclesoda
f3e1496d29 Change test emulator from mupen64plus to parallel-launcher (#790)
* mupen64plus -> parallel-launcher

* Add WSL support

* Update Makefile

make it work
2024-04-29 16:42:13 -07:00
arthurtilly
0005bbbd6a Save up to 130KB of RAM at literally zero cost (#786) 2024-04-21 20:40:47 -04:00
Gregory Heskett
e494069b0a Add support for a user-defined config_local.h file (#785)
This allows hack collaborators to toggle debug features such as TEST_LEVEL without the need of pushing it up and negatively impacting other hack contributors. This is also useful for general HackerSM54 development, since it may be desirable to have PUPPYPRINT_DEBUG enabled by default or to not have to worry about pushing config defines up to a development branch that risk getting merged later on.

To use, simply create a new config_local.h file and place it in the config folder. Add #pragma once to the top of the file and add all the defines you wish! If you wish for something to be undefined when it's enabled by default, simply use #undef as opposed to a commented out #define. Use a combination of #undef and #define if you wish to change an existing value of a define. This local configuration will be completely ignored if DISABLE_ALL is being used in config_debug.h.

Regarding HackerSM64 Development: All feature developers are still responsible for making sure their features work in all scenarios regardless of whatever they have toggled in this file by default. This config file may be convenient but it is not an excuse to not properly test your changes!
2024-04-21 20:38:07 -04:00
arthurtilly
f852ff4359 Platform Displacement 2.1 (#776) 2024-04-22 09:14:12 +12:00
Gregory Heskett
2ae3426957 Change compression type to yay0 and ignore .inc.c files in most directories (#784)
rnc1 has noticeably slower load times in vanilla than yay0 does. gzip and mio0 are pretty useless and can be yeeted from the repo, but that's not part of this PR's scope.
2024-04-21 17:13:47 -04:00
Reonu
ca937d23ee Label unlabelled audio func (func_80321080 to stop_secondary_music) (#782) 2024-04-15 01:59:54 +01:00
Matt Pharoah
7353db562c Merge pull request #774 from mpharoah/mpharoah/update-libpl
Update libpl
2024-03-06 17:28:42 -05:00
Matt Pharoah
82e0fdf391 Update libpl 2024-03-06 09:10:09 -05:00
178 changed files with 22520 additions and 6667 deletions

9
.gitignore vendored
View File

@@ -979,10 +979,6 @@ levels/wmotr/1.rgba16.png
levels/wmotr/2.rgba16.png
levels/wmotr/3.rgba16.png
levels/wmotr/4.rgba16.png
sound/samples/bowser_organ/00_organ_1.aiff
sound/samples/bowser_organ/01_organ_1_lq.aiff
sound/samples/bowser_organ/02_boys_choir.aiff
sound/samples/course_start/00_la.aiff
sound/samples/instruments/00.aiff
sound/samples/instruments/01_banjo_1.aiff
sound/samples/instruments/02.aiff
@@ -1059,7 +1055,6 @@ sound/samples/instruments/45b_la.aiff
sound/samples/instruments/46_pizzicato_strings_1.aiff
sound/samples/instruments/47_pizzicato_strings_2.aiff
sound/samples/instruments/48_steel_drum.aiff
sound/samples/piranha_music_box/00_music_box.aiff
sound/samples/sfx_1/00_twirl.aiff
sound/samples/sfx_1/01_brushing.aiff
sound/samples/sfx_1/02_hand_touch.aiff
@@ -2149,3 +2144,7 @@ lib/libs2d_engine.a
# :Zone_Identifier files
*Zone.Identifier
# user-specific config file
include/config/config_local.h
.DS_Store

View File

@@ -2,9 +2,7 @@
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in the repo.
* @Reonu
* @thecozies
* @gheskett
* @Reonu @gheskett @arthurtilly
# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners

194
Makefile
View File

@@ -67,7 +67,7 @@ else ifeq ($(SAVETYPE),sram)
DEFINES += SRAM=1
endif
DEFINES += NO_ERRNO_H=1 NO_GZIP=1
DEFINES += NO_ERRNO_H=1
# VERSION - selects the version of the game to build
# jp - builds the 1996 Japanese version
@@ -135,7 +135,7 @@ endif
#==============================================================================#
# Default non-gcc opt flags
DEFAULT_OPT_FLAGS = -Ofast -falign-functions=32
DEFAULT_OPT_FLAGS = -Os -ffinite-math-only -fno-signed-zeros -fno-math-errno
# Note: -fno-associative-math is used here to suppress warnings, ideally we would enable this as an optimization but
# this conflicts with -ftrapping-math apparently.
# TODO: Figure out how to allow -fassociative-math to be enabled
@@ -269,12 +269,10 @@ BUILD_DIR_BASE := build
# BUILD_DIR is the location where all build artifacts are placed
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_$(CONSOLE)
COMPRESS ?= rnc1
$(eval $(call validate-option,COMPRESS,mio0 yay0 gzip rnc1 rnc2 uncomp))
COMPRESS ?= lz4t
$(eval $(call validate-option,COMPRESS,mio0 yay0 lz4t gzip rnc1 rnc2 uncomp))
ifeq ($(COMPRESS),gzip)
DEFINES += GZIP=1
LIBZRULE := $(BUILD_DIR)/libz.a
LIBZLINK := -lz
else ifeq ($(COMPRESS),rnc1)
DEFINES += RNC1=1
else ifeq ($(COMPRESS),rnc2)
@@ -283,13 +281,12 @@ else ifeq ($(COMPRESS),yay0)
DEFINES += YAY0=1
else ifeq ($(COMPRESS),mio0)
DEFINES += MIO0=1
else ifeq ($(COMPRESS),lz4t)
DEFINES += LZ4T=1
else ifeq ($(COMPRESS),uncomp)
DEFINES += UNCOMPRESSED=1
endif
GZIPVER ?= std
$(eval $(call validate-option,GZIPVER,std libdef))
# Whether to hide commands or not
VERBOSE ?= 0
ifeq ($(VERBOSE),0)
@@ -314,36 +311,18 @@ PYTHON := python3
ifeq ($(filter clean distclean print-%,$(MAKECMDGOALS)),)
# Make sure assets exist
# Extract assets if necessary
NOEXTRACT ?= 0
ifeq ($(NOEXTRACT),0)
DUMMY != $(PYTHON) extract_assets.py us >&2 || echo FAIL
DUMMY != $(PYTHON) extract_assets.py >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets from US ROM)
endif
ifneq (,$(shell python3 tools/detect_baseroms.py jp))
DUMMY != $(PYTHON) extract_assets.py jp >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets from JP ROM)
endif
endif
ifneq (,$(shell python3 tools/detect_baseroms.py eu))
DUMMY != $(PYTHON) extract_assets.py eu >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets from EU ROM)
endif
endif
ifneq (,$(shell python3 tools/detect_baseroms.py sh))
DUMMY != $(PYTHON) extract_assets.py sh >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to extract assets from SH ROM)
endif
$(error Failed to extract assets from found baseroms)
endif
endif
# Make tools if out of date
$(info Building tools...)
DUMMY != $(MAKE) -s -C $(TOOLS_DIR) >&2 || echo FAIL
DUMMY != "$(MAKE)" -s -C $(TOOLS_DIR) >&2 || echo FAIL
ifeq ($(DUMMY),FAIL)
$(error Failed to build tools)
endif
@@ -373,7 +352,6 @@ BUILD_DIR_BASE := build
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_$(CONSOLE)
ROM := $(BUILD_DIR)/$(TARGET_STRING).z64
ELF := $(BUILD_DIR)/$(TARGET_STRING).elf
LIBZ := $(BUILD_DIR)/libz.a
LD_SCRIPT := sm64.ld
YAY0_DIR := $(BUILD_DIR)/bin
SOUND_BIN_DIR := $(BUILD_DIR)/sound
@@ -382,7 +360,7 @@ ACTOR_DIR := actors
LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
# Directories containing source files
SRC_DIRS += src src/boot src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound
SRC_DIRS += src src/boot src/boot/deflate src/game src/engine src/audio src/menu src/buffers lib/librtc actors levels bin data assets asm lib sound
LIBZ_SRC_DIRS := src/libz
GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists
BIN_DIRS := bin bin/$(VERSION)
@@ -394,11 +372,13 @@ include Makefile.split
LEVEL_C_FILES := $(wildcard levels/*/leveldata.c) $(wildcard levels/*/script.c) $(wildcard levels/*/geo.c)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) $(LEVEL_C_FILES)
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
LIBZ_C_FILES := $(foreach dir,$(LIBZ_SRC_DIRS),$(wildcard $(dir)/*.c))
GODDARD_C_FILES := $(foreach dir,$(GODDARD_SRC_DIRS),$(wildcard $(dir)/*.c))
S_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.s))
GENERATED_C_FILES := $(BUILD_DIR)/assets/mario_anim_data.c $(BUILD_DIR)/assets/demo_data.c
# Ignore all .inc.c files
C_FILES := $(filter-out %.inc.c,$(C_FILES))
# Sound files
SOUND_BANK_FILES := $(wildcard sound/sound_banks/*.json)
SOUND_SAMPLE_DIRS := $(wildcard sound/samples/*)
@@ -420,34 +400,18 @@ O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \
$(foreach file,$(GENERATED_C_FILES),$(file:.c=.o)) \
lib/PR/hvqm/hvqm2sp1.o lib/PR/hvqm/hvqm2sp2.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))
# Automatic dependency files
DEP_FILES := $(O_FILES:.o=.d) $(LIBZ_O_FILES:.o=.d) $(GODDARD_O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d
DEP_FILES := $(O_FILES:.o=.d) $(GODDARD_O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d
#==============================================================================#
# Compiler Options #
#==============================================================================#
# detect prefix for MIPS toolchain
ifneq ($(call find-command,mips64-elf-ld),)
CROSS := mips64-elf-
else ifneq ($(call find-command,mips-n64-ld),)
CROSS := mips-n64-
else ifneq ($(call find-command,mips64-ld),)
CROSS := mips64-
else ifneq ($(call find-command,mips-linux-gnu-ld),)
CROSS := mips-linux-gnu-
else ifneq ($(call find-command,mips64-linux-gnu-ld),)
CROSS := mips64-linux-gnu-
else ifneq ($(call find-command,mips-ld),)
CROSS := mips-
else
$(error Unable to detect a suitable MIPS toolchain installed)
endif
CROSS := $(call find-mips-toolchain)
LIBRARIES := nustd hvqm2 z goddard
LIBRARIES := nustd hvqm2 goddard
LINK_LIBRARIES = $(foreach i,$(LIBRARIES),-l$(i))
@@ -463,16 +427,18 @@ else ifeq ($(COMPILER),clang)
CC := clang
CXX := clang++
endif
# Prefer gcc's cpp if installed on the system
ifneq (,$(call find-command,cpp-10))
CPP := cpp-10
ARCH := $(shell uname -p)
# Check processor architecture. ARM users need a different binutils package.
ifeq ($(ARCH), arm)
LD := tools/mips64-elf-ld-arm
else
CPP := cpp
endif
ifneq ($(call find-command,mips-n64-ld),)
LD := mips-n64-ld
else
LD := tools/mips64-elf-ld
ifneq ($(call find-command,mips-n64-ld),)
LD := mips-n64-ld
else
LD := tools/mips64-elf-ld
endif
endif
AR := $(CROSS)ar
OBJDUMP := $(CROSS)objdump
@@ -498,8 +464,20 @@ endif
C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
# Prefer gcc's cpp if installed on the system
ifneq (,$(call find-command,clang))
CPP := clang
CPPFLAGS := -E -P -x c -Wno-trigraphs $(DEF_INC_CFLAGS)
else ifneq (,$(call find-command,cpp-10))
CPP := cpp-10
CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS)
else
CPP := cpp
CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS)
endif
# C compiler options
CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
CFLAGS = -std=gnu17 -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
ifeq ($(COMPILER),gcc)
CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra
CFLAGS += -Wno-missing-braces
@@ -515,7 +493,6 @@ ASFLAGS := -march=vr4300 -mabi=32 $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(fore
RSPASMFLAGS := $(foreach d,$(DEFINES),-definelabel $(subst =, ,$(d)))
# C preprocessor flags
CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS)
#==============================================================================#
# Miscellaneous Tools #
@@ -524,6 +501,8 @@ CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS)
# N64 tools
YAY0TOOL := $(TOOLS_DIR)/slienc
MIO0TOOL := $(TOOLS_DIR)/mio0
LZ4TPACK := $(TOOLS_DIR)/lz4tpack
DEFLATEPACK := $(TOOLS_DIR)/deflatepack
RNCPACK := $(TOOLS_DIR)/rncpack
FILESIZER := $(TOOLS_DIR)/filesizer
N64CKSUM := $(TOOLS_DIR)/n64cksum
@@ -537,24 +516,34 @@ EXTRACT_DATA_FOR_MIO := $(TOOLS_DIR)/extract_data_for_mio
SKYCONV := $(TOOLS_DIR)/skyconv
FIXLIGHTS_PY := $(TOOLS_DIR)/fixlights.py
FLIPS := $(TOOLS_DIR)/flips
ifeq ($(GZIPVER),std)
GZIP := gzip
else
GZIP := libdeflate-gzip
endif
# Use the system installed armips if available. Otherwise use the one provided with this repository.
ifneq (,$(call find-command,armips))
RSPASM := armips
else
RSPASM := $(TOOLS_DIR)/armips
endif
EMULATOR = mupen64plus
EMU_FLAGS =
ifneq (,$(call find-command,wslview))
LOADER = ./$(TOOLS_DIR)/UNFLoader.exe
EMULATOR = "/mnt/c/Program Files (x86)/parallel-launcher/parallel-launcher.exe"
else
LOADER = ./$(TOOLS_DIR)/UNFLoader
EMULATOR = parallel-launcher
endif
EMU_FLAGS =
# Adding a txt file to this location will then reference a UNFLoader path specified in the file, instead of locally.
# This is expecially important for WSL users because UNFLoader.exe is incredibly slow when run within WSL's filesystem, so this can be used to point to the C drive.
# The file should only contain the directory path that contains UNFLoader[.exe] (do not specify the filename).
LOADER_DIR_FILE_SPECIFICATION_PATH = ~/.local/share/HackerSM64/UNFLoader-dir.txt
LOADER_DIR = ./$(TOOLS_DIR)
ifneq (,$(wildcard $(LOADER_DIR_FILE_SPECIFICATION_PATH)))
LOADER_DIR = $(shell cat $(LOADER_DIR_FILE_SPECIFICATION_PATH))
endif
ifneq (,$(call find-command,wslview))
UNFLOADER_EXEC = $(LOADER_DIR)/UNFLoader.exe
else
UNFLOADER_EXEC = $(LOADER_DIR)/UNFLoader
endif
SHA1SUM = sha1sum
@@ -595,12 +584,12 @@ clean:
$(RM) -r $(BUILD_DIR_BASE)
rebuildtools:
$(MAKE) -C tools distclean
$(MAKE) -C tools
"$(MAKE)" -C tools distclean
"$(MAKE)" -C tools
distclean: clean
$(PYTHON) extract_assets.py --clean
$(MAKE) -C $(TOOLS_DIR) clean
"$(MAKE)" -C $(TOOLS_DIR) clean
test: $(ROM)
$(EMULATOR) $(EMU_FLAGS) $<
@@ -610,26 +599,33 @@ test-pj64: $(ROM)
# someone2639
# download and extract most recent unfloader build if needed
$(LOADER):
ifeq (,$(wildcard $(LOADER)))
$(UNFLOADER_EXEC):
ifeq (,$(wildcard $(UNFLOADER_EXEC)))
@$(PRINT) "Downloading latest UNFLoader...$(NO_COL)\n"
$(PYTHON) $(TOOLS_DIR)/get_latest_unfloader.py $(TOOLS_DIR)
$(PYTHON) $(TOOLS_DIR)/get_latest_unfloader.py $(LOADER_DIR)
endif
load: $(ROM) $(LOADER)
$(LOADER) -r $<
load: $(ROM) $(UNFLOADER_EXEC)
$(UNFLOADER_EXEC) -r $<
unf: $(ROM) $(LOADER)
$(LOADER) -d -r $<
unf: $(ROM) $(UNFLOADER_EXEC)
$(UNFLOADER_EXEC) -d -r $<
libultra: $(BUILD_DIR)/libultra.a
patch: $(ROM)
$(FLIPS) --create --bps $(shell python3 tools/detect_baseroms.py $(VERSION)) $(ROM) $(BUILD_DIR)/$(TARGET_STRING).bps
ifeq ($(shell uname), Darwin)
ifeq ($(MAKECMDGOALS), patch)
$(error "The 'make patch' command is not supported on macOS.")
endif
else
$(FLIPS) --create --bps "$(shell python3 tools/detect_baseroms.py $(VERSION))" "$(ROM)" "$(BUILD_DIR)/$(TARGET_STRING).bps"
endif
# Extra object file dependencies
$(BUILD_DIR)/asm/ipl3.o: $(IPL3_RAW_FILES)
$(BUILD_DIR)/src/game/crash_screen.o: $(CRASH_TEXTURE_C_FILES)
$(BUILD_DIR)/src/game/fasttext.o: $(FASTTEXT_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
@@ -641,11 +637,6 @@ endif
$(CRASH_TEXTURE_C_FILES): TEXTURE_ENCODING := u32
ifeq ($(COMPILER),gcc)
$(BUILD_DIR)/src/libz/%.o: OPT_FLAGS := -Os
$(BUILD_DIR)/src/libz/%.o: CFLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-pointer-sign
endif
ifeq ($(VERSION),eu)
TEXT_DIRS := text/de text/us text/fr
@@ -686,7 +677,7 @@ $(BUILD_DIR)/src/game/rendering_graph_node.o: OPT_FLAGS := $(GRAPH_NODE_OPT_FLAG
# $(info MATH_UTIL_OPT_FLAGS: $(MATH_UTIL_OPT_FLAGS))
# $(info GRAPH_NODE_OPT_FLAGS: $(GRAPH_NODE_OPT_FLAGS))
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) asm/debug $(GODDARD_SRC_DIRS) $(LIBZ_SRC_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) rsp include) $(YAY0_DIR) $(addprefix $(YAY0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) asm/debug $(GODDARD_SRC_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) rsp include) $(YAY0_DIR) $(addprefix $(YAY0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)
# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)
@@ -709,9 +700,13 @@ $(BUILD_DIR)/%: %.png
$(call print,Converting:,$<,$@)
$(V)$(N64GRAPHICS) -s raw -i $@ -g $< -f $(lastword $(subst ., ,$@))
$(BUILD_DIR)/%.preswap.inc.c: %.preswap.png
$(call print,Converting:,$<,$@)
$(V)$(N64GRAPHICS) -s $(TEXTURE_ENCODING) -i $@ -g $< -f $(lastword ,$(subst ., ,$*)) -S
$(BUILD_DIR)/%.inc.c: %.png
$(call print,Converting:,$<,$@)
$(V)$(N64GRAPHICS) -s $(TEXTURE_ENCODING) -i $@ -g $< -f $(lastword ,$(subst ., ,$(basename $<)))
$(V)$(N64GRAPHICS) -s $(TEXTURE_ENCODING) -i $@ -g $< -f $(lastword ,$(subst ., ,$*))
# Color Index CI8
$(BUILD_DIR)/%.ci8.inc.c: %.ci8.png
@@ -759,6 +754,8 @@ else ifeq ($(COMPRESS),yay0)
include compression/yay0rules.mk
else ifeq ($(COMPRESS),mio0)
include compression/mio0rules.mk
else ifeq ($(COMPRESS),lz4t)
include compression/lz4trules.mk
else ifeq ($(COMPRESS),uncomp)
include compression/uncomprules.mk
endif
@@ -769,7 +766,7 @@ endif
$(BUILD_DIR)/%.table: %.aiff
$(call print,Extracting codebook:,$<,$@)
$(V)$(AIFF_EXTRACT_CODEBOOK) $< >$@
$(V)$(AIFF_EXTRACT_CODEBOOK) $< $@
$(BUILD_DIR)/%.aifc: $(BUILD_DIR)/%.table %.aiff
$(call print,Encoding ADPCM:,$(word 2,$^),$@)
@@ -887,13 +884,8 @@ $(BUILD_DIR)/libgoddard.a: $(GODDARD_O_FILES)
@$(PRINT) "$(GREEN)Linking libgoddard: $(BLUE)$@ $(NO_COL)\n"
$(V)$(AR) rcs -o $@ $(GODDARD_O_FILES)
# Link libz
$(BUILD_DIR)/libz.a: $(LIBZ_O_FILES)
@$(PRINT) "$(GREEN)Linking libz: $(BLUE)$@ $(NO_COL)\n"
$(V)$(AR) rcs -o $@ $(LIBZ_O_FILES)
# SS2: Goddard rules to get size
$(BUILD_DIR)/sm64_prelim.ld: sm64.ld $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/libgoddard.a $(BUILD_DIR)/libz.a
$(BUILD_DIR)/sm64_prelim.ld: sm64.ld $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/libgoddard.a
$(call print,Preprocessing preliminary linker script:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -DPRELIMINARY=1 -DBUILD_DIR=$(BUILD_DIR) -DULTRALIB=lib$(ULTRALIB) -MMD -MP -MT $@ -MF $@.d -o $@ $<
@@ -903,7 +895,7 @@ $(BUILD_DIR)/sm64_prelim.elf: $(BUILD_DIR)/sm64_prelim.ld
$(BUILD_DIR)/goddard.txt: $(BUILD_DIR)/sm64_prelim.elf
$(call print,Getting Goddard size...)
$(V)python3 tools/getGoddardSize.py $(BUILD_DIR)/sm64_prelim.map $(VERSION)
$(V)python3 tools/getGoddardSize.py $(BUILD_DIR)/sm64_prelim.map $(BUILD_DIR)
$(BUILD_DIR)/asm/debug/map.o: asm/debug/map.s $(BUILD_DIR)/sm64_prelim.elf
$(call print,Assembling:,$<,$@)
@@ -911,9 +903,9 @@ $(BUILD_DIR)/asm/debug/map.o: asm/debug/map.s $(BUILD_DIR)/sm64_prelim.elf
$(V)$(CROSS)gcc -c $(ASMFLAGS) $(foreach i,$(INCLUDE_DIRS),-Wa,-I$(i)) -x assembler-with-cpp -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
# Link SM64 ELF file
$(ELF): $(BUILD_DIR)/sm64_prelim.elf $(BUILD_DIR)/asm/debug/map.o $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BUILD_DIR)/libz.a $(BUILD_DIR)/libgoddard.a
$(ELF): $(BUILD_DIR)/sm64_prelim.elf $(BUILD_DIR)/asm/debug/map.o $(O_FILES) $(YAY0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BUILD_DIR)/libgoddard.a
@$(PRINT) "$(GREEN)Linking ELF file: $(BLUE)$@ $(NO_COL)\n"
$(V)$(LD) --gc-sections -L $(BUILD_DIR) -T $(BUILD_DIR)/$(LD_SCRIPT) -T goddard.txt -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L$(LIBS_DIR) -l$(ULTRALIB) -Llib $(LINK_LIBRARIES) -u sprintf -u osMapTLB -Llib/gcclib/$(LIBGCCDIR) -lgcc -lrtc
$(V)$(LD) --gc-sections -L $(BUILD_DIR) -T $(BUILD_DIR)/$(LD_SCRIPT) -T goddard.txt -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -L$(LIBS_DIR) -l$(ULTRALIB) -Llib $(LINK_LIBRARIES) -u sprintf -u osMapTLB -Llib/gcclib/$(LIBGCCDIR) -lgcc
# Build ROM
ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS))))

View File

@@ -270,3 +270,6 @@ IPL3_RAW_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%,$(IP
CRASH_TEXTURE_FILES := $(wildcard $(TEXTURE_DIR)/crash_custom/*.png)
CRASH_TEXTURE_C_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.inc.c,$(CRASH_TEXTURE_FILES)))
FASTTEXT_TEXTURE_FILES := $(wildcard $(TEXTURE_DIR)/fasttext/*.png)
FASTTEXT_TEXTURE_C_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.inc.c,$(FASTTEXT_TEXTURE_FILES)))

View File

@@ -4,9 +4,9 @@
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 requires a US ROM in order to build. JP/EU ROMs are optional for some assets.
This repo needs gcc in order to be able to build it. To install it, run `sudo apt install gcc-mips-linux-gnu`
[How to install everything needed and build HackerSM64](https://github.com/HackerN64/HackerSM64/wiki/Installing-HackerSM64)
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):
@@ -118,7 +118,6 @@ Thanks to Frame#5375 and AloXado320 for also helping with silhouette stuff
- 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.c` for more details and configuration info. (By ArcticJaguar725) *
- Fazana's "puppyprint" text engine. *
- Use `print_small_text` to print normal text. The two last params are aligment and how many characters to print (-1 means PRINT_ALL).
- Use `render_multi_image` to draw large texture rectangles consisting of multiple images on the screen.
- More info in `puppyprint.c`
- 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.h` in the include folder for instructions and details.
- Red Coin Stars now support up to 99 red coins! In addition, multi-area red coin missions can now be created by setting the 2nd behavior paramater of the red coin star to the number of reds required for the star to spawn.
@@ -139,14 +138,6 @@ Thanks to Frame#5375 and AloXado320 for also helping with silhouette stuff
- 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.
@@ -207,7 +198,3 @@ 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

View File

@@ -1 +1 @@
v2.2.0
v2.3.0

View File

@@ -1,11 +0,0 @@
// Detect if the emux emulator extension is supported
// https://hackmd.io/@rasky/r1k7na6Jn
.include "macros.inc"
.section .text, "ax"
.set noreorder
glabel emux_detect
or $v0, $0, $0
jr $ra
tne $v0, $v0, 0x0

View File

@@ -1,14 +0,0 @@
// Used as part of emulator detection. The dynarec core of PJ64 4.0 only updates
// the COUNT register in between recompiled functions, so this will return 0 on
// PJ64 4.0 dynarec, but will instead return the count factor on other versions.
.include "macros.inc"
.section .text, "ax"
.set noreorder
.balign 32
glabel pj64_get_count_factor_asm
mfc0 $t0, $9 // $9 is the COUNT register
mfc0 $t1, $9
jr $ra
subu $v0, $t1, $t0

View File

@@ -14,7 +14,7 @@
.word 0x00000000 /* Checksum 2 */
.word 0x00000000 /* Unknown */
.word 0x00000000 /* Unknown */
.ascii INTERNAL_ROM_NAME /* Internal ROM name */
.ascii INTERNAL_ROM_NAME /* Internal ROM name */
#if defined(EMU_DEFAULT_TO_GCN)
/* Advanced homebrew ROM header bytes: https://n64brew.dev/wiki/ROM_Header#Advanced_Homebrew_ROM_Header */
.word 0x82000000
@@ -22,11 +22,8 @@
.word 0x00000000 /* Unknown */
#endif
.word 0x0000004E /* Cartridge */
#if defined(EEP4K) && !defined(EMU_DEFAULT_TO_GCN)
.ascii "SM" /* Cartridge ID */
#else
.ascii "ED" /* Cartridge ID */
#endif
/* Region */
#if defined(VERSION_JP) || defined(VERSION_SH)
@@ -35,14 +32,21 @@
.ascii "E" /* NTSC-U (North America) */
#endif
#if defined(SRAM)
.byte 0x32 /* Version */
#elif defined(EEP16K)
.byte 0x22 /* Version */
#elif defined(SRAM768K)
.byte 0x42 /* Version */
#elif defined(FLASHRAM)
.byte 0x52 /* Version */
#if defined(USE_RTC)
#define RTC_BIT 0x1
#else
.byte 0x12 /* Version */
#define RTC_BIT 0x0
#endif
/* Savetype, region, and RTC */
#if defined(SRAM)
.byte 0x32 | RTC_BIT
#elif defined(EEP16K)
.byte 0x22 | RTC_BIT
#elif defined(SRAM768K)
.byte 0x42 | RTC_BIT
#elif defined(FLASHRAM)
.byte 0x52 | RTC_BIT
#else
.byte 0x12 | RTC_BIT
#endif

View File

@@ -1861,10 +1861,6 @@
"textures/water/jrb_textures.0A000.rgba16.png": [32,32,2048,{"jp":[3354832,40960],"us":[3361584,40960],"eu":[3235184,40960],"sh":[3209552,40960]}],
"textures/water/jrb_textures.0A800.rgba16.png": [64,32,4096,{"jp":[3354832,43008],"us":[3361584,43008],"eu":[3235184,43008],"sh":[3209552,43008]}],
"textures/water/jrb_textures.0B800.rgba16.png": [64,32,4096,{"jp":[3354832,47104],"us":[3361584,47104],"eu":[3235184,47104],"sh":[3209552,47104]}],
"sound/samples/bowser_organ/00_organ_1.aiff": [0,{"jp":["@sound",195],"us":["@sound",216],"eu":["@sound",216]}],
"sound/samples/bowser_organ/01_organ_1_lq.aiff": [0,{"jp":["@sound",196],"us":["@sound",217],"eu":["@sound",217]}],
"sound/samples/bowser_organ/02_boys_choir.aiff": [0,{"jp":["@sound",197],"us":["@sound",218],"eu":["@sound",218]}],
"sound/samples/course_start/00_la.aiff": [0,{"jp":["@sound",194],"us":["@sound",215],"eu":["@sound",215]}],
"sound/samples/instruments/00.aiff": [0,{"jp":["@sound",120],"us":["@sound",141],"eu":["@sound",141],"sh":["@sound",141]}],
"sound/samples/instruments/01_banjo_1.aiff": [0,{"jp":["@sound",121],"us":["@sound",142],"eu":["@sound",142],"sh":["@sound",142]}],
"sound/samples/instruments/02.aiff": [0,{"jp":["@sound",122],"us":["@sound",143],"eu":["@sound",143],"sh":["@sound",143]}],
@@ -1918,8 +1914,8 @@
"sound/samples/instruments/32_metal_rimshot.aiff": [0,{"jp":["@sound",170],"us":["@sound",191],"eu":["@sound",191],"sh":["@sound",191]}],
"sound/samples/instruments/33_kick_drum_2.aiff": [0,{"jp":["@sound",171],"us":["@sound",192],"eu":["@sound",192],"sh":["@sound",192]}],
"sound/samples/instruments/34_alto_flute.aiff": [0,{"jp":["@sound",172],"us":["@sound",193],"eu":["@sound",193],"sh":["@sound",193]}],
"sound/samples/instruments/34b_organ.aiff": [0,{"sh":["@sound",194]}],
"sound/samples/instruments/34c_organ_lq.aiff": [0,{"sh":["@sound",195]}],
"sound/samples/instruments/34b_organ.aiff": [0,{"jp":["@sound",195],"us":["@sound",216],"eu":["@sound",216],"sh":["@sound",194]}],
"sound/samples/instruments/34c_organ_lq.aiff": [0,{"jp":["@sound",196],"us":["@sound",217],"eu":["@sound",217],"sh":["@sound",195]}],
"sound/samples/instruments/35_gospel_organ.aiff": [0,{"jp":["@sound",173],"us":["@sound",194],"eu":["@sound",194],"sh":["@sound",196]}],
"sound/samples/instruments/36_sawtooth_synth.aiff": [0,{"jp":["@sound",174],"us":["@sound",195],"eu":["@sound",195],"sh":["@sound",197]}],
"sound/samples/instruments/37_square_synth.aiff": [0,{"jp":["@sound",175],"us":["@sound",196],"eu":["@sound",196],"sh":["@sound",198]}],
@@ -1937,11 +1933,10 @@
"sound/samples/instruments/43_harmonica.aiff": [0,{"jp":["@sound",187],"us":["@sound",208],"eu":["@sound",208],"sh":["@sound",210]}],
"sound/samples/instruments/44_grand_piano.aiff": [0,{"jp":["@sound",188],"us":["@sound",209],"eu":["@sound",209],"sh":["@sound",211]}],
"sound/samples/instruments/45_french_horns_lq.aiff": [0,{"jp":["@sound",189],"us":["@sound",210],"eu":["@sound",210],"sh":["@sound",212]}],
"sound/samples/instruments/45b_la.aiff": [0,{"sh":["@sound",213]}],
"sound/samples/instruments/45b_la.aiff": [0,{"jp":["@sound",194],"us":["@sound",215],"eu":["@sound",215],"sh":["@sound",213]}],
"sound/samples/instruments/46_pizzicato_strings_1.aiff": [0,{"jp":["@sound",190],"us":["@sound",211],"eu":["@sound",211],"sh":["@sound",214]}],
"sound/samples/instruments/47_pizzicato_strings_2.aiff": [0,{"jp":["@sound",191],"us":["@sound",212],"eu":["@sound",212],"sh":["@sound",215]}],
"sound/samples/instruments/48_steel_drum.aiff": [0,{"jp":["@sound",192],"us":["@sound",213],"eu":["@sound",213],"sh":["@sound",216]}],
"sound/samples/piranha_music_box/00_music_box.aiff": [0,{"jp":["@sound",193],"us":["@sound",214],"eu":["@sound",214]}],
"sound/samples/sfx_1/00_twirl.aiff": [0,{"jp":["@sound",0],"us":["@sound",0],"eu":["@sound",0],"sh":["@sound",0]}],
"sound/samples/sfx_1/01_brushing.aiff": [0,{"jp":["@sound",1],"us":["@sound",1],"eu":["@sound",1],"sh":["@sound",1]}],
"sound/samples/sfx_1/02_hand_touch.aiff": [0,{"jp":["@sound",2],"us":["@sound",2],"eu":["@sound",2],"sh":["@sound",2]}],

View File

@@ -12,16 +12,16 @@
// SM64 (US/JP/EU/SH) Segment 02
#ifdef PUPPYPRINT
ALIGNED8 static const Texture small_font_default[] = {
#include "textures/segment2/custom_text.i4.inc.c"
#include "textures/segment2/custom_text.i4.preswap.inc.c"
};
ALIGNED8 static const Texture small_font_outline[] = {
#include "textures/segment2/custom_text2.ia4.inc.c"
#include "textures/segment2/custom_text2.ia4.preswap.inc.c"
};
ALIGNED8 static const Texture small_font_plain[] = {
#include "textures/segment2/custom_text3.i4.inc.c"
#include "textures/segment2/custom_text3.i4.preswap.inc.c"
};
ALIGNED8 static const Texture small_font_vanilla[] = {
#include "textures/segment2/custom_text4.i4.inc.c"
#include "textures/segment2/custom_text4.i4.preswap.inc.c"
};
const u8 small_font_kerning_default[] = {
@@ -2474,6 +2474,7 @@ static const Vtx vertex_billboard_num[] = {
// 0x0200EFF0 - 0x0200F038
const Gfx dl_billboard_num_begin[] = {
gsDPPipeSync(),
gsDPSetTextureFilter(G_TF_POINT),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, (G_TX_WRAP | G_TX_NOMIRROR), G_TX_NOMASK, G_TX_NOLOD, (G_TX_WRAP | G_TX_NOMIRROR), G_TX_NOMASK, G_TX_NOLOD),
@@ -2490,6 +2491,7 @@ const Gfx dl_billboard_num_end[] = {
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetTextureFilter(G_TF_BILERP),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsSPSetGeometryMode(G_LIGHTING),
gsSPEndDisplayList(),

View File

@@ -1,19 +1,9 @@
# Compress binary file to gzip
$(BUILD_DIR)/%.gz: $(BUILD_DIR)/%.bin
# Compress binary file
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
ifeq ($(GZIPVER),std)
$(V)$(GZIP) -c -9 -n $< > $@
else
$(V)$(GZIP) -c -12 -n $< > $@
endif
# Strip gzip header
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.gz
$(call print,Converting:,$<,$@)
$(V)dd bs=10 skip=1 if=$< of=$(<:.gz=.gz.strip) status=none
$(V)$(FILESIZER) $(<:.gz=.gz.strip) $@ `stat --format="%s" $(<:.gz=.bin)`
$(V)$(DEFLATEPACK) $< $@
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting GZIP to ELF:,$<,$@)
$(call print,Converting deflate to ELF:,$<,$@)
$(V)$(LD) -r -b binary $< -o $@

9
compression/lz4trules.mk Normal file
View File

@@ -0,0 +1,9 @@
# Compress binary file
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
$(V)$(LZ4TPACK) $< $@
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting LZ4T to ELF:,$<,$@)
$(V)$(LD) -r -b binary $< -o $@

View File

@@ -2694,7 +2694,7 @@ const BehaviorScript bhvSushiShark[] = {
const BehaviorScript bhvJrbSlidingBox[] = {
BEGIN(OBJ_LIST_SURFACE),
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE | OBJ_FLAG_NO_AUTO_DISPLACEMENT),
LOAD_COLLISION_DATA(jrb_seg7_collision_floating_box),
SET_HOME(),
BEGIN_LOOP(),
@@ -5437,11 +5437,7 @@ const BehaviorScript bhvTTCPendulum[] = {
const BehaviorScript bhvTTCTreadmill[] = {
BEGIN(OBJ_LIST_SURFACE),
#ifdef PLATFORM_DISPLACEMENT_2
OR_INT(oFlags, (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE | OBJ_FLAG_VELOCITY_PLATFORM)),
#else
OR_INT(oFlags, (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)),
#endif
OR_INT(oFlags, (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE | OBJ_FLAG_NO_AUTO_DISPLACEMENT)),
SET_FLOAT(oCollisionDistance, 750),
CALL_NATIVE(bhv_ttc_treadmill_init),
DELAY(1),

View File

@@ -4,7 +4,7 @@ import os
import json
import subprocess
from tools.detect_baseroms import get_rom_candidates
from tools.detect_baseroms import get_rom_candidates, ROMS_DIR
envmap_table = set([
"actors/mario/mario_metal.rgba16.png",
@@ -65,7 +65,7 @@ def remove_file(fname):
def clean_assets(local_asset_file):
assets = set(read_asset_map().keys())
assets.update(read_local_asset_list(local_asset_file))
for fname in list(assets) + [".assets-local.txt"]:
for fname in list(assets):
if fname.startswith("@"):
continue
try:
@@ -73,6 +73,19 @@ def clean_assets(local_asset_file):
except FileNotFoundError:
pass
if local_asset_file is not None:
local_asset_file.close()
remove_file(".assets-local.txt")
def usage():
all_langs = ["jp", "us", "eu", "sh"]
langs_str = " ".join("[" + lang + "]" for lang in all_langs)
print("Usage: ")
print(f" Show this help message: {sys.argv[0]} --help")
print(f" Extract from all found baseroms: {sys.argv[0]}")
print(f" Extract from specified versions: {sys.argv[0]} {langs_str}")
print(f" (For each version, its ROM file must exist,")
print(f" either in this folder or {ROMS_DIR}/)")
def main():
# In case we ever need to change formats of generated files, we keep a
@@ -91,6 +104,9 @@ def main():
if langs == ["--clean"]:
clean_assets(local_asset_file)
sys.exit(0)
elif langs == ["--help"] or langs == ["-h"]:
usage()
sys.exit(0)
asset_map = read_asset_map()
all_assets = []
@@ -112,6 +128,8 @@ def main():
romLUT = get_rom_candidates()
if not langs:
langs = romLUT.keys()
# verify the correct rom
for lang in langs:
@@ -134,7 +152,6 @@ def main():
sys.exit(1)
# Late imports (to optimize startup perf)
import hashlib
import tempfile
from collections import defaultdict
@@ -177,9 +194,15 @@ def main():
# presence of the correct roms automatically
# Make sure tools exist
subprocess.check_call(
["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
)
tools = [ "n64graphics", "skyconv", "mio0", "aifc_decode" ]
if os.name == 'nt':
tools = [tool + ".exe" for tool in tools]
make = "mingw32-make"
else:
make = "make"
cmd = [make, "-s", "-C", "tools/"] + tools
subprocess.check_call(cmd)
# Go through the assets in roughly alphabetical order (but assets in the same
# mio0 file still go together).

28
fast64.json Normal file
View File

@@ -0,0 +1,28 @@
{
"version": 1.0,
"autoLoad": true,
"microcode": "F3DEX2/LX2",
"rdpDefaults": {
"geometryMode": {
"zBuffer": true,
"shade": true,
"cullBack": true,
"lighting": true,
"shadeSmooth": true
},
"otherModeH": {
"textureConvert": "G_TC_FILT",
"textureFilter": "G_TF_BILERP",
"perspectiveCorrection": "G_TP_PERSP",
"pipelineMode": "G_PM_1PRIMITIVE"
},
"otherModeL": {},
"other": {}
},
"sm64": {
"refresh_version": "HackerSM64 2.3.0",
"compression_format": "yay0",
"force_extended_ram": false,
"matstack_fix": true
}
}

View File

@@ -19,6 +19,10 @@
#include "config/config_objects.h"
#include "config/config_rom.h"
// Local config - include a gitignore'd config file that's specific to just the user (if the file exists). Ignored for release builds.
#if __has_include("config/config_local.h") && !defined(DISABLE_ALL)
#include "config/config_local.h"
#endif
/* WARNING: Compatibility safeguards - don't remove this file unless you know what you're doing */
// WARNING: Compatibility safeguards - don't remove this file unless you know what you're doing
#include "config/config_safeguards.h"

View File

@@ -6,10 +6,7 @@
/**
* Forces the camera mode to your choice (except when swimming or flying).
* It does this by setting the area's camera->defMode to this mode, and also
* changes hardcoded modes to use c->defMode.
* Note: removes door cutscenes due to the way they're designed to work with specific modes.
* Search for FORCED_CAMERA_MODE in camera.c for more information.
* It does this by setting the area's camera->defMode to this mode.
*/
#define FORCED_CAMERA_MODE CAMERA_MODE_8_DIRECTIONS
@@ -60,17 +57,9 @@
/***** Vanilla config options *****/
/**********************************/
/**
* Included for ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS define.
*/
#include "config_game.h"
/**
* Allow course specific camera processing.
* You will likely want this disabled in non-vanilla hacks.
* This is automatically enabled when ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS is enabled,
* but feel free to override it if you really want to for some reason.
* Enabling this will automatically disable FORCED_CAMERA_MODE and USE_COURSE_DEFAULT_MODE.
*/
#ifdef ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS
#define ENABLE_VANILLA_CAM_PROCESSING
#endif
// #define ENABLE_VANILLA_CAM_PROCESSING

View File

@@ -124,7 +124,7 @@
/**
* May break viewport widescreen hacks.
* When this is disabled, the culling will only be skipped according to the NO_CULLING_EMULATOR_BLACKLIST.
* When this is disabled, the culling will only be skipped according to the NO_CULLING_EMULATOR_WHITELIST.
*/
// #define CULLING_ON_EMULATOR

View File

@@ -136,14 +136,8 @@
*/
#define BUGFIX_DIALOG_TIME_STOP
/**
* Enables Platform Displacement 2, an upgrade to the physics involving moving platforms and how Mario interacts with them.
*/
#define PLATFORM_DISPLACEMENT_2
/**
* Inertia defines; allow Mario to preserve his momemtum when leaving moving platforms.
* These require Platform Displacement 2 to be enabled.
*/
#define MARIO_INERTIA_UPWARD
// #define MARIO_INERTIA_LATERAL

Some files were not shown because too many files have changed in this diff Show More