discsystem - handle some errors that werent handled before
This commit is contained in:
parent
67d45dde10
commit
8f5059d53e
|
@ -270,7 +270,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
if (discMountJob.OUT_ErrorLevel)
|
||||
throw new InvalidOperationException(discMountJob.OUT_Log);
|
||||
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
|
||||
|
||||
if(disc == null)
|
||||
throw new InvalidOperationException("Can't load one of the files specified in the M3U");
|
||||
|
@ -329,7 +329,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
if (discMountJob.OUT_ErrorLevel)
|
||||
throw new InvalidOperationException(discMountJob.OUT_Log);
|
||||
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
|
||||
|
||||
var disc = discMountJob.OUT_Disc;
|
||||
//-----------
|
||||
|
@ -465,7 +465,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
if (discMountJob.OUT_ErrorLevel)
|
||||
throw new InvalidOperationException(discMountJob.OUT_Log);
|
||||
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
|
||||
|
||||
if (disc == null)
|
||||
throw new InvalidOperationException("Can't load one of the files specified in the M3U");
|
||||
|
|
|
@ -365,6 +365,13 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
|||
|
||||
void OpenTrack(CUE_File.Command.TRACK trackCommand)
|
||||
{
|
||||
//assert that a file is open
|
||||
if(curr_file == null)
|
||||
{
|
||||
Error("Track command encountered with no active file");
|
||||
throw new DiscJobAbortException();
|
||||
}
|
||||
|
||||
curr_track = new CompiledCueTrack();
|
||||
|
||||
//spill cdtext data into this track
|
||||
|
|
|
@ -55,4 +55,8 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
swLog.Write(job.OUT_Log);
|
||||
}
|
||||
}
|
||||
|
||||
class DiscJobAbortException : Exception
|
||||
{
|
||||
};
|
||||
}
|
|
@ -126,6 +126,8 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
}
|
||||
if (ext == ".cue")
|
||||
{
|
||||
//TODO - major renovation of error handling needed
|
||||
|
||||
//TODO - make sure code is designed so no matter what happens, a disc is disposed in case of errors.
|
||||
//perhaps the CUE_Format2 (once renamed to something like Context) can handle that
|
||||
var cuePath = IN_FromPath;
|
||||
|
@ -140,21 +142,25 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
if (cue_content == null)
|
||||
cue_content = File.ReadAllText(cuePath);
|
||||
parseJob.IN_CueString = cue_content;
|
||||
parseJob.Run(parseJob);
|
||||
//TODO - need better handling of log output
|
||||
bool okParse = true;
|
||||
try { parseJob.Run(parseJob); }
|
||||
catch (DiscJobAbortException) { okParse = false; parseJob.FinishLog(); }
|
||||
if (!string.IsNullOrEmpty(parseJob.OUT_Log)) Console.WriteLine(parseJob.OUT_Log);
|
||||
ConcatenateJobLog(parseJob);
|
||||
if (!okParse)
|
||||
goto DONE;
|
||||
|
||||
//compile the cue file:
|
||||
//includes this work: resolve required bin files and find out what it's gonna take to load the cue
|
||||
var compileJob = new CompileCueJob();
|
||||
compileJob.IN_CueContext = cueContext;
|
||||
compileJob.IN_CueFile = parseJob.OUT_CueFile;
|
||||
compileJob.Run();
|
||||
//TODO - need better handling of log output
|
||||
bool okCompile = true;
|
||||
try { compileJob.Run(); }
|
||||
catch (DiscJobAbortException) { okCompile = false; compileJob.FinishLog(); }
|
||||
if (!string.IsNullOrEmpty(compileJob.OUT_Log)) Console.WriteLine(compileJob.OUT_Log);
|
||||
ConcatenateJobLog(compileJob);
|
||||
if (compileJob.OUT_ErrorLevel)
|
||||
if (!okCompile || compileJob.OUT_ErrorLevel)
|
||||
goto DONE;
|
||||
|
||||
//check slow loading threshold
|
||||
|
|
Loading…
Reference in New Issue