Repository navigation
Load sceSifLoadModuleBuffer IRXs from IOP RAM - #407
Open
0xLeathery wants to merge 4 commits into
Open
0xLeathery wants to merge 4 commits into
0xLeathery wants to merge 4 commits into
Conversation
Move the ELF-sizing logic into a shared helper so the same reader works for both the EE guest and the IOP's own RAM.
sceSifLoadModuleBuffer takes the IOP address the EE has DMA'd the IRX to. The loader read that address from EE memory, found no ELF, and failed silently, so games that retry the load (Sly 2) loop forever. Fall back to EE memory for callers that pass the EE copy.
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.
Problem
sceSifLoadModuleBuffertakes an IOP RAM address. The EE first DMAs the IRX across withsceSifSetDma, then passes the IOP-side address to the loader.IopEmulator::Impl::loadModuleBufferread that address throughIopHost::readGuest, which looks in EE memory. It found no ELF there and returned-1without logging anything.Games that keep their IRXs inside the main ELF and retry the load until it succeeds then hang forever at boot. Sly 2 (SCUS-97316) does exactly that: it DMAs each embedded module to IOP
0x120000, callssceSifLoadModuleBuffer(0x120000, ...)and loops on a negative result.Fix
IopModuleLoader::readElfFromGuestinto a shared helper, and addIopModuleLoader::readElfFromIop, which reads throughIopMemory::readRam.loadModuleBuffertries IOP RAM first and falls back to EE memory, so existing callers that pass the EE copy (including the current IOP tests) keep working.Testing
ps2xIOP/tests/iop_emulator_tests.cpp: it writes a minimal IRX only into IOP RAM at0x120000and checks that it loads and starts. It fails before this change and passes after it.-DPS2X_IOP_BUILD_TESTS=ON.ps2x_tests: 446/446. The GS cache CTest suite: 45/45.cdvdmanimports, which this PR doesn't touch.Built and tested on macOS arm64 (Apple clang, sse2neon path).