Search files in the configured disc image and add sceCdTrayReq - #267
Open
drakolordx7 wants to merge 1 commit into
Open
drakolordx7 wants to merge 1 commit into
drakolordx7 wants to merge 1 commit into
Conversation
With a disc image configured (HostPathKind::CdImage), the cdvdman emulation reads sectors from the image but resolved sceCdSearchFile against the virtual ISO9660 layout built from the host folder. The two assign different LSNs, so a guest that looks a file up and then reads it through sceCdRead (an IRX streaming from disc, for example) read the wrong sectors, or failed the search when there is no host folder. Walk the image's own ISO9660 directory for sceCdSearchFile instead: read the primary volume descriptor, then the directory record of each path component (honouring the padding at sector ends and ;version suffixes), and return the record's LSN, size and directory flag. If there is no image or it has no ISO9660 volume descriptor, the virtual layout is used as before. The result buffer writing is shared by both paths. Also implement sceCdTrayReq (cdvdman ran-j#14), which was an unhandled import: the tray never moves, so it stores a tray count of 0 and returns 1. Killzone's PFILE_R.IRX calls it about 2.7k times per boot. The new test runs a module that searches an in-memory ISO9660 image (file in a subdirectory, file missing) and calls sceCdTrayReq; the search part fails without the change. Made by drakolord and assisted with Claude Code.
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.
With a disc image configured, the cdvdman emulation reads sectors from the image but resolved
sceCdSearchFileagainst the virtual ISO9660 layout built from the host folder. The two assign different LSNs, so a guest that looks a file up and then reads it withsceCdRead(an IRX streaming from disc, for example) reads the wrong sectors, or the search fails when there is no host folder.sceCdSearchFilenow walks the image's own ISO9660 directory (primary volume descriptor, then the directory record of each path component, honouring sector padding and;versionsuffixes) and returns that record's LSN, size and directory flag. Without an image, or if the image has no ISO9660 descriptor, the virtual layout is used as before.Also implements
sceCdTrayReq(cdvdman #14), previously an unhandled import: the tray never moves, so it stores a tray count of 0 and returns 1. (Killzone'sPFILE_R.IRXcalls it about 2.7k times per boot.)Tests: new
ps2_iop_emulator_testscase with an in-memory ISO9660 image (file in a subdirectory, missing file,sceCdTrayReq); the search part fails without the change. ps2xIOP ctest 4/4, gs_cache ctest 45/45 andps2x_testsunchanged from main.Behaviour change: with a valid image, a file that is not in the image now returns 0 instead of falling back to the host-folder layout.
Made by drakolord and assisted with Claude Code.