mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 05:35:52 +00:00
Add unused Dreamdump execution context
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
- Add MPRESS to packer filters
|
||||
- Update RedumpLib to 1.9.1
|
||||
- Split path creation in OptionsLoader
|
||||
- Add unused Dreamdump execution context
|
||||
|
||||
### 3.6.0 (2025-11-28)
|
||||
|
||||
|
||||
@@ -135,6 +135,15 @@ namespace MPF.CLI.Features
|
||||
|
||||
break;
|
||||
|
||||
// case InternalProgram.Dreamdump:
|
||||
// if (!File.Exists(Options.DreamdumpPath))
|
||||
// {
|
||||
// Console.Error.WriteLine("A path needs to be supplied in config.json for Dreamdump, exiting...");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// break;
|
||||
|
||||
case InternalProgram.Redumper:
|
||||
if (!File.Exists(Options.RedumperPath))
|
||||
{
|
||||
|
||||
@@ -123,6 +123,7 @@ namespace MPF.CLI.Features
|
||||
Console.WriteLine($"{InternalProgram.Redumper.ToString().ToLowerInvariant(),-15} => {InternalProgram.Redumper.LongName()}");
|
||||
Console.WriteLine($"{InternalProgram.DiscImageCreator.ToString().ToLowerInvariant(),-15} => {InternalProgram.DiscImageCreator.LongName()}");
|
||||
Console.WriteLine($"{InternalProgram.Aaru.ToString().ToLowerInvariant(),-15} => {InternalProgram.Aaru.LongName()}");
|
||||
// Console.WriteLine($"{InternalProgram.Dreamdump.ToString().ToLowerInvariant(),-15} => {InternalProgram.Dreamdump.LongName()}");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Input the dumping program and press Enter:");
|
||||
Console.Write("> ");
|
||||
|
||||
68
MPF.ExecutionContexts.Test/DreamdumpTests.cs
Normal file
68
MPF.ExecutionContexts.Test/DreamdumpTests.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System.Collections.Generic;
|
||||
using MPF.ExecutionContexts.Dreamdump;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using Xunit;
|
||||
|
||||
namespace MPF.ExecutionContexts.Test
|
||||
{
|
||||
public class DreamdumpTests
|
||||
{
|
||||
#region Default Values
|
||||
|
||||
private static readonly Dictionary<string, string?> AllOptions = new()
|
||||
{
|
||||
[SettingConstants.RereadCount] = "1000",
|
||||
[SettingConstants.SectorOrder] = "DATA_C2_SUB",
|
||||
};
|
||||
|
||||
// None of these scenarios are actually supported as all are treated like GD-ROM
|
||||
[Theory]
|
||||
[InlineData(null, null, null, "filename.bin", null, "--retries=20 --image-name=\"filename\" --sector-order=DATA_C2_SUB")]
|
||||
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.CDROM, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.DVD, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.NintendoWii, MediaType.NintendoWiiOpticalDisc, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.HDDVDVideo, MediaType.HDDVD, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.BDVideo, MediaType.BluRay, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.NintendoWiiU, MediaType.NintendoWiiUOpticalDisc, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
public void DefaultValueTest(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
string? expected)
|
||||
{
|
||||
var context = new ExecutionContext(system, type, drivePath, filename, driveSpeed, AllOptions);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Default
|
||||
|
||||
[Theory]
|
||||
[InlineData("--force-qtoc --train --retries=20 --image-name=image --image-path=path --read-offset=0 --read-at-once=0 --speed=8 --sector-order=so --drive=/dev/sr0")]
|
||||
public void DiscTest(string parameters)
|
||||
{
|
||||
string? expected = "--force-qtoc --train --retries=20 --image-name=\"image\" --image-path=\"path\" --read-offset=0 --read-at-once=0 --speed=8 --sector-order=so --drive=/dev/sr0";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
Assert.True(context.IsDumpingCommand());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("--image-name=\"image name.bin\" --image-path=\"directory name\"")]
|
||||
public void SpacesTest(string parameters)
|
||||
{
|
||||
string? expected = "--image-name=\"image name.bin\" --image-path=\"directory name\"";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
Assert.True(context.IsDumpingCommand());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -294,6 +294,28 @@ namespace MPF.ExecutionContexts
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an UInt8 setting from a settings, dictionary
|
||||
/// </summary>
|
||||
/// <param name="settings">Dictionary representing the settings</param>
|
||||
/// <param name="key">Setting key to get a value for</param>
|
||||
/// <param name="defaultValue">Default value to return if no value is found</param>
|
||||
/// <returns>Setting value if possible, default value otherwise</returns>
|
||||
internal static byte GetUInt8Setting(Dictionary<string, string?> settings, string key, byte defaultValue)
|
||||
{
|
||||
if (settings.ContainsKey(key))
|
||||
{
|
||||
if (byte.TryParse(settings[key], out byte value))
|
||||
return value;
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parameter Parsing
|
||||
|
||||
10
MPF.ExecutionContexts/Dreamdump/CommandStrings.cs
Normal file
10
MPF.ExecutionContexts/Dreamdump/CommandStrings.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Top-level commands for Dreamdump
|
||||
/// </summary>
|
||||
public static class CommandStrings
|
||||
{
|
||||
public const string NONE = "";
|
||||
}
|
||||
}
|
||||
15
MPF.ExecutionContexts/Dreamdump/Enumerations.cs
Normal file
15
MPF.ExecutionContexts/Dreamdump/Enumerations.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Drive sector order option
|
||||
/// </summary>
|
||||
public enum SectorOrder
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
DATA_C2,
|
||||
DATA_SUB,
|
||||
DATA_C2_SUB,
|
||||
DATA_SUB_C2,
|
||||
}
|
||||
}
|
||||
257
MPF.ExecutionContexts/Dreamdump/ExecutionContext.cs
Normal file
257
MPF.ExecutionContexts/Dreamdump/ExecutionContext.cs
Normal file
@@ -0,0 +1,257 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using MPF.ExecutionContexts.Data;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic set of Dreamdump parameters
|
||||
/// </summary>
|
||||
public sealed class ExecutionContext : BaseExecutionContext
|
||||
{
|
||||
#region Generic Dumping Information
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? InputPath
|
||||
=> (_inputs[FlagStrings.Drive] as StringInput)?.Value?.Trim('"');
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? OutputPath => Path.Combine(
|
||||
(_inputs[FlagStrings.ImagePath] as StringInput)?.Value?.Trim('"') ?? string.Empty,
|
||||
(_inputs[FlagStrings.ImageName] as StringInput)?.Value?.Trim('"') ?? string.Empty)
|
||||
+ GetDefaultExtension(MediaType);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int? Speed
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_inputs[FlagStrings.Speed] as Int32Input)?.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value is not null && value > 0)
|
||||
{
|
||||
this[FlagStrings.Speed] = true;
|
||||
(_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this[FlagStrings.Speed] = false;
|
||||
(_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Flag Values
|
||||
|
||||
/// <summary>
|
||||
/// Set of all command flags
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, Input> _inputs = new()
|
||||
{
|
||||
// Special
|
||||
[FlagStrings.ForceQTOC] = new FlagInput(FlagStrings.ForceQTOC),
|
||||
[FlagStrings.Train] = new FlagInput(FlagStrings.Train),
|
||||
[FlagStrings.Retries] = new UInt8Input(FlagStrings.Retries),
|
||||
|
||||
// Paths
|
||||
[FlagStrings.ImageName] = new StringInput(FlagStrings.ImageName) { Quotes = true },
|
||||
[FlagStrings.ImagePath] = new StringInput(FlagStrings.ImagePath) { Quotes = true },
|
||||
|
||||
// Drive Part
|
||||
[FlagStrings.ReadOffset] = new Int16Input(FlagStrings.ReadOffset),
|
||||
[FlagStrings.ReadAtOnce] = new UInt8Input(FlagStrings.ReadAtOnce),
|
||||
[FlagStrings.Speed] = new UInt16Input(FlagStrings.Speed),
|
||||
[FlagStrings.SectorOrder] = new StringInput(FlagStrings.SectorOrder),
|
||||
[FlagStrings.Drive] = new StringInput(FlagStrings.Drive),
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ExecutionContext(string? parameters) : base(parameters) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ExecutionContext(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
: base(system, type, drivePath, filename, driveSpeed, options)
|
||||
{
|
||||
}
|
||||
|
||||
#region BaseExecutionContext Implementations
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <remarks>Command support is irrelevant for Dreamdump</remarks>
|
||||
public override Dictionary<string, List<string>> GetCommandSupport()
|
||||
{
|
||||
return new Dictionary<string, List<string>>()
|
||||
{
|
||||
[CommandStrings.NONE] =
|
||||
[
|
||||
// Special
|
||||
FlagStrings.ForceQTOC,
|
||||
FlagStrings.Train,
|
||||
FlagStrings.Retries,
|
||||
|
||||
// Paths
|
||||
FlagStrings.ImageName,
|
||||
FlagStrings.ImagePath,
|
||||
|
||||
// Drive Part
|
||||
FlagStrings.ReadOffset,
|
||||
FlagStrings.ReadAtOnce,
|
||||
FlagStrings.Speed,
|
||||
FlagStrings.SectorOrder,
|
||||
FlagStrings.Drive,
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string GenerateParameters()
|
||||
{
|
||||
var parameters = new StringBuilder();
|
||||
|
||||
// Loop though and append all existing
|
||||
foreach (var kvp in _inputs)
|
||||
{
|
||||
// If the value doesn't exist
|
||||
string formatted = kvp.Value.Format(useEquals: true);
|
||||
if (formatted.Length == 0)
|
||||
continue;
|
||||
|
||||
// Append the parameter
|
||||
parameters.Append($"{formatted} ");
|
||||
}
|
||||
|
||||
return parameters.ToString().TrimEnd();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? GetDefaultExtension(MediaType? mediaType) => ".bin";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override MediaType? GetMediaType() => SabreTools.RedumpLib.Data.MediaType.GDROM;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool IsDumpingCommand() => true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void ResetValues()
|
||||
{
|
||||
BaseCommand = CommandStrings.NONE;
|
||||
|
||||
flags = [];
|
||||
|
||||
foreach (var kvp in _inputs)
|
||||
kvp.Value.ClearValue();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetDefaultParameters(string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
{
|
||||
BaseCommand = CommandStrings.NONE;
|
||||
|
||||
if (drivePath is not null)
|
||||
{
|
||||
this[FlagStrings.Drive] = true;
|
||||
(_inputs[FlagStrings.Drive] as StringInput)?.SetValue(drivePath);
|
||||
}
|
||||
|
||||
if (driveSpeed is not null && driveSpeed > 0)
|
||||
{
|
||||
this[FlagStrings.Speed] = true;
|
||||
(_inputs[FlagStrings.Speed] as UInt16Input)?.SetValue((ushort)driveSpeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
this[FlagStrings.Speed] = false;
|
||||
(_inputs[FlagStrings.Speed] as UInt16Input)?.SetValue(null);
|
||||
}
|
||||
|
||||
// Set user-defined options
|
||||
string? sectorOrder = GetStringSetting(options, SettingConstants.SectorOrder, SettingConstants.SectorOrderDefault);
|
||||
if (!string.IsNullOrEmpty(sectorOrder) && sectorOrder != SectorOrder.NONE.ToString())
|
||||
{
|
||||
this[FlagStrings.SectorOrder] = true;
|
||||
(_inputs[FlagStrings.SectorOrder] as StringInput)?.SetValue(sectorOrder!);
|
||||
}
|
||||
|
||||
// Set the output paths
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
{
|
||||
var imagePath = Path.GetDirectoryName(filename);
|
||||
if (!string.IsNullOrEmpty(imagePath))
|
||||
{
|
||||
this[FlagStrings.ImagePath] = true;
|
||||
(_inputs[FlagStrings.ImagePath] as StringInput)?.SetValue(imagePath!);
|
||||
}
|
||||
|
||||
string imageName = Path.GetFileNameWithoutExtension(filename);
|
||||
if (!string.IsNullOrEmpty(imageName))
|
||||
{
|
||||
this[FlagStrings.ImageName] = true;
|
||||
(_inputs[FlagStrings.ImageName] as StringInput)?.SetValue(imageName!);
|
||||
}
|
||||
}
|
||||
|
||||
byte retries = GetUInt8Setting(options, SettingConstants.RereadCount, SettingConstants.RereadCountDefault);
|
||||
if (retries > 0)
|
||||
{
|
||||
this[FlagStrings.Retries] = true;
|
||||
(_inputs[FlagStrings.Retries] as UInt8Input)?.SetValue(retries);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override bool ValidateAndSetParameters(string? parameters)
|
||||
{
|
||||
// The string has to be valid by itself first
|
||||
if (string.IsNullOrEmpty(parameters))
|
||||
return false;
|
||||
|
||||
// Now split the string into parts for easier validation
|
||||
string[] parts = SplitParameterString(parameters!);
|
||||
|
||||
// Setup the modes
|
||||
BaseCommand = null;
|
||||
|
||||
// Loop through all auxiliary flags, if necessary
|
||||
int index = 0;
|
||||
for (int i = index; i < parts.Length; i++)
|
||||
{
|
||||
// Match all possible flags
|
||||
foreach (var kvp in _inputs)
|
||||
{
|
||||
// If the value was not a match
|
||||
if (!kvp.Value.Process(parts, ref i))
|
||||
continue;
|
||||
|
||||
// Set the flag
|
||||
this[kvp.Key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If the image name was not set, set it with a default value
|
||||
if (string.IsNullOrEmpty((_inputs[FlagStrings.ImageName] as StringInput)?.Value))
|
||||
(_inputs[FlagStrings.ImageName] as StringInput)?.SetValue($"track_{DateTime.Now:yyyyMMdd-HHmm}");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
33
MPF.ExecutionContexts/Dreamdump/FlagStrings.cs
Normal file
33
MPF.ExecutionContexts/Dreamdump/FlagStrings.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Dumping flags for Dreamdump
|
||||
/// </summary>
|
||||
public static class FlagStrings
|
||||
{
|
||||
#region Special
|
||||
|
||||
public const string ForceQTOC = "--force-qtoc";
|
||||
public const string Train = "--train";
|
||||
public const string Retries = "--retries";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paths
|
||||
|
||||
public const string ImageName = "--image-name";
|
||||
public const string ImagePath = "--image-path";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Drive Part
|
||||
|
||||
public const string ReadOffset = "--read-offset";
|
||||
public const string ReadAtOnce = "--read-at-once"; // [0,40] (Linux), [0,20] (Windows)
|
||||
public const string Speed = "--speed";
|
||||
public const string SectorOrder = "--sector-order";
|
||||
public const string Drive = "--drive";
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
MPF.ExecutionContexts/Dreamdump/SettingConstants.cs
Normal file
11
MPF.ExecutionContexts/Dreamdump/SettingConstants.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
public static class SettingConstants
|
||||
{
|
||||
public const string RereadCount = "DreamdumpRereadCount";
|
||||
public const int RereadCountDefault = 20;
|
||||
|
||||
public const string SectorOrder = "DreamdumpSectorOrder";
|
||||
public static readonly string SectorOrderDefault = Dreamdump.SectorOrder.NONE.ToString();
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ namespace MPF.Frontend.Test
|
||||
[InlineData(InternalProgram.NONE, "Unknown")]
|
||||
[InlineData(InternalProgram.Aaru, "Aaru")]
|
||||
[InlineData(InternalProgram.DiscImageCreator, "DiscImageCreator")]
|
||||
// [InlineData(InternalProgram.Dreamdump, "Dreamdump")]
|
||||
[InlineData(InternalProgram.Redumper, "Redumper")]
|
||||
[InlineData(InternalProgram.CleanRip, "CleanRip")]
|
||||
[InlineData(InternalProgram.PS3CFW, "PS3 CFW")]
|
||||
@@ -168,6 +169,7 @@ namespace MPF.Frontend.Test
|
||||
[InlineData(InternalProgram.NONE, "Unknown")]
|
||||
[InlineData(InternalProgram.Aaru, "aaru")]
|
||||
[InlineData(InternalProgram.DiscImageCreator, "dic")]
|
||||
// [InlineData(InternalProgram.Dreamdump, "dreamdump")]
|
||||
[InlineData(InternalProgram.Redumper, "redumper")]
|
||||
[InlineData(InternalProgram.CleanRip, "cleanrip")]
|
||||
[InlineData(InternalProgram.PS3CFW, "ps3cfw")]
|
||||
@@ -210,6 +212,7 @@ namespace MPF.Frontend.Test
|
||||
[InlineData("", InternalProgram.NONE)]
|
||||
[InlineData("aaru", InternalProgram.Aaru)]
|
||||
[InlineData("dic", InternalProgram.DiscImageCreator)]
|
||||
// [InlineData("dreamdump", InternalProgram.Dreamdump)]
|
||||
[InlineData("redumper", InternalProgram.Redumper)]
|
||||
[InlineData("cleanrip", InternalProgram.CleanRip)]
|
||||
[InlineData("ps3cfw", InternalProgram.PS3CFW)]
|
||||
|
||||
@@ -157,6 +157,14 @@ namespace MPF.Frontend
|
||||
programFound = InternalProgram.Aaru;
|
||||
}
|
||||
|
||||
// if (programFound is null && _internalProgram != InternalProgram.Dreamdump)
|
||||
// {
|
||||
// var processor = new Dreamdump(_system);
|
||||
// var missingFiles = processor.FoundAllFiles(mediaType, outputDirectory, outputFilename);
|
||||
// if (missingFiles.Count == 0)
|
||||
// programFound = InternalProgram.Dreamdump;
|
||||
// }
|
||||
|
||||
return programFound;
|
||||
}
|
||||
|
||||
@@ -188,6 +196,13 @@ namespace MPF.Frontend
|
||||
programFound = InternalProgram.Aaru;
|
||||
}
|
||||
|
||||
// if (programFound is null && _internalProgram != InternalProgram.Dreamdump)
|
||||
// {
|
||||
// var processor = new Dreamdump(_system);
|
||||
// if (processor.FoundAnyFiles(mediaType, outputDirectory, outputFilename))
|
||||
// programFound = InternalProgram.Dreamdump;
|
||||
// }
|
||||
|
||||
return programFound;
|
||||
}
|
||||
|
||||
@@ -203,6 +218,7 @@ namespace MPF.Frontend
|
||||
{
|
||||
InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(parameters) { ExecutablePath = _options.AaruPath },
|
||||
InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(parameters) { ExecutablePath = _options.DiscImageCreatorPath },
|
||||
// InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(parameters) { ExecutablePath = _options.DreamdumpPath },
|
||||
InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(parameters) { ExecutablePath = _options.RedumperPath },
|
||||
|
||||
// If no dumping program found, set to null
|
||||
@@ -235,6 +251,7 @@ namespace MPF.Frontend
|
||||
InternalProgram.Aaru => new Aaru(_system),
|
||||
InternalProgram.CleanRip => new CleanRip(_system),
|
||||
InternalProgram.DiscImageCreator => new DiscImageCreator(_system),
|
||||
// InternalProgram.Dreamdump => new Dreamdump(_system),
|
||||
InternalProgram.PS3CFW => new PS3CFW(_system),
|
||||
InternalProgram.Redumper => new Redumper(_system),
|
||||
InternalProgram.UmdImageCreator => new UmdImageCreator(_system),
|
||||
@@ -269,6 +286,7 @@ namespace MPF.Frontend
|
||||
{
|
||||
InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
|
||||
InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
|
||||
// InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
|
||||
InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
|
||||
|
||||
// If no dumping program found, set to null
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using DreamdumpSectorOrder = MPF.ExecutionContexts.Dreamdump.SectorOrder;
|
||||
using LogCompression = MPF.Processors.LogCompression;
|
||||
using RedumperDriveType = MPF.ExecutionContexts.Redumper.DriveType;
|
||||
using RedumperReadMethod = MPF.ExecutionContexts.Redumper.ReadMethod;
|
||||
@@ -118,6 +119,7 @@ namespace MPF.Frontend
|
||||
|
||||
InternalProgram.Aaru => "Aaru",
|
||||
InternalProgram.DiscImageCreator => "DiscImageCreator",
|
||||
// InternalProgram.Dreamdump => "Dreamdump",
|
||||
InternalProgram.Redumper => "Redumper",
|
||||
|
||||
#endregion
|
||||
@@ -295,6 +297,7 @@ namespace MPF.Frontend
|
||||
|
||||
InternalProgram.Aaru => "aaru",
|
||||
InternalProgram.DiscImageCreator => "dic",
|
||||
// InternalProgram.Dreamdump => "dreamdump",
|
||||
InternalProgram.Redumper => "redumper",
|
||||
|
||||
#endregion
|
||||
@@ -317,6 +320,36 @@ namespace MPF.Frontend
|
||||
|
||||
#region Convert from String
|
||||
|
||||
/// <summary>
|
||||
/// Get the DreamdumpSectorOrder enum value for a given string
|
||||
/// </summary>
|
||||
/// <param name="order">String value to convert</param>
|
||||
/// <returns>DreamdumpSectorOrder represented by the string, if possible</returns>
|
||||
public static DreamdumpSectorOrder ToDreamdumpSectorOrder(this string? order)
|
||||
{
|
||||
return (order?.ToLowerInvariant()) switch
|
||||
{
|
||||
"data_c2_sub"
|
||||
or "data c2 sub"
|
||||
or "data-c2-sub"
|
||||
or "datac2sub" => DreamdumpSectorOrder.DATA_C2_SUB,
|
||||
"data_sub_c2"
|
||||
or "data sub c2"
|
||||
or "data-sub-c2"
|
||||
or "datasubc2" => DreamdumpSectorOrder.DATA_SUB_C2,
|
||||
"data_sub"
|
||||
or "data sub"
|
||||
or "data-sub"
|
||||
or "datasub" => DreamdumpSectorOrder.DATA_SUB,
|
||||
"data_c2"
|
||||
or "data c2"
|
||||
or "data-c2"
|
||||
or "datac2" => DreamdumpSectorOrder.DATA_C2,
|
||||
|
||||
_ => DreamdumpSectorOrder.NONE,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the InterfaceLanguage enum value for a given string
|
||||
/// </summary>
|
||||
@@ -362,6 +395,7 @@ namespace MPF.Frontend
|
||||
or "dic"
|
||||
or "dicreator"
|
||||
or "discimagecreator" => InternalProgram.DiscImageCreator,
|
||||
// "dreamdump" => InternalProgram.Dreamdump,
|
||||
"rd"
|
||||
or "redumper" => InternalProgram.Redumper,
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace MPF.Frontend
|
||||
// Dumping support
|
||||
Aaru,
|
||||
DiscImageCreator,
|
||||
// Dreamdump,
|
||||
Redumper,
|
||||
|
||||
// Verification support only
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.IO;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using AaruSettings = MPF.ExecutionContexts.Aaru.SettingConstants;
|
||||
using DICSettings = MPF.ExecutionContexts.DiscImageCreator.SettingConstants;
|
||||
// using DreamdumpSectorOrder = MPF.ExecutionContexts.Dreamdump.SectorOrder;
|
||||
// using DreamdumpSettings = MPF.ExecutionContexts.Dreamdump.SettingConstants;
|
||||
using LogCompression = MPF.Processors.LogCompression;
|
||||
using RedumperDriveType = MPF.ExecutionContexts.Redumper.DriveType;
|
||||
using RedumperReadMethod = MPF.ExecutionContexts.Redumper.ReadMethod;
|
||||
@@ -64,6 +66,32 @@ namespace MPF.Frontend
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0051
|
||||
/// <summary>
|
||||
/// Default Dreamdump path
|
||||
/// </summary>
|
||||
private static string DefaultDreamdumpPath
|
||||
{
|
||||
get
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
string executableName = Environment.OSVersion.Platform switch
|
||||
{
|
||||
PlatformID.Unix => "dreamdump",
|
||||
PlatformID.MacOSX => "dreamdump",
|
||||
_ => "dreamdump.exe"
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
#if NET20 || NET35
|
||||
return Path.Combine("Programs", Path.Combine("Dreamdump", executableName));
|
||||
#else
|
||||
return Path.Combine("Programs", "Dreamdump", executableName);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE0051
|
||||
|
||||
/// <summary>
|
||||
/// Default Redumper path
|
||||
/// </summary>
|
||||
@@ -124,6 +152,15 @@ namespace MPF.Frontend
|
||||
set { Settings["DiscImageCreatorPath"] = value; }
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Path to Dreamdump
|
||||
// /// </summary>
|
||||
// public string? DreamdumpPath
|
||||
// {
|
||||
// get { return GetStringSetting(Settings, "DreamdumpPath", DefaultDreamdumpPath); }
|
||||
// set { Settings["DreamdumpPath"] = value; }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Path to Redumper
|
||||
/// </summary>
|
||||
@@ -435,6 +472,44 @@ namespace MPF.Frontend
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dreamdump
|
||||
|
||||
// /// <summary>
|
||||
// /// Enable options incompatible with redump submissions
|
||||
// /// </summary>
|
||||
// public bool DreamdumpNonRedumpMode
|
||||
// {
|
||||
// get { return GetBooleanSetting(Settings, "DreamdumpNonRedumpMode", false); }
|
||||
// set { Settings["DreamdumpNonRedumpMode"] = value.ToString(); }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Currently selected default Dreamdump sector order
|
||||
// /// </summary>
|
||||
// public DreamdumpSectorOrder DreamdumpSectorOrder
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// var valueString = GetStringSetting(Settings, DreamdumpSettings.SectorOrder, DreamdumpSettings.SectorOrderDefault);
|
||||
// return valueString.ToDreamdumpSectorOrder();
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Settings[DreamdumpSettings.SectorOrder] = value.ToString();
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Default number of rereads
|
||||
// /// </summary>
|
||||
// public int DreamdumpRereadCount
|
||||
// {
|
||||
// get { return GetInt32Setting(Settings, DreamdumpSettings.RereadCount, DreamdumpSettings.RereadCountDefault); }
|
||||
// set { Settings[DreamdumpSettings.RereadCount] = value.ToString(); }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Redumper
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -424,6 +424,7 @@ namespace MPF.Frontend.Tools
|
||||
Aaru => InternalProgram.Aaru,
|
||||
CleanRip => InternalProgram.CleanRip,
|
||||
DiscImageCreator => InternalProgram.DiscImageCreator,
|
||||
// Dreamdump => InternalProgram.Dreamdump,
|
||||
PS3CFW => InternalProgram.PS3CFW,
|
||||
Redumper => InternalProgram.Redumper,
|
||||
UmdImageCreator => InternalProgram.UmdImageCreator,
|
||||
|
||||
@@ -349,7 +349,17 @@ namespace MPF.Frontend.ViewModels
|
||||
InternalProgram internalProgram = Options.InternalProgram;
|
||||
|
||||
// Create a static list of supported Check programs, not everything
|
||||
var internalPrograms = new List<InternalProgram> { InternalProgram.Redumper, InternalProgram.Aaru, InternalProgram.DiscImageCreator, InternalProgram.CleanRip, InternalProgram.PS3CFW, InternalProgram.UmdImageCreator, InternalProgram.XboxBackupCreator };
|
||||
var internalPrograms = new List<InternalProgram>
|
||||
{
|
||||
InternalProgram.Redumper,
|
||||
InternalProgram.Aaru,
|
||||
InternalProgram.DiscImageCreator,
|
||||
// InternalProgram.Dreamdump,
|
||||
InternalProgram.CleanRip,
|
||||
InternalProgram.PS3CFW,
|
||||
InternalProgram.UmdImageCreator,
|
||||
InternalProgram.XboxBackupCreator
|
||||
};
|
||||
InternalPrograms = internalPrograms.ConvertAll(ip => new Element<InternalProgram>(ip));
|
||||
|
||||
// Select the current default dumping program
|
||||
|
||||
@@ -2164,6 +2164,9 @@ namespace MPF.Frontend.ViewModels
|
||||
InternalProgram.DiscImageCreator when CurrentMediaType == MediaType.NintendoWiiUOpticalDisc => true,
|
||||
InternalProgram.DiscImageCreator when CurrentMediaType == MediaType.SDCard => true,
|
||||
|
||||
// Dreamdump
|
||||
// InternalProgram.Dreamdump when CurrentMediaType == MediaType.GDROM => true,
|
||||
|
||||
// Redumper
|
||||
InternalProgram.Redumper when CurrentMediaType == MediaType.BluRay => true,
|
||||
InternalProgram.Redumper when CurrentMediaType == MediaType.CDROM => true,
|
||||
@@ -2444,9 +2447,10 @@ namespace MPF.Frontend.ViewModels
|
||||
#pragma warning disable IDE0072
|
||||
return program switch
|
||||
{
|
||||
InternalProgram.Redumper => File.Exists(Options.RedumperPath),
|
||||
InternalProgram.Aaru => File.Exists(Options.AaruPath),
|
||||
InternalProgram.DiscImageCreator => File.Exists(Options.DiscImageCreatorPath),
|
||||
// InternalProgram.Dreamdump => File.Exists(Options.DreamdumpPath),
|
||||
InternalProgram.Redumper => File.Exists(Options.RedumperPath),
|
||||
_ => false,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
@@ -106,7 +106,13 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
private static List<Element<InternalProgram>> PopulateInternalPrograms()
|
||||
{
|
||||
var internalPrograms = new List<InternalProgram> { InternalProgram.Redumper, InternalProgram.DiscImageCreator, InternalProgram.Aaru };
|
||||
var internalPrograms = new List<InternalProgram>
|
||||
{
|
||||
InternalProgram.Redumper,
|
||||
InternalProgram.DiscImageCreator,
|
||||
InternalProgram.Aaru,
|
||||
// InternalProgram.Dreamdump,
|
||||
};
|
||||
return internalPrograms.ConvertAll(ip => new Element<InternalProgram>(ip));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user