mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-05 21:29:24 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ba04e63c7 | ||
|
|
77dc1d0029 | ||
|
|
2b6538707f | ||
|
|
902e4e5715 | ||
|
|
28f6d50e5a | ||
|
|
d8ed7d6ad7 | ||
|
|
078d7d0ea3 | ||
|
|
5895a66c7a | ||
|
|
5ccff836e2 | ||
|
|
b2c2e8c4d9 | ||
|
|
890959cfe0 | ||
|
|
8729c7f20c |
6
DICUI.Check/App.config
Normal file
6
DICUI.Check/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
</configuration>
|
||||
59
DICUI.Check/DICUI.Check.csproj
Normal file
59
DICUI.Check/DICUI.Check.csproj
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8CFDE289-E171-4D49-A40D-5293265C1253}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>DICUI.Check</RootNamespace>
|
||||
<AssemblyName>DICUI.Check</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
|
||||
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
|
||||
<Name>DICUI.Library</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
163
DICUI.Check/Program.cs
Normal file
163
DICUI.Check/Program.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI.Check
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// Help options
|
||||
if (args.Length == 0
|
||||
|| args[0] == "/h" || args[0] == "/?"
|
||||
|| args[0] == "-h" || args[0] == "-?")
|
||||
{
|
||||
DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
// List options
|
||||
if (args[0] == "/lm" || args[0] == "/listmedia"
|
||||
|| args[0] == "-lm" || args[0] == "--listmedia")
|
||||
{
|
||||
ListMediaTypes();
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
else if (args[0] == "/ls" || args[0] == "/listsystems"
|
||||
|| args[0] == "-ls" || args[0] == "--listsystems")
|
||||
{
|
||||
ListKnownSystems();
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
|
||||
// Normal operation check
|
||||
if (args.Length < 3)
|
||||
{
|
||||
DisplayHelp("Invalid number of arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the MediaType
|
||||
var mediaType = Converters.StringToMediaType(args[0].Trim('"'));
|
||||
if (mediaType == MediaType.NONE)
|
||||
{
|
||||
DisplayHelp($"{args[0]} is not a recognized media type");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the KnownSystem
|
||||
var knownSystem = Converters.StringToKnownSystem(args[1].Trim('"'));
|
||||
if (knownSystem == KnownSystem.NONE)
|
||||
{
|
||||
DisplayHelp($"{args[1]} is not a recognized system");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make a new Progress object
|
||||
var progress = new Progress<Result>();
|
||||
progress.ProgressChanged += ProgressUpdated;
|
||||
|
||||
// Loop through all the rest of the args
|
||||
for (int i = 2; i < args.Length; i++)
|
||||
{
|
||||
// Check for a file
|
||||
if (!File.Exists(args[i]))
|
||||
{
|
||||
DisplayHelp($"{args[i]} does not exist");
|
||||
return;
|
||||
}
|
||||
|
||||
// Now populate an environment
|
||||
var env = new DumpEnvironment
|
||||
{
|
||||
OutputDirectory = "",
|
||||
OutputFilename = args[i],
|
||||
System = knownSystem,
|
||||
Type = mediaType,
|
||||
ScanForProtection = false,
|
||||
};
|
||||
env.FixOutputPaths();
|
||||
|
||||
// Finally, attempt to do the output dance
|
||||
var result = env.VerifyAndSaveDumpOutput(progress);
|
||||
Console.WriteLine(result.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Display help for DICUI.Check
|
||||
/// </summary>
|
||||
/// <param name="error">Error string to prefix the help text with</param>
|
||||
private static void DisplayHelp(string error = null)
|
||||
{
|
||||
if (error != null)
|
||||
Console.WriteLine(error);
|
||||
|
||||
Console.WriteLine("Usage:");
|
||||
Console.WriteLine("DICUI.Check.exe <mediatype> <system> </path/to/output.bin> ...");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(@"Common Media Types:\r\n
|
||||
bd / bluray - BD-ROM
|
||||
cd / cdrom - CD-ROM
|
||||
dvd - DVD-ROM
|
||||
fd / floppy - Floppy Disk
|
||||
gd / gdrom - GD-ROM
|
||||
umd - UMD");
|
||||
Console.WriteLine("Run 'DICUI.Check.exe [-lm|--listmedia' for more options");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(@"Common Systems:\r\n
|
||||
apple / mac - Apple Macintosh
|
||||
cdi - Philips CD-i
|
||||
ibm / ibmpc - IBM PC Compatible
|
||||
psx / ps1 - Sony PlayStation
|
||||
ps2 - Sony PlayStation 2
|
||||
psp - Sony PlayStation Portable
|
||||
saturn - Sega Saturn
|
||||
xbox - Microsoft XBOX
|
||||
x360 - Microsoft XBOX 360");
|
||||
Console.WriteLine("Run 'DICUI.Check.exe [-ls|--listsystems' for more options");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all media types with their short usable names
|
||||
/// </summary>
|
||||
private static void ListMediaTypes()
|
||||
{
|
||||
Console.WriteLine("Supported Media Types:");
|
||||
foreach (var val in Enum.GetValues(typeof(MediaType)))
|
||||
{
|
||||
if (((MediaType)val) == MediaType.NONE)
|
||||
continue;
|
||||
|
||||
Console.WriteLine($"{((MediaType?)val).ShortName()} - {((MediaType?)val).Name()}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all known systems with their short usable names
|
||||
/// </summary>
|
||||
private static void ListKnownSystems()
|
||||
{
|
||||
Console.WriteLine("Supported Known Systems:");
|
||||
foreach (var val in Enum.GetValues(typeof(KnownSystem)))
|
||||
{
|
||||
if (((KnownSystem)val) == KnownSystem.NONE)
|
||||
continue;
|
||||
|
||||
Console.WriteLine($"{((KnownSystem?)val).ShortName()} - {((KnownSystem?)val).Name()}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simple process counter to write to console
|
||||
/// </summary>
|
||||
private static void ProgressUpdated(object sender, Result value)
|
||||
{
|
||||
Console.WriteLine(value.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
DICUI.Check/Properties/AssemblyInfo.cs
Normal file
36
DICUI.Check/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DICUI.Check")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DICUI.Check")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8cfde289-e171-4d49-a40d-5293265c1253")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -56,6 +56,7 @@
|
||||
public const string SeventyFour = "/74";
|
||||
public const string SkipSector = "/sk";
|
||||
public const string SubchannelReadLevel = "/s";
|
||||
public const string VideoNow = "/vn";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
SeventyFour,
|
||||
SkipSector,
|
||||
SubchannelReadLevel,
|
||||
VideoNow,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,6 +70,7 @@
|
||||
|
||||
#region Consoles
|
||||
|
||||
AtariJaguarCD,
|
||||
BandaiPlaydiaQuickInteractiveSystem,
|
||||
BandaiApplePippin,
|
||||
CommodoreAmigaCD32,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -290,6 +290,9 @@ namespace DICUI.Utilities
|
||||
// First, sanitized the output filename to strip off any potential extension
|
||||
string outputFilename = Path.GetFileNameWithoutExtension(OutputFilename);
|
||||
|
||||
// Some disc types are audio-only
|
||||
bool audioOnly = (System == KnownSystem.AtariJaguarCD) || (System == KnownSystem.AudioCD);
|
||||
|
||||
// Now ensure that all required files exist
|
||||
string combinedBase = Path.Combine(OutputDirectory, outputFilename);
|
||||
switch (Type)
|
||||
@@ -301,8 +304,8 @@ namespace DICUI.Utilities
|
||||
&& File.Exists(combinedBase + ".cue")
|
||||
&& File.Exists(combinedBase + ".dat")
|
||||
&& File.Exists(combinedBase + ".img")
|
||||
&& (System == KnownSystem.AudioCD || File.Exists(combinedBase + ".img_EdcEcc.txt"))
|
||||
&& (System == KnownSystem.AudioCD || File.Exists(combinedBase + ".scm"))
|
||||
&& (audioOnly || File.Exists(combinedBase + ".img_EdcEcc.txt") || File.Exists(combinedBase + ".img_EccEdc.txt"))
|
||||
&& (audioOnly || File.Exists(combinedBase + ".scm"))
|
||||
&& File.Exists(combinedBase + ".sub")
|
||||
&& File.Exists(combinedBase + "_c2Error.txt")
|
||||
&& File.Exists(combinedBase + "_cmd.txt")
|
||||
@@ -455,11 +458,20 @@ namespace DICUI.Utilities
|
||||
case MediaType.GDROM: // TODO: Verify GD-ROM outputs this
|
||||
mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.MasteringSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings["Label-Side " + Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings["Data-Side " + Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? "Disc has no PVD";
|
||||
mappings[Template.ErrorCountField] = GetErrorCount(combinedBase + ".img_EdcEcc.txt").ToString();
|
||||
|
||||
long errorCount = -1;
|
||||
if (File.Exists(combinedBase + ".img_EdcEcc.txt"))
|
||||
errorCount = GetErrorCount(combinedBase + ".img_EdcEcc.txt");
|
||||
else if (File.Exists(combinedBase + ".img_EccEdc.txt"))
|
||||
errorCount = GetErrorCount(combinedBase + ".img_EccEdc.txt");
|
||||
|
||||
mappings[Template.ErrorCountField] = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString());
|
||||
|
||||
mappings[Template.CuesheetField] = GetFullFile(combinedBase + ".cue") ?? "";
|
||||
mappings[Template.WriteOffsetField] = GetWriteOffset(combinedBase + "_disc.txt") ?? "";
|
||||
|
||||
@@ -620,7 +632,6 @@ namespace DICUI.Utilities
|
||||
mappings[Template.CopyProtectionField] = GetDVDProtection(combinedBase + "_CSSKey.txt", combinedBase + "_disc.txt") ?? "";
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
case KnownSystem.MicrosoftXBOX360:
|
||||
if (GetXBOXAuxInfo(combinedBase + "_disc.txt", out string dmihash, out string pfihash, out string sshash, out string ss, out string ssver))
|
||||
{
|
||||
mappings[Template.XBOXDMIHash] = dmihash ?? "";
|
||||
@@ -629,7 +640,29 @@ namespace DICUI.Utilities
|
||||
mappings[Template.XBOXSSVersion] = ssver ?? "";
|
||||
mappings[Template.XBOXSSRanges] = ss ?? "";
|
||||
}
|
||||
if (GetXBOXDMIInfo(Path.Combine(OutputDirectory, "DMI.bin"), out string serial, out string version, out string region))
|
||||
{
|
||||
mappings[Template.DiscSerialField] = serial ?? Template.RequiredValue;
|
||||
mappings[Template.VersionField] = version ?? Template.RequiredValue;
|
||||
mappings[Template.RegionField] = region ?? Template.RequiredValue;
|
||||
}
|
||||
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX360:
|
||||
if (GetXBOXAuxInfo(combinedBase + "_disc.txt", out string dmi360hash, out string pfi360hash, out string ss360hash, out string ss360, out string ssver360))
|
||||
{
|
||||
mappings[Template.XBOXDMIHash] = dmi360hash ?? "";
|
||||
mappings[Template.XBOXPFIHash] = pfi360hash ?? "";
|
||||
mappings[Template.XBOXSSHash] = ss360hash ?? "";
|
||||
mappings[Template.XBOXSSVersion] = ssver360 ?? "";
|
||||
mappings[Template.XBOXSSRanges] = ss360 ?? "";
|
||||
}
|
||||
if (GetXBOX360DMIInfo(Path.Combine(OutputDirectory, "DMI.bin"), out string serial360, out string version360, out string region360))
|
||||
{
|
||||
mappings[Template.DiscSerialField] = serial360 ?? Template.RequiredValue;
|
||||
mappings[Template.VersionField] = version360 ?? Template.RequiredValue;
|
||||
mappings[Template.RegionField] = region360 ?? Template.RequiredValue;
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(Drive.Letter) ?? "";
|
||||
@@ -712,8 +745,8 @@ namespace DICUI.Utilities
|
||||
output.Add("\tInner " + Template.MasteringRingField + ": " + info["Inner " + Template.MasteringRingField]);
|
||||
output.Add("\tOuter " + Template.MasteringSIDField + ": " + info["Outer " + Template.MasteringSIDField]);
|
||||
output.Add("\tInner " + Template.MasteringSIDField + ": " + info["Inner " + Template.MasteringSIDField]);
|
||||
output.Add("\tLabel-Side " + Template.MouldSIDField + ": " + info["Label-Side " + Template.MouldSIDField]);
|
||||
output.Add("\tData-Side " + Template.MouldSIDField + ": " + info["Data-Side " + Template.MouldSIDField]);
|
||||
output.Add("\tLabel-Side " + Template.MouldSIDField + ": " + info["Label-Side " + Template.MouldSIDField]);
|
||||
output.Add("\t" + Template.AdditionalMouldField + ": " + info[Template.AdditionalMouldField]);
|
||||
output.Add("\tOuter " + Template.ToolstampField + ": " + info["Outer " + Template.ToolstampField]);
|
||||
output.Add("\tInner " + Template.ToolstampField + ": " + info["Inner " + Template.ToolstampField]);
|
||||
@@ -723,8 +756,8 @@ namespace DICUI.Utilities
|
||||
{
|
||||
output.Add("\t" + Template.MasteringRingField + ": " + info[Template.MasteringRingField]);
|
||||
output.Add("\t" + Template.MasteringSIDField + ": " + info[Template.MasteringSIDField]);
|
||||
output.Add("\tLabel-Side " + Template.MouldSIDField + ": " + info["Label-Side " + Template.MouldSIDField]);
|
||||
output.Add("\tData-Side " + Template.MouldSIDField + ": " + info["Data-Side " + Template.MouldSIDField]);
|
||||
output.Add("\tLabel-Side " + Template.MouldSIDField + ": " + info["Label-Side " + Template.MouldSIDField]);
|
||||
output.Add("\t" + Template.AdditionalMouldField + ": " + info[Template.AdditionalMouldField]);
|
||||
output.Add("\t" + Template.ToolstampField + ": " + info[Template.ToolstampField]);
|
||||
}
|
||||
@@ -1029,7 +1062,7 @@ namespace DICUI.Utilities
|
||||
/// <summary>
|
||||
/// Get the detected error count from the input files, if possible
|
||||
/// </summary>
|
||||
/// <param name="edcecc">.img_EdcEcc.txt file location</param>
|
||||
/// <param name="edcecc">.img_EdcEcc.txt/.img_EccEdc.txt file location</param>
|
||||
/// <returns>Error count if possible, -1 on error</returns>
|
||||
private long GetErrorCount(string edcecc)
|
||||
{
|
||||
@@ -1651,6 +1684,98 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the XOX serial info from the DMI.bin file, if possible
|
||||
/// </summary>
|
||||
/// <param name="dmi">DMI.bin file location</param>
|
||||
/// <returns>True on successful extraction of info, false otherwise</returns>
|
||||
private bool GetXBOXDMIInfo(string dmi, out string serial, out string version, out string region)
|
||||
{
|
||||
serial = null; version = null; region = null;
|
||||
|
||||
if (!File.Exists(dmi))
|
||||
return false;
|
||||
|
||||
using (BinaryReader br = new BinaryReader(File.OpenRead(dmi)))
|
||||
{
|
||||
try
|
||||
{
|
||||
br.BaseStream.Seek(8, SeekOrigin.Begin);
|
||||
char[] str = br.ReadChars(8);
|
||||
|
||||
serial = $"{str[0]}{str[1]}-{str[2]}{str[3]}{str[4]}";
|
||||
version = $"1.{str[5]}{str[6]}";
|
||||
region = GetXBOXRegion(str[7]);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the XBOX 360 serial info from the DMI.bin file, if possible
|
||||
/// </summary>
|
||||
/// <param name="dmi">DMI.bin file location</param>
|
||||
/// <returns>True on successful extraction of info, false otherwise</returns>
|
||||
private bool GetXBOX360DMIInfo(string dmi, out string serial, out string version, out string region)
|
||||
{
|
||||
serial = null; version = null; region = null;
|
||||
|
||||
if (!File.Exists(dmi))
|
||||
return false;
|
||||
|
||||
using (BinaryReader br = new BinaryReader(File.OpenRead(dmi)))
|
||||
{
|
||||
try
|
||||
{
|
||||
br.BaseStream.Seek(64, SeekOrigin.Begin);
|
||||
char[] str = br.ReadChars(14);
|
||||
|
||||
serial = $"{str[0]}{str[1]}-{str[2]}{str[3]}{str[4]}{str[5]}";
|
||||
version = $"1.{str[6]}{str[7]}";
|
||||
region = GetXBOXRegion(str[8]);
|
||||
// str[9], str[10], str[11] - unknown purpose
|
||||
// str[12], str[13] - disc <12> of <13>
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine the region based on the XBOX serial character
|
||||
/// </summary>
|
||||
/// <param name="region">Character denoting the region</param>
|
||||
/// <returns>Region name, if possible</returns>
|
||||
private string GetXBOXRegion(char region)
|
||||
{
|
||||
switch (region)
|
||||
{
|
||||
case 'W':
|
||||
return "World";
|
||||
case 'A':
|
||||
return "USA";
|
||||
case 'J':
|
||||
return "Japan or Asia";
|
||||
case 'E':
|
||||
return "Europe (or single country)";
|
||||
case 'K':
|
||||
return "USA, Japan or USA, Asia";
|
||||
case 'L':
|
||||
return "USA, Europe";
|
||||
case 'H':
|
||||
return "Japan, Europe";
|
||||
default:
|
||||
return "Could not determine region";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the write offset from the input file, if possible
|
||||
/// </summary>
|
||||
@@ -1708,7 +1833,7 @@ namespace DICUI.Utilities
|
||||
/// Verify that the current environment has a complete dump and create submission info is possible
|
||||
/// </summary>
|
||||
/// <returns>Result instance with the outcome</returns>
|
||||
private Result VerifyAndSaveDumpOutput(IProgress<Result> progress)
|
||||
public Result VerifyAndSaveDumpOutput(IProgress<Result> progress)
|
||||
{
|
||||
// Check to make sure that the output had all the correct files
|
||||
if (!FoundAllFiles())
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace DICUI.Utilities
|
||||
return Converters.MediaTypeToString(type);
|
||||
}
|
||||
|
||||
public static string ShortName(this MediaType? type)
|
||||
{
|
||||
return Converters.MediaTypeToShortString(type);
|
||||
}
|
||||
|
||||
public static string Extension(this MediaType? type)
|
||||
{
|
||||
return Converters.MediaTypeToExtension(type);
|
||||
@@ -67,6 +72,11 @@ namespace DICUI.Utilities
|
||||
return Converters.KnownSystemToString(system);
|
||||
}
|
||||
|
||||
public static string ShortName(this KnownSystem? system)
|
||||
{
|
||||
return Converters.KnownSystemToShortString(system);
|
||||
}
|
||||
|
||||
public static KnownSystemCategory Category(this KnownSystem? system)
|
||||
{
|
||||
if (system < KnownSystem.MarkerConsoleEnd)
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace DICUI.Utilities
|
||||
public int? ScanFileProtectValue; // Timeout value (default 60)
|
||||
public int?[] SkipSectorValue = new int?[2]; // Skip between sectors
|
||||
public int? SubchannelReadLevelValue; // 0 no next sub, 1 next sub (default), 2 next and next next
|
||||
public int? VideoNowValue; // Insert n empty bytes in the head of 1st track
|
||||
|
||||
/// <summary>
|
||||
/// Generic empty constructor for adding things individually
|
||||
@@ -90,6 +91,7 @@ namespace DICUI.Utilities
|
||||
ForceUnitAccessValue = null;
|
||||
ScanFileProtectValue = null;
|
||||
SubchannelReadLevelValue = null;
|
||||
VideoNowValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,6 +500,7 @@ namespace DICUI.Utilities
|
||||
if (Command == DICCommand.Audio
|
||||
|| Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.ScanFileProtect])
|
||||
@@ -570,6 +573,22 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
// VideoNow
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.VideoNow])
|
||||
{
|
||||
parameters.Add(DICFlag.VideoNow.Name());
|
||||
if (VideoNowValue != null)
|
||||
{
|
||||
if (VideoNowValue >= 0)
|
||||
parameters.Add(VideoNowValue.ToString());
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return string.Join(" ", parameters);
|
||||
}
|
||||
|
||||
@@ -1165,7 +1184,8 @@ namespace DICUI.Utilities
|
||||
|
||||
case DICFlagStrings.ScanFileProtect:
|
||||
if (parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.Data)
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.DigitalVideoDisc)
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
@@ -1240,6 +1260,27 @@ namespace DICUI.Utilities
|
||||
i++;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.VideoNow:
|
||||
if (parts[0] != DICCommandStrings.CompactDisc)
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[DICFlag.VideoNow] = true;
|
||||
break;
|
||||
}
|
||||
else if (IsFlag(parts[i + 1]))
|
||||
{
|
||||
this[DICFlag.VideoNow] = true;
|
||||
break;
|
||||
}
|
||||
else if (!IsValidNumber(parts[i + 1], lowerBound: 0))
|
||||
return false;
|
||||
|
||||
this[DICFlag.VideoNow] = true;
|
||||
VideoNowValue = Int32.Parse(parts[i + 1]);
|
||||
i++;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -1412,6 +1453,9 @@ namespace DICUI.Utilities
|
||||
SubchannelReadLevelValue = 2;
|
||||
}
|
||||
break;
|
||||
case KnownSystem.HasbroVideoNow:
|
||||
this[DICFlag.VideoNow] = true;
|
||||
break;
|
||||
case KnownSystem.NECPCEngineTurboGrafxCD:
|
||||
this[DICFlag.MCN] = true;
|
||||
break;
|
||||
@@ -1423,7 +1467,10 @@ namespace DICUI.Utilities
|
||||
break;
|
||||
case MediaType.DVD:
|
||||
if (paranoid)
|
||||
{
|
||||
this[DICFlag.CopyrightManagementInformation] = true;
|
||||
this[DICFlag.ScanFileProtect] = true;
|
||||
}
|
||||
break;
|
||||
case MediaType.GDROM:
|
||||
this[DICFlag.C2Opcode] = true;
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace DICUI.Utilities
|
||||
{
|
||||
#region Consoles
|
||||
|
||||
case KnownSystem.AtariJaguarCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.BandaiPlaydiaQuickInteractiveSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
@@ -270,6 +273,7 @@ namespace DICUI.Utilities
|
||||
break;
|
||||
case KnownSystem.PanasonicM2:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.PhotoPlayVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace DICUI.Test.Utilities
|
||||
/* paranoid mode tests */
|
||||
[InlineData(KnownSystem.IBMPCCompatible, MediaType.CDROM, true, 1000, 2, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect, DICFlag.ScanSectorProtect, DICFlag.SubchannelReadLevel })]
|
||||
[InlineData(KnownSystem.AppleMacintosh, MediaType.CDROM, false, 20, null, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect })]
|
||||
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, true, 500, null, new DICFlag[] { DICFlag.CopyrightManagementInformation })]
|
||||
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, true, 500, null, new DICFlag[] { DICFlag.CopyrightManagementInformation, DICFlag.ScanFileProtect })]
|
||||
[InlineData(KnownSystem.HDDVDVideo, MediaType.HDDVD, true, 500, null, new DICFlag[] { DICFlag.CopyrightManagementInformation })]
|
||||
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, false, 500, null, new DICFlag[] { })]
|
||||
[InlineData(KnownSystem.HDDVDVideo, MediaType.HDDVD, false, 500, null, new DICFlag[] { })]
|
||||
|
||||
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Library", "DICUI.Libr
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Forms", "DICUI.Forms\DICUI.Forms.csproj", "{A6719A99-BF0E-4637-9A8E-CB38B1E16971}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Check", "DICUI.Check\DICUI.Check.csproj", "{8CFDE289-E171-4D49-A40D-5293265C1253}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -33,6 +35,10 @@ Global
|
||||
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
11
appveyor.yml
11
appveyor.yml
@@ -32,20 +32,23 @@ build:
|
||||
|
||||
# post-build step
|
||||
after_build:
|
||||
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/2500541/DiscImageCreator_20181022.zip
|
||||
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/3008503/DiscImageCreator_20190326.zip
|
||||
- ps: appveyor DownloadFile http://www.rawdump.net/tools/subdump_fua_0x28.zip
|
||||
- 7z e DiscImageCreator_20181022.zip -oDICUI\bin\Debug\Programs Release_ANSI\*
|
||||
- 7z e DiscImageCreator_20181022.zip -oDICUI.Forms\bin\Debug\Programs Release_ANSI\*
|
||||
- 7z e DiscImageCreator_20190326.zip -oDICUI\bin\Debug\Programs Release_ANSI\*
|
||||
- 7z e DiscImageCreator_20190326.zip -oDICUI.Forms\bin\Debug\Programs Release_ANSI\*
|
||||
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug *
|
||||
- 7z e subdump_fua_0x28.zip -oDICUI.Forms\bin\Debug *
|
||||
- mv DICUI\bin\Debug\subdump_fua_0x28.exe DICUI\bin\Debug\subdump.exe
|
||||
- mv DICUI.Forms\bin\Debug\subdump_fua_0x28.exe DICUI.Forms\bin\Debug\subdump.exe
|
||||
- 7z a DICUI.zip DICUI\bin\Debug\*
|
||||
- 7z a DICUI-Winforms.zip DICUI.Forms\bin\Debug\*
|
||||
- 7z a DICUI-Check.zip DICUI.Check\bin\Debug\*
|
||||
|
||||
# artifact linking
|
||||
artifacts:
|
||||
- path: DICUI.zip
|
||||
name: DICUI
|
||||
- path: DICUI-Winforms.zip
|
||||
name: DICUI Winforms
|
||||
name: DICUI Winforms
|
||||
- path: DICUI-Check.zip
|
||||
name: DICUI Check
|
||||
Reference in New Issue
Block a user