Emulation.DiscSystem -> simplify if/elses into return statements
This commit is contained in:
parent
cd9103b412
commit
3f9b93be59
|
@ -8,9 +8,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
public static M3U_File Read(StreamReader sr)
|
public static M3U_File Read(StreamReader sr)
|
||||||
{
|
{
|
||||||
M3U_File ret = new M3U_File();
|
M3U_File ret = new M3U_File();
|
||||||
if (!ret.Parse(sr))
|
return !ret.Parse(sr) ? null : ret;
|
||||||
return null;
|
|
||||||
else return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parse(StreamReader sr)
|
bool Parse(StreamReader sr)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
//disc type identification logic
|
//disc type identification logic
|
||||||
|
|
||||||
|
@ -175,8 +176,8 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
//its a cheap win for a lot of systems, but ONLY if the iso.Parse() method is quick running (might have to time it)
|
//its a cheap win for a lot of systems, but ONLY if the iso.Parse() method is quick running (might have to time it)
|
||||||
if (isIso)
|
if (isIso)
|
||||||
{
|
{
|
||||||
var appId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].ApplicationIdentifier).TrimEnd('\0', ' ');
|
var appId = Encoding.ASCII.GetString(iso.VolumeDescriptors[0].ApplicationIdentifier).TrimEnd('\0', ' ');
|
||||||
var sysId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].SystemIdentifier).TrimEnd('\0', ' ');
|
var sysId = Encoding.ASCII.GetString(iso.VolumeDescriptors[0].SystemIdentifier).TrimEnd('\0', ' ');
|
||||||
|
|
||||||
//for example: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
|
//for example: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
|
||||||
//but, some PSX games (junky rips) don't have the 'licensed by string' so we'll hope they get caught here
|
//but, some PSX games (junky rips) don't have the 'licensed by string' so we'll hope they get caught here
|
||||||
|
@ -365,8 +366,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
private bool SectorContains(string s, int lba = 0)
|
private bool SectorContains(string s, int lba = 0)
|
||||||
{
|
{
|
||||||
var data = ReadSectorCached(lba);
|
var data = ReadSectorCached(lba);
|
||||||
if (data == null) return false;
|
return data != null && Encoding.ASCII.GetString(data).ToLower().Contains(s.ToLower());
|
||||||
return System.Text.Encoding.ASCII.GetString(data).ToLower().Contains(s.ToLower());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -127,14 +127,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The string representation of the MSF
|
/// The string representation of the MSF
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Value
|
public string Value => !Valid ? "--:--:--" : $"{(Negative ? '-' : '+')}{MIN:D2}:{SEC:D2}:{FRAC:D2}";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (!Valid) return "--:--:--";
|
|
||||||
return $"{(Negative ? '-' : '+')}{MIN:D2}:{SEC:D2}:{FRAC:D2}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly byte MIN, SEC, FRAC;
|
public readonly byte MIN, SEC, FRAC;
|
||||||
public readonly bool Valid, Negative;
|
public readonly bool Valid, Negative;
|
||||||
|
|
|
@ -133,8 +133,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
{
|
{
|
||||||
int index = lba - FirstLBA;
|
int index = lba - FirstLBA;
|
||||||
if (index < 0) return null;
|
if (index < 0) return null;
|
||||||
if (index >= Sectors.Count) return null;
|
return index >= Sectors.Count ? null : Sectors[index];
|
||||||
return Sectors[index];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,9 +164,7 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
public ISectorSynthJob2448 Get(int lba)
|
public ISectorSynthJob2448 Get(int lba)
|
||||||
{
|
{
|
||||||
if (Condition(lba))
|
return Condition(lba) ? Patch : Parent.Get(lba);
|
||||||
return Patch;
|
|
||||||
else return Parent.Get(lba);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue