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.
This commit is contained in:
parent
259929499f
commit
a2d97dfb5f
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue