mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Remove Redundant Calls and PSX Automation (#75)
* Work with callbacks to increase perf * Make EDC field for PSX automatic * Make AntiMod field for PSX automatic * Make LibCrypt field for PSX automatic * Remove psxt001z Now that we have confirmed that DIC outputs the required information for libcrypt, we no longer need the external call to psxt001z to confirm (output was unused anyway) * We need the subIntention data for LibCrypt * Let's avoid null for now * Set default speed in case of error * Check the layerbreak better * Remove extraneous header checking * Add SubIntention field if it exists, always * Add LibCrypt flag by default for PSX * SubIntention needs a newline
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="dicPath" value="Programs\DiscImageCreator.exe"/>
|
||||
<add key="psxt001zPath" value="psxt001z.exe"/>
|
||||
<add key="subdumpPath" value="subdump.exe"/>
|
||||
<add key="defaultOutputPath" value="ISO"/>
|
||||
</appSettings>
|
||||
|
||||
@@ -98,13 +98,13 @@
|
||||
public const string DATField = "DAT";
|
||||
public const string ErrorCountField = "Error Count";
|
||||
public const string CuesheetField = "Cuesheet";
|
||||
public const string SubIntentionField = "SubIntention Data (SecuROM)";
|
||||
public const string SubIntentionField = "SubIntention Data (SecuROM/LibCrypt)";
|
||||
public const string WriteOffsetField = "Write Offset";
|
||||
public const string LayerbreakField = "Layerbreak";
|
||||
public const string PlaystationEXEDateField = "EXE Date";
|
||||
public const string PlayStationEDCField = "EDC"; // TODO: Not automatic yet
|
||||
public const string PlayStationAntiModchipField = "Anti-modchip"; // TODO: Not automatic yet
|
||||
public const string PlayStationLibCryptField = "LibCrypt"; // TODO: Not automatic yet
|
||||
public const string PlayStationEDCField = "EDC";
|
||||
public const string PlayStationAntiModchipField = "Anti-modchip";
|
||||
public const string PlayStationLibCryptField = "LibCrypt";
|
||||
public const string SaturnHeaderField = "Header";
|
||||
public const string SaturnBuildDateField = "Build Date";
|
||||
public const string XBOXDMIHash = "DMI.bin Hashes";
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace DICUI
|
||||
|
||||
// Populate the list of drives
|
||||
PopulateDrives();
|
||||
SetCurrentDiscType();
|
||||
|
||||
// Populate the list of drive speeds
|
||||
PopulateDriveSpeeds();
|
||||
@@ -178,7 +177,6 @@ namespace DICUI
|
||||
cmb_SystemType.ItemsSource = _systems;
|
||||
cmb_SystemType.DisplayMemberPath = "Key";
|
||||
cmb_SystemType.SelectedIndex = 0;
|
||||
cmb_SystemType_SelectionChanged(null, null);
|
||||
|
||||
btn_StartStop.IsEnabled = false;
|
||||
}
|
||||
@@ -195,16 +193,16 @@ namespace DICUI
|
||||
.ToList();
|
||||
cmb_DriveLetter.ItemsSource = _drives;
|
||||
cmb_DriveLetter.DisplayMemberPath = "Key";
|
||||
cmb_DriveLetter.SelectedIndex = 0;
|
||||
cmb_DriveLetter_SelectionChanged(null, null);
|
||||
|
||||
if (cmb_DriveLetter.Items.Count > 0)
|
||||
{
|
||||
cmb_DriveLetter.SelectedIndex = 0;
|
||||
lbl_Status.Content = "Valid optical disc found! Choose your Disc Type";
|
||||
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
|
||||
btn_StartStop.IsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmb_DriveLetter.SelectedIndex = -1;
|
||||
lbl_Status.Content = "No valid optical disc found!";
|
||||
btn_StartStop.IsEnabled = false;
|
||||
}
|
||||
@@ -247,7 +245,6 @@ namespace DICUI
|
||||
|
||||
// Get the currently selected options
|
||||
string dicPath = _options.dicPath;
|
||||
string psxtPath = _options.psxtPath;
|
||||
string subdumpPath = _options.subdumpPath;
|
||||
char driveLetter = (char)driveKvp?.Key;
|
||||
bool isFloppy = (driveKvp?.Value == UIElements.FloppyDriveString);
|
||||
@@ -344,51 +341,6 @@ namespace DICUI
|
||||
childProcess.WaitForExit();
|
||||
});
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
if (!File.Exists(psxtPath))
|
||||
{
|
||||
lbl_Status.Content = "Error! Could not find psxt001z!";
|
||||
break;
|
||||
}
|
||||
|
||||
// Invoke the program with all 3 configurations
|
||||
// TODO: Use these outputs for PSX information
|
||||
await Task.Run(() =>
|
||||
{
|
||||
childProcess = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = psxtPath,
|
||||
Arguments = "\"" + DumpInformation.GetFirstTrack(outputDirectory, outputFilename) + "\" > " + "\"" + Path.Combine(outputDirectory, "psxt001z.txt"),
|
||||
},
|
||||
};
|
||||
childProcess.Start();
|
||||
childProcess.WaitForExit();
|
||||
|
||||
childProcess = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = psxtPath,
|
||||
Arguments = "--libcrypt \"" + Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(outputFilename) + ".sub") + "\" > \"" + Path.Combine(outputDirectory, "libcrypt.txt"),
|
||||
},
|
||||
};
|
||||
childProcess.Start();
|
||||
childProcess.WaitForExit();
|
||||
|
||||
childProcess = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = psxtPath,
|
||||
Arguments = "--libcryptdrvfast " + driveLetter + " > " + "\"" + Path.Combine(outputDirectory, "libcryptdrv.log"),
|
||||
},
|
||||
};
|
||||
childProcess.Start();
|
||||
childProcess.WaitForExit();
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
// Check to make sure that the output had all the correct files
|
||||
@@ -473,14 +425,27 @@ namespace DICUI
|
||||
var systemKvp = cmb_SystemType.SelectedItem as KeyValuePair<string, KnownSystem?>?;
|
||||
var mediaKvp = cmb_MediaType.SelectedItem as KeyValuePair<string, MediaType?>?;
|
||||
|
||||
// If we're on a separator, go to the next item
|
||||
// If we're on a separator, go to the next item and return
|
||||
if (systemKvp?.Value == null)
|
||||
{
|
||||
systemKvp = cmb_SystemType.Items[++cmb_SystemType.SelectedIndex] as KeyValuePair<string, KnownSystem?>?;
|
||||
cmb_SystemType.SelectedIndex++;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the selected system info
|
||||
var selectedSystem = systemKvp?.Value;
|
||||
var selectedMediaType = mediaKvp != null ? mediaKvp?.Value : MediaType.NONE;
|
||||
int currentMediaTypeIndex = _mediaTypes.FindIndex(kvp => kvp.Value == _currentMediaType);
|
||||
|
||||
// If the current system contains the media type, switch to it and return
|
||||
if (_currentMediaType != null && _currentMediaType != MediaType.NONE)
|
||||
{
|
||||
if (currentMediaTypeIndex != -1 && cmb_MediaType.SelectedIndex != currentMediaTypeIndex)
|
||||
{
|
||||
cmb_MediaType.SelectedIndex = currentMediaTypeIndex;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No system chosen, update status
|
||||
if (selectedSystem == KnownSystem.NONE)
|
||||
@@ -524,14 +489,8 @@ namespace DICUI
|
||||
// Take care of the selected item
|
||||
if (_currentMediaType != null && _currentMediaType != MediaType.NONE)
|
||||
{
|
||||
int index = _mediaTypes.FindIndex(kvp => kvp.Value == _currentMediaType);
|
||||
if (index != -1)
|
||||
if (currentMediaTypeIndex != -1)
|
||||
{
|
||||
if (cmb_MediaType.SelectedIndex != index)
|
||||
{
|
||||
cmb_MediaType.SelectedIndex = index;
|
||||
}
|
||||
|
||||
lbl_Status.Content = string.Format("{0} ready to dump", mediaKvp?.Key);
|
||||
}
|
||||
else
|
||||
@@ -638,6 +597,9 @@ namespace DICUI
|
||||
/// </summary>
|
||||
private void SetSupportedDriveSpeed()
|
||||
{
|
||||
// Set generic drive speed just in case
|
||||
cmb_DriveSpeed.SelectedItem = 8;
|
||||
|
||||
// Get the drive letter from the selected item
|
||||
var selected = cmb_DriveLetter.SelectedItem as KeyValuePair<char, string>?;
|
||||
if (selected == null || (selected?.Value == UIElements.FloppyDriveString))
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace DICUI
|
||||
{
|
||||
public string defaultOutputPath { get; private set; }
|
||||
public string dicPath { get; private set; }
|
||||
public string psxtPath { get; private set; }
|
||||
public string subdumpPath { get; private set; }
|
||||
|
||||
public void Save()
|
||||
@@ -31,7 +30,6 @@ namespace DICUI
|
||||
{
|
||||
//TODO: hardcoded, we should find a better way
|
||||
dicPath = ConfigurationManager.AppSettings["dicPath"] ?? @"Programs\DiscImageCreator.exe";
|
||||
psxtPath = ConfigurationManager.AppSettings["psxt001zPath"] ?? "psxt001z.exe";
|
||||
subdumpPath = ConfigurationManager.AppSettings["subdumpPath"] ?? "subdump.exe";
|
||||
defaultOutputPath = ConfigurationManager.AppSettings["defaultOutputPath"] ?? "ISO";
|
||||
}
|
||||
|
||||
@@ -26,24 +26,19 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="DicImageCreator Path:" FontWeight="Bold"/>
|
||||
<TextBox x:Name="txt_dicPath" Grid.Row="0" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="btn_dicPath" Grid.Row="0" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click" />
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="psxt001z Path:" FontWeight="Bold"/>
|
||||
<TextBox x:Name="txt_psxtPath" Grid.Row="1" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="btn_psxtPath" Grid.Row="1" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click" />
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="subdump Path:" FontWeight="Bold"/>
|
||||
<TextBox x:Name="txt_subdumpPath" Grid.Row="1" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="btn_subdumpPath" Grid.Row="1" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="subdump Path:" FontWeight="Bold"/>
|
||||
<TextBox x:Name="txt_subdumpPath" Grid.Row="2" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="btn_subdumpPath" Grid.Row="2" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Default Output Path:" FontWeight="Bold"/>
|
||||
<TextBox x:Name="txt_defaultOutputPath" Grid.Row="3" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="btn_defaultOutputPath" Grid.Row="3" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click" />
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Default Output Path:" FontWeight="Bold"/>
|
||||
<TextBox x:Name="txt_defaultOutputPath" Grid.Row="2" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="btn_defaultOutputPath" Grid.Row="2" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click" />
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using Button = System.Windows.Controls.Button;
|
||||
using TextBox = System.Windows.Controls.TextBox;
|
||||
@@ -51,7 +40,7 @@ namespace DICUI
|
||||
|
||||
private string[] PathSettings()
|
||||
{
|
||||
string[] pathSettings = { "defaultOutputPath", "dicPath", "psxtPath", "subdumpPath" };
|
||||
string[] pathSettings = { "defaultOutputPath", "dicPath", "subdumpPath" };
|
||||
return pathSettings;
|
||||
}
|
||||
|
||||
|
||||
@@ -264,6 +264,7 @@ namespace DICUI.Utilities
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
parameters.Add(DICFlags.ScanAntiMod);
|
||||
parameters.Add(DICFlags.NoFixSubQLibCrypt);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -162,12 +162,12 @@ namespace DICUI.Utilities
|
||||
mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? "";
|
||||
mappings[Template.ErrorCountField] = GetErrorCount(combinedBase + ".img_EdcEcc.txt",
|
||||
combinedBase + "_c2Error.txt",
|
||||
combinedBase + "_mainError.txt").ToString();
|
||||
mappings[Template.CuesheetField] = GetFullFile(combinedBase + ".cue");
|
||||
mappings[Template.WriteOffsetField] = GetWriteOffset(combinedBase + "_disc.txt");
|
||||
mappings[Template.CuesheetField] = GetFullFile(combinedBase + ".cue") ?? "";
|
||||
mappings[Template.WriteOffsetField] = GetWriteOffset(combinedBase + "_disc.txt") ?? "";
|
||||
|
||||
// System-specific options
|
||||
switch (sys)
|
||||
@@ -181,28 +181,38 @@ namespace DICUI.Utilities
|
||||
FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt");
|
||||
if (fi.Length > 0)
|
||||
{
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt");
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt") ?? "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SegaSaturn:
|
||||
mappings[Template.SaturnHeaderField] = GetSaturnHeader(GetFirstTrack(outputDirectory, outputFilename)).ToString();
|
||||
mappings[Template.SaturnHeaderField] = GetSaturnHeader(GetFirstTrack(outputDirectory, outputFilename)) ?? "";
|
||||
if (GetSaturnBuildInfo(mappings[Template.SaturnHeaderField], out string serial, out string version, out string buildDate))
|
||||
{
|
||||
mappings[Template.DiscSerialField] = serial;
|
||||
mappings[Template.VersionField] = version;
|
||||
mappings[Template.SaturnBuildDateField] = buildDate;
|
||||
mappings[Template.DiscSerialField] = serial ?? "";
|
||||
mappings[Template.VersionField] = version ?? "";
|
||||
mappings[Template.SaturnBuildDateField] = buildDate ?? "";
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.PlayStationEDCField] = Template.YesNoValue;
|
||||
mappings[Template.PlayStationAntiModchipField] = Template.YesNoValue;
|
||||
mappings[Template.PlayStationLibCryptField] = Template.YesNoValue;
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter) ?? "";
|
||||
mappings[Template.PlayStationEDCField] = GetMissingEDCCount(combinedBase + ".img_eccEdc.txt") > 0 ? "No" : "Yes";
|
||||
mappings[Template.PlayStationAntiModchipField] = GetAntiModchipDetected(combinedBase + "_disc.txt") ? "Yes" : "No";
|
||||
mappings[Template.PlayStationLibCryptField] = "No";
|
||||
if (File.Exists(combinedBase + "_subIntention.txt"))
|
||||
{
|
||||
FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt");
|
||||
if (fi.Length > 0)
|
||||
{
|
||||
mappings[Template.PlayStationLibCryptField] = "Yes";
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt") ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter) ?? "";
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter) ?? "";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -210,10 +220,10 @@ namespace DICUI.Utilities
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
string layerbreak = GetLayerbreak(combinedBase + "_disc.txt");
|
||||
string layerbreak = GetLayerbreak(combinedBase + "_disc.txt") ?? "";
|
||||
|
||||
// If we have a single-layer disc
|
||||
if (layerbreak == null)
|
||||
if (String.IsNullOrWhiteSpace(layerbreak))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -229,7 +239,7 @@ namespace DICUI.Utilities
|
||||
mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? "";
|
||||
}
|
||||
// If we have a dual-layer disc
|
||||
else
|
||||
@@ -251,7 +261,7 @@ namespace DICUI.Utilities
|
||||
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
|
||||
mappings["Outer " + Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings["Inner " + Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? "";
|
||||
mappings[Template.LayerbreakField] = layerbreak;
|
||||
}
|
||||
|
||||
@@ -267,7 +277,7 @@ namespace DICUI.Utilities
|
||||
FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt");
|
||||
if (fi.Length > 0)
|
||||
{
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt");
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt") ?? "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -276,15 +286,15 @@ namespace DICUI.Utilities
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
if (GetXBOXAuxInfo(combinedBase + "_disc.txt", out string dmihash, out string pfihash, out string sshash, out string ss))
|
||||
{
|
||||
mappings[Template.XBOXDMIHash] = dmihash;
|
||||
mappings[Template.XBOXPFIHash] = pfihash;
|
||||
mappings[Template.XBOXSSHash] = sshash;
|
||||
mappings[Template.XBOXSSRanges] = ss;
|
||||
mappings[Template.XBOXDMIHash] = dmihash ?? "";
|
||||
mappings[Template.XBOXPFIHash] = pfihash ?? "";
|
||||
mappings[Template.XBOXSSHash] = sshash ?? "";
|
||||
mappings[Template.XBOXSSRanges] = ss ?? "";
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter) ?? "";
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter) ?? "";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -400,7 +410,7 @@ namespace DICUI.Utilities
|
||||
}
|
||||
else if (line.StartsWith("Total errors:"))
|
||||
{
|
||||
return Int64.Parse(line.Remove(0, 14));
|
||||
return Int64.Parse(line.Remove(0, "Total errors:".Length).Trim());
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -413,6 +423,49 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the existance of an anti-modchip string from the input file, if possible
|
||||
/// </summary>
|
||||
/// <param name="disc">_disc.txt file location</param>
|
||||
/// <returns>Antimodchip existance if possible, false on error</returns>
|
||||
private static bool GetAntiModchipDetected(string disc)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(disc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
using (StreamReader sr = File.OpenText(disc))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check for either antimod string
|
||||
string line = sr.ReadLine().Trim();
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
if (line.StartsWith("Detected anti-mod string"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (line.StartsWith("No anti-mod string"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
line = sr.ReadLine().Trim();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the layerbreak from the input file, if possible
|
||||
/// </summary>
|
||||
@@ -430,12 +483,6 @@ namespace DICUI.Utilities
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _disc.txt
|
||||
if (sr.ReadLine() != "========== DiscStructure ==========")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fast forward to the layerbreak
|
||||
while (!sr.ReadLine().Trim().StartsWith("EndDataSector")) ;
|
||||
|
||||
@@ -450,6 +497,41 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the detected missing EDC count from the input files, if possible
|
||||
/// </summary>
|
||||
/// <param name="edcecc">.img_EdcEcc.txt file location</param>
|
||||
/// <returns>Missing EDC count if possible, -1 on error</returns>
|
||||
private static long GetMissingEDCCount(string edcecc)
|
||||
{
|
||||
// If one of the files doesn't exist, we can't get info from them
|
||||
if (!File.Exists(edcecc))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First line of defense is the EdcEcc error file
|
||||
using (StreamReader sr = File.OpenText(edcecc))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Fast forward to the PVD
|
||||
string line = sr.ReadLine();
|
||||
while (!line.StartsWith("[INFO]"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
return Int64.Parse(line.Remove(0, "[INFO] Number of sector(s) where EDC doesn't exist: ".Length).Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the PVD from the input file, if possible
|
||||
/// </summary>
|
||||
@@ -467,22 +549,15 @@ namespace DICUI.Utilities
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _mainInfo.txt
|
||||
if (sr.ReadLine() != "========== LBA[000016, 0x00010]: Main Channel ==========")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fast forward to the PVD
|
||||
while (!sr.ReadLine().StartsWith("0310")) ;
|
||||
|
||||
// Now that we're at the PVD, read each line in and concatenate
|
||||
string pvd = sr.ReadLine() + "\n"; // 0320
|
||||
pvd += sr.ReadLine() + "\n"; // 0330
|
||||
pvd += sr.ReadLine() + "\n"; // 0340
|
||||
pvd += sr.ReadLine() + "\n"; // 0350
|
||||
pvd += sr.ReadLine() + "\n"; // 0360
|
||||
pvd += sr.ReadLine() + "\n"; // 0370
|
||||
string pvd = "";
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
pvd += sr.ReadLine() + "\n"; // 320-370
|
||||
}
|
||||
|
||||
return pvd;
|
||||
}
|
||||
@@ -689,12 +764,6 @@ namespace DICUI.Utilities
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _disc.txt for XBOX
|
||||
if (sr.ReadLine() != "========== Lock state ==========")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fast forward to the Security Sector Ranges
|
||||
while (!sr.ReadLine().Trim().StartsWith("Number of security sector ranges:")) ;
|
||||
|
||||
@@ -745,12 +814,6 @@ namespace DICUI.Utilities
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _disc.txt
|
||||
if (sr.ReadLine() != "========== TOC ==========")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fast forward to the offsets
|
||||
while (!sr.ReadLine().Trim().StartsWith("========== Offset")) ;
|
||||
sr.ReadLine(); // Combined Offset
|
||||
@@ -887,12 +950,6 @@ namespace DICUI.Utilities
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
output.Add(Template.CopyProtectionField + ": " + info[Template.CopyProtectionField]); output.Add("");
|
||||
|
||||
if (info.ContainsKey(Template.SubIntentionField))
|
||||
{
|
||||
output.Add(Template.SubIntentionField + ":"); output.Add("");
|
||||
output.AddRange(info[Template.SubIntentionField].Split('\n'));
|
||||
}
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
@@ -904,6 +961,11 @@ namespace DICUI.Utilities
|
||||
output.AddRange(info[Template.XBOXSSRanges].Split('\n'));
|
||||
break;
|
||||
}
|
||||
if (info.ContainsKey(Template.SubIntentionField))
|
||||
{
|
||||
output.Add(Template.SubIntentionField + ":"); output.Add("");
|
||||
output.AddRange(info[Template.SubIntentionField].Split('\n')); output.Add("");
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CD:
|
||||
|
||||
36
appveyor.yml
Normal file
36
appveyor.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
# version format
|
||||
version: 1.06_{build}
|
||||
|
||||
# vm template
|
||||
image: Visual Studio 2017
|
||||
|
||||
# environment variables
|
||||
environment:
|
||||
EnableNuGetPackageRestore: true
|
||||
|
||||
# msbuild configuration
|
||||
platform:
|
||||
- AnyCPU
|
||||
configuration:
|
||||
- Debug
|
||||
|
||||
# install dependencies
|
||||
install:
|
||||
- ps: appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
||||
|
||||
# pre-build script
|
||||
before_build:
|
||||
- nuget restore
|
||||
|
||||
# build step
|
||||
build:
|
||||
verbosity: minimal
|
||||
|
||||
# post-build step
|
||||
after_build:
|
||||
- 7z a dicui_%APPVEYOR_BUILD_VERSION%.zip bin\Debug
|
||||
|
||||
# artifact linking
|
||||
artifacts:
|
||||
- path: dicui_$(version).zip
|
||||
name: DICUI
|
||||
Reference in New Issue
Block a user