From a2d97dfb5fabc91c8b86294bf3a00f70433bf968 Mon Sep 17 00:00:00 2001 From: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Sat, 21 Sep 2024 03:04:02 -0700 Subject: [PATCH] Remove "direct" bin file handling If you want something like this done, just look for a .cue file next to the .bin file. Do not try to generate a temp .cue and pass that .cue along as the disc file to load, you will potentially run into a situation that temp .cue filename (mind you, this is random!) will act as the game name (due to not being present in db for whatever reason), affecting stuff like SaveRAM and such. The disc file "loaded" must not have some random junk in the filename. --- src/BizHawk.Client.Common/RomLoader.cs | 28 ------------------- .../DiscMountJob.cs | 5 ---- 2 files changed, 33 deletions(-) diff --git a/src/BizHawk.Client.Common/RomLoader.cs b/src/BizHawk.Client.Common/RomLoader.cs index d7d6763454..bc332cbaf5 100644 --- a/src/BizHawk.Client.Common/RomLoader.cs +++ b/src/BizHawk.Client.Common/RomLoader.cs @@ -485,34 +485,6 @@ namespace BizHawk.Client.Common game.System = VSystemID.Raw.SGB; } break; - case VSystemID.Raw.PSX when ext is ".bin": - const string FILE_EXT_CUE = ".cue"; - var cuePath = TempFileManager.GetTempFilename(friendlyName: "syn", dotAndExtension: FILE_EXT_CUE, delete: false); - DiscMountJob.CreateSyntheticCue(cueFilePath: cuePath, binFilePath: file.Name); - var gameBak = game; - var nextEmulatorBak = nextEmulator; - try - { - if (LoadDisc( - path: cuePath, - nextComm, - new(cuePath), - ext: FILE_EXT_CUE, - forcedCoreName: forcedCoreName, - out nextEmulator, - out game)) - { - return; - } - Console.WriteLine("synthesised .cue failed to load"); - } - catch (Exception e) - { - Console.WriteLine($"synthesised .cue failed to load: {e}"); - } - game = gameBak; - nextEmulator = nextEmulatorBak; - break; } var cip = new CoreInventoryParameters(this) { diff --git a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs index fcf38d2d24..03d4ab3861 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscMountJob.cs @@ -230,10 +230,5 @@ namespace BizHawk.Emulation.DiscSystem var len = new FileInfo(binFilePath).Length; return GenerateCue(binFilename, isMode2: len % 2048 is not 0 && len % 2352 is 0); } - - public static void CreateSyntheticCue(string cueFilePath, string binFilePath) - => File.WriteAllText( - path: cueFilePath, - contents: GenerateCue(binFilename: binFilePath/*abs is fine here*/, binFilePath: binFilePath)); //TODO as with .iso, may want to try both } }