Lameguy64 / mkpsxiso

ISO disc image maker written specifically for PlayStation homebrew development
GNU General Public License v2.0
214 stars 33 forks source link

Image is corrupted if it contains directories nested more than 2 deep #3

Closed blincoln682F048A closed 6 years ago

blincoln682F048A commented 6 years ago

Thank you for the fantastic tool. I'm really glad that people don't have to resort to leaked copies of old commercial software anymore.

I've run into a weird issue while trying to rebuild a game that made heavy use of nested directories. Looking back on other disc images I've generated with mkpsxiso, they actually had the same problem, but it didn't cause me enough grief to notice in the earlier cases.

If the filesystem contains nested directories with depth of 3 or greater, most (if not all) content written to the image after the first most-deeply-nested part of the directory tree is unreadable by most tools. i.e. trying to access the content with the image attached via VirtualCloneDrive will fail, and games running in ePSXe will be unable to access it either. WinISO can access the content, so I suspect it's some sort of subtle corruption of the filesystem as opposed to an obvious flaw.

I've uploaded a minimal test case here: https://www.beneaththewaves.net/noindex/other/mkpsxiso-nested_dirs.zip. It includes both the source files and a bin/cue image created with the current version of mkpsxiso. I tried going back as far as 1.14 and the issue still occurred there.

Steps to reproduce:

1 - If desired, rebuild the bin/cue image using the XML and files in the archive linked above. It will be necessary to update the paths in the XML file, of course. 2 - Attach the image via VirtualCloneDrive. 3 - Observe that the following files can be accessed:

Lameguy64 commented 6 years ago

I suspect it is something to do with how MKPSXISO generates the path table and I've confirmed that its bugged. That likely explains why there are file access issues with deeper directory trees but the issue still occurs on even with a few directories on the root.

I'm now working on fixing the issue.

Lameguy64 commented 6 years ago

I just committed version 1.19 of mkpsxiso which fixes the path table issue as well as a few smaller bugs. Download can be found on the repo's readme document.

As for the directory tree issue you've been having, I have not found any more issues with how the directory structure is generated by mkpsxiso that could be the cause of it aside from the path table generation which has been fixed. It appears to be an operating system related issue when it comes to directory trees with similarly named directories as it persists in SN's BuildCD tool with a similar directory structure in my tests and I don't think there really is much of a way to fix it by the looks of it.

The best you can do is to minimize creating identically named directories in a directory tree.

blincoln682F048A commented 6 years ago

Looks great now. Thanks!