Rename Aaru.Console project to Aaru.Logging.

This commit is contained in:
2025-08-17 05:50:25 +01:00
parent 1a6f7a02c6
commit 02ec8a05d8
365 changed files with 5465 additions and 5347 deletions

View File

@@ -39,7 +39,6 @@ using System.Linq;
using System.Text;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.Console;
using Aaru.Decoders.Bluray;
using Aaru.Decoders.CD;
using Aaru.Decoders.DVD;
@@ -47,6 +46,7 @@ using Aaru.Decoders.SCSI.MMC;
using Aaru.Decoders.Sega;
using Aaru.Devices;
using Aaru.Helpers;
using Aaru.Logging;
using DMI = Aaru.Decoders.Xbox.DMI;
using Sector = Aaru.Decoders.CD.Sector;
@@ -126,7 +126,7 @@ public static class MMC
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];
byte[] testMark = new byte[12];
Array.Copy(sector, 0, testMark, 0, 12);
return syncMark.SequenceEqual(testMark) && (sector[0xF] == 0 || sector[0xF] == 1 || sector[0xF] == 2);
@@ -140,9 +140,9 @@ public static class MMC
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];
byte[] testMark = new byte[12];
for(var i = 0; i <= 2336; i++)
for(int i = 0; i <= 2336; i++)
{
Array.Copy(sector, i, testMark, 0, 12);
@@ -176,7 +176,7 @@ public static class MMC
static byte[] DescrambleAndFixOffset(byte[] sector, int offsetBytes, int sectorsForOffset)
{
var descrambled = new byte[2352];
byte[] descrambled = new byte[2352];
int offsetFix = offsetBytes < 0 ? 2352 * sectorsForOffset + offsetBytes : offsetBytes;
@@ -199,7 +199,7 @@ public static class MMC
if(!isData || sector0[0xF] != 2 && sector0[0xF] != 1) return false;
var testMark = new byte[4];
byte[] testMark = new byte[4];
Array.Copy(sector16, 24, testMark, 0, 4);
return cdiMark.SequenceEqual(testMark);
@@ -209,13 +209,13 @@ public static class MMC
{
if(videoFrame is null || videoFrame.Length < _videoNowColorFrameMarker.Length) return false;
var buffer = new byte[_videoNowColorFrameMarker.Length];
byte[] buffer = new byte[_videoNowColorFrameMarker.Length];
for(var framePosition = 0; framePosition + buffer.Length < videoFrame.Length; framePosition++)
for(int framePosition = 0; framePosition + buffer.Length < videoFrame.Length; framePosition++)
{
Array.Copy(videoFrame, framePosition, buffer, 0, buffer.Length);
for(var ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
for(int ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
if(!_videoNowColorFrameMarker.SequenceEqual(buffer)) continue;
@@ -227,13 +227,13 @@ public static class MMC
internal static int GetVideoNowColorOffset(byte[] data)
{
var buffer = new byte[_videoNowColorFrameMarker.Length];
byte[] buffer = new byte[_videoNowColorFrameMarker.Length];
for(var framePosition = 0; framePosition + buffer.Length < data.Length; framePosition++)
for(int framePosition = 0; framePosition + buffer.Length < data.Length; framePosition++)
{
Array.Copy(data, framePosition, buffer, 0, buffer.Length);
for(var ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
for(int ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
if(!_videoNowColorFrameMarker.SequenceEqual(buffer)) continue;
@@ -331,10 +331,10 @@ public static class MMC
if(mediaType is MediaType.CD or MediaType.CDROMXA)
{
var hasDataTrack = false;
var hasAudioTrack = false;
var allFirstSessionTracksAreAudio = true;
var hasVideoTrack = false;
bool hasDataTrack = false;
bool hasAudioTrack = false;
bool allFirstSessionTracksAreAudio = true;
bool hasVideoTrack = false;
if(decodedToc.HasValue)
{
@@ -370,11 +370,11 @@ public static class MMC
if((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack ||
(TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrackIncremental)
{
var startAddress = (uint)(track.PHOUR * 3600 * 75 +
track.PMIN * 60 * 75 +
track.PSEC * 75 +
track.PFRAME -
150);
uint startAddress = (uint)(track.PHOUR * 3600 * 75 +
track.PMIN * 60 * 75 +
track.PSEC * 75 +
track.PFRAME -
150);
if(startAddress < startOfFirstDataTrack) startOfFirstDataTrack = startAddress;
@@ -488,11 +488,11 @@ public static class MMC
FullTOC.TrackDataDescriptor secondSessionFirstTrackTrack =
decodedToc.Value.TrackDescriptors.First(t => t.POINT == secondSessionFirstTrack);
var firstSectorSecondSessionFirstTrack = (uint)(secondSessionFirstTrackTrack.PHOUR * 3600 * 75 +
secondSessionFirstTrackTrack.PMIN * 60 * 75 +
secondSessionFirstTrackTrack.PSEC * 75 +
secondSessionFirstTrackTrack.PFRAME -
150);
uint firstSectorSecondSessionFirstTrack = (uint)(secondSessionFirstTrackTrack.PHOUR * 3600 * 75 +
secondSessionFirstTrackTrack.PMIN * 60 * 75 +
secondSessionFirstTrackTrack.PSEC * 75 +
secondSessionFirstTrackTrack.PFRAME -
150);
sense = dev.ReadCd(out cmdBuf,
out _,
@@ -579,7 +579,7 @@ public static class MMC
videoNowColorFrame = new byte[9 * 2352];
for(var i = 0; i < 9; i++)
for(int i = 0; i < 9; i++)
{
sense = dev.ReadCd(out cmdBuf,
out _,
@@ -634,11 +634,11 @@ public static class MMC
if(firstTrack?.POINT is >= 1 and < 0xA0)
{
var firstTrackSector = (uint)(firstTrack.Value.PHOUR * 3600 * 75 +
firstTrack.Value.PMIN * 60 * 75 +
firstTrack.Value.PSEC * 75 +
firstTrack.Value.PFRAME -
150);
uint firstTrackSector = (uint)(firstTrack.Value.PHOUR * 3600 * 75 +
firstTrack.Value.PMIN * 60 * 75 +
firstTrack.Value.PSEC * 75 +
firstTrack.Value.PFRAME -
150);
// Check for hidden data before start of track 1
if(firstTrackSector > 0)
@@ -707,8 +707,8 @@ public static class MMC
if(combinedOffset % 2352 != 0) sectorsForOffset++;
var lba0 = 0;
var lba16 = 16;
int lba0 = 0;
int lba16 = 16;
if(combinedOffset < 0)
{
@@ -1602,8 +1602,8 @@ public static class MMC
isoSector[5] != 0x31)
return;
var rootStart = BitConverter.ToUInt32(isoSector, 158);
var rootLength = BitConverter.ToUInt32(isoSector, 166);
uint rootStart = BitConverter.ToUInt32(isoSector, 158);
uint rootLength = BitConverter.ToUInt32(isoSector, 166);
if(rootStart == 0 || rootLength == 0) return;
@@ -1644,7 +1644,7 @@ public static class MMC
if(isoSector.Length < 2048) return;
var rootPos = 0;
int rootPos = 0;
uint pcdStart = 0;
uint pcdLength = 0;
@@ -1652,8 +1652,8 @@ public static class MMC
rootPos < isoSector.Length &&
rootPos + isoSector[rootPos] <= isoSector.Length)
{
int nameLen = isoSector[rootPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[rootPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, rootPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -1705,7 +1705,7 @@ public static class MMC
if(isoSector.Length < 2048) return;
for(var pi = 0; pi < pcdLength; pi++)
for(int pi = 0; pi < pcdLength; pi++)
{
int pcdPos = pi * 2048;
uint infoPos = 0;
@@ -1714,8 +1714,8 @@ public static class MMC
pcdPos < isoSector.Length &&
pcdPos + isoSector[pcdPos] <= isoSector.Length)
{
int nameLen = isoSector[pcdPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[pcdPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -1750,7 +1750,7 @@ public static class MMC
if(sense) break;
var systemId = new byte[8];
byte[] systemId = new byte[8];
Array.Copy(isoSector, 0, systemId, 0, 8);
string id = StringHandlers.CToString(systemId).TrimEnd();
@@ -1842,7 +1842,7 @@ public static class MMC
// The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :)
byte decryptByte = ps2BootSectors[0];
for(var i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
for(int i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _);
@@ -1863,7 +1863,7 @@ public static class MMC
if(sector0 != null)
{
var syncBytes = new byte[7];
byte[] syncBytes = new byte[7];
Array.Copy(sector0, 0, syncBytes, 0, 7);
if(_operaId.SequenceEqual(syncBytes))
@@ -1887,8 +1887,8 @@ public static class MMC
if(playdia1 != null && playdia2 != null)
{
var pd1 = new byte[_playdiaCopyright.Length];
var pd2 = new byte[_playdiaCopyright.Length];
byte[] pd1 = new byte[_playdiaCopyright.Length];
byte[] pd2 = new byte[_playdiaCopyright.Length];
Array.Copy(playdia1, 38, pd1, 0, pd1.Length);
Array.Copy(playdia2, 0, pd2, 0, pd1.Length);
@@ -1905,7 +1905,7 @@ public static class MMC
if(secondDataSectorNotZero != null)
{
var pce = new byte[_pcEngineSignature.Length];
byte[] pce = new byte[_pcEngineSignature.Length];
Array.Copy(secondDataSectorNotZero, 32, pce, 0, pce.Length);
if(_pcEngineSignature.SequenceEqual(pce))
@@ -1920,7 +1920,7 @@ public static class MMC
if(firstDataSectorNotZero != null)
{
var pcfx = new byte[_pcFxSignature.Length];
byte[] pcfx = new byte[_pcFxSignature.Length];
Array.Copy(firstDataSectorNotZero, 0, pcfx, 0, pcfx.Length);
if(_pcFxSignature.SequenceEqual(pcfx))
@@ -1935,9 +1935,9 @@ public static class MMC
if(firstTrackSecondSessionAudio != null)
{
var jaguar = new byte[_atariSignature.Length];
byte[] jaguar = new byte[_atariSignature.Length];
for(var i = 0; i + jaguar.Length <= firstTrackSecondSessionAudio.Length; i += 2)
for(int i = 0; i + jaguar.Length <= firstTrackSecondSessionAudio.Length; i += 2)
{
Array.Copy(firstTrackSecondSessionAudio, i, jaguar, 0, jaguar.Length);
@@ -1953,7 +1953,7 @@ public static class MMC
if(firstTrackSecondSession?.Length >= 2336)
{
var milcd = new byte[2048];
byte[] milcd = new byte[2048];
Array.Copy(firstTrackSecondSession, 24, milcd, 0, 2048);
if(Dreamcast.DecodeIPBin(milcd).HasValue)
@@ -2000,13 +2000,13 @@ public static class MMC
if(!sense)
{
var cdg = false;
var cdeg = false;
var cdmidi = false;
bool cdg = false;
bool cdeg = false;
bool cdmidi = false;
for(var i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
var tmpSub = new byte[96];
byte[] tmpSub = new byte[96];
Array.Copy(subBuf, i * 96, tmpSub, 0, 96);
DetectRwPackets(tmpSub, out bool cdgPacket, out bool cdegPacket, out bool cdmidiPacket);
@@ -2121,8 +2121,8 @@ public static class MMC
isoSector[5] != 0x31)
return;
var rootStart = BitConverter.ToUInt32(isoSector, 158);
var rootLength = BitConverter.ToUInt32(isoSector, 166);
uint rootStart = BitConverter.ToUInt32(isoSector, 158);
uint rootLength = BitConverter.ToUInt32(isoSector, 166);
if(rootStart == 0 || rootLength == 0) return;
@@ -2173,7 +2173,7 @@ public static class MMC
uint ps1Start = 0;
uint ps1Length = 0;
for(var ri = 0; ri < rootLength; ri++)
for(int ri = 0; ri < rootLength; ri++)
{
int rootPos = ri * 2048;
@@ -2181,8 +2181,8 @@ public static class MMC
isoSector[rootPos] > 0 &&
rootPos + isoSector[rootPos] <= isoSector.Length)
{
int nameLen = isoSector[rootPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[rootPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, rootPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -2290,8 +2290,8 @@ public static class MMC
{
using var sr = new StringReader(iplTxt);
var correctNeoGeoCd = true;
var lineNumber = 0;
bool correctNeoGeoCd = true;
int lineNumber = 0;
while(sr.Peek() > 0)
{
@@ -2429,7 +2429,7 @@ public static class MMC
uint infoPos = 0;
for(var vi = 0; vi < vcdLength; vi++)
for(int vi = 0; vi < vcdLength; vi++)
{
int vcdPos = vi * 2048;
@@ -2437,8 +2437,8 @@ public static class MMC
isoSector[vcdPos] > 0 &&
vcdPos + isoSector[vcdPos] <= isoSector.Length)
{
int nameLen = isoSector[vcdPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[vcdPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, vcdPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -2474,7 +2474,7 @@ public static class MMC
if(sense) break;
var systemId = new byte[8];
byte[] systemId = new byte[8];
Array.Copy(isoSector, 0, systemId, 0, 8);
string id = StringHandlers.CToString(systemId).TrimEnd();
@@ -2545,7 +2545,7 @@ public static class MMC
uint infoPos = 0;
for(var pi = 0; pi < pcdLength; pi++)
for(int pi = 0; pi < pcdLength; pi++)
{
int pcdPos = pi * 2048;
@@ -2553,8 +2553,8 @@ public static class MMC
isoSector[pcdPos] > 0 &&
pcdPos + isoSector[pcdPos] <= isoSector.Length)
{
int nameLen = isoSector[pcdPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[pcdPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -2590,7 +2590,7 @@ public static class MMC
if(sense) break;
var systemId = new byte[8];
byte[] systemId = new byte[8];
Array.Copy(isoSector, 0, systemId, 0, 8);
string id = StringHandlers.CToString(systemId).TrimEnd();
@@ -2728,7 +2728,7 @@ public static class MMC
// The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :)
byte decryptByte = ps2BootSectors[0];
for(var i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
for(int i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _);
@@ -2747,7 +2747,7 @@ public static class MMC
if(sector1 != null)
{
var tmp = new byte[_ps3Id.Length];
byte[] tmp = new byte[_ps3Id.Length];
Array.Copy(sector1, 0, tmp, 0, tmp.Length);
if(tmp.SequenceEqual(_ps3Id))
@@ -2801,7 +2801,7 @@ public static class MMC
case "BDU":
if(sector1 != null)
{
var tmp = new byte[_ps5Id.Length];
byte[] tmp = new byte[_ps5Id.Length];
Array.Copy(sector1, 1024, tmp, 0, tmp.Length);
if(tmp.SequenceEqual(_ps5Id))
@@ -2834,20 +2834,20 @@ public static class MMC
cdegPacket = false;
cdmidiPacket = false;
var cdSubRwPack1 = new byte[24];
var cdSubRwPack2 = new byte[24];
var cdSubRwPack3 = new byte[24];
var cdSubRwPack4 = new byte[24];
byte[] cdSubRwPack1 = new byte[24];
byte[] cdSubRwPack2 = new byte[24];
byte[] cdSubRwPack3 = new byte[24];
byte[] cdSubRwPack4 = new byte[24];
var i = 0;
int i = 0;
for(var j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F);
switch(cdSubRwPack1[0])
{

View File

@@ -37,7 +37,6 @@ using System.Threading;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Core.Media.Detection;
using Aaru.Decoders.CD;
using Aaru.Decoders.DVD;
@@ -46,6 +45,7 @@ using Aaru.Decoders.SCSI.MMC;
using Aaru.Decoders.SCSI.SSC;
using Aaru.Decoders.Xbox;
using Aaru.Devices;
using Aaru.Logging;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
using DMI = Aaru.Decoders.Xbox.DMI;
using DVDDecryption = Aaru.Decryption.DVD.Dump;
@@ -66,13 +66,13 @@ public sealed class ScsiInfo
MediaType = MediaType.Unknown;
MediaInserted = false;
var resets = 0;
int resets = 0;
bool sense;
byte[] cmdBuf;
byte[] senseBuf;
var containsFloppyPage = false;
var sessions = 1;
var firstTrackLastSession = 1;
bool containsFloppyPage = false;
int sessions = 1;
int firstTrackLastSession = 1;
if(dev.IsRemovable)
{
@@ -97,7 +97,7 @@ public sealed class ScsiInfo
{
case 0x3A:
{
var leftRetries = 5;
int leftRetries = 5;
while(leftRetries > 0)
{
@@ -121,7 +121,7 @@ public sealed class ScsiInfo
}
case 0x04 when decSense?.ASCQ == 0x01:
{
var leftRetries = 10;
int leftRetries = 10;
while(leftRetries > 0)
{
@@ -217,7 +217,7 @@ public sealed class ScsiInfo
if(ReadCapacity16 != null)
{
var temp = new byte[8];
byte[] temp = new byte[8];
Array.Copy(cmdBuf, 0, temp, 0, 8);
Array.Reverse(temp);