Repository navigation
arm64: playable Dam, mission select, HUD and 64-bit audio fixes - #1
Merged
Merged
Conversation
Fixes the LP64 port so the S24 Ultra build renders Dam correctly and guards patrol on the ground, see Bond and shoot him. - PORT_LP64 (platform_info.h) guards 64-bit-only fixes so the 32-bit builds compile what they always did. - Player/hand/watch/gait models get host-sized storage instead of overlaying N64 offsets (fixes sky-only terrain, garbage start pos, missing gun). - Guard weapons: the setup record is the N64 0x88-byte layout, so rebuild a host WeaponObjRecord from the wire fields (weaponnum read as 0 and every attack try failed). - Restore the chr anim callback (ground height / stand tile) with a pointer sanity check; widen truncating (s32) animation pointer casts. - Pad-name tables, patrol paths, anim flip func and bg portals kept full-width; skip cleanupObjects on unload (wire-layout objects) and harden sndGetPlayingState. Setup objects other than weapons are still read as host structs on 64-bit; converting them at load is the proper follow-up. The 32-bit build compiles but has not been run on device. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Found by reproducing the S24 bugs on an x86_64 emulator build (a new developer-only ABI: same LP64 engine, never in the release APK). Rendering - Vertex was 24 bytes on a 64-bit host (pointer union), so every Vertex[] walk disagreed with the 16-byte display-list vertices: the film strip drew black wedges. Vertex is 16 bytes again; the collision-only related node moves to a side table built in model64.c. - vtxstore sized its entry table with a hard-coded 0x14 (0x18 on LP64) and overflowed into neighbouring allocations. - gunDrawSight kept a Gfx* in an s32 and passed &s32 as Gfx**, so the callee read 4 bytes of stack as the pointer's upper half (garbage display list, and a crash). Same for portDrawTargetPlus. - HUD armor/health gauge display lists were built in place in the player struct in room for 8-byte commands and ran over their own vertex data; they get separate buffers on LP64. - ~50 functions called without a declaration had pointer results truncated to int; declared in port/include/port_lp64_protos.h (fixes a boot crash in set_mt_tex_alloc on x86_64 and strchr in the options parser). - wiredl: purge cached expansions when a buffer is (un)registered. Audio (was muted on arm64) - port/src/bank64.c converts the big-endian bank files and Rare sequence table into host structs; sample tables, the music heap and the frame buffer are placed in the low arena because the mixer takes 32-bit addresses. - ALDelay input/output are signed: r->input[-d->input] with u32 made the reverb delay lines read and write before their buffer, corrupting the synth. - ALParam is padded so the 40-byte voice-start record fits (it overran its slot and corrupted the free list on every voice start). - Verified on the emulator by rendering ~100 s of PCM: tonal, stereo, ~-15 dBFS music, no crashes. Not verified on a real phone. The emulator's texture streaking on LOD textures looks emulator-specific and is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Goal
Make the 64-bit (arm64-v8a) engine playable on the Galaxy S24 Ultra: Dam renders correctly, guards patrol, see and shoot Bond, the mission-select screen draws properly, and sound works. 32-bit builds (Windows, Retroid Pocket 6) must stay as they were.
Description
Two commits, all 64-bit fixes guarded by
PORT_LP64or behaviour-identical on 32-bit:Vertexwas 24 bytes on LP64; it is 16 again (collision related-node moves to a side table). vtxstore entry size no longer hard-coded.gunDrawSightkept aGfx*in ans32and passed&s32asGfx**; HUD gauge display lists overran their vertex data; ~50 implicitly declared pointer-returning functions are now declared (port_lp64_protos.h).port/src/bank64.cconverts the big-endian banks and music table to host structs; sample tables, music heap and frame buffer live in the low arena (mixer takes 32-bit addresses); reverb delay offsets are signed;ALParampadded so voice starts no longer corrupt the free list.x86_64added as a developer-only ABI (same LP64 engine) so these bugs reproduce on the Android emulator. It is never part of the universal APK.Fixes # n/a
Type of Change
How Has This Been Tested?
gunDrawSight, the reverb offset type andVertexchanges touch shared code.Checklist