Fix crashes and improve input handling#8
Open
spacestate1 wants to merge 1 commit intoyaz0r:masterfrom
Open
Conversation
- File loading: add null checks for fopen failures instead of crashing, handle missing files gracefully with error return - Dragon data: skip loading dragon forms when model file is missing - Menus: replace assert(0) with Unimplemented() in enemy list, map, system menu, and menu background tasks; play error sound on unimplemented submenu selection - Battle debug list: implement up/down navigation for battle module selection (was Unimplemented) - Battle manager: remove assert in unhandled switch case - Inventory: add bounds check on item category array to prevent overflow, use Unimplemented() for berserk category - Town camera: use default fade color instead of asserting on unknown case - Input: map keyboard A/S/D/Q/W and gamepad shoulders/X/back to Saturn C/Z/X/L/R buttons for full controller support - Logger: add cleanupLoggers() for clean shutdown
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.
Replaces hard crashes (assert/abort) with graceful handling, adds null checks, and maps all Saturn controller buttons.
Files changed
File loading safety
getFileSize()(L524-527): Print error message when file cannot be opened (before assert)openFileHandle()(L549-554): Return a valid struct with size 0 instead of crashing when fopen failsloadFile()(L631-634, L673-676): Check for null handle and zero-size files, free resources and return -1 instead of crashingDragon model loading
Menu stubs
assert(0)withUnimplemented()in enemy list, map, system menu, and menu background tasksBattle system
Unimplemented())assert(0)withbreakin unhandled switch default caseInventory
assert(0)withUnimplemented()for berserk categoryOther
cleanupLoggers()to clear all log buffers on shutdowncleanupLoggers()cleanupLoggers()before exitInput mapping
Merge note
Safe to merge on its own. All changes are defensive - they prevent crashes and add input buttons. Nothing depends on this PR, and it doesn't depend on any other. Good candidate for merging first.