Commit Graph

1572 Commits

Author SHA1 Message Date
djevangelia 7e9cf1eb1c Enemy rando, set EnTp EnSkb EnPeehat collider positions on actor init (#7049) 2026-08-10 01:10:40 +00:00
Philip Dubé f27ddede59 Fix mirror decal not rendering on some walls (#7052) 2026-08-09 22:01:31 +00:00
Pedro Nascimento 4e39d06acc fix(audio): bound audio-heap cache tables (SIGSEGV with large custom music packs) (#6932)
Root cause of three identical field crashes (audio thread, opcode fetch
through a pointer with its low 32 bits overwritten, seconds after scene
transitions): AudioHeap_AllocPermanent writes permanentCache[index] with
index = permanentPool.count and no bound against the 32-entry array. In
SoH every soundfont sync-load is forced permanent, and custom sequences
whose SEQ.xml says CachePolicy="Temporary" ALSO allocate permanently
(the factory stores the LUS enum where CACHE_TEMPORARY == 0, while
AudioLoad_SyncLoad's switch reads 0 with the ROM convention
'permanent'). A pack with ~60 streamed customs plus vanilla fonts pushes
count past 32 within a session, after which each allocation sprays a
{ptr, size, tableType/id} triplet at 24-byte stride through
gAudioContext - entry[135]'s ptr field lands exactly on
seqPlayers[0].scriptState.pc and entry[156] on seqPlayers[1]'s (both
verified against the crash-dump registers).

- permanentCache raised 32 -> 512 (12 KB) and AllocPermanent refuses
  allocations past the array instead of corrupting memory.
- Same unbounded-index disease fixed in the three sibling writers:
  AllocCached's persistent path (16-entry array; CACHE_EITHER degrades
  to temporary, hard persistent requests fail cleanly),
  AllocPersistentSampleCacheEntry, AllocTemporarySampleCacheEntry.
- seqLoadStatus malloc sized for the full id space (sequenceMapSize +
  0xF) matching sequenceMap; custom ids above sequenceMapSize previously
  overflowed the allocation by up to 15 bytes.

Upstream SoH bugs, not branch-introduced - this branch's many-track
packs merely made the overflow reachable in normal play. Standalone
upstreamable fix.
2026-08-09 18:36:33 +00:00
Philip Dubé bf7177256a FixFlexDrops (#7047) 2026-08-09 15:46:51 +00:00
Philip Dubé 5ecff16bdb Fix heap corruption due to skybox code using GameState as PlayState (#7045)
Also corrects clearing skybox context before Skybox_Setup
2026-08-09 01:05:15 +00:00
Pepper0ni 07944d785c Allow buying tunic as either age in rando even without shopsanity. (#7016) 2026-08-08 21:17:10 +00:00
Jameriquiah a4901abdc5 Hookify Skeleton Unregisters (#6988)
Co-authored-by: serprex <159546+serprex@users.noreply.github.com>
2026-08-08 21:16:10 +00:00
djevangelia f2f4413bff Decomp, some camera names (#7043) 2026-08-08 21:12:31 +00:00
djevangelia 982f598e01 Savestates, add sEffectContext (#7042) 2026-08-08 20:39:09 +00:00
djevangelia 5d1a396668 Polish, Twinrova intro cutscene skip with Kotake/Koume appear on climb (#7001) 2026-08-08 19:04:04 +00:00
djevangelia 6420c435b1 Enemy rando, fix Dark Link crush etc voidouts (#7038) 2026-08-08 17:59:23 +00:00
Philip Dubé 6706b49d1c Shuffle Treasure Chest Game (#7020) 2026-08-07 03:17:10 +00:00
djevangelia a089fa60ba Restoration, hover fishing condition + XZ speed (#7031) 2026-08-06 19:08:23 +00:00
Philip Dubé b76e303ceb Shuffle Silver (#5659)
Co-authored-by: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com>
Co-authored-by: leggettc18 <chris@leggett.dev>
2026-08-06 01:51:59 +00:00
djevangelia 0ed782ddce Enhancement, drop throw-only actors toggle (#7023)
Co-authored-by: djevangelia <djevangelia>
2026-08-05 15:03:18 +00:00
David Racine 29c7e75688 Fix Gold Skulltula tokens overwriting the Bow inventory slot (#7021)
gItemSlots and sExtraItemBases only cover the item IDs that live in the
inventory, but Item_Give and Item_CheckObtainability index them with any
item ID. Reading past gItemSlots lands on gUpgradeShifts, so
INV_CONTENT(ITEM_SKULL_TOKEN) resolved to the Bow slot and stored the
token there, permanently corrupting the save.

Route both through a bounds-checked Item_GetSlot that reports SLOT_NONE
for items that have no slot, and skip the inventory store in that case.

That read is also undefined behaviour, which link-time optimization is
free to exploit: with it present clang dropped the ITEM_SKULL_TOKEN
branch and the ITEM_MEDALLION_WATER horse fixup from Item_Give
entirely, so tokens were never counted either.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 04:03:12 +00:00
Jordan Longstaff 2fd7e052cc Cleanup and fix Dampe's race both prizes regression (#6999) 2026-08-04 13:22:20 +00:00
David Racine eafafe507e fix: seqLoadStatus OOB reads/writes for custom SAF sequences (#6917)
Custom SAF sequence IDs can exceed sequenceMapSize, causing out-of-bounds
reads/writes on the seqLoadStatus byte array (sized exactly sequenceMapSize).

This is the direct cause of intermittent battle music failure with BGM packs
(issue #5706): on the second encounter, AudioLoad_SyncLoadSeq reads a garbage
value from heap memory past seqLoadStatus[] and may find 1 (loading in
progress), causing it to return NULL early — the sequence player is never
initialized and no battle music plays.

Symmetric fix to the fontLoadStatus guards in PR #6916:
- AudioLoad_IsSeqLoadComplete: return true for OOB seqIds (custom SAF
  sequences are resource-manager-backed, not in the async-load status table)
- AudioLoad_SetSeqLoadStatus: skip update for seqId >= sequenceMapSize
- AudioLoad_SyncLoadSeq: skip the in-progress check for OOB seqIds

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 21:05:07 +00:00
djevangelia 5a57a0cbc3 Decomp, naming (OnePointCS, itemAction, blure, wall/floor types) (#7007) 2026-07-31 16:56:30 +00:00
Jordan Longstaff 2c5762a0f2 [Enhancement] Dampe's Race awards both rewards at once (#6980) 2026-07-25 23:07:07 +00:00
Jordan Longstaff f9512bf446 Ingo Race: skip rematch (#6991) 2026-07-25 14:45:42 +00:00
Jordan Longstaff 2b35211956 [Enhancement] Award both prizes for high score in Horseback Archery (#6982) 2026-07-25 14:01:44 +00:00
Philip Dubé c4e92a70f4 Constant-size texture scroll display lists via G_SETTILESIZE_LERP (#6902)
Rewrite Gfx_TexScrollEx / Gfx_TwoTexScrollEx / Gfx_TwoTexScrollEnvColorEx to
emit one command per tile instead of one baked tile size per interpolated frame,
so texture DL memory no longer scales with InterpolationFPS
2026-07-24 18:35:24 +00:00
Jordan Longstaff 5af79defb6 Ingo Race Once: add option to skip both races (#6975) 2026-07-24 16:30:08 +00:00
Jordan Longstaff 9d1e5d2811 Hookify Lost Woods Ocarina game (#6976) 2026-07-24 16:28:36 +00:00
djevangelia 3c565ed6e6 Vanilla bugfix, allow fishing with blank B (#6826) 2026-07-24 16:24:56 +00:00
Philip Dubé 581af47419 Fix typos (#6978) 2026-07-24 15:19:36 +00:00
Philip Dubé da4e6dc332 Progressive Shuffle Open Chest (#6971) 2026-07-23 23:35:41 +00:00
Jordan Longstaff cca66cdc5d Hookify Shooting Gallery options (#6972) 2026-07-23 23:33:50 +00:00
Jordan Longstaff 5c55c01c68 Hookify frogs' Ocarina game (#6969) 2026-07-23 21:48:46 +00:00
Jordan Longstaff 35dcba5944 [Enhancement] Ingo Race Once (#6965) 2026-07-23 05:33:04 +00:00
Jordan Longstaff 236c9c81f5 Hookify Bombchu Bowling options (#6968)
Cuccos get destroyed when options turned on
2026-07-23 03:56:43 +00:00
djevangelia fb657cc5d5 Savestates, more AudioOcarina serialization (#6954) 2026-07-22 13:48:10 +00:00
Philip Dubé d62c5879aa Fix problems with Zelda's Letter & Weird Egg hatching (#6962) 2026-07-22 12:24:31 +00:00
djevangelia 6f14e7b162 Restoration, fix Japanese subtitle + MQ logo (#6953) 2026-07-22 10:21:32 +00:00
Philip Dubé 1ea7206073 Shuffle Zelda's Letter (#6938)
Removes RSK_SKIP_CHILD_ZELDA & RSK_KAK_GATE,
these are managed by RSK_SHUFFLE_ZELDAS_LETTER & RSK_STARTING_ZELDAS_LETTER & RSK_SHUFFLE_WEIRD_EGG
2026-07-19 22:37:45 +00:00
djevangelia 2c9187f27a Bugfix, make CC invisible Link equips invisible (#6926) 2026-07-19 20:52:22 +00:00
djevangelia e579e7b9a4 Polishing, climb everything door opening + sloped ledge climb up (#6936)
Allow player to try opening doors while climbing. Player can't open anything if a door doesn't offer it, so it's ok to try. Handle doors don't change player y position (player walks in the air), so manually lower it.
    Increase y height limit for doors to offer open from 15.0f/20.0f to 50.0f (normal door height). (For shutter doors height could be individualized depending on shutter door type in the future.)
    Make climbing up animation play even for sloped ledges. The animation/action breaks because game thinks player is not on ground. So, at the end of Player_ProcessSceneCollision, if player is in climbing up action, manually set BGCHECKFLAG_GROUND.
2026-07-19 17:04:32 +00:00
Christopher Leggett 8cb0c74592 Better Save Menu: Ability to Reset to Spawn from anywhere (#6937)
Adds an option for a Better Save Menu that, after saving, allows you to effectively soft-reset the current save (either return to spawn or reset to the dungeon entrance), and additionally lets you reset to spawn specifcally, even if you are in a dungeon. This allows for escaping from the rare entrance-rando related softlock that can happen.
2026-07-19 17:01:50 +00:00
djevangelia 29d4ff4205 Decomp, update AudioOcarina (code_800EC960.c) (#6941) 2026-07-19 16:54:43 +00:00
djevangelia dfaed90868 Savestates, player serialization (#6927) 2026-07-18 18:10:01 +00:00
djevangelia 033613a6cf Vanilla bugfix, ladder cutscene softlock (#6804) 2026-07-18 15:02:59 +00:00
djevangelia 852fb86cf2 Rando, prevent carrying abducted Ruto into Bigocto room (#6845)
If Ruto enters Bigocto's room after she has already been abducted, the room behaves weird due to actor functions. Randomizer respawns Ruto after abduction, so this can become a problem.

The easiest solution is probably to just not let player open doors to Bigocto room while carrying Ruto after abduction.
This fix makes shutter doors in randomizer when offering player to open the door - check scene, abduction flag, if door is transition actor index 21 or 3, held actor, and if held actor is Ruto.
Looks like this: https://www.youtube.com/watch?v=2Siq2Z41Pqo

The shutter door in decomp and thus this fix uses macros that are missing here, I copied all of them to the corresponding place in actor.h as they are very useful for actor params and will be added anyway when/if code is synced with decomp.
2026-07-13 15:32:10 +00:00
djevangelia d1d6a564e5 Bugfix, grotto boulder block respawn from water voidout (#6854) 2026-07-13 15:02:11 +00:00
David Racine fdb7e194cc fix(audio): bounds-check fontId to stop OOB crash with large SAF packs (#6916)
AudioLoad_IsFontLoadComplete had a stub `return true` that bypassed all
load-status checks, masking an out-of-bounds write: for large SAF packs
(many custom sequences) SetFontLoadStatus indexed fontLoadStatus[] with
fontId values larger than the fontMapSize-sized array, causing heap
corruption and semi-random crashes.

Remove the stub. Add a (size_t)fontId >= fontMapSize guard in both the
check and the setter: out-of-range IDs (custom SAF sequences that carry
no associated soundfont) are treated as "loaded" in the check and
silently skipped in the write, matching prior observable behavior while
eliminating the OOB access.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 12:12:43 +00:00
Philip Dubé ff7eb482d4 Don't point free cam at sky coming out of crawlspace (#6920) 2026-07-13 04:56:00 +00:00
Philip Dubé 66bb7888b0 Add save state wiring for Barinade, Bongo Bongo, & Morpha (#6914)
Rename various variables across codebase to match decomp,
many had been renamed when exposed for previous save state mechanism
2026-07-12 22:35:19 +00:00
djevangelia a44197712c Bugfix, prevent looping fanfares from softlocking HBA (#6874) 2026-07-12 17:51:26 +00:00
Philip Dubé c94ae8ccf3 wire decomp static savestates with macros (#6904) 2026-07-12 15:09:47 +00:00
Amber Burton 2b423c36aa GIM Restoration (#6865)
All edge cases for bottle combinations and replacement/filling mirrors the real game, as well we produce the compass text, and does not render the item exactly as the original game does. (I would have preferred rendering the item since its only cosmetic but I couldn't find a way to do it).

This also swaps the table redirect stuff for using the direct item id's which is a lot more clear and does not substitute anything for 'good enough' and covers all the edge case ids that have been documented.

This is purely a cosmetic change to present the visual of the item without affecting the cutscene making any tricks for GIM still work and just looks more polished.

This supplies effects of ALL game versions (including MZX build) as well as providing text table.

To note: we still can crash with GIM even when returning item None EVEN at least with returning Kokiri Tunic (I can't really figure out why) and there are a few items in the table that use extra data that I don't know how to implement here just yet but the info is in the docs under "Variable".

In the case of disabling the gim restoration, the game would still crash. This change adds a text id protection to prevent crashing, as well prevents invalid items from crashing directly, and also makes it so the game will no longer crash when having GIM disabled in the menu.

Co-authored-by: serprex <159546+serprex@users.noreply.github.com>
2026-07-12 15:09:06 +00:00