Fix passing by of media type by dumping methods.

This commit is contained in:
2020-01-30 23:04:37 +00:00
parent d4f5af281d
commit 96f5729cfc
5 changed files with 16 additions and 17 deletions

View File

@@ -62,8 +62,7 @@ namespace DiscImageChef.Core.Devices.Dumping
partial class Dump partial class Dump
{ {
/// <summary>Dumps a compact disc</summary> /// <summary>Dumps a compact disc</summary>
/// <param name="dskType">Disc type as detected in MMC layer</param> void CompactDisc()
void CompactDisc(out MediaType dskType)
{ {
ExtentsULong audioExtents; // Extents with audio sectors ExtentsULong audioExtents; // Extents with audio sectors
ulong blocks; // Total number of positive sectors ulong blocks; // Total number of positive sectors
@@ -115,7 +114,7 @@ namespace DiscImageChef.Core.Devices.Dumping
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags
dskType = MediaType.CD; MediaType dskType = MediaType.CD;
if(_dumpRaw) if(_dumpRaw)
{ {

View File

@@ -50,12 +50,13 @@ namespace DiscImageChef.Core.Devices.Dumping
partial class Dump partial class Dump
{ {
/// <summary>Dumps an optical disc</summary> /// <summary>Dumps an optical disc</summary>
void Mmc(ref MediaType dskType) void Mmc()
{ {
bool sense; MediaType dskType = MediaType.Unknown;
byte[] tmpBuf; bool sense;
bool compactDisc = true; byte[] tmpBuf;
bool isXbox = false; bool compactDisc = true;
bool isXbox = false;
_speedMultiplier = 1; _speedMultiplier = 1;
// TODO: Log not only what is it reading, but if it was read correctly or not. // TODO: Log not only what is it reading, but if it was read correctly or not.
@@ -194,7 +195,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(compactDisc) if(compactDisc)
{ {
CompactDisc(out dskType); CompactDisc();
return; return;
} }
@@ -681,12 +682,12 @@ namespace DiscImageChef.Core.Devices.Dumping
if(isXbox) if(isXbox)
{ {
Xgd(mediaTags, ref dskType); Xgd(mediaTags, dskType);
return; return;
} }
Sbc(mediaTags, ref dskType, true); Sbc(mediaTags, dskType, true);
} }
static void AddMediaTagToSidecar(string outputPath, KeyValuePair<MediaTagType, byte[]> tag, static void AddMediaTagToSidecar(string outputPath, KeyValuePair<MediaTagType, byte[]> tag,

View File

@@ -60,7 +60,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <param name="opticalDisc">If device contains an optical disc (e.g. DVD or BD)</param> /// <param name="opticalDisc">If device contains an optical disc (e.g. DVD or BD)</param>
/// <param name="mediaTags">Media tags as retrieved in MMC layer</param> /// <param name="mediaTags">Media tags as retrieved in MMC layer</param>
/// <param name="dskType">Disc type as detected in SCSI or MMC layer</param> /// <param name="dskType">Disc type as detected in SCSI or MMC layer</param>
internal void Sbc(Dictionary<MediaTagType, byte[]> mediaTags, ref MediaType dskType, bool opticalDisc) internal void Sbc(Dictionary<MediaTagType, byte[]> mediaTags, MediaType dskType, bool opticalDisc)
{ {
bool sense; bool sense;
byte scsiMediumType = 0; byte scsiMediumType = 0;

View File

@@ -45,8 +45,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <summary>Dumps a SCSI Block Commands device or a Reduced Block Commands devices</summary> /// <summary>Dumps a SCSI Block Commands device or a Reduced Block Commands devices</summary>
public void Scsi() public void Scsi()
{ {
MediaType dskType = MediaType.Unknown; int resets = 0;
int resets = 0;
if(_dev.IsRemovable) if(_dev.IsRemovable)
{ {
@@ -235,14 +234,14 @@ namespace DiscImageChef.Core.Devices.Dumping
return; return;
case PeripheralDeviceTypes.MultiMediaDevice: case PeripheralDeviceTypes.MultiMediaDevice:
if(_outputPlugin is IWritableOpticalImage) if(_outputPlugin is IWritableOpticalImage)
Mmc(ref dskType); Mmc();
else else
StoppingErrorMessage?. StoppingErrorMessage?.
Invoke("The specified plugin does not support storing optical disc images."); Invoke("The specified plugin does not support storing optical disc images.");
return; return;
default: default:
Sbc(null, ref dskType, false); Sbc(null, MediaType.Unknown, false);
break; break;
} }

View File

@@ -59,7 +59,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <summary>Dumps an Xbox Game Disc using a Kreon drive</summary> /// <summary>Dumps an Xbox Game Disc using a Kreon drive</summary>
/// <param name="mediaTags">Media tags as retrieved in MMC layer</param> /// <param name="mediaTags">Media tags as retrieved in MMC layer</param>
/// <param name="dskType">Disc type as detected in MMC layer</param> /// <param name="dskType">Disc type as detected in MMC layer</param>
internal void Xgd(Dictionary<MediaTagType, byte[]> mediaTags, ref MediaType dskType) internal void Xgd(Dictionary<MediaTagType, byte[]> mediaTags, MediaType dskType)
{ {
bool sense; bool sense;
const uint BLOCK_SIZE = 2048; const uint BLOCK_SIZE = 2048;