PSX .bin+.cue in archive doesn't load correctly
Reported on Discord. ~~I haven't repro'd it yet because Linux.~~
This isn't planned to work. Bin is a big random access file. Archives aren't random access. We're not gonna dearchive huge files automatically to temp when they're opened. Certainly not BEFORE we have an option to load the discs completely to memory.
Closely related #2046 #2245
I feel like the only possible solution is converting the Bin and Cue into a CHD format which Beetle and PCSX ReARMed support.
Closing as duplicate, but I'll leave the stacktrace here (non-fatal error shown when you load such an archive and select Playstation in the platform picker that appears):
System.ArgumentException: The specified path is not of a legal form (empty).
at System.IO.Path.InsecureGetFullPath (System.String path) [0x00025] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Path.GetFullPath (System.String path) [0x00000] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00027] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00042] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Directory.InternalEnumeratePaths (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x0003c] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Directory.EnumerateFiles (System.String path, System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at System.IO.Directory.EnumerateFiles (System.String path) [0x0000b] in <65a38edf81fe405bb4fb28e56b25f9d8>:0
at BizHawk.Client.Common.RomLoader.TryLoadSiblingCue (BizHawk.Emulation.Common.CoreComm nextComm, System.String binFilePath, System.String forcedCoreName, BizHawk.Emulation.Common.IEmulator& nextEmulator, BizHawk.Emulation.Common.GameInfo& game, System.Boolean& cancel) [0x0007e] in <db86dbed7e34458d9cfc530c76a22c8d>:0
at BizHawk.Client.Common.RomLoader.LoadOther (BizHawk.Emulation.Common.CoreComm nextComm, BizHawk.Common.HawkFile file, System.String ext, System.String forcedCoreName, BizHawk.Emulation.Common.IEmulator& nextEmulator, BizHawk.Client.Common.RomGame& rom, BizHawk.Emulation.Common.GameInfo& game, System.Boolean& cancel) [0x001a2] in <db86dbed7e34458d9cfc530c76a22c8d>:0
at BizHawk.Client.Common.RomLoader.LoadRom (System.String path, BizHawk.Emulation.Common.CoreComm nextComm, System.String launchLibretroCore, System.String forcedCoreName, System.Int32 recursiveCount) [0x0031b] in <db86dbed7e34458d9cfc530c76a22c8d>:0
Going to reopen this because i ran into this recently and upon investigating the architecture around this is actively hostile and doesn't work properly. Note that this is not about supporting bin+cue from archives (which is #2046), but properly not supporting it as long as it's not implemented.
Loading an archive as rom goes through this function: https://github.com/TASEmulators/BizHawk/blob/0681dd2590ffe8e68e3383d273566118e557c6bb/src/BizHawk.Client.Common/RomLoader.cs#L197-L211
This code WILL load the first contained .bin files as that file extension is included in AutoloadFromArchive and then throw with the stacktrace yoshi posted above, which is less than useful for any normal user.
Most likely .bin files should never be automatically loaded from archives (only if a preferred platform has been set as per the second condition above) and instead files like .cue should be so they go through this code after: https://github.com/TASEmulators/BizHawk/blob/0681dd2590ffe8e68e3383d273566118e557c6bb/src/BizHawk.Client.Common/RomLoader.cs#L882-L885
Are you saying the problem is that it's going off of file extension (#3435), and .bin is listed for non-disc consoles so it gets included in AutoloadFromArchive?
Are you saying the problem is that it's going off of file extension (#3435), and
.binis listed for non-disc consoles so it gets included inAutoloadFromArchive?
Effectively yes. But I don't think looking at file extensions is the problem (you cannot guess every file type from its contents) but rather the fact that bin files get loaded from archives and cue files don't.