mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add support for dumping Genesis / Mega Drive cartridges using a Retrode.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
|
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
|
||||||
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net6/aaru" />
|
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net6/aaru" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="m dump /dev/sda foo.sfc" />
|
<option name="PROGRAM_PARAMETERS" value="m dump /dev/sdb foo2.md" />
|
||||||
<option name="WORKING_DIRECTORY" value="$USER_HOME$/Desktop" />
|
<option name="WORKING_DIRECTORY" value="$USER_HOME$/Desktop" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
|
|||||||
@@ -46,7 +46,12 @@ public partial class Dump
|
|||||||
0x53, 0x46, 0x43
|
0x53, 0x46, 0x43
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>Dumps a CFW PlayStation Portable UMD</summary>
|
static readonly byte[] _genesisExtension =
|
||||||
|
{
|
||||||
|
0x42, 0x49, 0x4E
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>Dumps a game cartridge using a Retrode adapter</summary>
|
||||||
void Retrode()
|
void Retrode()
|
||||||
{
|
{
|
||||||
bool sense = _dev.Read10(out byte[] buffer, out _, 0, false, true, false, false, 0, 512, 0, 1, _dev.Timeout,
|
bool sense = _dev.Read10(out byte[] buffer, out _, 0, false, true, false, false, 0, 512, 0, 1, _dev.Timeout,
|
||||||
@@ -92,23 +97,32 @@ public partial class Dump
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int romPos;
|
int romPos;
|
||||||
bool sfcFound = false;
|
bool sfcFound = false;
|
||||||
|
bool genesisFound = false;
|
||||||
tmp = new byte[3];
|
tmp = new byte[3];
|
||||||
|
|
||||||
for(romPos = 0; romPos < buffer.Length; romPos += 0x20)
|
for(romPos = 0; romPos < buffer.Length; romPos += 0x20)
|
||||||
{
|
{
|
||||||
Array.Copy(buffer, romPos + 8, tmp, 0, 3);
|
Array.Copy(buffer, romPos + 8, tmp, 0, 3);
|
||||||
|
|
||||||
if(!tmp.SequenceEqual(_sfcExtension))
|
if(tmp.SequenceEqual(_sfcExtension))
|
||||||
continue;
|
{
|
||||||
|
sfcFound = true;
|
||||||
|
|
||||||
sfcFound = true;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
if(tmp.SequenceEqual(_genesisExtension))
|
||||||
|
{
|
||||||
|
genesisFound = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!sfcFound)
|
if(!sfcFound &&
|
||||||
|
!genesisFound)
|
||||||
{
|
{
|
||||||
StoppingErrorMessage?.Invoke("No cartridge found, not dumping...");
|
StoppingErrorMessage?.Invoke("No cartridge found, not dumping...");
|
||||||
_dumpLog.WriteLine("No cartridge found, not dumping...");
|
_dumpLog.WriteLine("No cartridge found, not dumping...");
|
||||||
@@ -119,13 +133,13 @@ public partial class Dump
|
|||||||
ushort cluster = BitConverter.ToUInt16(buffer, romPos + 0x1A);
|
ushort cluster = BitConverter.ToUInt16(buffer, romPos + 0x1A);
|
||||||
uint romSize = BitConverter.ToUInt32(buffer, romPos + 0x1C);
|
uint romSize = BitConverter.ToUInt32(buffer, romPos + 0x1C);
|
||||||
|
|
||||||
const MediaType mediaType = MediaType.SNESGamePak;
|
MediaType mediaType = genesisFound ? MediaType.MegaDriveCartridge : MediaType.SNESGamePak;
|
||||||
uint blocksToRead = 64;
|
uint blocksToRead = 64;
|
||||||
double totalDuration = 0;
|
double totalDuration = 0;
|
||||||
double currentSpeed = 0;
|
double currentSpeed = 0;
|
||||||
double maxSpeed = double.MinValue;
|
double maxSpeed = double.MinValue;
|
||||||
double minSpeed = double.MaxValue;
|
double minSpeed = double.MaxValue;
|
||||||
byte[] senseBuf;
|
byte[] senseBuf;
|
||||||
|
|
||||||
if(_outputPlugin is not IByteAddressableImage outputBai ||
|
if(_outputPlugin is not IByteAddressableImage outputBai ||
|
||||||
!outputBai.SupportedMediaTypes.Contains(mediaType))
|
!outputBai.SupportedMediaTypes.Contains(mediaType))
|
||||||
|
|||||||
Reference in New Issue
Block a user