mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-05 13:49:40 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61ce45667b | ||
|
|
ababfdd2ed | ||
|
|
9683074197 | ||
|
|
ab2bc8f50c | ||
|
|
aa86ddaf47 | ||
|
|
68afebace4 | ||
|
|
bebe3ab8a0 |
14
Constants.cs
14
Constants.cs
@@ -98,16 +98,16 @@
|
||||
public const string SubIntentionField = "SubIntention (SecuROM)";
|
||||
public const string WriteOffsetField = "WriteOffset";
|
||||
public const string LayerbreakField = "Layerbreak";
|
||||
public const string PlaystationEXEDateField = "EXE Date"; // TODO: Not automatic yet
|
||||
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 SaturnHeaderField = "Header"; // TODO: Not automatic yet
|
||||
public const string SaturnBuildDateField = "Build Date"; // TODO: Not automatic yet
|
||||
public const string XBOXDMICRC = "DMI.bin CRC32"; // TODO: Not automatic yet
|
||||
public const string XBOXPFICRC = "PFI.bin CRC32"; // TODO: Not automatic yet
|
||||
public const string XBOXSSCRC = "SS.bin CRC32"; // TODO: Not automatic yet
|
||||
public const string XBOXSSRanges = "Security Sector Ranges"; // TODO: Not automatic yet
|
||||
public const string SaturnHeaderField = "Header";
|
||||
public const string SaturnBuildDateField = "Build Date";
|
||||
public const string XBOXDMIHash = "DMI.bin Hashes";
|
||||
public const string XBOXPFIHash = "PFI.bin Hashes";
|
||||
public const string XBOXSSHash = "SS.bin Hashes";
|
||||
public const string XBOXSSRanges = "Security Sector Ranges";
|
||||
|
||||
// Default values
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
CommodoreAmigaCDTV,
|
||||
MattelHyperscan,
|
||||
MicrosoftXBOX,
|
||||
MicrosoftXBOX360,
|
||||
MicrosoftXBOX360XDG2,
|
||||
MicrosoftXBOX360XDG3,
|
||||
MicrosoftXBOXOne,
|
||||
NECPCEngineTurboGrafxCD,
|
||||
NECPCFX,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
@@ -58,7 +58,11 @@ namespace DICUI
|
||||
else if ((string)btn_StartStop.Content == UIElements.StopDumping)
|
||||
{
|
||||
CancelDumping();
|
||||
EjectDisc();
|
||||
|
||||
if (chk_EjectWhenDone.IsChecked == true)
|
||||
{
|
||||
EjectDisc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +163,7 @@ namespace DICUI
|
||||
if (cmb_DriveLetter.Items.Count > 0)
|
||||
{
|
||||
lbl_Status.Content = "Valid optical disc found! Choose your Disc Type";
|
||||
btn_StartStop.IsEnabled = true;
|
||||
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,11 +273,6 @@ namespace DICUI
|
||||
childProcess.WaitForExit();
|
||||
});
|
||||
|
||||
if (chk_EjectWhenDone.IsChecked == true)
|
||||
{
|
||||
EjectDisc();
|
||||
}
|
||||
|
||||
// Special cases
|
||||
switch (system)
|
||||
{
|
||||
@@ -380,17 +379,16 @@ namespace DICUI
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary<string, string> templateValues = DumpInformation.ExtractOutputInformation(outputDirectory, outputFilename, system, type, driveLetter);
|
||||
List<string> formattedValues = DumpInformation.FormatOutputData(templateValues, system, type);
|
||||
bool success = DumpInformation.WriteOutputData(outputDirectory, outputFilename, formattedValues);
|
||||
|
||||
lbl_Status.Content = "Dumping complete!";
|
||||
btn_StartStop.Content = UIElements.StartDumping;
|
||||
if (chk_EjectWhenDone.IsChecked == true)
|
||||
{
|
||||
EjectDisc();
|
||||
}
|
||||
|
||||
Dictionary<string, string> templateValues = DumpInformation.ExtractOutputInformation(outputDirectory, outputFilename, system, type);
|
||||
List<string> formattedValues = DumpInformation.FormatOutputData(templateValues, system, type);
|
||||
bool success = DumpInformation.WriteOutputData(outputDirectory, outputFilename, formattedValues);
|
||||
|
||||
btn_StartStop.Content = UIElements.StartDumping;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -466,7 +464,7 @@ namespace DICUI
|
||||
case DiscType.GameCubeGameDisc:
|
||||
case DiscType.GDROM:
|
||||
lbl_Status.Content = string.Format("{0} discs are partially supported by DIC", Converters.DiscTypeToString(tuple.Item3));
|
||||
btn_StartStop.IsEnabled = true;
|
||||
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
|
||||
break;
|
||||
case DiscType.HDDVD:
|
||||
case DiscType.UMD:
|
||||
@@ -475,9 +473,22 @@ namespace DICUI
|
||||
lbl_Status.Content = string.Format("{0} discs are not currently supported by DIC", Converters.DiscTypeToString(tuple.Item3));
|
||||
btn_StartStop.IsEnabled = false;
|
||||
break;
|
||||
case DiscType.DVD5:
|
||||
case DiscType.DVD9:
|
||||
if (tuple.Item2 == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
{
|
||||
lbl_Status.Content = string.Format("{0} discs are not currently supported by DIC", Converters.DiscTypeToString(tuple.Item3));
|
||||
btn_StartStop.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
lbl_Status.Content = string.Format("{0} ready to dump", Converters.DiscTypeToString(tuple.Item3));
|
||||
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
lbl_Status.Content = string.Format("{0} ready to dump", Converters.DiscTypeToString(tuple.Item3));
|
||||
btn_StartStop.IsEnabled = true;
|
||||
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -490,7 +501,16 @@ namespace DICUI
|
||||
cmb_DriveSpeed.IsEnabled = false;
|
||||
break;
|
||||
default:
|
||||
cmb_DriveSpeed.IsEnabled = true;
|
||||
if (tuple.Item2 == KnownSystem.MicrosoftXBOX
|
||||
|| tuple.Item2 == KnownSystem.MicrosoftXBOX360XDG2
|
||||
|| tuple.Item2 == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
{
|
||||
cmb_DriveSpeed.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmb_DriveSpeed.IsEnabled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -503,7 +523,7 @@ namespace DICUI
|
||||
btn_OutputDirectoryBrowse.IsEnabled = false;
|
||||
cmb_DriveLetter.IsEnabled = false;
|
||||
cmb_DriveSpeed.IsEnabled = false;
|
||||
btn_StartStop.IsEnabled = true;
|
||||
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
|
||||
lbl_Status.Content = "User input mode";
|
||||
}
|
||||
else
|
||||
@@ -513,14 +533,20 @@ namespace DICUI
|
||||
txt_OutputDirectory.IsEnabled = true;
|
||||
btn_OutputDirectoryBrowse.IsEnabled = true;
|
||||
cmb_DriveLetter.IsEnabled = true;
|
||||
cmb_DriveSpeed.IsEnabled = true;
|
||||
|
||||
// Populate with the correct params for inputs (if we're not on the default option)
|
||||
if (cmb_DiscType.SelectedIndex > 0)
|
||||
{
|
||||
var selected = cmb_DiscType.SelectedValue as Tuple<string, KnownSystem?, DiscType?>;
|
||||
var driveletter = cmb_DriveLetter.SelectedValue as Tuple<char, string, bool>;
|
||||
string discType = Converters.DiscTypeToBaseCommand(selected.Item3);
|
||||
|
||||
// If either item is invalid, skip this
|
||||
if (selected == null || driveletter == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string discType = Converters.KnownSystemAndDiscTypeToBaseCommand(selected.Item2, selected.Item3);
|
||||
List<string> defaultParams = Converters.KnownSystemAndDiscTypeToParameters(selected.Item2, selected.Item3);
|
||||
txt_Parameters.Text = discType
|
||||
+ " " + driveletter.Item1
|
||||
@@ -529,7 +555,8 @@ namespace DICUI
|
||||
&& selected.Item3 != DiscType.BD25
|
||||
&& selected.Item3 != DiscType.BD50
|
||||
&& selected.Item2 != KnownSystem.MicrosoftXBOX
|
||||
&& selected.Item2 != KnownSystem.MicrosoftXBOX360
|
||||
&& selected.Item2 != KnownSystem.MicrosoftXBOX360XDG2
|
||||
&& selected.Item2 != KnownSystem.MicrosoftXBOX360XDG3
|
||||
? (int)cmb_DriveSpeed.SelectedItem + " " : "")
|
||||
+ string.Join(" ", defaultParams);
|
||||
}
|
||||
|
||||
15
README.md
15
README.md
@@ -26,10 +26,25 @@ Dizzzy - Concept/Ideas/Beta tester
|
||||
Download the latest release here:
|
||||
[https://github.com/reignstumble/DICUI/releases](https://github.com/reignstumble/DICUI/releases)
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-06-15
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Version 1.06 released:
|
||||
|
||||
- Fixed not being able to use the `/c2` flag properly
|
||||
- Fixed times when the ability to start dumping was improperly allowed
|
||||
- Added full support for XBOX and XBOX360 (XDG1, XDG2) dumping through DIC (using a Kreon, or presumably a 0800)
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-06-14
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Version 1.05a released:
|
||||
|
||||
- Fixed some ordering and nullability issues
|
||||
- Added automatic fields for PS1, PS2, Saturn
|
||||
|
||||
Version 1.05 released:
|
||||
|
||||
- Miscellaneous fixes around custom parameter validation, dump information accuracy, settings window, and TODO cleanup
|
||||
|
||||
@@ -59,47 +59,6 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the DIC command to be used for a given DiscType
|
||||
/// </summary>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <returns>String containing the command, null on error</returns>
|
||||
public static string DiscTypeToBaseCommand(DiscType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
return DICCommands.CompactDisc;
|
||||
case DiscType.DVD5:
|
||||
case DiscType.DVD9:
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.GDROM:
|
||||
return DICCommands.GDROM;
|
||||
case DiscType.HDDVD:
|
||||
return null;
|
||||
case DiscType.BD25:
|
||||
case DiscType.BD50:
|
||||
return DICCommands.BluRay;
|
||||
|
||||
// Special Formats
|
||||
case DiscType.GameCubeGameDisc:
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.WiiOpticalDisc:
|
||||
return null;
|
||||
case DiscType.WiiUOpticalDisc:
|
||||
return null;
|
||||
case DiscType.UMD:
|
||||
return null;
|
||||
|
||||
// Non-optical
|
||||
case DiscType.Floppy:
|
||||
return DICCommands.Floppy;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default extension for a given disc type
|
||||
/// </summary>
|
||||
@@ -174,6 +133,64 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the DIC command to be used for a given DiscType
|
||||
/// </summary>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <returns>String containing the command, null on error</returns>
|
||||
public static string KnownSystemAndDiscTypeToBaseCommand(KnownSystem? sys, DiscType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
if (sys == KnownSystem.MicrosoftXBOX)
|
||||
{
|
||||
return DICCommands.XBOX;
|
||||
}
|
||||
return DICCommands.CompactDisc;
|
||||
case DiscType.DVD5:
|
||||
if (sys == KnownSystem.MicrosoftXBOX
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG2
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
{
|
||||
return DICCommands.XBOX;
|
||||
}
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.DVD9:
|
||||
if (sys == KnownSystem.MicrosoftXBOX
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG2
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
{
|
||||
return DICCommands.XBOX;
|
||||
}
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.GDROM:
|
||||
return DICCommands.GDROM;
|
||||
case DiscType.HDDVD:
|
||||
return null;
|
||||
case DiscType.BD25:
|
||||
case DiscType.BD50:
|
||||
return DICCommands.BluRay;
|
||||
|
||||
// Special Formats
|
||||
case DiscType.GameCubeGameDisc:
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.WiiOpticalDisc:
|
||||
return null;
|
||||
case DiscType.WiiUOpticalDisc:
|
||||
return null;
|
||||
case DiscType.UMD:
|
||||
return null;
|
||||
|
||||
// Non-optical
|
||||
case DiscType.Floppy:
|
||||
return DICCommands.Floppy;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list of default parameters for a given system and disc type
|
||||
/// </summary>
|
||||
@@ -275,8 +292,10 @@ namespace DICUI.Utilities
|
||||
return "Mattel HyperScan";
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
return "Microsoft XBOX";
|
||||
case KnownSystem.MicrosoftXBOX360:
|
||||
return "Microsoft XBOX 360";
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
return "Microsoft XBOX 360 (XDG2)";
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
return "Microsoft XBOX 360 (XDG3)";
|
||||
case KnownSystem.MicrosoftXBOXOne:
|
||||
return "Microsoft XBOX One";
|
||||
case KnownSystem.NECPCEngineTurboGrafxCD:
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
@@ -116,9 +118,10 @@ namespace DICUI.Utilities
|
||||
/// <param name="outputFilename">Base filename to use</param>
|
||||
/// <param name="sys">KnownSystem value to check</param>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <param name="driveLetter">Drive letter to check</param>
|
||||
/// <returns>Dictionary containing mapped output values, null on error</returns>
|
||||
/// <remarks>TODO: Make sure that all special formats are accounted for</remarks>
|
||||
public static Dictionary<string, string> ExtractOutputInformation(string outputDirectory, string outputFilename, KnownSystem? sys, DiscType? type)
|
||||
public static Dictionary<string, string> ExtractOutputInformation(string outputDirectory, string outputFilename, KnownSystem? sys, DiscType? type, char driveLetter)
|
||||
{
|
||||
// First, sanitized the output filename to strip off any potential extension
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
@@ -182,22 +185,28 @@ namespace DICUI.Utilities
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SegaSaturn:
|
||||
mappings[Template.SaturnHeaderField] = Template.RequiredValue; // GetSaturnHeader(GetFirstTrack(outputDirectory, outputFilename));
|
||||
mappings[Template.SaturnBuildDateField] = Template.RequiredValue; //GetSaturnBuildDate(GetFirstTrack(outputDirectory, outputFilename));
|
||||
mappings[Template.SaturnHeaderField] = GetSaturnHeader(GetFirstTrack(outputDirectory, outputFilename)).ToString();
|
||||
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;
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
mappings[Template.PlaystationEXEDateField] = Template.RequiredValue; // GetPlaysStationEXEDate(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.PlayStationEDCField] = Template.YesNoValue;
|
||||
mappings[Template.PlayStationAntiModchipField] = Template.YesNoValue;
|
||||
mappings[Template.PlayStationLibCryptField] = Template.YesNoValue;
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = Template.RequiredValue; // GetPlaysStationEXEDate(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case DiscType.DVD5: // TODO: Add XBOX360-specific outputs to this
|
||||
case DiscType.DVD5:
|
||||
case DiscType.HDDVD:
|
||||
case DiscType.BD25:
|
||||
mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
@@ -223,19 +232,14 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
mappings[Template.XBOXDMICRC] = Template.RequiredValue;
|
||||
mappings[Template.XBOXPFICRC] = Template.RequiredValue;
|
||||
mappings[Template.XBOXSSCRC] = Template.RequiredValue;
|
||||
mappings[Template.XBOXSSRanges] = Template.RequiredValue;
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = Template.RequiredValue; // GetPlaysStationEXEDate(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case DiscType.DVD9: // TODO: Add XBOX360-specific outputs to this
|
||||
case DiscType.DVD9:
|
||||
case DiscType.BD50:
|
||||
mappings["Outer " + Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
mappings["Inner " + Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
@@ -265,13 +269,19 @@ namespace DICUI.Utilities
|
||||
}
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
mappings[Template.XBOXDMICRC] = Template.RequiredValue;
|
||||
mappings[Template.XBOXPFICRC] = Template.RequiredValue;
|
||||
mappings[Template.XBOXSSCRC] = Template.RequiredValue;
|
||||
mappings[Template.XBOXSSRanges] = Template.RequiredValue;
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
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;
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = Template.RequiredValue; // GetPlaysStationEXEDate(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -482,6 +492,240 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the EXE date from a PlayStation disc, if possible
|
||||
/// </summary>
|
||||
/// <param name="driveLetter">Drive letter to use to check</param>
|
||||
/// <returns>EXE date in "yyyy-mm-dd" format if possible, null on error</returns>
|
||||
private static string GetPlayStationEXEDate(char driveLetter)
|
||||
{
|
||||
// If the folder no longer exists, we can't do this part
|
||||
string drivePath = driveLetter + ":\\";
|
||||
if (!Directory.Exists(drivePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we can't find SYSTEM.CNF, we don't have a PlayStation disc
|
||||
string systemCnfPath = Path.Combine(drivePath, "SYSTEM.CNF");
|
||||
if (!File.Exists(systemCnfPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Let's try reading SYSTEM.CNF to find the "BOOT" value
|
||||
string exeName = null;
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = File.OpenText(systemCnfPath))
|
||||
{
|
||||
// Not assuming proper ordering, just in case
|
||||
string line = sr.ReadLine();
|
||||
while (!line.StartsWith("BOOT"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Once it finds the "BOOT" line, extract the name
|
||||
exeName = Regex.Match(line, @"BOOT.? = cdrom.?:\\(.*?);.*").Groups[1].Value;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error was
|
||||
return null;
|
||||
}
|
||||
|
||||
// Now that we have the EXE name, try to get the fileinfo for it
|
||||
string exePath = Path.Combine(drivePath, exeName);
|
||||
if (!File.Exists(exePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
FileInfo fi = new FileInfo(exePath);
|
||||
return fi.LastWriteTimeUtc.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the version from a PlayStation 2 disc, if possible
|
||||
/// </summary>
|
||||
/// <param name="driveLetter">Drive letter to use to check</param>
|
||||
/// <returns>Game version if possible, null on error</returns>
|
||||
private static string GetPlayStation2Version(char driveLetter)
|
||||
{
|
||||
// If the folder no longer exists, we can't do this part
|
||||
string drivePath = driveLetter + ":\\";
|
||||
if (!Directory.Exists(drivePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we can't find SYSTEM.CNF, we don't have a PlayStation disc
|
||||
string systemCnfPath = Path.Combine(drivePath, "SYSTEM.CNF");
|
||||
if (!File.Exists(systemCnfPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Let's try reading SYSTEM.CNF to find the "VER" value
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = File.OpenText(systemCnfPath))
|
||||
{
|
||||
// Not assuming proper ordering, just in case
|
||||
string line = sr.ReadLine();
|
||||
while (!line.StartsWith("VER"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Once it finds the "VER" line, extract the version
|
||||
return Regex.Match(line, @"VER = (.*)").Groups[1].Value;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error was
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the header from a Saturn disc, if possible
|
||||
/// </summary>
|
||||
/// <param name="firstTrackPath">Path to the first track to check</param>
|
||||
/// <returns>Header as a byte array if possible, null on error</returns>
|
||||
private static string GetSaturnHeader(string firstTrackPath)
|
||||
{
|
||||
// If the file doesn't exist, we can't get the header
|
||||
if (!File.Exists(firstTrackPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Try to open the file and read the correct number of bytes
|
||||
try
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(File.OpenRead(firstTrackPath)))
|
||||
{
|
||||
br.ReadBytes(0x10);
|
||||
byte[] headerBytes = br.ReadBytes(0x100);
|
||||
|
||||
// Now format the bytes in a way we like
|
||||
string headerString = "";
|
||||
int ptr = 0;
|
||||
while (ptr < headerBytes.Length)
|
||||
{
|
||||
byte[] sub = new byte[16];
|
||||
Array.Copy(headerBytes, ptr, sub, 0, 16);
|
||||
headerString += ptr.ToString("X").PadLeft(4, '0') + " : "
|
||||
+ BitConverter.ToString(sub).Replace("-", " ") + " "
|
||||
+ Encoding.ASCII.GetString(sub) + "\n";
|
||||
ptr += 16;
|
||||
}
|
||||
|
||||
return headerString.TrimEnd('\n');
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error was
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the build info from a Saturn disc, if possible
|
||||
/// </summary>
|
||||
/// <<param name="saturnHeader">String representing a formatter variant of the Saturn header</param>
|
||||
/// <returns>True on successful extraction of info, false otherwise</returns>
|
||||
private static bool GetSaturnBuildInfo(string saturnHeader, out string serial, out string version, out string date)
|
||||
{
|
||||
serial = null; version = null; date = null;
|
||||
|
||||
// If the input header is null, we can't do a thing
|
||||
if (String.IsNullOrWhiteSpace(saturnHeader))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now read it in cutting it into lines for easier parsing
|
||||
try
|
||||
{
|
||||
string[] header = saturnHeader.Split('\n');
|
||||
string serialVersionLine = header[2].Substring(57);
|
||||
string dateLine = header[3].Substring(57);
|
||||
serial = serialVersionLine.Substring(0, 8);
|
||||
version = serialVersionLine.Substring(10, 6);
|
||||
date = dateLine.Substring(0, 8);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error is
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the XBOX/360 auxiliary info from the outputted files, if possible
|
||||
/// </summary>
|
||||
/// <param name="disc">_disc.txt file location</param>
|
||||
/// <returns>True on successful extraction of info, false otherwise</returns>
|
||||
private static bool GetXBOXAuxInfo(string disc, out string dmihash, out string pfihash, out string sshash, out string ss)
|
||||
{
|
||||
dmihash = null; pfihash = null; sshash = null; ss = null;
|
||||
|
||||
// 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
|
||||
{
|
||||
// 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:")) ;
|
||||
|
||||
// Now that we're at the ranges, read each line in and concatenate
|
||||
// TODO: Make this output like the old method (startlba-endlba)
|
||||
string line = sr.ReadLine();
|
||||
while (!line.Trim().StartsWith("========== Unlock 2 state(wxripper) =========="))
|
||||
{
|
||||
ss += line + "\n";
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Fast forward to the aux hashes
|
||||
while (!line.Trim().StartsWith("<rom"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Read in the hashes to the proper parts
|
||||
sshash = line.Trim();
|
||||
pfihash = sr.ReadLine().Trim();
|
||||
dmihash = sr.ReadLine().Trim();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the write offset from the input file, if possible
|
||||
/// </summary>
|
||||
@@ -586,7 +830,13 @@ namespace DICUI.Utilities
|
||||
break;
|
||||
}
|
||||
output.Add(Template.BarcodeField + ": " + info[Template.BarcodeField]);
|
||||
output.Add(Template.ISBNField + ": " + info[Template.ISBNField]);
|
||||
switch(sys)
|
||||
{
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
output.Add(Template.ISBNField + ": " + info[Template.ISBNField]);
|
||||
break;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
@@ -632,9 +882,11 @@ namespace DICUI.Utilities
|
||||
}
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
output.Add(Template.XBOXDMICRC + ": " + info[Template.XBOXDMICRC]);
|
||||
output.Add(Template.XBOXPFICRC + ": " + info[Template.XBOXPFICRC]);
|
||||
output.Add(Template.XBOXSSCRC + ": " + info[Template.XBOXSSCRC]); output.Add("");
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
output.Add(Template.XBOXDMIHash + ": " + info[Template.XBOXDMIHash]);
|
||||
output.Add(Template.XBOXPFIHash + ": " + info[Template.XBOXPFIHash]);
|
||||
output.Add(Template.XBOXSSHash + ": " + info[Template.XBOXSSHash]); output.Add("");
|
||||
output.Add(Template.XBOXSSRanges + ":"); output.Add("");
|
||||
output.AddRange(info[Template.XBOXSSRanges].Split('\n'));
|
||||
break;
|
||||
|
||||
@@ -39,9 +39,14 @@ namespace DICUI.Utilities
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
types.Add(DiscType.CD);
|
||||
types.Add(DiscType.DVD5);
|
||||
types.Add(DiscType.DVD9);
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX360:
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
types.Add(DiscType.CD);
|
||||
types.Add(DiscType.DVD9);
|
||||
types.Add(DiscType.HDDVD);
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
types.Add(DiscType.CD);
|
||||
types.Add(DiscType.DVD9);
|
||||
types.Add(DiscType.HDDVD);
|
||||
@@ -479,7 +484,8 @@ namespace DICUI.Utilities
|
||||
new ManagementObjectSearcher("root\\CIMV2",
|
||||
"SELECT * FROM Win32_LogicalDisk");
|
||||
|
||||
foreach (ManagementObject queryObj in searcher.Get())
|
||||
var collection = searcher.Get();
|
||||
foreach (ManagementObject queryObj in collection)
|
||||
{
|
||||
uint? mediaType = (uint?)queryObj["MediaType"];
|
||||
if (mediaType != null && ((mediaType > 0 && mediaType < 11) || (mediaType > 12 && mediaType < 22)))
|
||||
@@ -831,7 +837,7 @@ namespace DICUI.Utilities
|
||||
}
|
||||
i++;
|
||||
break;
|
||||
case DICFlags.ForceUnitAccess: // CD, GDROM, Data, Audio
|
||||
case DICFlags.ForceUnitAccess:
|
||||
if (parts[0] != DICCommands.CompactDisc
|
||||
&& parts[0] != DICCommands.GDROM
|
||||
&& parts[0] != DICCommands.Data
|
||||
@@ -913,21 +919,23 @@ namespace DICUI.Utilities
|
||||
for (int j = 1; j < 4; j++)
|
||||
{
|
||||
// If the next item doesn't exist, it's good
|
||||
if (!DoesNextExist(parts, i + j - 1))
|
||||
if (!DoesNextExist(parts, i + 1))
|
||||
{
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
// If the next item is a flag, it's good
|
||||
if (IsFlag(parts[i + j]))
|
||||
if (IsFlag(parts[i + 1]))
|
||||
{
|
||||
i += (j - 1);
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
// If the next item isn't a valid number
|
||||
else if (!IsValidNumber(parts[i + j], lowerBound: 0))
|
||||
else if (!IsValidNumber(parts[i + 1], lowerBound: 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case DICFlags.SubchannelReadLevel:
|
||||
|
||||
Reference in New Issue
Block a user