initial commit

This commit is contained in:
what 2021-07-26 13:04:16 -07:00
commit 1b60743303
274 changed files with 25866 additions and 0 deletions

View file

@ -0,0 +1,133 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgram
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using SEGATools.Graphics;
using System;
using System.IO;
namespace SEGATools.Security
{
public class InitialProgram
{
public static readonly uint IP_FILESIZE = 32768;
private static readonly string IP_FILENAME = "IP.BIN";
private static readonly string IP0000_FILENAME = "IP0000.BIN";
public byte[] RawData { get; internal set; }
public string RawPeripherals { get; internal set; }
public string HardwareID { get; internal set; }
public string MakerID { get; internal set; }
public string CRC { get; internal set; }
public string ComputedCRC { get; internal set; }
public bool IsCRCValid => this.CRC.Equals(this.ComputedCRC);
public string DeviceInformation { get; internal set; }
public string AreaSymbols { get; internal set; }
public string ProductID { get; internal set; }
public string ProductVersion { get; internal set; }
public string MainBinary { get; internal set; }
public string CompanyName { get; internal set; }
public string SoftwareName { get; internal set; }
public DateTime ReleaseDate { get; internal set; }
public InitialProgramToc TableOfContent { get; internal set; }
public MRImage SegaLicenseImage { get; internal set; }
public MRImage SegaTradeMarkImage { get; internal set; }
public MRImage CustomBrandingImage { get; internal set; }
public bool SupportVga => InitialProgramUtils.ConvertHexStringToBytes(this.RawPeripherals.Substring(5, 1))[0] == (byte) 1;
public bool UseWindowsCE => InitialProgramUtils.ConvertHexStringToBytes(this.RawPeripherals.Substring(6, 1))[0] == (byte) 1;
public bool SupportJapanArea => this.SupportArea(SupportedAreas.Japan);
public bool SupportUsaArea => this.SupportArea(SupportedAreas.Usa);
public bool SupportEuropeArea => this.SupportArea(SupportedAreas.Europe);
public bool SupportGun => this.SupportPeripheral(SupportedPeripherals.Gun);
public bool SupportKeyboard => this.SupportPeripheral(SupportedPeripherals.Keyboard);
public bool SupportMouse => this.SupportPeripheral(SupportedPeripherals.Mouse);
public bool SupportMemoryCard => this.SupportExpandedPeripheral(SupportedExpandedPeripherals.MemoryCard);
public bool SupportSoundInputPeripheral => this.SupportExpandedPeripheral(SupportedExpandedPeripherals.SoundInputPeripheral);
public bool SupportVibrator => this.SupportExpandedPeripheral(SupportedExpandedPeripherals.Vibrator);
public bool SupportOtherDevices => this.SupportExpandedPeripheral(SupportedExpandedPeripherals.OtherDevices);
public bool SupportStartABDirections => this.SupportButtons(SupportedButtons.StartABDirections);
public bool SupportCButton => this.SupportButtons(SupportedButtons.CButton);
public bool SupportDButton => this.SupportButtons(SupportedButtons.DButton);
public bool SupportXButton => this.SupportButtons(SupportedButtons.XButton);
public bool SupportYButton => this.SupportButtons(SupportedButtons.YButton);
public bool SupportZButton => this.SupportButtons(SupportedButtons.ZButton);
public bool SupportExpandedDirectionButtons => this.SupportButtons(SupportedButtons.ExpandedDirectionButtons);
public bool SupportAnalogRTrigger => this.SupportButtons(SupportedButtons.AnalogRTrigger);
public bool SupportAnalogLTrigger => this.SupportButtons(SupportedButtons.AnalogLTrigger);
public bool SupportAnalogHorizontalController => this.SupportButtons(SupportedButtons.AnalogHorizontalController);
public bool SupportAnalogVerticalController => this.SupportButtons(SupportedButtons.AnalogVerticalController);
public bool SupportExpandedAnalogHorizontal => this.SupportButtons(SupportedButtons.ExpandedAnalogHorizontal);
public bool SupportExpandedAnalogVertical => this.SupportButtons(SupportedButtons.ExpandedAnalogVertical);
public bool SupportArea(SupportedAreas supportedAreas)
{
SupportedAreas supportedAreas1 = SupportedAreas.None;
if (this.AreaSymbols[0] == 'J')
supportedAreas1 |= SupportedAreas.Japan;
if (this.AreaSymbols[1] == 'U')
supportedAreas1 |= SupportedAreas.Usa;
if (this.AreaSymbols[2] == 'E')
supportedAreas1 |= SupportedAreas.Europe;
return (supportedAreas1 & supportedAreas) == supportedAreas;
}
public bool SupportPeripheral(SupportedPeripherals supportedPeripherals) => ((SupportedPeripherals) InitialProgramUtils.ConvertHexStringToBytes(this.RawPeripherals.Substring(0, 1))[0] & supportedPeripherals) == supportedPeripherals;
public bool SupportExpandedPeripheral(
SupportedExpandedPeripherals supportedExpandedPeripherals)
{
return ((SupportedExpandedPeripherals) InitialProgramUtils.ConvertHexStringToBytes(this.RawPeripherals.Substring(4, 1))[0] & supportedExpandedPeripherals) == supportedExpandedPeripherals;
}
public bool SupportButtons(SupportedButtons supportedButtons) => ((SupportedButtons) BitConverter.ToUInt32(InitialProgramUtils.ConvertHexStringToBytes(this.RawPeripherals.Substring(0, 4)), 0) & supportedButtons) == supportedButtons;
public System.IO.Stream Stream => (System.IO.Stream) new MemoryStream(this.RawData, 0, this.RawData.Length, false);
public string FileName => this.SegaLicenseImage != null ? InitialProgram.IP_FILENAME : InitialProgram.IP0000_FILENAME;
}
}

View file

@ -0,0 +1,114 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramConverter
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using SEGATools.Graphics;
using System;
using System.Globalization;
using System.Text;
namespace SEGATools.Security
{
public class InitialProgramConverter
{
public static readonly int INITIAL_PROGRAM_SIZE = 32768;
private static readonly Logger.ILog logger = Logger.CreateLog();
private static readonly string HARDWARE_ID = "SEGA SEGAKATANA";
private static readonly string MAKER_ID = "SEGA ENTERPRISES";
private static readonly int OFFSET_HARDWARE_ID = 0;
private static readonly int OFFSET_MAKER_ID = 16;
private static readonly int OFFSET_CRC = 32;
private static readonly int OFFSET_DEVICE_INFORMATION = 37;
private static readonly int OFFSET_AREA_SYMBOLS = 48;
private static readonly int OFFSET_PERIPHERALS = 56;
private static readonly int OFFSET_PRODUCT_ID = 64;
private static readonly int OFFSET_PRODUCT_VERSION = 74;
private static readonly int OFFSET_RELEASE_DATE = 80;
private static readonly int OFFSET_MAIN_BINARY = 96;
private static readonly int OFFSET_COMPAGNY_NAME = 112;
private static readonly int OFFSET_SOFWARE_NAME = 128;
private static readonly int OFFSET_TOC = 256;
private static readonly int OFFSET_SEGA_LICENSE_LOGO = 9111;
private static readonly int OFFSET_SEGA_TRADEMARK_LOGO = 8812;
private static readonly int OFFSET_SEGA_CUSTOM_BRANDING_LOGO = 14368;
public static InitialProgram ToInitialProgram(byte[] buffer, int startIndex)
{
if (startIndex < 0 || buffer.Length - startIndex < InitialProgramConverter.INITIAL_PROGRAM_SIZE)
throw new ArgumentOutOfRangeException();
InitialProgram initialProgram = new InitialProgram();
initialProgram.HardwareID = InitialProgramConverter.ParseField("hardware ID", buffer, startIndex + InitialProgramConverter.OFFSET_HARDWARE_ID, 15);
if (!initialProgram.HardwareID.Equals(InitialProgramConverter.HARDWARE_ID))
throw new InitialProgramInvalidHardwareIdException();
initialProgram.MakerID = InitialProgramConverter.ParseField("maker ID", buffer, startIndex + InitialProgramConverter.OFFSET_MAKER_ID, 16);
if (!initialProgram.MakerID.Equals(InitialProgramConverter.MAKER_ID))
throw new InitialProgramInvalidMakerIdException();
initialProgram.DeviceInformation = InitialProgramConverter.ParseField("device information", buffer, startIndex + InitialProgramConverter.OFFSET_DEVICE_INFORMATION, 11);
initialProgram.AreaSymbols = InitialProgramConverter.ParseField("area symbols", buffer, startIndex + InitialProgramConverter.OFFSET_AREA_SYMBOLS, 7);
initialProgram.RawPeripherals = InitialProgramConverter.ParseField("area symbols", buffer, startIndex + InitialProgramConverter.OFFSET_PERIPHERALS, 7);
initialProgram.ProductID = InitialProgramConverter.ParseField("product ID", buffer, startIndex + InitialProgramConverter.OFFSET_PRODUCT_ID, 10);
initialProgram.ProductVersion = InitialProgramConverter.ParseField("product version", buffer, startIndex + InitialProgramConverter.OFFSET_PRODUCT_VERSION, 6);
initialProgram.CRC = InitialProgramConverter.ParseField("CRC", buffer, startIndex + InitialProgramConverter.OFFSET_CRC, 4);
initialProgram.ComputedCRC = InitialProgramUtils.ComputeCRC(initialProgram.ProductID, initialProgram.ProductVersion).ToString("X4");
string field = InitialProgramConverter.ParseField("release date", buffer, startIndex + InitialProgramConverter.OFFSET_RELEASE_DATE, 8);
try
{
initialProgram.ReleaseDate = DateTime.ParseExact(field, "yyyyMMdd", (IFormatProvider) CultureInfo.InvariantCulture, DateTimeStyles.None);
}
catch (Exception ex)
{
throw new InitialProgramReleaseDateParsingException(field, ex);
}
initialProgram.MainBinary = InitialProgramConverter.ParseField("main binary", buffer, startIndex + InitialProgramConverter.OFFSET_MAIN_BINARY, 16);
initialProgram.CompanyName = InitialProgramConverter.ParseField("company name", buffer, startIndex + InitialProgramConverter.OFFSET_COMPAGNY_NAME, 16);
initialProgram.SoftwareName = InitialProgramConverter.ParseField("software name", buffer, startIndex + InitialProgramConverter.OFFSET_SOFWARE_NAME, 128);
try
{
initialProgram.TableOfContent = InitialProgramTocConverter.ToInitialProgramToc(buffer, startIndex + InitialProgramConverter.OFFSET_TOC);
}
catch (InitialProgramTocException ex)
{
logger.Error(ex);
}
byte[] numArray = new byte[InitialProgramConverter.INITIAL_PROGRAM_SIZE];
Buffer.BlockCopy((Array) buffer, startIndex, (Array) numArray, 0, InitialProgramConverter.INITIAL_PROGRAM_SIZE);
initialProgram.RawData = numArray;
initialProgram.SegaLicenseImage = InitialProgramConverter.GetMRImage(buffer, startIndex + InitialProgramConverter.OFFSET_SEGA_LICENSE_LOGO);
initialProgram.SegaTradeMarkImage = InitialProgramConverter.GetMRImage(buffer, startIndex + InitialProgramConverter.OFFSET_SEGA_TRADEMARK_LOGO);
initialProgram.CustomBrandingImage = InitialProgramConverter.GetMRImage(buffer, startIndex + InitialProgramConverter.OFFSET_SEGA_CUSTOM_BRANDING_LOGO);
return initialProgram;
}
private static string ParseField(string fieldName, byte[] buffer, int startIndex, int lenght)
{
try
{
return Encoding.Default.GetString(buffer, startIndex, lenght);
}
catch (Exception ex)
{
throw new InitialProgramFieldParsingException(fieldName, startIndex, ex);
}
}
private static MRImage GetMRImage(byte[] buffer, int startIndex)
{
try
{
return MRImageConverter.ToMRImage(buffer, startIndex);
}
catch (MRImageIdentifierMissingException ex)
{
logger.Error(ex);
return (MRImage) null;
}
catch (MRImageDecompressionException ex)
{
InitialProgramConverter.logger.ErrorFormat("Unable to decompress MR image: {0}", (object) ex);
throw new InitialProgramInvalidMRImageException(startIndex, (Exception) ex);
}
}
}
}

View file

@ -0,0 +1,23 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
public class InitialProgramException : Exception
{
internal InitialProgramException(string message)
: base(message)
{
}
internal InitialProgramException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}

View file

@ -0,0 +1,46 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramExtended
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using SEGATools.Binary;
using System.Collections.Generic;
namespace SEGATools.Security
{
public class InitialProgramExtended : InitialProgram
{
public List<SEGALibrary> Libraries;
private InitialProgramExtended(InitialProgram ip, List<SEGALibrary> libraries)
{
this.AreaSymbols = ip.AreaSymbols;
this.CompanyName = ip.CompanyName;
this.ComputedCRC = ip.ComputedCRC;
this.CRC = ip.CRC;
this.CustomBrandingImage = ip.CustomBrandingImage;
this.DeviceInformation = ip.DeviceInformation;
this.HardwareID = ip.HardwareID;
this.MainBinary = ip.MainBinary;
this.MakerID = ip.MakerID;
this.ProductID = ip.ProductID;
this.ProductVersion = ip.ProductVersion;
this.RawData = ip.RawData;
this.RawPeripherals = ip.RawPeripherals;
this.ReleaseDate = ip.ReleaseDate;
this.SegaLicenseImage = ip.SegaLicenseImage;
this.SegaTradeMarkImage = ip.SegaTradeMarkImage;
this.SoftwareName = ip.SoftwareName;
this.TableOfContent = ip.TableOfContent;
this.Libraries = libraries;
}
public static InitialProgramExtended create(
InitialProgram ip,
List<SEGALibrary> libraries)
{
return new InitialProgramExtended(ip, libraries);
}
}
}

View file

@ -0,0 +1,21 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramFieldParsingException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
public class InitialProgramFieldParsingException : InitialProgramException
{
public InitialProgramFieldParsingException(
string fieldName,
int offset,
Exception innerException)
: base(string.Format("the field {0} at offset 0x{1:X8} is not valid", (object) fieldName, (object) offset), innerException)
{
}
}
}

View file

@ -0,0 +1,459 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramGeneralSettingsViewer
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using SEGATools.Binary;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SEGATools.Security
{
public class InitialProgramGeneralSettingsViewer : UserControl
{
private static readonly Logger.ILog logger = Logger.CreateLog();
private IContainer components;
private ToolTip toolTip;
private Label lbHardwareId;
private Label lbMakerId;
private Label lbCrc;
private Label lbReleaseDate;
private Label lbMedia;
private Label lbProductId;
private FlowLayoutPanel fplArea;
private CheckBox cbAreaJapan;
private CheckBox cbAreaUs;
private CheckBox cbAreaEurope;
private GroupBox gbSupportedAreas;
private Label lbFirstReadFilename;
private Label lbCompagnyName;
private Label lbApplicationTitle;
private TextBox tbHardwareId;
private TextBox tbMakerId;
private TextBox tbProductId;
private TextBox tbProductVersion;
private TextBox tbMedia;
private TextBox tbCrc;
private TextBox tbReleaseDate;
private TextBox tbFirstFileName;
private FlowLayoutPanel flpSegaLibrary;
private GroupBox gbSegaAIPLibrary;
private TextBox tbCompagnyName;
private TextBox tbApplicationName;
private FlowLayoutPanel flpMediaOptions;
private CheckBox cbMediaOptionsVgaSupport;
private CheckBox cbMediaOptionsUseWindowsCe;
private GroupBox gbMediaOptions;
private RadioButton rbSegaLibraryRoundZero;
private RadioButton rbSegaLibraryRoundNearest;
public InitialProgramGeneralSettingsViewer() => this.InitializeComponent();
public void LoadInitialProgram(InitialProgramExtended ip)
{
if (ip == null)
return;
this.tbApplicationName.Text = ip.SoftwareName.Trim();
this.tbHardwareId.Text = ip.HardwareID;
this.tbMakerId.Text = ip.MakerID;
this.tbFirstFileName.Text = ip.MainBinary.Trim();
this.tbCompagnyName.Text = ip.CompanyName.Trim();
this.tbProductId.Text = ip.ProductID.Trim();
this.tbProductVersion.Text = ip.ProductVersion.Trim();
this.tbReleaseDate.Text = ip.ReleaseDate.Date.ToString("yyyy/MM/dd");
this.tbMedia.Text = ip.DeviceInformation.Trim();
this.SetCRC((InitialProgram) ip);
this.SetAreaSymbols((InitialProgram) ip);
this.SetOther((InitialProgram) ip);
if (ip.Libraries == null)
return;
this.SetAIPLibrary(ip);
}
private void SetCRC(InitialProgram ip)
{
this.tbCrc.Text = ip.CRC;
this.tbCrc.ForeColor = Color.White;
if (!ip.IsCRCValid)
{
this.tbCrc.BackColor = Color.Red;
this.toolTip.SetToolTip((Control) this.tbCrc, string.Format("Incorrect CRC! Should be {0}", (object) ip.ComputedCRC));
}
else
this.tbCrc.BackColor = Color.Green;
}
private void SetAreaSymbols(InitialProgram ip)
{
this.cbAreaJapan.Checked = ip.SupportJapanArea;
this.cbAreaUs.Checked = ip.SupportUsaArea;
this.cbAreaEurope.Checked = ip.SupportEuropeArea;
}
private void SetOther(InitialProgram ip)
{
this.cbMediaOptionsVgaSupport.Checked = ip.SupportVga;
this.cbMediaOptionsUseWindowsCe.Checked = ip.UseWindowsCE;
}
private void SetAIPLibrary(InitialProgramExtended ip)
{
this.rbSegaLibraryRoundZero.Enabled = this.rbSegaLibraryRoundNearest.Enabled = false;
this.rbSegaLibraryRoundZero.Checked = this.rbSegaLibraryRoundNearest.Checked = false;
SEGALibrary segaLibrary1 = ip.Libraries.Find((Predicate<SEGALibrary>) (library => library.GetLibraryType() == SEGALibraryType.AIP));
if (segaLibrary1 == null)
return;
SEGALibrary segaLibrary2 = ip.Libraries.Find((Predicate<SEGALibrary>) (library => library.GetLibraryType() == SEGALibraryType.FLASH_MEMORY_MANAGER));
SEGALibraryVersion version = SEGALibrary.AIP_103.Version;
if (segaLibrary2 != null)
version = SEGALibrary.AIPf_105.Version;
this.rbSegaLibraryRoundZero.Enabled = this.rbSegaLibraryRoundNearest.Enabled = false;
this.rbSegaLibraryRoundZero.Checked = this.rbSegaLibraryRoundNearest.Checked = false;
if (segaLibrary1.Version.CompareTo(version) <= 0)
this.rbSegaLibraryRoundZero.Checked = true;
else
this.rbSegaLibraryRoundNearest.Checked = true;
if (!ip.UseWindowsCE)
this.rbSegaLibraryRoundZero.Enabled = this.rbSegaLibraryRoundNearest.Enabled = true;
this.gbSegaAIPLibrary.Text = "SEGA AIP Library: v" + (object) segaLibrary1.Version;
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
this.components.Dispose();
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = (IContainer) new Container();
this.toolTip = new ToolTip(this.components);
this.lbHardwareId = new Label();
this.lbMakerId = new Label();
this.lbCrc = new Label();
this.lbReleaseDate = new Label();
this.lbMedia = new Label();
this.lbProductId = new Label();
this.fplArea = new FlowLayoutPanel();
this.cbAreaJapan = new CheckBox();
this.cbAreaUs = new CheckBox();
this.cbAreaEurope = new CheckBox();
this.gbSupportedAreas = new GroupBox();
this.lbFirstReadFilename = new Label();
this.lbCompagnyName = new Label();
this.lbApplicationTitle = new Label();
this.tbHardwareId = new TextBox();
this.tbMakerId = new TextBox();
this.tbProductId = new TextBox();
this.tbProductVersion = new TextBox();
this.tbMedia = new TextBox();
this.tbCrc = new TextBox();
this.tbReleaseDate = new TextBox();
this.tbFirstFileName = new TextBox();
this.flpSegaLibrary = new FlowLayoutPanel();
this.rbSegaLibraryRoundZero = new RadioButton();
this.rbSegaLibraryRoundNearest = new RadioButton();
this.gbSegaAIPLibrary = new GroupBox();
this.tbCompagnyName = new TextBox();
this.tbApplicationName = new TextBox();
this.flpMediaOptions = new FlowLayoutPanel();
this.cbMediaOptionsVgaSupport = new CheckBox();
this.cbMediaOptionsUseWindowsCe = new CheckBox();
this.gbMediaOptions = new GroupBox();
this.fplArea.SuspendLayout();
this.gbSupportedAreas.SuspendLayout();
this.flpSegaLibrary.SuspendLayout();
this.gbSegaAIPLibrary.SuspendLayout();
this.flpMediaOptions.SuspendLayout();
this.gbMediaOptions.SuspendLayout();
this.SuspendLayout();
this.lbHardwareId.AutoSize = true;
this.lbHardwareId.Location = new Point(3, 55);
this.lbHardwareId.Name = "lbHardwareId";
this.lbHardwareId.Size = new Size(70, 13);
this.lbHardwareId.TabIndex = 0;
this.lbHardwareId.Text = "Hardware ID:";
this.lbMakerId.AutoSize = true;
this.lbMakerId.Location = new Point(3, 94);
this.lbMakerId.Name = "lbMakerId";
this.lbMakerId.Size = new Size(54, 13);
this.lbMakerId.TabIndex = 0;
this.lbMakerId.Text = "Maker ID:";
this.lbCrc.AutoSize = true;
this.lbCrc.Location = new Point(340, 152);
this.lbCrc.Name = "lbCrc";
this.lbCrc.Size = new Size(32, 13);
this.lbCrc.TabIndex = 0;
this.lbCrc.Text = "CRC:";
this.lbReleaseDate.AutoSize = true;
this.lbReleaseDate.Location = new Point(155, 133);
this.lbReleaseDate.Name = "lbReleaseDate";
this.lbReleaseDate.Size = new Size(73, 13);
this.lbReleaseDate.TabIndex = 0;
this.lbReleaseDate.Text = "Release date:";
this.lbMedia.AutoSize = true;
this.lbMedia.Location = new Point(245, 133);
this.lbMedia.Name = "lbMedia";
this.lbMedia.Size = new Size(39, 13);
this.lbMedia.TabIndex = 0;
this.lbMedia.Text = "Media:";
this.lbProductId.AutoSize = true;
this.lbProductId.Location = new Point(155, 94);
this.lbProductId.Name = "lbProductId";
this.lbProductId.Size = new Size(61, 13);
this.lbProductId.TabIndex = 0;
this.lbProductId.Text = "Product ID:";
this.fplArea.AutoSize = true;
this.fplArea.Controls.Add((Control) this.cbAreaJapan);
this.fplArea.Controls.Add((Control) this.cbAreaUs);
this.fplArea.Controls.Add((Control) this.cbAreaEurope);
this.fplArea.Dock = DockStyle.Fill;
this.fplArea.FlowDirection = FlowDirection.TopDown;
this.fplArea.Location = new Point(3, 16);
this.fplArea.Name = "fplArea";
this.fplArea.Size = new Size(112, 69);
this.fplArea.TabIndex = 0;
this.cbAreaJapan.AutoCheck = false;
this.cbAreaJapan.AutoSize = true;
this.cbAreaJapan.Location = new Point(3, 3);
this.cbAreaJapan.Name = "cbAreaJapan";
this.cbAreaJapan.Size = new Size(55, 17);
this.cbAreaJapan.TabIndex = 11;
this.cbAreaJapan.Text = "Japan";
this.cbAreaJapan.UseVisualStyleBackColor = true;
this.cbAreaUs.AutoCheck = false;
this.cbAreaUs.AutoSize = true;
this.cbAreaUs.Location = new Point(3, 26);
this.cbAreaUs.Name = "cbAreaUs";
this.cbAreaUs.Size = new Size(48, 17);
this.cbAreaUs.TabIndex = 12;
this.cbAreaUs.Text = "USA";
this.cbAreaUs.UseVisualStyleBackColor = true;
this.cbAreaEurope.AutoCheck = false;
this.cbAreaEurope.AutoSize = true;
this.cbAreaEurope.Location = new Point(3, 49);
this.cbAreaEurope.Name = "cbAreaEurope";
this.cbAreaEurope.Size = new Size(60, 17);
this.cbAreaEurope.TabIndex = 13;
this.cbAreaEurope.Text = "Europe";
this.cbAreaEurope.UseVisualStyleBackColor = true;
this.gbSupportedAreas.AutoSize = true;
this.gbSupportedAreas.Controls.Add((Control) this.fplArea);
this.gbSupportedAreas.Location = new Point(336, 58);
this.gbSupportedAreas.Name = "gbSupportedAreas";
this.gbSupportedAreas.Size = new Size(118, 88);
this.gbSupportedAreas.TabIndex = 0;
this.gbSupportedAreas.TabStop = false;
this.gbSupportedAreas.Text = "Supported area(s):";
this.lbFirstReadFilename.AutoSize = true;
this.lbFirstReadFilename.Location = new Point(3, 133);
this.lbFirstReadFilename.Name = "lbFirstReadFilename";
this.lbFirstReadFilename.Size = new Size(95, 13);
this.lbFirstReadFilename.TabIndex = 0;
this.lbFirstReadFilename.Text = "First read filename:";
this.lbCompagnyName.AutoSize = true;
this.lbCompagnyName.Location = new Point(155, 55);
this.lbCompagnyName.Name = "lbCompagnyName";
this.lbCompagnyName.Size = new Size(89, 13);
this.lbCompagnyName.TabIndex = 0;
this.lbCompagnyName.Text = "Compagny name:";
this.lbApplicationTitle.AutoSize = true;
this.lbApplicationTitle.Location = new Point(3, 0);
this.lbApplicationTitle.Name = "lbApplicationTitle";
this.lbApplicationTitle.Size = new Size(81, 13);
this.lbApplicationTitle.TabIndex = 0;
this.lbApplicationTitle.Text = "Application title:";
this.tbHardwareId.BackColor = Color.White;
this.tbHardwareId.Location = new Point(6, 71);
this.tbHardwareId.MaxLength = 15;
this.tbHardwareId.Name = "tbHardwareId";
this.tbHardwareId.ReadOnly = true;
this.tbHardwareId.Size = new Size(143, 20);
this.tbHardwareId.TabIndex = 2;
this.tbHardwareId.Text = "SEGA SEGAKATANA";
this.tbHardwareId.TextAlign = HorizontalAlignment.Center;
this.tbMakerId.BackColor = Color.White;
this.tbMakerId.Location = new Point(6, 110);
this.tbMakerId.Name = "tbMakerId";
this.tbMakerId.ReadOnly = true;
this.tbMakerId.Size = new Size(143, 20);
this.tbMakerId.TabIndex = 4;
this.tbMakerId.Text = "SEGA ENTERPRISES";
this.tbMakerId.TextAlign = HorizontalAlignment.Center;
this.tbProductId.BackColor = Color.White;
this.tbProductId.Location = new Point(158, 110);
this.tbProductId.Name = "tbProductId";
this.tbProductId.ReadOnly = true;
this.tbProductId.Size = new Size(81, 20);
this.tbProductId.TabIndex = 5;
this.tbProductId.TextAlign = HorizontalAlignment.Center;
this.tbProductVersion.BackColor = Color.White;
this.tbProductVersion.Location = new Point(248, 110);
this.tbProductVersion.Name = "tbProductVersion";
this.tbProductVersion.ReadOnly = true;
this.tbProductVersion.Size = new Size(81, 20);
this.tbProductVersion.TabIndex = 6;
this.tbProductVersion.TextAlign = HorizontalAlignment.Center;
this.tbMedia.BackColor = Color.White;
this.tbMedia.Location = new Point(248, 149);
this.tbMedia.Name = "tbMedia";
this.tbMedia.ReadOnly = true;
this.tbMedia.Size = new Size(81, 20);
this.tbMedia.TabIndex = 9;
this.tbMedia.TextAlign = HorizontalAlignment.Center;
this.tbCrc.BackColor = Color.White;
this.tbCrc.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, (byte) 0);
this.tbCrc.ForeColor = Color.White;
this.tbCrc.Location = new Point(378, 149);
this.tbCrc.Name = "tbCrc";
this.tbCrc.ReadOnly = true;
this.tbCrc.Size = new Size(76, 20);
this.tbCrc.TabIndex = 10;
this.tbCrc.Text = "FFFF";
this.tbCrc.TextAlign = HorizontalAlignment.Center;
this.tbReleaseDate.BackColor = Color.White;
this.tbReleaseDate.Location = new Point(158, 149);
this.tbReleaseDate.Name = "tbReleaseDate";
this.tbReleaseDate.ReadOnly = true;
this.tbReleaseDate.Size = new Size(81, 20);
this.tbReleaseDate.TabIndex = 8;
this.tbReleaseDate.TextAlign = HorizontalAlignment.Center;
this.tbFirstFileName.BackColor = Color.White;
this.tbFirstFileName.Location = new Point(6, 149);
this.tbFirstFileName.Name = "tbFirstFileName";
this.tbFirstFileName.ReadOnly = true;
this.tbFirstFileName.Size = new Size(143, 20);
this.tbFirstFileName.TabIndex = 7;
this.tbFirstFileName.TextAlign = HorizontalAlignment.Center;
this.flpSegaLibrary.AutoSize = true;
this.flpSegaLibrary.Controls.Add((Control) this.rbSegaLibraryRoundZero);
this.flpSegaLibrary.Controls.Add((Control) this.rbSegaLibraryRoundNearest);
this.flpSegaLibrary.Dock = DockStyle.Fill;
this.flpSegaLibrary.FlowDirection = FlowDirection.TopDown;
this.flpSegaLibrary.Location = new Point(3, 16);
this.flpSegaLibrary.Name = "flpSegaLibrary";
this.flpSegaLibrary.Size = new Size(227, 46);
this.flpSegaLibrary.TabIndex = 0;
this.rbSegaLibraryRoundZero.AutoCheck = false;
this.rbSegaLibraryRoundZero.AutoSize = true;
this.rbSegaLibraryRoundZero.Location = new Point(3, 3);
this.rbSegaLibraryRoundZero.Name = "rbSegaLibraryRoundZero";
this.rbSegaLibraryRoundZero.Size = new Size(152, 17);
this.rbSegaLibraryRoundZero.TabIndex = 23;
this.rbSegaLibraryRoundZero.TabStop = true;
this.rbSegaLibraryRoundZero.Text = "Floating Point: Round Zero";
this.rbSegaLibraryRoundZero.UseVisualStyleBackColor = true;
this.rbSegaLibraryRoundNearest.AutoCheck = false;
this.rbSegaLibraryRoundNearest.AutoSize = true;
this.rbSegaLibraryRoundNearest.Location = new Point(3, 26);
this.rbSegaLibraryRoundNearest.Name = "rbSegaLibraryRoundNearest";
this.rbSegaLibraryRoundNearest.Size = new Size(167, 17);
this.rbSegaLibraryRoundNearest.TabIndex = 24;
this.rbSegaLibraryRoundNearest.TabStop = true;
this.rbSegaLibraryRoundNearest.Text = "Floating Point: Round Nearest";
this.rbSegaLibraryRoundNearest.UseVisualStyleBackColor = true;
this.gbSegaAIPLibrary.AutoSize = true;
this.gbSegaAIPLibrary.Controls.Add((Control) this.flpSegaLibrary);
this.gbSegaAIPLibrary.Location = new Point(6, 175);
this.gbSegaAIPLibrary.Name = "gbSegaAIPLibrary";
this.gbSegaAIPLibrary.Size = new Size(233, 65);
this.gbSegaAIPLibrary.TabIndex = 0;
this.gbSegaAIPLibrary.TabStop = false;
this.gbSegaAIPLibrary.Text = "SEGA AIP Library:";
this.tbCompagnyName.BackColor = Color.White;
this.tbCompagnyName.Location = new Point(158, 71);
this.tbCompagnyName.Name = "tbCompagnyName";
this.tbCompagnyName.ReadOnly = true;
this.tbCompagnyName.Size = new Size(171, 20);
this.tbCompagnyName.TabIndex = 3;
this.tbCompagnyName.TextAlign = HorizontalAlignment.Center;
this.tbApplicationName.BackColor = Color.White;
this.tbApplicationName.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, (byte) 0);
this.tbApplicationName.Location = new Point(6, 16);
this.tbApplicationName.Multiline = true;
this.tbApplicationName.Name = "tbApplicationName";
this.tbApplicationName.ReadOnly = true;
this.tbApplicationName.Size = new Size(448, 36);
this.tbApplicationName.TabIndex = 1;
this.tbApplicationName.Text = "THIS IS A SAMPLE DISK FOR USE INTHE OFFICE ONLY / DO NOT SELL / DO NOT CARRY OUT FROM THE OFFICE";
this.tbApplicationName.TextAlign = HorizontalAlignment.Center;
this.flpMediaOptions.AutoSize = true;
this.flpMediaOptions.Controls.Add((Control) this.cbMediaOptionsVgaSupport);
this.flpMediaOptions.Controls.Add((Control) this.cbMediaOptionsUseWindowsCe);
this.flpMediaOptions.Dock = DockStyle.Fill;
this.flpMediaOptions.FlowDirection = FlowDirection.TopDown;
this.flpMediaOptions.Location = new Point(3, 16);
this.flpMediaOptions.Name = "flpMediaOptions";
this.flpMediaOptions.Size = new Size(200, 46);
this.flpMediaOptions.TabIndex = 22;
this.cbMediaOptionsVgaSupport.AutoCheck = false;
this.cbMediaOptionsVgaSupport.AutoSize = true;
this.cbMediaOptionsVgaSupport.Location = new Point(3, 3);
this.cbMediaOptionsVgaSupport.Name = "cbMediaOptionsVgaSupport";
this.cbMediaOptionsVgaSupport.Size = new Size(118, 17);
this.cbMediaOptionsVgaSupport.TabIndex = 16;
this.cbMediaOptionsVgaSupport.Text = "VGA box supported";
this.cbMediaOptionsVgaSupport.UseVisualStyleBackColor = true;
this.cbMediaOptionsUseWindowsCe.AutoCheck = false;
this.cbMediaOptionsUseWindowsCe.AutoSize = true;
this.cbMediaOptionsUseWindowsCe.Location = new Point(3, 26);
this.cbMediaOptionsUseWindowsCe.Name = "cbMediaOptionsUseWindowsCe";
this.cbMediaOptionsUseWindowsCe.Size = new Size(106, 17);
this.cbMediaOptionsUseWindowsCe.TabIndex = 17;
this.cbMediaOptionsUseWindowsCe.Text = "Use WindowsCE";
this.cbMediaOptionsUseWindowsCe.UseVisualStyleBackColor = true;
this.gbMediaOptions.AutoSize = true;
this.gbMediaOptions.Controls.Add((Control) this.flpMediaOptions);
this.gbMediaOptions.Location = new Point(248, 175);
this.gbMediaOptions.Name = "gbMediaOptions";
this.gbMediaOptions.Size = new Size(206, 65);
this.gbMediaOptions.TabIndex = 0;
this.gbMediaOptions.TabStop = false;
this.gbMediaOptions.Text = "Other:";
this.AutoScaleDimensions = new SizeF(6f, 13f);
this.AutoScaleMode = AutoScaleMode.Font;
this.Controls.Add((Control) this.gbMediaOptions);
this.Controls.Add((Control) this.gbSegaAIPLibrary);
this.Controls.Add((Control) this.tbApplicationName);
this.Controls.Add((Control) this.tbCompagnyName);
this.Controls.Add((Control) this.tbFirstFileName);
this.Controls.Add((Control) this.tbReleaseDate);
this.Controls.Add((Control) this.tbCrc);
this.Controls.Add((Control) this.tbMedia);
this.Controls.Add((Control) this.tbProductVersion);
this.Controls.Add((Control) this.tbProductId);
this.Controls.Add((Control) this.tbMakerId);
this.Controls.Add((Control) this.tbHardwareId);
this.Controls.Add((Control) this.lbApplicationTitle);
this.Controls.Add((Control) this.lbCompagnyName);
this.Controls.Add((Control) this.lbFirstReadFilename);
this.Controls.Add((Control) this.gbSupportedAreas);
this.Controls.Add((Control) this.lbProductId);
this.Controls.Add((Control) this.lbMedia);
this.Controls.Add((Control) this.lbReleaseDate);
this.Controls.Add((Control) this.lbCrc);
this.Controls.Add((Control) this.lbMakerId);
this.Controls.Add((Control) this.lbHardwareId);
this.Name = nameof (InitialProgramGeneralSettingsViewer);
this.Size = new Size(460, 246);
this.fplArea.ResumeLayout(false);
this.fplArea.PerformLayout();
this.gbSupportedAreas.ResumeLayout(false);
this.gbSupportedAreas.PerformLayout();
this.flpSegaLibrary.ResumeLayout(false);
this.flpSegaLibrary.PerformLayout();
this.gbSegaAIPLibrary.ResumeLayout(false);
this.gbSegaAIPLibrary.PerformLayout();
this.flpMediaOptions.ResumeLayout(false);
this.flpMediaOptions.PerformLayout();
this.gbMediaOptions.ResumeLayout(false);
this.gbMediaOptions.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,123 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramImagesViewer
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using SEGATools.Graphics;
using SEGATools.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SEGATools.Security
{
public class InitialProgramImagesViewer : UserControl
{
private List<InitialProgramImagesViewer.MRImageItem> mrImageItems = new List<InitialProgramImagesViewer.MRImageItem>();
private IContainer components;
private ComboBox cbMRImages;
private Label lbMRImage;
private MRImageViewer mrImageViewer;
public InitialProgramImagesViewer()
{
this.InitializeComponent();
this.cbMRImages.SelectionChangeCommitted += new EventHandler(this.cbMRImages_SelectionChangeCommitted);
}
public void LoadInitialProgram(InitialProgramExtended ip, string basePath)
{
this.mrImageViewer.BasePath = basePath;
this.cbMRImages.Enabled = false;
this.mrImageItems.Clear();
this.addMRImage(ip.SegaLicenseImage, Resources.MRIpImageSegaLicense);
this.addMRImage(ip.CustomBrandingImage, Resources.MRIpImageSegaCustomBranding);
this.addMRImage(ip.SegaTradeMarkImage, Resources.MRIpImageSegaTM);
this.cbMRImages.DataSource = (object) this.mrImageItems;
this.cbMRImages.DisplayMember = InitialProgramImagesViewer.MRImageItem.DisplayMember;
this.cbMRImages.ValueMember = InitialProgramImagesViewer.MRImageItem.ValueMember;
if (this.mrImageItems.Count <= 0)
return;
this.cbMRImages.Enabled = true;
this.cbMRImages.SelectedIndex = 0;
this.mrImageViewer.LoadMRImage(this.mrImageItems[0].Image, this.mrImageItems[0].Name);
}
private void addMRImage(MRImage mrImage, string displayName)
{
if (mrImage == null)
return;
this.mrImageItems.Add(new InitialProgramImagesViewer.MRImageItem(displayName, mrImage));
}
private void cbMRImages_SelectionChangeCommitted(object sender, EventArgs e)
{
if (this.cbMRImages.SelectedItem == null)
return;
InitialProgramImagesViewer.MRImageItem selectedItem = (InitialProgramImagesViewer.MRImageItem) this.cbMRImages.SelectedItem;
this.mrImageViewer.LoadMRImage(selectedItem.Image, selectedItem.Name);
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
this.components.Dispose();
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.cbMRImages = new ComboBox();
this.lbMRImage = new Label();
this.mrImageViewer = new MRImageViewer();
this.SuspendLayout();
this.cbMRImages.DropDownStyle = ComboBoxStyle.DropDownList;
this.cbMRImages.FlatStyle = FlatStyle.Popup;
this.cbMRImages.FormattingEnabled = true;
this.cbMRImages.Location = new Point(76, 9);
this.cbMRImages.Name = "cbMRImages";
this.cbMRImages.Size = new Size(380, 21);
this.cbMRImages.TabIndex = 0;
this.lbMRImage.AutoSize = true;
this.lbMRImage.Location = new Point(11, 12);
this.lbMRImage.Name = "lbMRImage";
this.lbMRImage.Size = new Size(59, 13);
this.lbMRImage.TabIndex = 0;
this.lbMRImage.Text = "MR Image:";
this.mrImageViewer.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
this.mrImageViewer.Location = new Point(2, 35);
this.mrImageViewer.Name = "mrImageViewer";
this.mrImageViewer.Size = new Size(460, 205);
this.mrImageViewer.TabIndex = 0;
this.AutoScaleDimensions = new SizeF(6f, 13f);
this.AutoScaleMode = AutoScaleMode.Font;
this.Controls.Add((Control) this.cbMRImages);
this.Controls.Add((Control) this.lbMRImage);
this.Controls.Add((Control) this.mrImageViewer);
this.Name = "MRInitialProgramImagesViewer";
this.Size = new Size(463, 240);
this.ResumeLayout(false);
this.PerformLayout();
}
internal sealed class MRImageItem
{
public static string DisplayMember => "Name";
public static string ValueMember => "Image";
public string Name { get; set; }
public MRImage Image { get; set; }
public MRImageItem(string name, MRImage image)
{
this.Name = name;
this.Image = image;
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramInvalidHardwareIdException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
namespace SEGATools.Security
{
public class InitialProgramInvalidHardwareIdException : InitialProgramException
{
public InitialProgramInvalidHardwareIdException()
: base("invalid hardware ID")
{
}
}
}

View file

@ -0,0 +1,18 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramInvalidMRImageException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
public class InitialProgramInvalidMRImageException : InitialProgramException
{
public InitialProgramInvalidMRImageException(int offset, Exception innerException)
: base(string.Format("data at offset 0x{0:X8} is not a valid MR image", (object) offset), innerException)
{
}
}
}

View file

@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramInvalidMakerIdException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
namespace SEGATools.Security
{
public class InitialProgramInvalidMakerIdException : InitialProgramException
{
public InitialProgramInvalidMakerIdException()
: base("invalid maker ID")
{
}
}
}

View file

@ -0,0 +1,144 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramLibraryReferences
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using SEGATools.Binary;
using SEGATools.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace SEGATools.Security
{
public class InitialProgramLibraryReferences : UserControl
{
private IContainer components;
private TableLayoutPanel tableLayoutPanel;
private Label lbLibraryHint;
private ListView listViewLibRef;
public InitialProgramLibraryReferences()
{
this.InitializeComponent();
this.InitializeHintText(0);
this.InitializeListViewColumns();
}
public void LoadInitialProgram(InitialProgramExtended ip)
{
if (ip == null)
return;
this.LoadLibraryReferences(ip);
}
private void InitializeHintText(int NumberOfLibraries)
{
string str;
switch (NumberOfLibraries)
{
case 0:
str = Resources.LibRefNoLibFound;
break;
case 1:
str = Resources.LibRefNumberSingle;
break;
default:
str = string.Format(Resources.LibRefNumberPlurial, (object) NumberOfLibraries);
break;
}
this.lbLibraryHint.Text = string.Format(Resources.LibRefHint, (object) str);
}
private void InitializeListViewColumns()
{
this.listViewLibRef.Columns.Add(InitialProgramLibraryReferences.createColumn(Resources.LibRefColumnName, HorizontalAlignment.Left));
this.listViewLibRef.Columns.Add(InitialProgramLibraryReferences.createColumn(Resources.LibRefColumnVersion, HorizontalAlignment.Right));
this.listViewLibRef.Columns.Add(InitialProgramLibraryReferences.createColumn(Resources.LibRefColumnBuildDate, HorizontalAlignment.Right));
this.ResizeListViewColumns();
}
private void LoadLibraryReferences(InitialProgramExtended ip)
{
foreach (SEGALibrary segaLibrary in (IEnumerable<SEGALibrary>) ip.Libraries.OrderBy<SEGALibrary, string>((Func<SEGALibrary, string>) (lib => lib.Name)))
this.listViewLibRef.Items.Add(new ListViewItem(new string[3]
{
segaLibrary.Name,
segaLibrary.Version.ToString(),
segaLibrary.BuildDate.ToString()
}));
this.InitializeHintText(ip.Libraries.Count);
this.ResizeListViewColumns();
}
private void ResizeListViewColumns() => this.listViewLibRef.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
private static ColumnHeader createColumn(string Name, HorizontalAlignment alignment) => new ColumnHeader()
{
Text = Name,
TextAlign = alignment
};
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
this.components.Dispose();
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.tableLayoutPanel = new TableLayoutPanel();
this.lbLibraryHint = new Label();
this.listViewLibRef = new ListView();
this.tableLayoutPanel.SuspendLayout();
this.SuspendLayout();
this.tableLayoutPanel.BackColor = Color.Transparent;
this.tableLayoutPanel.ColumnCount = 1;
this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
this.tableLayoutPanel.Controls.Add((Control) this.lbLibraryHint, 0, 0);
this.tableLayoutPanel.Controls.Add((Control) this.listViewLibRef, 0, 1);
this.tableLayoutPanel.Dock = DockStyle.Fill;
this.tableLayoutPanel.Location = new Point(0, 0);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 2;
this.tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 24f));
this.tableLayoutPanel.RowStyles.Add(new RowStyle());
this.tableLayoutPanel.Size = new Size(428, 150);
this.tableLayoutPanel.TabIndex = 0;
this.lbLibraryHint.BackColor = Color.Transparent;
this.lbLibraryHint.Dock = DockStyle.Fill;
this.lbLibraryHint.Location = new Point(3, 0);
this.lbLibraryHint.Name = "lbLibraryHint";
this.lbLibraryHint.Size = new Size(422, 24);
this.lbLibraryHint.TabIndex = 0;
this.lbLibraryHint.Text = "...";
this.lbLibraryHint.TextAlign = ContentAlignment.MiddleLeft;
this.listViewLibRef.BackColor = SystemColors.Window;
this.listViewLibRef.Dock = DockStyle.Fill;
this.listViewLibRef.FullRowSelect = true;
this.listViewLibRef.HeaderStyle = ColumnHeaderStyle.Nonclickable;
this.listViewLibRef.Location = new Point(0, 24);
this.listViewLibRef.Margin = new Padding(0);
this.listViewLibRef.MultiSelect = false;
this.listViewLibRef.Name = "listViewLibRef";
this.listViewLibRef.ShowGroups = false;
this.listViewLibRef.Size = new Size(428, 126);
this.listViewLibRef.TabIndex = 1;
this.listViewLibRef.UseCompatibleStateImageBehavior = false;
this.listViewLibRef.View = View.Details;
this.AutoScaleDimensions = new SizeF(6f, 13f);
this.AutoScaleMode = AutoScaleMode.Font;
this.BackColor = SystemColors.Control;
this.Controls.Add((Control) this.tableLayoutPanel);
this.Name = nameof (InitialProgramLibraryReferences);
this.Size = new Size(428, 150);
this.tableLayoutPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,373 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramPeripheralsViewer
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SEGATools.Security
{
public class InitialProgramPeripheralsViewer : UserControl
{
private IContainer components;
private GroupBox gbSupportedPeripherals;
private FlowLayoutPanel fplSupportedPeripherals;
private CheckBox cbMouse;
private CheckBox cbKeyboard;
private CheckBox cbGunController;
private GroupBox gbSupportedExpandedPeripherals;
private FlowLayoutPanel flpSupportedExpandedPeripherals;
private CheckBox cbMemoryCard;
private CheckBox cbVibrator;
private CheckBox cbSoundInputPeripheral;
private CheckBox cbOtherDevices;
private GroupBox gbMinimalSet;
private FlowLayoutPanel flpMinimalSet;
private CheckBox cbStartABDirButtons;
private CheckBox cbCButton;
private CheckBox cbDButton;
private CheckBox cbXButton;
private CheckBox cbYButton;
private CheckBox cbZButton;
private CheckBox cbAnalogLTrigger;
private CheckBox cbAnalogRTrigger;
private CheckBox cbStandardAnalogX;
private CheckBox cbStandardAnalogY;
private CheckBox cbExpandedDirectionButtons;
private CheckBox cbExpandedAnalogX;
private CheckBox cbExpandedAnalogY;
public InitialProgramPeripheralsViewer() => this.InitializeComponent();
public void LoadInitialProgram(InitialProgramExtended ip)
{
if (ip == null)
return;
this.SetSupportedPeripherals((InitialProgram) ip);
this.SetSupportedExpandedPeripherals((InitialProgram) ip);
this.SetSupportedButtons((InitialProgram) ip);
}
private void SetSupportedPeripherals(InitialProgram ip)
{
this.cbGunController.Checked = ip.SupportGun;
this.cbKeyboard.Checked = ip.SupportKeyboard;
this.cbMouse.Checked = ip.SupportMouse;
}
private void SetSupportedExpandedPeripherals(InitialProgram ip)
{
this.cbMemoryCard.Checked = ip.SupportMemoryCard;
this.cbVibrator.Checked = ip.SupportVibrator;
this.cbSoundInputPeripheral.Checked = ip.SupportSoundInputPeripheral;
this.cbOtherDevices.Checked = ip.SupportOtherDevices;
}
private void SetSupportedButtons(InitialProgram ip)
{
this.cbStartABDirButtons.Checked = ip.SupportStartABDirections;
this.cbCButton.Checked = ip.SupportCButton;
this.cbDButton.Checked = ip.SupportDButton;
this.cbXButton.Checked = ip.SupportXButton;
this.cbYButton.Checked = ip.SupportYButton;
this.cbZButton.Checked = ip.SupportZButton;
this.cbExpandedDirectionButtons.Checked = ip.SupportExpandedDirectionButtons;
this.cbAnalogLTrigger.Checked = ip.SupportAnalogLTrigger;
this.cbAnalogRTrigger.Checked = ip.SupportAnalogRTrigger;
this.cbStandardAnalogX.Checked = ip.SupportAnalogHorizontalController;
this.cbStandardAnalogY.Checked = ip.SupportAnalogVerticalController;
this.cbExpandedAnalogX.Checked = ip.SupportExpandedAnalogHorizontal;
this.cbExpandedAnalogY.Checked = ip.SupportExpandedAnalogVertical;
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
this.components.Dispose();
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.gbSupportedPeripherals = new GroupBox();
this.fplSupportedPeripherals = new FlowLayoutPanel();
this.cbMouse = new CheckBox();
this.cbKeyboard = new CheckBox();
this.cbGunController = new CheckBox();
this.gbSupportedExpandedPeripherals = new GroupBox();
this.flpSupportedExpandedPeripherals = new FlowLayoutPanel();
this.cbMemoryCard = new CheckBox();
this.cbVibrator = new CheckBox();
this.cbSoundInputPeripheral = new CheckBox();
this.cbOtherDevices = new CheckBox();
this.gbMinimalSet = new GroupBox();
this.flpMinimalSet = new FlowLayoutPanel();
this.cbStartABDirButtons = new CheckBox();
this.cbCButton = new CheckBox();
this.cbDButton = new CheckBox();
this.cbXButton = new CheckBox();
this.cbYButton = new CheckBox();
this.cbZButton = new CheckBox();
this.cbAnalogLTrigger = new CheckBox();
this.cbAnalogRTrigger = new CheckBox();
this.cbStandardAnalogX = new CheckBox();
this.cbStandardAnalogY = new CheckBox();
this.cbExpandedDirectionButtons = new CheckBox();
this.cbExpandedAnalogX = new CheckBox();
this.cbExpandedAnalogY = new CheckBox();
this.gbSupportedPeripherals.SuspendLayout();
this.fplSupportedPeripherals.SuspendLayout();
this.gbSupportedExpandedPeripherals.SuspendLayout();
this.flpSupportedExpandedPeripherals.SuspendLayout();
this.gbMinimalSet.SuspendLayout();
this.flpMinimalSet.SuspendLayout();
this.SuspendLayout();
this.gbSupportedPeripherals.Controls.Add((Control) this.fplSupportedPeripherals);
this.gbSupportedPeripherals.Location = new Point(6, 148);
this.gbSupportedPeripherals.Name = "gbSupportedPeripherals";
this.gbSupportedPeripherals.Size = new Size(147, 91);
this.gbSupportedPeripherals.TabIndex = 0;
this.gbSupportedPeripherals.TabStop = false;
this.gbSupportedPeripherals.Text = "Supported peripherals:";
this.fplSupportedPeripherals.AutoSize = true;
this.fplSupportedPeripherals.Controls.Add((Control) this.cbMouse);
this.fplSupportedPeripherals.Controls.Add((Control) this.cbKeyboard);
this.fplSupportedPeripherals.Controls.Add((Control) this.cbGunController);
this.fplSupportedPeripherals.Dock = DockStyle.Fill;
this.fplSupportedPeripherals.FlowDirection = FlowDirection.TopDown;
this.fplSupportedPeripherals.Location = new Point(3, 16);
this.fplSupportedPeripherals.Name = "fplSupportedPeripherals";
this.fplSupportedPeripherals.Size = new Size(141, 72);
this.fplSupportedPeripherals.TabIndex = 0;
this.cbMouse.AutoCheck = false;
this.cbMouse.AutoSize = true;
this.cbMouse.Location = new Point(3, 3);
this.cbMouse.Name = "cbMouse";
this.cbMouse.Size = new Size(58, 17);
this.cbMouse.TabIndex = 14;
this.cbMouse.Text = "Mouse";
this.cbMouse.UseVisualStyleBackColor = true;
this.cbKeyboard.AutoCheck = false;
this.cbKeyboard.AutoSize = true;
this.cbKeyboard.Location = new Point(3, 26);
this.cbKeyboard.Name = "cbKeyboard";
this.cbKeyboard.Size = new Size(71, 17);
this.cbKeyboard.TabIndex = 15;
this.cbKeyboard.Text = "Keyboard";
this.cbKeyboard.UseVisualStyleBackColor = true;
this.cbGunController.AutoCheck = false;
this.cbGunController.AutoSize = true;
this.cbGunController.Location = new Point(3, 49);
this.cbGunController.Name = "cbGunController";
this.cbGunController.Size = new Size(93, 17);
this.cbGunController.TabIndex = 16;
this.cbGunController.Text = "Gun Controller";
this.cbGunController.UseVisualStyleBackColor = true;
this.gbSupportedExpandedPeripherals.Controls.Add((Control) this.flpSupportedExpandedPeripherals);
this.gbSupportedExpandedPeripherals.Location = new Point(163, 148);
this.gbSupportedExpandedPeripherals.Name = "gbSupportedExpandedPeripherals";
this.gbSupportedExpandedPeripherals.Size = new Size(292, 91);
this.gbSupportedExpandedPeripherals.TabIndex = 0;
this.gbSupportedExpandedPeripherals.TabStop = false;
this.gbSupportedExpandedPeripherals.Text = "Supported Expanded Peripherals:";
this.flpSupportedExpandedPeripherals.Controls.Add((Control) this.cbMemoryCard);
this.flpSupportedExpandedPeripherals.Controls.Add((Control) this.cbVibrator);
this.flpSupportedExpandedPeripherals.Controls.Add((Control) this.cbSoundInputPeripheral);
this.flpSupportedExpandedPeripherals.Controls.Add((Control) this.cbOtherDevices);
this.flpSupportedExpandedPeripherals.Dock = DockStyle.Fill;
this.flpSupportedExpandedPeripherals.FlowDirection = FlowDirection.TopDown;
this.flpSupportedExpandedPeripherals.Location = new Point(3, 16);
this.flpSupportedExpandedPeripherals.Name = "flpSupportedExpandedPeripherals";
this.flpSupportedExpandedPeripherals.Size = new Size(286, 72);
this.flpSupportedExpandedPeripherals.TabIndex = 0;
this.cbMemoryCard.AutoCheck = false;
this.cbMemoryCard.AutoSize = true;
this.cbMemoryCard.Location = new Point(3, 3);
this.cbMemoryCard.Name = "cbMemoryCard";
this.cbMemoryCard.Size = new Size(88, 17);
this.cbMemoryCard.TabIndex = 17;
this.cbMemoryCard.Text = "Memory Card";
this.cbMemoryCard.UseVisualStyleBackColor = true;
this.cbVibrator.AutoCheck = false;
this.cbVibrator.AutoSize = true;
this.cbVibrator.Location = new Point(3, 26);
this.cbVibrator.Name = "cbVibrator";
this.cbVibrator.Size = new Size(62, 17);
this.cbVibrator.TabIndex = 18;
this.cbVibrator.Text = "Vibrator";
this.cbVibrator.UseVisualStyleBackColor = true;
this.cbSoundInputPeripheral.AutoCheck = false;
this.cbSoundInputPeripheral.AutoSize = true;
this.cbSoundInputPeripheral.Location = new Point(3, 49);
this.cbSoundInputPeripheral.Name = "cbSoundInputPeripheral";
this.cbSoundInputPeripheral.Size = new Size(134, 17);
this.cbSoundInputPeripheral.TabIndex = 19;
this.cbSoundInputPeripheral.Text = "Sound Input Peripheral";
this.cbSoundInputPeripheral.UseVisualStyleBackColor = true;
this.cbOtherDevices.AutoCheck = false;
this.cbOtherDevices.AutoSize = true;
this.cbOtherDevices.Location = new Point(143, 3);
this.cbOtherDevices.Name = "cbOtherDevices";
this.cbOtherDevices.Size = new Size(94, 17);
this.cbOtherDevices.TabIndex = 20;
this.cbOtherDevices.Text = "Other Devices";
this.cbOtherDevices.UseVisualStyleBackColor = true;
this.gbMinimalSet.AutoSize = true;
this.gbMinimalSet.BackColor = Color.Transparent;
this.gbMinimalSet.Controls.Add((Control) this.flpMinimalSet);
this.gbMinimalSet.Location = new Point(6, 3);
this.gbMinimalSet.Name = "gbMinimalSet";
this.gbMinimalSet.Size = new Size(449, 139);
this.gbMinimalSet.TabIndex = 0;
this.gbMinimalSet.TabStop = false;
this.gbMinimalSet.Text = "Minimal set of buttons required by application:";
this.flpMinimalSet.Controls.Add((Control) this.cbStartABDirButtons);
this.flpMinimalSet.Controls.Add((Control) this.cbCButton);
this.flpMinimalSet.Controls.Add((Control) this.cbDButton);
this.flpMinimalSet.Controls.Add((Control) this.cbXButton);
this.flpMinimalSet.Controls.Add((Control) this.cbYButton);
this.flpMinimalSet.Controls.Add((Control) this.cbZButton);
this.flpMinimalSet.Controls.Add((Control) this.cbAnalogLTrigger);
this.flpMinimalSet.Controls.Add((Control) this.cbAnalogRTrigger);
this.flpMinimalSet.Controls.Add((Control) this.cbStandardAnalogX);
this.flpMinimalSet.Controls.Add((Control) this.cbStandardAnalogY);
this.flpMinimalSet.Controls.Add((Control) this.cbExpandedDirectionButtons);
this.flpMinimalSet.Controls.Add((Control) this.cbExpandedAnalogX);
this.flpMinimalSet.Controls.Add((Control) this.cbExpandedAnalogY);
this.flpMinimalSet.Dock = DockStyle.Fill;
this.flpMinimalSet.FlowDirection = FlowDirection.TopDown;
this.flpMinimalSet.Location = new Point(3, 16);
this.flpMinimalSet.Name = "flpMinimalSet";
this.flpMinimalSet.Size = new Size(443, 120);
this.flpMinimalSet.TabIndex = 0;
this.cbStartABDirButtons.AutoCheck = false;
this.cbStartABDirButtons.AutoSize = true;
this.cbStartABDirButtons.Location = new Point(3, 3);
this.cbStartABDirButtons.Name = "cbStartABDirButtons";
this.cbStartABDirButtons.Size = new Size(161, 17);
this.cbStartABDirButtons.TabIndex = 1;
this.cbStartABDirButtons.Text = "Start, A, B, Direction Buttons";
this.cbStartABDirButtons.UseVisualStyleBackColor = true;
this.cbCButton.AutoCheck = false;
this.cbCButton.AutoSize = true;
this.cbCButton.Location = new Point(3, 26);
this.cbCButton.Name = "cbCButton";
this.cbCButton.Size = new Size(67, 17);
this.cbCButton.TabIndex = 2;
this.cbCButton.Text = "C Button";
this.cbCButton.UseVisualStyleBackColor = true;
this.cbDButton.AutoCheck = false;
this.cbDButton.AutoSize = true;
this.cbDButton.Location = new Point(3, 49);
this.cbDButton.Name = "cbDButton";
this.cbDButton.Size = new Size(68, 17);
this.cbDButton.TabIndex = 3;
this.cbDButton.Text = "D Button";
this.cbDButton.UseVisualStyleBackColor = true;
this.cbXButton.AutoCheck = false;
this.cbXButton.AutoSize = true;
this.cbXButton.Location = new Point(3, 72);
this.cbXButton.Name = "cbXButton";
this.cbXButton.Size = new Size(67, 17);
this.cbXButton.TabIndex = 4;
this.cbXButton.Text = "X Button";
this.cbXButton.UseVisualStyleBackColor = true;
this.cbYButton.AutoCheck = false;
this.cbYButton.AutoSize = true;
this.cbYButton.Location = new Point(3, 95);
this.cbYButton.Name = "cbYButton";
this.cbYButton.Size = new Size(67, 17);
this.cbYButton.TabIndex = 5;
this.cbYButton.Text = "Y Button";
this.cbYButton.UseVisualStyleBackColor = true;
this.cbZButton.AutoCheck = false;
this.cbZButton.AutoSize = true;
this.cbZButton.Location = new Point(170, 3);
this.cbZButton.Name = "cbZButton";
this.cbZButton.Size = new Size(67, 17);
this.cbZButton.TabIndex = 6;
this.cbZButton.Text = "Z Button";
this.cbZButton.UseVisualStyleBackColor = true;
this.cbAnalogLTrigger.AutoCheck = false;
this.cbAnalogLTrigger.AutoSize = true;
this.cbAnalogLTrigger.Location = new Point(170, 26);
this.cbAnalogLTrigger.Name = "cbAnalogLTrigger";
this.cbAnalogLTrigger.Size = new Size(104, 17);
this.cbAnalogLTrigger.TabIndex = 7;
this.cbAnalogLTrigger.Text = "Analog L Trigger";
this.cbAnalogLTrigger.UseVisualStyleBackColor = true;
this.cbAnalogRTrigger.AutoCheck = false;
this.cbAnalogRTrigger.AutoSize = true;
this.cbAnalogRTrigger.Location = new Point(170, 49);
this.cbAnalogRTrigger.Name = "cbAnalogRTrigger";
this.cbAnalogRTrigger.Size = new Size(106, 17);
this.cbAnalogRTrigger.TabIndex = 8;
this.cbAnalogRTrigger.Text = "Analog R Trigger";
this.cbAnalogRTrigger.UseVisualStyleBackColor = true;
this.cbStandardAnalogX.AutoCheck = false;
this.cbStandardAnalogX.AutoSize = true;
this.cbStandardAnalogX.Location = new Point(170, 72);
this.cbStandardAnalogX.Name = "cbStandardAnalogX";
this.cbStandardAnalogX.Size = new Size(115, 17);
this.cbStandardAnalogX.TabIndex = 9;
this.cbStandardAnalogX.Text = "Standard Analog X";
this.cbStandardAnalogX.UseVisualStyleBackColor = true;
this.cbStandardAnalogY.AutoCheck = false;
this.cbStandardAnalogY.AutoSize = true;
this.cbStandardAnalogY.Location = new Point(170, 95);
this.cbStandardAnalogY.Name = "cbStandardAnalogY";
this.cbStandardAnalogY.Size = new Size(115, 17);
this.cbStandardAnalogY.TabIndex = 10;
this.cbStandardAnalogY.Text = "Standard Analog Y";
this.cbStandardAnalogY.UseVisualStyleBackColor = true;
this.cbExpandedDirectionButtons.AutoCheck = false;
this.cbExpandedDirectionButtons.AutoSize = true;
this.cbExpandedDirectionButtons.Location = new Point(291, 3);
this.cbExpandedDirectionButtons.Name = "cbExpandedDirectionButtons";
this.cbExpandedDirectionButtons.Size = new Size(158, 17);
this.cbExpandedDirectionButtons.TabIndex = 11;
this.cbExpandedDirectionButtons.Text = "Expanded Direction Buttons";
this.cbExpandedDirectionButtons.UseVisualStyleBackColor = true;
this.cbExpandedAnalogX.AutoCheck = false;
this.cbExpandedAnalogX.AutoSize = true;
this.cbExpandedAnalogX.Location = new Point(291, 26);
this.cbExpandedAnalogX.Name = "cbExpandedAnalogX";
this.cbExpandedAnalogX.Size = new Size(120, 17);
this.cbExpandedAnalogX.TabIndex = 12;
this.cbExpandedAnalogX.Text = "Expanded Analog X";
this.cbExpandedAnalogX.UseVisualStyleBackColor = true;
this.cbExpandedAnalogY.AutoCheck = false;
this.cbExpandedAnalogY.AutoSize = true;
this.cbExpandedAnalogY.Location = new Point(291, 49);
this.cbExpandedAnalogY.Name = "cbExpandedAnalogY";
this.cbExpandedAnalogY.Size = new Size(120, 17);
this.cbExpandedAnalogY.TabIndex = 13;
this.cbExpandedAnalogY.Text = "Expanded Analog Y";
this.cbExpandedAnalogY.UseVisualStyleBackColor = true;
this.AutoScaleDimensions = new SizeF(6f, 13f);
this.AutoScaleMode = AutoScaleMode.Font;
this.AutoSize = true;
this.BackColor = Color.Transparent;
this.Controls.Add((Control) this.gbSupportedPeripherals);
this.Controls.Add((Control) this.gbSupportedExpandedPeripherals);
this.Controls.Add((Control) this.gbMinimalSet);
this.Name = nameof (InitialProgramPeripheralsViewer);
this.Size = new Size(460, 246);
this.gbSupportedPeripherals.ResumeLayout(false);
this.gbSupportedPeripherals.PerformLayout();
this.fplSupportedPeripherals.ResumeLayout(false);
this.fplSupportedPeripherals.PerformLayout();
this.gbSupportedExpandedPeripherals.ResumeLayout(false);
this.flpSupportedExpandedPeripherals.ResumeLayout(false);
this.flpSupportedExpandedPeripherals.PerformLayout();
this.gbMinimalSet.ResumeLayout(false);
this.flpMinimalSet.ResumeLayout(false);
this.flpMinimalSet.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,18 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramReleaseDateParsingException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
public class InitialProgramReleaseDateParsingException : InitialProgramException
{
public InitialProgramReleaseDateParsingException(string releaseDate, Exception innerException)
: base(string.Format("invalid release date \"{0}\"", (object) releaseDate), innerException)
{
}
}
}

View file

@ -0,0 +1,25 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramToc
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
using System.Collections.Generic;
using System.Linq;
namespace SEGATools.Security
{
public class InitialProgramToc
{
public InitialProgramTrackInfo FirstTrack => this.Tracks.Aggregate<InitialProgramTrackInfo>((Func<InitialProgramTrackInfo, InitialProgramTrackInfo, InitialProgramTrackInfo>) ((a, b) => a.Index > b.Index ? b : a));
public InitialProgramTrackInfo LastTrack => this.Tracks.Aggregate<InitialProgramTrackInfo>((Func<InitialProgramTrackInfo, InitialProgramTrackInfo, InitialProgramTrackInfo>) ((a, b) => a.Index <= b.Index ? b : a));
public bool HasSplitedDataTracks => this.FirstTrack != null && this.LastTrack != null && this.FirstTrack.Index != this.LastTrack.Index;
public List<InitialProgramTrackInfo> Tracks { get; private set; }
internal InitialProgramToc(InitialProgramTrackInfo[] tracks) => this.Tracks = ((IEnumerable<InitialProgramTrackInfo>) tracks).OrderBy<InitialProgramTrackInfo, int>((Func<InitialProgramTrackInfo, int>) (track => track.Index)).ToList<InitialProgramTrackInfo>();
}
}

View file

@ -0,0 +1,96 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTocConverter
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace SEGATools.Security
{
internal sealed class InitialProgramTocConverter
{
private const string TOC_ID = "TOC1";
private const int TOC_ID_LENGTH = 4;
private const int TOC_TRACKINFO_LENGTH = 4;
private const int TOC_NUMBER_OF_TRACKINFO = 97;
private const int TOC_TRACKINFO_SIZE = 388;
private const int TOC_DATA_SIZE = 392;
private const int TOC_TRACK_INDEX_OFFSET = 3;
private const int TOC_TRACK_POST_GAP = 150;
private static readonly Logger.ILog logger = Logger.CreateLog();
private static uint TocTrackNumber(uint n) => (n & 16711680U) >> 16;
private static uint TocTrackFAD(uint n) => n & 16777215U;
private static InitialProgramTrackInfo.ControlData TocTrackType(uint n) => (InitialProgramTrackInfo.ControlData) ((n & 4026531840U) >> 28);
internal static InitialProgramToc ToInitialProgramToc(
byte[] buffer,
int startIndex)
{
if (startIndex < 0 || buffer.Length - startIndex < 392)
{
InitialProgramTocConverter.logger.ErrorFormat("Buffer too small: {0} bytes", (object) (buffer.Length - startIndex));
throw new ArgumentOutOfRangeException();
}
string str = Encoding.ASCII.GetString(buffer, startIndex, "TOC1".Length);
if (!"TOC1".Equals(str))
{
InitialProgramTocConverter.logger.ErrorFormat("Expected TOC identifier \"{0}\", got \"{1}\"", (object) "TOC1", (object) str);
throw new InitialProgramTocIdentifierMissingException();
}
InitialProgramTocConverter.TOC structure = (InitialProgramTocConverter.TOC) Marshal.PtrToStructure(Marshal.UnsafeAddrOfPinnedArrayElement((Array) buffer, startIndex + 4), typeof (InitialProgramTocConverter.TOC));
int length = (int) InitialProgramTocConverter.TocTrackNumber(structure.LastTrack) - (int) InitialProgramTocConverter.TocTrackNumber(structure.FirstTrack) + 1;
InitialProgramTocConverter.logger.InfoFormat("Number Of Tracks = {0}", (object) length);
InitialProgramTrackInfo[] tracks = length > 0 ? new InitialProgramTrackInfo[length] : throw new InitialProgramTocWrongNumberOfTracksException();
int num = tracks.Length - 1;
for (int trackNumber = num; trackNumber >= 0; --trackNumber)
{
uint track1 = structure.Tracks[trackNumber];
uint StartFAD = InitialProgramTocConverter.TocTrackFAD(track1);
InitialProgramTrackInfo.ControlData controlData = InitialProgramTocConverter.TocTrackType(track1);
if (!Enum.IsDefined(typeof (InitialProgramTrackInfo.ControlData), (object) controlData))
{
InitialProgramTocConverter.logger.ErrorFormat("Track {0} control value is not supported: {1}", (object) trackNumber, (object) controlData);
throw new InitialProgramTocWrongControlDataException(trackNumber, controlData);
}
InitialProgramTocTrackBuilder programTocTrackBuilder = InitialProgramTocTrackBuilder.aTrackWithIndex(3 + trackNumber).WithStartFAD(StartFAD).WithCtrl(controlData);
uint LastFAD;
if (trackNumber == num)
{
LastFAD = InitialProgramTocConverter.TocTrackFAD(structure.LeadOut) - 1U;
}
else
{
uint track2 = structure.Tracks[trackNumber + 1];
LastFAD = InitialProgramTocConverter.TocTrackFAD(track2) - 1U;
if (controlData != InitialProgramTocConverter.TocTrackType(track2))
LastFAD -= 150U;
}
programTocTrackBuilder.WithLastFAD(LastFAD);
InitialProgramTrackInfo programTrackInfo = programTocTrackBuilder.Build();
tracks[trackNumber] = programTrackInfo;
InitialProgramTocConverter.logger.DebugFormat("IP TOC: found {0}", (object) programTrackInfo);
}
return new InitialProgramToc(tracks);
}
[StructLayout(LayoutKind.Explicit, Size = 388, Pack = 1)]
private struct TOC
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 97, ArraySubType = UnmanagedType.U4)]
[FieldOffset(0)]
public uint[] Tracks;
[FieldOffset(388)]
public uint FirstTrack;
[FieldOffset(392)]
public uint LastTrack;
[FieldOffset(396)]
public uint LeadOut;
}
}
}

View file

@ -0,0 +1,23 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTocException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
internal class InitialProgramTocException : Exception
{
internal InitialProgramTocException(string message)
: base(message)
{
}
internal InitialProgramTocException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}

View file

@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTocIdentifierMissingException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
namespace SEGATools.Security
{
internal class InitialProgramTocIdentifierMissingException : InitialProgramTocException
{
public InitialProgramTocIdentifierMissingException()
: base("TOC identifier missing")
{
}
}
}

View file

@ -0,0 +1,53 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTocTrackBuilder
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
namespace SEGATools.Security
{
public class InitialProgramTocTrackBuilder
{
private int Index;
private uint StartFAD;
private uint Size;
private InitialProgramTrackInfo.ControlData Ctrl;
private InitialProgramTocTrackBuilder()
{
}
public InitialProgramTocTrackBuilder WithIndex(int Index)
{
this.Index = Index;
return this;
}
public InitialProgramTocTrackBuilder WithStartFAD(uint StartFAD)
{
this.StartFAD = StartFAD;
return this;
}
public InitialProgramTocTrackBuilder WithCtrl(
InitialProgramTrackInfo.ControlData Ctrl)
{
this.Ctrl = Ctrl;
return this;
}
public InitialProgramTocTrackBuilder WithLastFAD(uint LastFAD)
{
this.Size = LastFAD + 1U - this.StartFAD;
return this;
}
public InitialProgramTrackInfo Build() => new InitialProgramTrackInfo(this.Index, this.StartFAD, this.Size, this.Ctrl);
public static InitialProgramTocTrackBuilder aTrackWithIndex(
int Index)
{
return new InitialProgramTocTrackBuilder().WithIndex(Index);
}
}
}

View file

@ -0,0 +1,161 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTocViewer
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using ImageReader.DiscSectors;
using SEGATools.Formater;
using SEGATools.Properties;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SEGATools.Security
{
public class InitialProgramTocViewer : UserControl
{
private IContainer components;
private Label lbTocHint;
private TableLayoutPanel tableLayoutPanel;
private ListView listViewToc;
public InitialProgramTocViewer()
{
this.InitializeComponent();
this.InitializeHintText(0);
this.InitializeListViewColumns();
}
public void LoadInitialProgram(InitialProgramExtended ip)
{
if (ip == null)
return;
this.LoadToc((InitialProgram) ip);
}
private void InitializeHintText(int NumberOfTracks)
{
string str;
switch (NumberOfTracks)
{
case 0:
str = Resources.TocNoTrackFound;
break;
case 1:
str = Resources.TocTrackNumberSingle;
break;
default:
str = string.Format(Resources.TocTrackNumberPlurial, (object) NumberOfTracks);
break;
}
this.lbTocHint.Text = string.Format(Resources.TocHint, (object) str);
}
private void InitializeListViewColumns()
{
this.listViewToc.Columns.Add(InitialProgramTocViewer.createColumn(Resources.TocColumnName, HorizontalAlignment.Center));
this.listViewToc.Columns.Add(InitialProgramTocViewer.createColumn(Resources.TocColumnDataType, HorizontalAlignment.Center));
this.listViewToc.Columns.Add(InitialProgramTocViewer.createColumn(Resources.TocColumnStart, HorizontalAlignment.Right));
this.listViewToc.Columns.Add(InitialProgramTocViewer.createColumn(Resources.TocColumnEnd, HorizontalAlignment.Right));
this.listViewToc.Columns.Add(InitialProgramTocViewer.createColumn(Resources.TocColumnSizeInSectors, HorizontalAlignment.Right));
this.listViewToc.Columns.Add(InitialProgramTocViewer.createColumn(Resources.TocColumnSize, HorizontalAlignment.Right));
this.listViewToc.Columns.Add(InitialProgramTocViewer.createColumn(Resources.TocColumnSizeInBytes, HorizontalAlignment.Right));
this.ResizeListViewColumns();
}
private static ColumnHeader createColumn(string Name, HorizontalAlignment alignment) => new ColumnHeader()
{
Text = Name,
TextAlign = alignment
};
private void ResizeListViewColumns() => this.listViewToc.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
private void LoadToc(InitialProgram ip)
{
if (ip.TableOfContent == null)
{
this.InitializeHintText(0);
this.ResizeListViewColumns();
}
else
{
foreach (InitialProgramTrackInfo track in ip.TableOfContent.Tracks)
{
long Size = (long) track.Size * (long) DiscSectorCommon.RawSectorSize;
this.listViewToc.Items.Add(new ListViewItem(new string[7]
{
string.Format("{0:00}", (object) track.Index),
track.Ctrl.ToString().ToLower(),
track.FrameAddress.ToString(),
track.LastFrameAddress.ToString(),
track.Size.ToString(),
SizeFormater.ToHumanReadableSize(Size),
Size.ToString()
}));
}
this.InitializeHintText(ip.TableOfContent.Tracks.Count);
this.ResizeListViewColumns();
}
}
protected override void Dispose(bool disposing)
{
if (disposing && this.components != null)
this.components.Dispose();
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.lbTocHint = new Label();
this.tableLayoutPanel = new TableLayoutPanel();
this.listViewToc = new ListView();
this.tableLayoutPanel.SuspendLayout();
this.SuspendLayout();
this.lbTocHint.BackColor = Color.Transparent;
this.lbTocHint.Dock = DockStyle.Fill;
this.lbTocHint.Location = new Point(3, 0);
this.lbTocHint.Name = "lbTocHint";
this.lbTocHint.Size = new Size(422, 24);
this.lbTocHint.TabIndex = 0;
this.lbTocHint.Text = "...";
this.lbTocHint.TextAlign = ContentAlignment.MiddleLeft;
this.tableLayoutPanel.BackColor = Color.Transparent;
this.tableLayoutPanel.ColumnCount = 1;
this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f));
this.tableLayoutPanel.Controls.Add((Control) this.lbTocHint, 0, 0);
this.tableLayoutPanel.Controls.Add((Control) this.listViewToc, 0, 1);
this.tableLayoutPanel.Dock = DockStyle.Fill;
this.tableLayoutPanel.Location = new Point(0, 0);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 2;
this.tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 24f));
this.tableLayoutPanel.RowStyles.Add(new RowStyle());
this.tableLayoutPanel.Size = new Size(428, 150);
this.tableLayoutPanel.TabIndex = 1;
this.listViewToc.BackColor = SystemColors.Window;
this.listViewToc.CausesValidation = false;
this.listViewToc.Dock = DockStyle.Fill;
this.listViewToc.FullRowSelect = true;
this.listViewToc.HeaderStyle = ColumnHeaderStyle.Nonclickable;
this.listViewToc.Location = new Point(0, 24);
this.listViewToc.Margin = new Padding(0);
this.listViewToc.Name = "listViewToc";
this.listViewToc.ShowGroups = false;
this.listViewToc.Size = new Size(428, 126);
this.listViewToc.TabIndex = 1;
this.listViewToc.UseCompatibleStateImageBehavior = false;
this.listViewToc.View = View.Details;
this.AutoScaleDimensions = new SizeF(6f, 13f);
this.AutoScaleMode = AutoScaleMode.Font;
this.BackColor = Color.Transparent;
this.Controls.Add((Control) this.tableLayoutPanel);
this.Name = nameof (InitialProgramTocViewer);
this.Size = new Size(428, 150);
this.tableLayoutPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,24 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTocWrongControlDataException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
namespace SEGATools.Security
{
internal class InitialProgramTocWrongControlDataException : InitialProgramTocException
{
public int TrackNumber { get; private set; }
public InitialProgramTrackInfo.ControlData ControlData { get; private set; }
public InitialProgramTocWrongControlDataException(
int trackNumber,
InitialProgramTrackInfo.ControlData wrongCtrlValue)
: base(string.Format("Track {0} control data value is wrong: {1}", (object) trackNumber, (object) wrongCtrlValue))
{
this.TrackNumber = trackNumber;
this.ControlData = wrongCtrlValue;
}
}
}

View file

@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTocWrongNumberOfTracksException
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
namespace SEGATools.Security
{
internal class InitialProgramTocWrongNumberOfTracksException : InitialProgramTocException
{
public InitialProgramTocWrongNumberOfTracksException()
: base("the number of tracks specified in the TOC is invalid")
{
}
}
}

View file

@ -0,0 +1,41 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramTrackInfo
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
namespace SEGATools.Security
{
public class InitialProgramTrackInfo
{
public int Index { get; private set; }
public uint FrameAddress { get; private set; }
public uint LastFrameAddress => (uint) ((int) this.FrameAddress + (int) this.Size - 1);
public InitialProgramTrackInfo.ControlData Ctrl { get; private set; }
public uint Size { get; private set; }
internal InitialProgramTrackInfo(
int index,
uint StartFAD,
uint Size,
InitialProgramTrackInfo.ControlData Ctrl)
{
this.Index = index;
this.FrameAddress = StartFAD;
this.Size = Size;
this.Ctrl = Ctrl;
}
public override string ToString() => string.Format("Track {0} [CTLR = {1}, FAD = 0x{2:X}, SIZE = 0x{3:X}]", (object) this.Index, (object) this.Ctrl, (object) this.FrameAddress, (object) this.Size);
public enum ControlData
{
Audio = 0,
Data = 4,
}
}
}

View file

@ -0,0 +1,52 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.InitialProgramUtils
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
public class InitialProgramUtils
{
private static readonly Logger.ILog logger = Logger.CreateLog();
public static int ComputeCRC(string productId, string productVersion)
{
int num = (int) ushort.MaxValue;
foreach (char ch in productId + productVersion)
{
num ^= (int) ch << 8;
for (int index = 0; index < 8; ++index)
{
if ((num & 32768) > 1)
num = num << 1 ^ 4129;
else
num <<= 1;
}
}
return num & (int) ushort.MaxValue;
}
public static byte[] ConvertHexStringToBytes(string hexString)
{
byte[] numArray = new byte[hexString.Length];
for (int index = 0; index < numArray.Length; ++index)
{
try
{
numArray[index] = Convert.ToByte(hexString[index].ToString(), 16);
}
catch (Exception ex)
{
logger.Error(ex);
numArray[index] = (byte) 0;
}
}
if (BitConverter.IsLittleEndian)
Array.Reverse((Array) numArray);
return numArray;
}
}
}

View file

@ -0,0 +1,19 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.SupportedAreas
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
[Flags]
public enum SupportedAreas
{
None = 0,
Japan = 1,
Usa = 2,
Europe = 4,
}
}

View file

@ -0,0 +1,48 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.SupportedButtons
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
[Flags]
public enum SupportedButtons
{
None = 0,
StartABDirections = 1,
CButton = 2,
DButton = 4,
XButton = 8,
Unused1 = 16, // 0x00000010
Unused2 = 32, // 0x00000020
Unused3 = 64, // 0x00000040
Unused4 = 128, // 0x00000080
YButton = 256, // 0x00000100
ZButton = 512, // 0x00000200
ExpandedDirectionButtons = 1024, // 0x00000400
AnalogRTrigger = 2048, // 0x00000800
Unused5 = 4096, // 0x00001000
Unused6 = 8192, // 0x00002000
Unused7 = 16384, // 0x00004000
Unused8 = 32768, // 0x00008000
AnalogLTrigger = 65536, // 0x00010000
AnalogHorizontalController = 131072, // 0x00020000
AnalogVerticalController = 262144, // 0x00040000
ExpandedAnalogHorizontal = 524288, // 0x00080000
Unused9 = 1048576, // 0x00100000
Unused10 = 2097152, // 0x00200000
Unused11 = 4194304, // 0x00400000
Unused12 = 8388608, // 0x00800000
ExpandedAnalogVertical = 16777216, // 0x01000000
Unused13 = 33554432, // 0x02000000
Unused14 = 67108864, // 0x04000000
Unused15 = 134217728, // 0x08000000
Unused16 = 268435456, // 0x10000000
Unused17 = 536870912, // 0x20000000
Unused18 = 1073741824, // 0x40000000
Unused19 = -2147483648, // 0x80000000
}
}

View file

@ -0,0 +1,24 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.SupportedExpandedPeripherals
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
[Flags]
public enum SupportedExpandedPeripherals
{
None = 0,
OtherDevices = 1,
Vibrator = 2,
SoundInputPeripheral = 4,
MemoryCard = 8,
Unused1 = 16, // 0x00000010
Unused2 = 32, // 0x00000020
Unused3 = 64, // 0x00000040
Unused4 = 128, // 0x00000080
}
}

View file

@ -0,0 +1,24 @@
// Decompiled with JetBrains decompiler
// Type: SEGATools.Security.SupportedPeripherals
// Assembly: SEGATools, Version=1.0.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
// MVID: D631183F-57B1-40A1-B502-5364D288307A
// Assembly location: SEGATools.dll
using System;
namespace SEGATools.Security
{
[Flags]
public enum SupportedPeripherals
{
None = 0,
Unused1 = 1,
Keyboard = 2,
Gun = 4,
Mouse = 8,
Unused2 = 16, // 0x00000010
Unused3 = 32, // 0x00000020
Unused4 = 64, // 0x00000040
Unused5 = 128, // 0x00000080
}
}