Fixed three macOS bugs (save-state crash, blank Input settings, ROM double-click) - #3
Open
mysterypaintwo wants to merge 5 commits into
Open
Fixed three macOS bugs (save-state crash, blank Input settings, ROM double-click)#3mysterypaintwo wants to merge 5 commits into
mysterypaintwo wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes three unrelated bugs, all reproduced and verified on Apple Silicon (macOS 26 Tahoe). None of the changes affect SNES emulation (
sfc/,processor/); they are limited to save-state I/O, UI, and macOS integration.Fix save-state load crash (heap corruption).
nall::Decode::RLEreconstructed the uncompressed size using undefined behavior (shifting a promoted 32-bit value by up to 56 bits), producing an invalid allocation size on arm64. This corrupted the heap during decompression and caused a crash shortly afterward. The decoder now matches the encoder's 64-bit implementation.Fix empty Input/Hotkeys mapping list on first open.
SettingsWindow::show()activated the window through the baseWindowclass, bypassingSettingsWindow::setVisible(), which refreshes the mapping list. As a result, mappings only appeared after changing the device dropdown. The mappings are now refreshed whenever the window is shown.Fix opening ROMs via Finder ("Open With" / double-click).
bsnes previously had no document-opening path on macOS because
Info.plistdid not declare supported document types and no Apple Event handler was registered. This PR:kAEOpenDocumentshandler early in startup,.sfc,.smc,.gb,.gbc,.bs,.st) usingLSHandlerRank: Alternate.During testing I also found duplicate LaunchServices registrations can prevent file opening on some development systems. That's an environment issue rather than a code bug, but reviewers who can't reproduce may want to clear stale registrations with
lsregister.Testing
Verified manually on Apple Silicon (macOS 26 Tahoe):
Settings -> Input/Hotkeyspopulates mappings immediately on first open.open -a bsnes.app romfile.sfc) with nobsnesprocess running beforehand (confirmed viaps) successfully launches the emulator and loads the ROM. This distinction matters: an already-running instance receives document-open events through a different path and would pass even without this fix, so this was specifically tested as a cold launch.alttpoAngelScript script folder with no errors, confirming AngelScript's arm64 support (already present on this branch'sunstablebase) works correctly alongside these fixes.