Exemplo n.º 1
0
        /// <summary>Decodes an IP.BIN sector in SEGA CD / MEGA CD format</summary>
        /// <param name="ipbin_sector">IP.BIN sector</param>
        /// <returns>Decoded IP.BIN</returns>
        public static IPBin?DecodeIPBin(byte[] ipbin_sector)
        {
            if (ipbin_sector == null)
            {
                return(null);
            }

            if (ipbin_sector.Length < 512)
            {
                return(null);
            }

            IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian <IPBin>(ipbin_sector);

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_name = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.volume_name));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.system_name = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.system_name));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "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("SegaCD IP.BIN Decoder", "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("SegaCD IP.BIN Decoder", "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}",
                                       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("SegaCD IP.BIN Decoder", "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}",
                                       ipbin.sp_work_ram_size);

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.release_date = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.release_date));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.release_date2 = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.release_date2));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.developer_code = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.developer_code));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.domestic_title = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.domestic_title));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.overseas_title = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.overseas_title));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.product_code = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.product_code));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.peripherals = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.peripherals));

            AaruConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.region_codes = \"{0}\"",
                                       Encoding.ASCII.GetString(ipbin.region_codes));

            string id = Encoding.ASCII.GetString(ipbin.SegaHardwareID);

            return(id == "SEGADISCSYSTEM  " || id == "SEGADATADISC    " || id == "SEGAOS          " ? ipbin
                       : (IPBin?)null);
        }
Exemplo n.º 2
0
        /// <summary>Pretty prints a decoded IP.BIN in SEGA CD / MEGA CD format</summary>
        /// <param name="decoded">Decoded IP.BIN</param>
        /// <returns>Description of the IP.BIN contents</returns>
        public static string Prettify(IPBin?decoded)
        {
            if (decoded == null)
            {
                return(null);
            }

            IPBin ipbin = decoded.Value;

            var IPBinInformation = new StringBuilder();

            IPBinInformation.AppendLine("--------------------------------");
            IPBinInformation.AppendLine("SEGA IP.BIN INFORMATION:");
            IPBinInformation.AppendLine("--------------------------------");

            // Decoding all data
            DateTime    ipbindate = DateTime.MinValue;
            CultureInfo provider  = CultureInfo.InvariantCulture;

            try
            {
                ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "MMddyyyy", provider);
            }
            catch
            {
                try
                {
                    ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date2), "yyyy.MMM",
                                                    provider);
                }
                #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
                catch
                {
                    // ignored
                }
                #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
            }

            /*
             * switch (Encoding.ASCII.GetString(application_type))
             * {
             *  case "GM":
             *      IPBinInformation.AppendLine("Disc is a game.");
             *      break;
             *  case "AI":
             *      IPBinInformation.AppendLine("Disc is an application.");
             *      break;
             *  default:
             *      IPBinInformation.AppendLine("Disc is from unknown type.");
             *      break;
             * }
             */

            IPBinInformation.AppendFormat("Volume name: {0}", Encoding.ASCII.GetString(ipbin.volume_name)).AppendLine();

            //IPBinInformation.AppendFormat("Volume version: {0}", Encoding.ASCII.GetString(ipbin.volume_version)).AppendLine();
            //IPBinInformation.AppendFormat("{0}", Encoding.ASCII.GetString(ipbin.volume_type)).AppendLine();
            IPBinInformation.AppendFormat("System name: {0}", Encoding.ASCII.GetString(ipbin.system_name)).AppendLine();

            //IPBinInformation.AppendFormat("System version: {0}", Encoding.ASCII.GetString(ipbin.system_version)).AppendLine();
            IPBinInformation.AppendFormat("Initial program address: 0x{0:X8}", ipbin.ip_address).AppendLine();
            IPBinInformation.AppendFormat("Initial program load size: {0} bytes", ipbin.ip_loadsize).AppendLine();

            IPBinInformation.AppendFormat("Initial program entry address: 0x{0:X8}", ipbin.ip_entry_address).
            AppendLine();

            IPBinInformation.AppendFormat("Initial program work RAM: {0} bytes", ipbin.ip_work_ram_size).AppendLine();
            IPBinInformation.AppendFormat("System program address: 0x{0:X8}", ipbin.sp_address).AppendLine();
            IPBinInformation.AppendFormat("System program load size: {0} bytes", ipbin.sp_loadsize).AppendLine();

            IPBinInformation.AppendFormat("System program entry address: 0x{0:X8}", ipbin.sp_entry_address).
            AppendLine();

            IPBinInformation.AppendFormat("System program work RAM: {0} bytes", ipbin.sp_work_ram_size).AppendLine();

            if (ipbindate != DateTime.MinValue)
            {
                IPBinInformation.AppendFormat("Release date: {0}", ipbindate).AppendLine();
            }

            //IPBinInformation.AppendFormat("Release date (other format): {0}", Encoding.ASCII.GetString(release_date2)).AppendLine();
            IPBinInformation.AppendFormat("Hardware ID: {0}", Encoding.ASCII.GetString(ipbin.hardware_id)).AppendLine();

            IPBinInformation.AppendFormat("Developer code: {0}", Encoding.ASCII.GetString(ipbin.developer_code)).
            AppendLine();

            IPBinInformation.AppendFormat("Domestic title: {0}", Encoding.ASCII.GetString(ipbin.domestic_title)).
            AppendLine();

            IPBinInformation.AppendFormat("Overseas title: {0}", Encoding.ASCII.GetString(ipbin.overseas_title)).
            AppendLine();

            IPBinInformation.AppendFormat("Product code: {0}", Encoding.ASCII.GetString(ipbin.product_code)).
            AppendLine();

            IPBinInformation.AppendFormat("Peripherals:").AppendLine();

            foreach (byte peripheral in ipbin.peripherals)
            {
                switch ((char)peripheral)
                {
                case 'A':
                    IPBinInformation.AppendLine("Game supports analog controller.");

                    break;

                case 'B':
                    IPBinInformation.AppendLine("Game supports trackball.");

                    break;

                case 'G':
                    IPBinInformation.AppendLine("Game supports light gun.");

                    break;

                case 'J':
                    IPBinInformation.AppendLine("Game supports JoyPad.");

                    break;

                case 'K':
                    IPBinInformation.AppendLine("Game supports keyboard.");

                    break;

                case 'M':
                    IPBinInformation.AppendLine("Game supports mouse.");

                    break;

                case 'O':
                    IPBinInformation.AppendLine("Game supports Master System's JoyPad.");

                    break;

                case 'P':
                    IPBinInformation.AppendLine("Game supports printer interface.");

                    break;

                case 'R':
                    IPBinInformation.AppendLine("Game supports serial (RS-232C) interface.");

                    break;

                case 'T':
                    IPBinInformation.AppendLine("Game supports tablet interface.");

                    break;

                case 'V':
                    IPBinInformation.AppendLine("Game supports paddle controller.");

                    break;

                case ' ': break;

                default:
                    IPBinInformation.AppendFormat("Game supports unknown peripheral {0}.", peripheral).AppendLine();

                    break;
                }
            }

            IPBinInformation.AppendLine("Regions supported:");

            foreach (byte region in ipbin.region_codes)
            {
                switch ((char)region)
                {
                case 'J':
                    IPBinInformation.AppendLine("Japanese NTSC.");

                    break;

                case 'U':
                    IPBinInformation.AppendLine("USA NTSC.");

                    break;

                case 'E':
                    IPBinInformation.AppendLine("Europe PAL.");

                    break;

                case ' ': break;

                default:
                    IPBinInformation.AppendFormat("Game supports unknown region {0}.", region).AppendLine();

                    break;
                }
            }

            return(IPBinInformation.ToString());
        }
Exemplo n.º 3
0
        public static string Prettify(IPBin?decoded)
        {
            if (decoded == null)
            {
                return(null);
            }

            IPBin ipbin = decoded.Value;

            StringBuilder IPBinInformation = new StringBuilder();

            IPBinInformation.AppendLine("--------------------------------");
            IPBinInformation.AppendLine("SEGA IP.BIN INFORMATION:");
            IPBinInformation.AppendLine("--------------------------------");

            // Decoding all data
            DateTime    ipbindate;
            CultureInfo provider = CultureInfo.InvariantCulture;

            ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "yyyyMMdd", provider);
            IPBinInformation.AppendFormat("Product name: {0}", Encoding.ASCII.GetString(ipbin.product_name))
            .AppendLine();
            IPBinInformation.AppendFormat("Product version: {0}", Encoding.ASCII.GetString(ipbin.product_version))
            .AppendLine();
            IPBinInformation.AppendFormat("Product CRC: 0x{0:X8}", ipbin.dreamcast_crc).AppendLine();
            IPBinInformation.AppendFormat("Producer: {0}", Encoding.ASCII.GetString(ipbin.producer)).AppendLine();
            IPBinInformation.AppendFormat("Disc media: {0}", Encoding.ASCII.GetString(ipbin.dreamcast_media))
            .AppendLine();
            IPBinInformation.AppendFormat("Disc number {0} of {1}", (char)ipbin.disc_no, (char)ipbin.disc_total_nos)
            .AppendLine();
            IPBinInformation.AppendFormat("Release date: {0}", ipbindate).AppendLine();
            switch (Encoding.ASCII.GetString(ipbin.boot_filename))
            {
            case "1ST_READ.BIN":
                IPBinInformation.AppendLine("Disc boots natively.");
                break;

            case "0WINCE.BIN  ":
                IPBinInformation.AppendLine("Disc boots using Windows CE.");
                break;

            default:
                IPBinInformation.AppendFormat("Disc boots using unknown loader: {0}.",
                                              Encoding.ASCII.GetString(ipbin.boot_filename)).AppendLine();
                break;
            }

            IPBinInformation.AppendLine("Regions supported:");
            foreach (byte region in ipbin.region_codes)
            {
                switch ((char)region)
                {
                case 'J':
                    IPBinInformation.AppendLine("Japanese NTSC.");
                    break;

                case 'U':
                    IPBinInformation.AppendLine("North America NTSC.");
                    break;

                case 'E':
                    IPBinInformation.AppendLine("Europe PAL.");
                    break;

                case ' ': break;

                default:
                    IPBinInformation.AppendFormat("Game supports unknown region {0}.", region).AppendLine();
                    break;
                }
            }

            int iPeripherals = int.Parse(Encoding.ASCII.GetString(ipbin.peripherals), NumberStyles.HexNumber);

            if ((iPeripherals & 0x00000001) == 0x00000001)
            {
                IPBinInformation.AppendLine("Game uses Windows CE.");
            }

            IPBinInformation.AppendFormat("Peripherals:").AppendLine();

            if ((iPeripherals & 0x00000010) == 0x00000010)
            {
                IPBinInformation.AppendLine("Game supports the VGA Box.");
            }
            if ((iPeripherals & 0x00000100) == 0x00000100)
            {
                IPBinInformation.AppendLine("Game supports other expansion.");
            }
            if ((iPeripherals & 0x00000200) == 0x00000200)
            {
                IPBinInformation.AppendLine("Game supports Puru Puru pack.");
            }
            if ((iPeripherals & 0x00000400) == 0x00000400)
            {
                IPBinInformation.AppendLine("Game supports Mike Device.");
            }
            if ((iPeripherals & 0x00000800) == 0x00000800)
            {
                IPBinInformation.AppendLine("Game supports Memory Card.");
            }
            if ((iPeripherals & 0x00001000) == 0x00001000)
            {
                IPBinInformation.AppendLine("Game requires A + B + Start buttons and D-Pad.");
            }
            if ((iPeripherals & 0x00002000) == 0x00002000)
            {
                IPBinInformation.AppendLine("Game requires C button.");
            }
            if ((iPeripherals & 0x00004000) == 0x00004000)
            {
                IPBinInformation.AppendLine("Game requires D button.");
            }
            if ((iPeripherals & 0x00008000) == 0x00008000)
            {
                IPBinInformation.AppendLine("Game requires X button.");
            }
            if ((iPeripherals & 0x00010000) == 0x00010000)
            {
                IPBinInformation.AppendLine("Game requires Y button.");
            }
            if ((iPeripherals & 0x00020000) == 0x00020000)
            {
                IPBinInformation.AppendLine("Game requires Z button.");
            }
            if ((iPeripherals & 0x00040000) == 0x00040000)
            {
                IPBinInformation.AppendLine("Game requires expanded direction buttons.");
            }
            if ((iPeripherals & 0x00080000) == 0x00080000)
            {
                IPBinInformation.AppendLine("Game requires analog R trigger.");
            }
            if ((iPeripherals & 0x00100000) == 0x00100000)
            {
                IPBinInformation.AppendLine("Game requires analog L trigger.");
            }
            if ((iPeripherals & 0x00200000) == 0x00200000)
            {
                IPBinInformation.AppendLine("Game requires analog horizontal controller.");
            }
            if ((iPeripherals & 0x00400000) == 0x00400000)
            {
                IPBinInformation.AppendLine("Game requires analog vertical controller.");
            }
            if ((iPeripherals & 0x00800000) == 0x00800000)
            {
                IPBinInformation.AppendLine("Game requires expanded analog horizontal controller.");
            }
            if ((iPeripherals & 0x01000000) == 0x01000000)
            {
                IPBinInformation.AppendLine("Game requires expanded analog vertical controller.");
            }
            if ((iPeripherals & 0x02000000) == 0x02000000)
            {
                IPBinInformation.AppendLine("Game supports Gun.");
            }
            if ((iPeripherals & 0x04000000) == 0x04000000)
            {
                IPBinInformation.AppendLine("Game supports Keyboard.");
            }
            if ((iPeripherals & 0x08000000) == 0x08000000)
            {
                IPBinInformation.AppendLine("Game supports Mouse.");
            }

            if ((iPeripherals & 0xEE) != 0)
            {
                IPBinInformation.AppendFormat("Game supports unknown peripherals mask {0:X2}", iPeripherals & 0xEE);
            }

            return(IPBinInformation.ToString());
        }
Exemplo n.º 4
0
        public static IPBin?DecodeIPBin(byte[] ipbin_sector)
        {
            if (ipbin_sector == null)
            {
                return(null);
            }

            if (ipbin_sector.Length < 512)
            {
                return(null);
            }

            IntPtr ptr = Marshal.AllocHGlobal(512);

            Marshal.Copy(ipbin_sector, 0, ptr, 512);
            IPBin ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin));

            Marshal.FreeHGlobal(ptr);

            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_name = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.volume_name));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.system_name = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.system_name));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_version = \"{0:X}\"",
                                      ipbin.volume_version);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.volume_type = 0x{0:X8}",
                                      ipbin.volume_type);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.system_version = 0x{0:X8}",
                                      ipbin.system_version);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_address = 0x{0:X8}", ipbin.ip_address);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_loadsize = {0}", ipbin.ip_loadsize);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_entry_address = 0x{0:X8}",
                                      ipbin.ip_entry_address);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.ip_work_ram_size = {0}",
                                      ipbin.ip_work_ram_size);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_address = 0x{0:X8}", ipbin.sp_address);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_loadsize = {0}", ipbin.sp_loadsize);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_entry_address = 0x{0:X8}",
                                      ipbin.sp_entry_address);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.sp_work_ram_size = {0}",
                                      ipbin.sp_work_ram_size);
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.release_date = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.release_date));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.release_date2 = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.release_date2));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.developer_code = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.developer_code));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.domestic_title = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.domestic_title));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.overseas_title = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.overseas_title));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.product_code = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.product_code));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.peripherals = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.peripherals));
            DicConsole.DebugWriteLine("SegaCD IP.BIN Decoder", "segacd_ipbin.region_codes = \"{0}\"",
                                      Encoding.ASCII.GetString(ipbin.region_codes));

            string id = Encoding.ASCII.GetString(ipbin.SegaHardwareID);

            return(id == "SEGADISCSYSTEM  " || id == "SEGADATADISC    " || id == "SEGAOS          "
                       ? ipbin
                       : (IPBin?)null);
        }
Exemplo n.º 5
0
        public static string Prettify(IPBin?decoded)
        {
            if (decoded == null)
            {
                return(null);
            }

            IPBin ipbin = decoded.Value;

            StringBuilder IPBinInformation = new StringBuilder();

            IPBinInformation.AppendLine("--------------------------------");
            IPBinInformation.AppendLine("SEGA IP.BIN INFORMATION:");
            IPBinInformation.AppendLine("--------------------------------");

            // Decoding all data
            DateTime    ipbindate;
            CultureInfo provider = CultureInfo.InvariantCulture;

            ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(ipbin.release_date), "yyyyMMdd", provider);
            IPBinInformation.AppendFormat("Product name: {0}", Encoding.ASCII.GetString(ipbin.product_name))
            .AppendLine();
            IPBinInformation.AppendFormat("Product number: {0}", Encoding.ASCII.GetString(ipbin.product_no))
            .AppendLine();
            IPBinInformation.AppendFormat("Product version: {0}", Encoding.ASCII.GetString(ipbin.product_version))
            .AppendLine();
            IPBinInformation.AppendFormat("Release date: {0}", ipbindate).AppendLine();
            IPBinInformation.AppendFormat("Disc number {0} of {1}", (char)ipbin.disc_no, (char)ipbin.disc_total_nos)
            .AppendLine();

            IPBinInformation.AppendFormat("Peripherals:").AppendLine();
            foreach (byte peripheral in ipbin.peripherals)
            {
                switch ((char)peripheral)
                {
                case 'A':
                    IPBinInformation.AppendLine("Game supports analog controller.");
                    break;

                case 'J':
                    IPBinInformation.AppendLine("Game supports JoyPad.");
                    break;

                case 'K':
                    IPBinInformation.AppendLine("Game supports keyboard.");
                    break;

                case 'M':
                    IPBinInformation.AppendLine("Game supports mouse.");
                    break;

                case 'S':
                    IPBinInformation.AppendLine("Game supports analog steering controller.");
                    break;

                case 'T':
                    IPBinInformation.AppendLine("Game supports multitap.");
                    break;

                case ' ': break;

                default:
                    IPBinInformation.AppendFormat("Game supports unknown peripheral {0}.", peripheral).AppendLine();
                    break;
                }
            }

            IPBinInformation.AppendLine("Regions supported:");
            foreach (byte region in ipbin.region_codes)
            {
                switch ((char)region)
                {
                case 'J':
                    IPBinInformation.AppendLine("Japanese NTSC.");
                    break;

                case 'U':
                    IPBinInformation.AppendLine("North America NTSC.");
                    break;

                case 'E':
                    IPBinInformation.AppendLine("Europe PAL.");
                    break;

                case 'T':
                    IPBinInformation.AppendLine("Asia NTSC.");
                    break;

                case ' ': break;

                default:
                    IPBinInformation.AppendFormat("Game supports unknown region {0}.", region).AppendLine();
                    break;
                }
            }

            return(IPBinInformation.ToString());
        }
Exemplo n.º 6
0
        public static IPBin?DecodeIPBin(byte[] ipbin_sector)
        {
            if (ipbin_sector == null)
            {
                return(null);
            }

            if (ipbin_sector.Length < 512)
            {
                return(null);
            }

            IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian <IPBin>(ipbin_sector);

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.maker_id = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.maker_id));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.spare_space1 = \"{0}\"",
            //                           (char)ipbin.spare_space1);

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "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("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.disc_no_separator = \"{0}\"",
            //                           (char)ipbin.disc_no_separator);

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.disc_total_nos = \"{0}\"",
            //                           (char)ipbin.disc_total_nos);

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.spare_space2 = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.spare_space2));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.region_codes = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.region_codes));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.peripherals = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.peripherals));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.product_no = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.product_no));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.product_version = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.product_version));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.release_date = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.release_date));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.spare_space3 = \"{0}\"",
            //                           (char)ipbin.spare_space3);

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.boot_filename = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.boot_filename));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.producer = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.producer));

            //AaruConsole.DebugWriteLine("Dreamcast IP.BIN Decoder", "dreamcast_ipbin.product_name = \"{0}\"",
            //                           Encoding.ASCII.GetString(ipbin.product_name));

            return(Encoding.ASCII.GetString(ipbin.SegaHardwareID) == "SEGA SEGAKATANA " ? ipbin : (IPBin?)null);
        }