From 2a52c3075d0dfa893d3f6f34f667d6165ae8d871 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 3 Oct 2023 17:21:19 +0100 Subject: [PATCH] [Aaru.Decoders] Introduced constants for module names Introduces constant fields for respective debug module names, replacing the hardcoded ones. This is done to standardize the naming convention, reduce redundancy and potentially avoid any typos or name mismatches across the project. This change makes the code more maintainable and easier to update in case module names need to be changed. --- Bluray/BCA.cs | 3 ++- Bluray/Cartridge.cs | 3 ++- Bluray/DDS.cs | 3 ++- Bluray/DI.cs | 5 +++-- Bluray/Spare.cs | 3 ++- CD/ATIP.cs | 4 +++- CD/CDTextOnLeadIn.cs | 4 +++- CD/FullTOC.cs | 4 +++- CD/PMA.cs | 4 +++- CD/Session.cs | 4 +++- CD/TOC.cs | 4 +++- Floppy/Apple2.cs | 25 +++++++++++++------------ Sega/CD.cs | 44 +++++++++++++++++++++++--------------------- Sega/Dreamcast.cs | 34 ++++++++++++++++++---------------- Sega/Saturn.cs | 28 +++++++++++++++------------- 15 files changed, 98 insertions(+), 74 deletions(-) diff --git a/Bluray/BCA.cs b/Bluray/BCA.cs index a5b79d3..3f7b96a 100644 --- a/Bluray/BCA.cs +++ b/Bluray/BCA.cs @@ -55,6 +55,7 @@ namespace Aaru.Decoders.Bluray; SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")] public static class BCA { + const string MODULE_NAME = "BD BCA decoder"; #region Public structures public struct BurstCuttingArea { @@ -76,7 +77,7 @@ public static class BCA if(BCAResponse.Length != 68) { - AaruConsole.DebugWriteLine("BD BCA decoder", Localization.Found_incorrect_Blu_ray_BCA_size_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_incorrect_Blu_ray_BCA_size_0_bytes, BCAResponse.Length); return null; diff --git a/Bluray/Cartridge.cs b/Bluray/Cartridge.cs index c21a34c..a071066 100644 --- a/Bluray/Cartridge.cs +++ b/Bluray/Cartridge.cs @@ -56,6 +56,7 @@ namespace Aaru.Decoders.Bluray; SuppressMessage("ReSharper", "UnassignedField.Global")] public static class Cartridge { + const string MODULE_NAME = "BD Cartridge Status decoder"; #region Public structures public struct CartridgeStatus { @@ -91,7 +92,7 @@ public static class Cartridge if(CSResponse.Length != 8) { - AaruConsole.DebugWriteLine("BD Cartridge Status decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_incorrect_Blu_ray_Cartridge_Status_size_0_bytes, CSResponse.Length); diff --git a/Bluray/DDS.cs b/Bluray/DDS.cs index d649298..7ae829f 100644 --- a/Bluray/DDS.cs +++ b/Bluray/DDS.cs @@ -58,6 +58,7 @@ public static class DDS #region Private constants /// Disc Definition Structure Identifier "DS" const ushort DDSIdentifier = 0x4453; + const string MODULE_NAME = "BD DDS decoder"; #endregion Private constants #region Public structures @@ -132,7 +133,7 @@ public static class DDS if(decoded.Signature != DDSIdentifier) { - AaruConsole.DebugWriteLine("BD DDS decoder", Localization.Found_incorrect_DDS_signature_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_incorrect_DDS_signature_0, decoded.Signature); return null; diff --git a/Bluray/DI.cs b/Bluray/DI.cs index 857a193..5383a69 100644 --- a/Bluray/DI.cs +++ b/Bluray/DI.cs @@ -91,6 +91,7 @@ public static class DI /// Disc Information Unit Identifier "DI" const ushort DIUIdentifier = 0x4449; + const string MODULE_NAME = "BD Disc Information decoder"; #endregion Private constants #region Public methods @@ -101,7 +102,7 @@ public static class DI if(DIResponse.Length != 4100) { - AaruConsole.DebugWriteLine("BD Disc Information decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_incorrect_Blu_ray_Disc_Information_size_0_bytes, DIResponse.Length); @@ -192,7 +193,7 @@ public static class DI default: { - AaruConsole.DebugWriteLine("BD Disc Information decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_unknown_disc_type_identifier_0, Encoding.ASCII.GetString(unit.DiscTypeIdentifier)); diff --git a/Bluray/Spare.cs b/Bluray/Spare.cs index 5254d62..7f169e5 100644 --- a/Bluray/Spare.cs +++ b/Bluray/Spare.cs @@ -54,6 +54,7 @@ namespace Aaru.Decoders.Bluray; SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")] public static class Spare { + const string MODULE_NAME = "BD Spare Area Information decoder"; #region Public structures public struct SpareAreaInformation { @@ -79,7 +80,7 @@ public static class Spare if(SAIResponse.Length != 16) { - AaruConsole.DebugWriteLine("BD Spare Area Information decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization. Spare_Decode_Found_incorrect_Blu_ray_Spare_Area_Information_size_0_bytes, SAIResponse.Length); diff --git a/CD/ATIP.cs b/CD/ATIP.cs index d51a028..67259ce 100644 --- a/CD/ATIP.cs +++ b/CD/ATIP.cs @@ -55,6 +55,8 @@ namespace Aaru.Decoders.CD; SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")] public static class ATIP { + const string MODULE_NAME = "CD ATIP decoder"; + public static CDATIP Decode(byte[] CDATIPResponse) { if(CDATIPResponse is not { Length: > 4 }) @@ -65,7 +67,7 @@ public static class ATIP if(CDATIPResponse.Length != 32 && CDATIPResponse.Length != 28) { - AaruConsole.DebugWriteLine("CD ATIP decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization. Expected_CD_ATIP_size_32_bytes_is_not_received_size_0_bytes_not_decoding, CDATIPResponse.Length); diff --git a/CD/CDTextOnLeadIn.cs b/CD/CDTextOnLeadIn.cs index a38c0e5..a45cc9e 100644 --- a/CD/CDTextOnLeadIn.cs +++ b/CD/CDTextOnLeadIn.cs @@ -55,6 +55,8 @@ namespace Aaru.Decoders.CD; SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")] public static class CDTextOnLeadIn { + const string MODULE_NAME = "CD-TEXT decoder"; + public enum PackTypeIndicator : byte { /// Title of the track (or album if track == 0) @@ -110,7 +112,7 @@ public static class CDTextOnLeadIn if(decoded.DataLength + 2 != CDTextResponse.Length) { - AaruConsole.DebugWriteLine("CD-TEXT decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization. Expected_CD_TEXT_size_0_bytes_is_not_received_size_1_bytes_not_decoding, decoded.DataLength + 2, CDTextResponse.Length); diff --git a/CD/FullTOC.cs b/CD/FullTOC.cs index 4939999..c42701b 100644 --- a/CD/FullTOC.cs +++ b/CD/FullTOC.cs @@ -60,6 +60,8 @@ namespace Aaru.Decoders.CD; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class FullTOC { + const string MODULE_NAME = "CD full TOC decoder"; + public static CDFullTOC? Decode(byte[] CDFullTOCResponse) { if(CDFullTOCResponse is not { Length: > 4 }) @@ -76,7 +78,7 @@ public static class FullTOC if(decoded.DataLength + 2 != CDFullTOCResponse.Length) { - AaruConsole.DebugWriteLine("CD full TOC decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization. Expected_CDFullTOC_size_0_bytes_is_not_received_size_1_bytes_not_decoding, decoded.DataLength + 2, CDFullTOCResponse.Length); diff --git a/CD/PMA.cs b/CD/PMA.cs index 60a8ef9..107d58b 100644 --- a/CD/PMA.cs +++ b/CD/PMA.cs @@ -55,6 +55,8 @@ namespace Aaru.Decoders.CD; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class PMA { + const string MODULE_NAME = "CD PMA decoder"; + public static CDPMA? Decode(byte[] CDPMAResponse) { if(CDPMAResponse is not { Length: > 4 }) @@ -74,7 +76,7 @@ public static class PMA if(decoded.DataLength + 2 != CDPMAResponse.Length) { - AaruConsole.DebugWriteLine("CD PMA decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization. Expected_CD_PMA_size_0_bytes_is_not_received_size_1_bytes_not_decoding, decoded.DataLength + 2, CDPMAResponse.Length); diff --git a/CD/Session.cs b/CD/Session.cs index 03b6a74..666e851 100644 --- a/CD/Session.cs +++ b/CD/Session.cs @@ -53,6 +53,8 @@ namespace Aaru.Decoders.CD; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class Session { + const string MODULE_NAME = "CD Session Info decoder"; + public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse) { if(CDSessionInfoResponse is not { Length: > 4 }) @@ -69,7 +71,7 @@ public static class Session if(decoded.DataLength + 2 != CDSessionInfoResponse.Length) { - AaruConsole.DebugWriteLine("CD Session Info decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization. Expected_CDSessionInfo_size_0_bytes_is_not_received_size_1_bytes_not_decoding, decoded.DataLength + 2, CDSessionInfoResponse.Length); diff --git a/CD/TOC.cs b/CD/TOC.cs index 4fd6c05..df0411b 100644 --- a/CD/TOC.cs +++ b/CD/TOC.cs @@ -56,6 +56,8 @@ namespace Aaru.Decoders.CD; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class TOC { + const string MODULE_NAME = "CD TOC decoder"; + public static CDTOC? Decode(byte[] CDTOCResponse) { if(CDTOCResponse is not { Length: > 4 }) @@ -72,7 +74,7 @@ public static class TOC if(decoded.DataLength + 2 != CDTOCResponse.Length) { - AaruConsole.DebugWriteLine("CD TOC decoder", + AaruConsole.DebugWriteLine(MODULE_NAME, Localization. Expected_CD_TOC_size_0_bytes_is_not_received_size_1_bytes_not_decoding, decoded.DataLength + 2, CDTOCResponse.Length); diff --git a/Floppy/Apple2.cs b/Floppy/Apple2.cs index 0266abb..1e8cc07 100644 --- a/Floppy/Apple2.cs +++ b/Floppy/Apple2.cs @@ -46,6 +46,7 @@ namespace Aaru.Decoders.Floppy; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class Apple2 { + const string MODULE_NAME = "Apple ][ GCR Decoder"; static readonly byte[] ReadTable5and3 = { // 00h @@ -269,7 +270,7 @@ public static class Apple2 if(data[position] == 0xD5 && data[position + 1] == 0xAA) { - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Prologue_found_at_0, position); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Prologue_found_at_0, position); // Epilogue not in correct position if(data[position + 11] != 0xDE || @@ -307,23 +308,23 @@ public static class Apple2 } }; - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Volume_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Volume_0, (((sector.addressField.volume[0] & 0x55) << 1) | (sector.addressField.volume[1] & 0x55)) & 0xFF); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Core.Track_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Core.Track_0, (((sector.addressField.track[0] & 0x55) << 1) | (sector.addressField.track[1] & 0x55)) & 0xFF); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Sector_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Sector_0, (((sector.addressField.sector[0] & 0x55) << 1) | (sector.addressField.sector[1] & 0x55)) & 0xFF); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Checksum_0, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Checksum_0, (((sector.addressField.checksum[0] & 0x55) << 1) | (sector.addressField.checksum[1] & 0x55)) & 0xFF); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Epilogue_0_1_2, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Epilogue_0_1_2, sector.addressField.epilogue[0], sector.addressField.epilogue[1], sector.addressField.epilogue[2]); @@ -352,10 +353,10 @@ public static class Apple2 sector.innerGap = gaps.ToArray(); sector.dataField = new RawDataField(); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Inner_gap_has_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Inner_gap_has_0_bytes, sector.innerGap.Length); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Prologue_found_at_0, position); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Prologue_found_at_0, position); sector.dataField.prologue = new byte[3]; sector.dataField.prologue[0] = data[position]; sector.dataField.prologue[1] = data[position + 1]; @@ -378,7 +379,7 @@ public static class Apple2 sector.dataField.data = gaps.ToArray(); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Data_has_0_bytes, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Data_has_0_bytes, sector.dataField.data.Length); sector.dataField.checksum = data[position]; @@ -410,10 +411,10 @@ public static class Apple2 // Return current position to be able to read separate sectors endOffset = position; - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Got_0_bytes_of_gap, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Got_0_bytes_of_gap, sector.gap.Length); - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Finished_sector_at_0, position); + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Finished_sector_at_0, position); return sector; } @@ -523,7 +524,7 @@ public static class Apple2 break; } - AaruConsole.DebugWriteLine("Apple ][ GCR Decoder", Localization.Adding_sector_0_of_track_1, + AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Adding_sector_0_of_track_1, (((sector.addressField.sector[0] & 0x55) << 1) | (sector.addressField.sector[1] & 0x55)) & 0xFF, (((sector.addressField.track[0] & 0x55) << 1) | diff --git a/Sega/CD.cs b/Sega/CD.cs index d144890..abb14c2 100644 --- a/Sega/CD.cs +++ b/Sega/CD.cs @@ -46,6 +46,8 @@ namespace Aaru.Decoders.Sega; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class CD { + const string MODULE_NAME = "SegaCD IP.BIN Decoder"; + /// Decodes an IP.BIN sector in SEGA CD / MEGA CD format /// IP.BIN sector /// Decoded IP.BIN @@ -59,60 +61,60 @@ public static class CD IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian(ipbin_sector); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_name = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.volume_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.volume_name)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.system_name = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.system_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.system_name)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_version = \"{0:X}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.volume_version = \"{0:X}\"", ipbin.volume_version); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_type = 0x{0:X8}", ipbin.volume_type); + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.volume_type = 0x{0:X8}", ipbin.volume_type); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.system_version = 0x{0:X8}", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.system_version = 0x{0:X8}", ipbin.system_version); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_address = 0x{0:X8}", ipbin.ip_address); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_loadsize = {0}", ipbin.ip_loadsize); + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.ip_address = 0x{0:X8}", ipbin.ip_address); + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.ip_loadsize = {0}", ipbin.ip_loadsize); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_entry_address = 0x{0:X8}", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.ip_entry_address = 0x{0:X8}", ipbin.ip_entry_address); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_work_ram_size = {0}", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.ip_work_ram_size = {0}", ipbin.ip_work_ram_size); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_address = 0x{0:X8}", ipbin.sp_address); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_loadsize = {0}", ipbin.sp_loadsize); + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.sp_address = 0x{0:X8}", ipbin.sp_address); + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.sp_loadsize = {0}", ipbin.sp_loadsize); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_entry_address = 0x{0:X8}", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.sp_entry_address = 0x{0:X8}", ipbin.sp_entry_address); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_work_ram_size = {0}", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.sp_work_ram_size = {0}", ipbin.sp_work_ram_size); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.release_date = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.release_date2 = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.release_date2 = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date2)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.developer_code = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.developer_code = \"{0}\"", Encoding.ASCII.GetString(ipbin.developer_code)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.domestic_title = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.domestic_title = \"{0}\"", Encoding.ASCII.GetString(ipbin.domestic_title)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.overseas_title = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.overseas_title = \"{0}\"", Encoding.ASCII.GetString(ipbin.overseas_title)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.product_code = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.product_code = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_code)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.peripherals = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.peripherals = \"{0}\"", Encoding.ASCII.GetString(ipbin.peripherals)); - AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.region_codes = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "segacd_ipbin.region_codes = \"{0}\"", Encoding.ASCII.GetString(ipbin.region_codes)); string id = Encoding.ASCII.GetString(ipbin.SegaHardwareID); diff --git a/Sega/Dreamcast.cs b/Sega/Dreamcast.cs index af58f7c..31442c6 100644 --- a/Sega/Dreamcast.cs +++ b/Sega/Dreamcast.cs @@ -45,6 +45,8 @@ namespace Aaru.Decoders.Sega; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class Dreamcast { + const string MODULE_NAME = "Dreamcast IP.BIN Decoder"; + /// Decodes an IP.BIN sector in Dreamcast format /// IP.BIN sector /// Decoded IP.BIN @@ -58,51 +60,51 @@ public static class Dreamcast IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian(ipbin_sector); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.maker_id = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.maker_id = \"{0}\"", Encoding.ASCII.GetString(ipbin.maker_id)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.spare_space1 = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.spare_space1 = \"{0}\"", (char)ipbin.spare_space1); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.dreamcast_media = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.dreamcast_media = \"{0}\"", Encoding.ASCII.GetString(ipbin.dreamcast_media)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.disc_no = {0}", (char)ipbin.disc_no); + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.disc_no = {0}", (char)ipbin.disc_no); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.disc_no_separator = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.disc_no_separator = \"{0}\"", (char)ipbin.disc_no_separator); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.disc_total_nos = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.disc_total_nos = \"{0}\"", (char)ipbin.disc_total_nos); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.spare_space2 = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.spare_space2 = \"{0}\"", Encoding.ASCII.GetString(ipbin.spare_space2)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.region_codes = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.region_codes = \"{0}\"", Encoding.ASCII.GetString(ipbin.region_codes)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.peripherals = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.peripherals = \"{0}\"", Encoding.ASCII.GetString(ipbin.peripherals)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.product_no = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.product_no = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_no)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.product_version = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.product_version = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_version)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.release_date = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.spare_space3 = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.spare_space3 = \"{0}\"", (char)ipbin.spare_space3); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.boot_filename = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.boot_filename = \"{0}\"", Encoding.ASCII.GetString(ipbin.boot_filename)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.producer = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.producer = \"{0}\"", Encoding.ASCII.GetString(ipbin.producer)); - AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.product_name = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "dreamcast_ipbin.product_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_name)); return Encoding.ASCII.GetString(ipbin.SegaHardwareID) == "SEGA SEGAKATANA " ? ipbin : null; diff --git a/Sega/Saturn.cs b/Sega/Saturn.cs index 6fe9d87..5e4e444 100644 --- a/Sega/Saturn.cs +++ b/Sega/Saturn.cs @@ -45,6 +45,8 @@ namespace Aaru.Decoders.Sega; SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public static class Saturn { + const string MODULE_NAME = "Saturn IP.BIN Decoder"; + /// Decodes an IP.BIN sector in Saturn format /// IP.BIN sector /// Decoded IP.BIN @@ -58,42 +60,42 @@ public static class Saturn IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian(ipbin_sector); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.maker_id = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.maker_id = \"{0}\"", Encoding.ASCII.GetString(ipbin.maker_id)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.product_no = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.product_no = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_no)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.product_version = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.product_version = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_version)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.release_date = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.saturn_media = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.saturn_media = \"{0}\"", Encoding.ASCII.GetString(ipbin.saturn_media)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.disc_no = {0}", (char)ipbin.disc_no); + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.disc_no = {0}", (char)ipbin.disc_no); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.disc_no_separator = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.disc_no_separator = \"{0}\"", (char)ipbin.disc_no_separator); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.disc_total_nos = {0}", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.disc_total_nos = {0}", (char)ipbin.disc_total_nos); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.release_date = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.spare_space1 = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.spare_space1 = \"{0}\"", Encoding.ASCII.GetString(ipbin.spare_space1)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.region_codes = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.region_codes = \"{0}\"", Encoding.ASCII.GetString(ipbin.region_codes)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.peripherals = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.peripherals = \"{0}\"", Encoding.ASCII.GetString(ipbin.peripherals)); - AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.product_name = \"{0}\"", + AaruConsole.DebugWriteLine(MODULE_NAME, "saturn_ipbin.product_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_name)); return Encoding.ASCII.GetString(ipbin.SegaHardwareID) == "SEGA SEGASATURN " ? ipbin : null;