saturnus: support 8mbit/32mbit dram cart as a syncsetting. this inflates your savestate size heavily, of course...

This commit is contained in:
goyuken 2014-02-23 17:06:24 +00:00
parent 17f64cf8f5
commit d7371fcf42
7 changed files with 240 additions and 181 deletions

View File

@ -28,226 +28,249 @@
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButtonGL = new System.Windows.Forms.RadioButton();
this.radioButtonSoft = new System.Windows.Forms.RadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDownFactor = new System.Windows.Forms.NumericUpDown();
this.radioButtonFree = new System.Windows.Forms.RadioButton();
this.radioButtonFactor = new System.Windows.Forms.RadioButton();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButtonGL);
this.groupBox1.Controls.Add(this.radioButtonSoft);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(111, 100);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Render Type";
//
// radioButtonGL
//
this.radioButtonGL.AutoSize = true;
this.radioButtonGL.Location = new System.Drawing.Point(6, 42);
this.radioButtonGL.Name = "radioButtonGL";
this.radioButtonGL.Size = new System.Drawing.Size(68, 17);
this.radioButtonGL.TabIndex = 1;
this.radioButtonGL.TabStop = true;
this.radioButtonGL.Text = "Open GL";
this.radioButtonGL.UseVisualStyleBackColor = true;
//
// radioButtonSoft
//
this.radioButtonSoft.AutoSize = true;
this.radioButtonSoft.Location = new System.Drawing.Point(6, 19);
this.radioButtonSoft.Name = "radioButtonSoft";
this.radioButtonSoft.Size = new System.Drawing.Size(67, 17);
this.radioButtonSoft.TabIndex = 0;
this.radioButtonSoft.TabStop = true;
this.radioButtonSoft.Text = "Software";
this.radioButtonSoft.UseVisualStyleBackColor = true;
this.radioButtonSoft.CheckedChanged += new System.EventHandler(this.radioButtonSoft_CheckedChanged);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.numericUpDown2);
this.groupBox2.Controls.Add(this.numericUpDown1);
this.groupBox2.Controls.Add(this.numericUpDownFactor);
this.groupBox2.Controls.Add(this.radioButtonFree);
this.groupBox2.Controls.Add(this.radioButtonFactor);
this.groupBox2.Location = new System.Drawing.Point(129, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(215, 100);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Render Resolution";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(134, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(14, 13);
this.label1.TabIndex = 5;
this.label1.Text = "X";
//
// numericUpDown2
//
this.numericUpDown2.Increment = new decimal(new int[] {
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButtonGL = new System.Windows.Forms.RadioButton();
this.radioButtonSoft = new System.Windows.Forms.RadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDownFactor = new System.Windows.Forms.NumericUpDown();
this.radioButtonFree = new System.Windows.Forms.RadioButton();
this.radioButtonFactor = new System.Windows.Forms.RadioButton();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.comboBoxCartType = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).BeginInit();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButtonGL);
this.groupBox1.Controls.Add(this.radioButtonSoft);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(111, 100);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Render Type";
//
// radioButtonGL
//
this.radioButtonGL.AutoSize = true;
this.radioButtonGL.Location = new System.Drawing.Point(6, 42);
this.radioButtonGL.Name = "radioButtonGL";
this.radioButtonGL.Size = new System.Drawing.Size(68, 17);
this.radioButtonGL.TabIndex = 1;
this.radioButtonGL.TabStop = true;
this.radioButtonGL.Text = "Open GL";
this.radioButtonGL.UseVisualStyleBackColor = true;
//
// radioButtonSoft
//
this.radioButtonSoft.AutoSize = true;
this.radioButtonSoft.Location = new System.Drawing.Point(6, 19);
this.radioButtonSoft.Name = "radioButtonSoft";
this.radioButtonSoft.Size = new System.Drawing.Size(67, 17);
this.radioButtonSoft.TabIndex = 0;
this.radioButtonSoft.TabStop = true;
this.radioButtonSoft.Text = "Software";
this.radioButtonSoft.UseVisualStyleBackColor = true;
this.radioButtonSoft.CheckedChanged += new System.EventHandler(this.radioButtonSoft_CheckedChanged);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.numericUpDown2);
this.groupBox2.Controls.Add(this.numericUpDown1);
this.groupBox2.Controls.Add(this.numericUpDownFactor);
this.groupBox2.Controls.Add(this.radioButtonFree);
this.groupBox2.Controls.Add(this.radioButtonFactor);
this.groupBox2.Location = new System.Drawing.Point(129, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(215, 100);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Render Resolution";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(134, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(14, 13);
this.label1.TabIndex = 5;
this.label1.Text = "X";
//
// numericUpDown2
//
this.numericUpDown2.Increment = new decimal(new int[] {
8,
0,
0,
0});
this.numericUpDown2.Location = new System.Drawing.Point(154, 44);
this.numericUpDown2.Maximum = new decimal(new int[] {
this.numericUpDown2.Location = new System.Drawing.Point(154, 44);
this.numericUpDown2.Maximum = new decimal(new int[] {
1024,
0,
0,
0});
this.numericUpDown2.Minimum = new decimal(new int[] {
this.numericUpDown2.Minimum = new decimal(new int[] {
224,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(53, 20);
this.numericUpDown2.TabIndex = 4;
this.numericUpDown2.Value = new decimal(new int[] {
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(53, 20);
this.numericUpDown2.TabIndex = 4;
this.numericUpDown2.Value = new decimal(new int[] {
224,
0,
0,
0});
//
// numericUpDown1
//
this.numericUpDown1.Increment = new decimal(new int[] {
//
// numericUpDown1
//
this.numericUpDown1.Increment = new decimal(new int[] {
8,
0,
0,
0});
this.numericUpDown1.Location = new System.Drawing.Point(75, 44);
this.numericUpDown1.Maximum = new decimal(new int[] {
this.numericUpDown1.Location = new System.Drawing.Point(75, 44);
this.numericUpDown1.Maximum = new decimal(new int[] {
2048,
0,
0,
0});
this.numericUpDown1.Minimum = new decimal(new int[] {
this.numericUpDown1.Minimum = new decimal(new int[] {
320,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(53, 20);
this.numericUpDown1.TabIndex = 3;
this.numericUpDown1.Value = new decimal(new int[] {
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(53, 20);
this.numericUpDown1.TabIndex = 3;
this.numericUpDown1.Value = new decimal(new int[] {
320,
0,
0,
0});
//
// numericUpDownFactor
//
this.numericUpDownFactor.Location = new System.Drawing.Point(119, 19);
this.numericUpDownFactor.Maximum = new decimal(new int[] {
//
// numericUpDownFactor
//
this.numericUpDownFactor.Location = new System.Drawing.Point(119, 19);
this.numericUpDownFactor.Maximum = new decimal(new int[] {
4,
0,
0,
0});
this.numericUpDownFactor.Minimum = new decimal(new int[] {
this.numericUpDownFactor.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownFactor.Name = "numericUpDownFactor";
this.numericUpDownFactor.Size = new System.Drawing.Size(64, 20);
this.numericUpDownFactor.TabIndex = 2;
this.numericUpDownFactor.Value = new decimal(new int[] {
this.numericUpDownFactor.Name = "numericUpDownFactor";
this.numericUpDownFactor.Size = new System.Drawing.Size(64, 20);
this.numericUpDownFactor.TabIndex = 2;
this.numericUpDownFactor.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// radioButtonFree
//
this.radioButtonFree.AutoSize = true;
this.radioButtonFree.Location = new System.Drawing.Point(6, 46);
this.radioButtonFree.Name = "radioButtonFree";
this.radioButtonFree.Size = new System.Drawing.Size(63, 17);
this.radioButtonFree.TabIndex = 1;
this.radioButtonFree.TabStop = true;
this.radioButtonFree.Text = "Specific";
this.radioButtonFree.UseVisualStyleBackColor = true;
//
// radioButtonFactor
//
this.radioButtonFactor.AutoSize = true;
this.radioButtonFactor.Location = new System.Drawing.Point(6, 19);
this.radioButtonFactor.Name = "radioButtonFactor";
this.radioButtonFactor.Size = new System.Drawing.Size(107, 17);
this.radioButtonFactor.TabIndex = 0;
this.radioButtonFactor.TabStop = true;
this.radioButtonFactor.Text = "Multiple of Native";
this.radioButtonFactor.UseVisualStyleBackColor = true;
this.radioButtonFactor.CheckedChanged += new System.EventHandler(this.radioButtonFactor_CheckedChanged);
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(187, 122);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(268, 122);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// SaturnPrefs
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(355, 155);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "SaturnPrefs";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Preferences";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).EndInit();
this.ResumeLayout(false);
//
// radioButtonFree
//
this.radioButtonFree.AutoSize = true;
this.radioButtonFree.Location = new System.Drawing.Point(6, 46);
this.radioButtonFree.Name = "radioButtonFree";
this.radioButtonFree.Size = new System.Drawing.Size(63, 17);
this.radioButtonFree.TabIndex = 1;
this.radioButtonFree.TabStop = true;
this.radioButtonFree.Text = "Specific";
this.radioButtonFree.UseVisualStyleBackColor = true;
//
// radioButtonFactor
//
this.radioButtonFactor.AutoSize = true;
this.radioButtonFactor.Location = new System.Drawing.Point(6, 19);
this.radioButtonFactor.Name = "radioButtonFactor";
this.radioButtonFactor.Size = new System.Drawing.Size(107, 17);
this.radioButtonFactor.TabIndex = 0;
this.radioButtonFactor.TabStop = true;
this.radioButtonFactor.Text = "Multiple of Native";
this.radioButtonFactor.UseVisualStyleBackColor = true;
this.radioButtonFactor.CheckedChanged += new System.EventHandler(this.radioButtonFactor_CheckedChanged);
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(188, 178);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(269, 178);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.comboBoxCartType);
this.groupBox3.Location = new System.Drawing.Point(12, 118);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(332, 54);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Cartridge Type";
//
// comboBoxCartType
//
this.comboBoxCartType.FormattingEnabled = true;
this.comboBoxCartType.Location = new System.Drawing.Point(6, 19);
this.comboBoxCartType.Name = "comboBoxCartType";
this.comboBoxCartType.Size = new System.Drawing.Size(320, 21);
this.comboBoxCartType.TabIndex = 0;
//
// SaturnPrefs
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(356, 213);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "SaturnPrefs";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Preferences";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).EndInit();
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -265,5 +288,7 @@
private System.Windows.Forms.RadioButton radioButtonFactor;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.ComboBox comboBoxCartType;
}
}

View File

@ -17,6 +17,7 @@ namespace BizHawk.Client.EmuHawk
public SaturnPrefs()
{
InitializeComponent();
comboBoxCartType.Items.AddRange(Enum.GetNames(typeof(LibYabause.CartType)));
try
{
var ss = (Yabause.SaturnSyncSettings)Global.Emulator.GetSyncSettings();
@ -28,6 +29,7 @@ namespace BizHawk.Client.EmuHawk
numericUpDownFactor.Value = ss.DispFactor;
numericUpDown1.Value = ss.GLW;
numericUpDown2.Value = ss.GLH;
comboBoxCartType.SelectedItem = Enum.GetName(typeof(LibYabause.CartType), ss.CartType);
}
catch (ArgumentOutOfRangeException)
{
@ -53,6 +55,7 @@ namespace BizHawk.Client.EmuHawk
ss.DispFactor = (int)numericUpDownFactor.Value;
ss.GLW = (int)numericUpDown1.Value;
ss.GLH = (int)numericUpDown2.Value;
ss.CartType = (LibYabause.CartType)Enum.Parse(typeof(LibYabause.CartType), (string)comboBoxCartType.SelectedItem);
GlobalWin.MainForm.PutCoreSyncSettings(ss);
}
}

View File

@ -163,6 +163,14 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libyabause_glsetnativefactor(int n);
public enum CartType : int
{
NONE = 0,
DRAM8MBIT = 6,
DRAM32MBIT = 7
}
/// <summary>
///
/// </summary>
@ -171,7 +179,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
/// <param name="usegl">true for opengl</param>
/// <returns></returns>
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool libyabause_init(ref CDInterface intf, string biosfn, bool usegl);
public static extern bool libyabause_init(ref CDInterface intf, string biosfn, bool usegl, CartType carttype);
public struct CDInterface
{

View File

@ -82,7 +82,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
string BiosPipe = fp.GetPipeNameNative();
fp.Offer(bios);
if (!LibYabause.libyabause_init(ref CDInt, BiosPipe, GL))
if (!LibYabause.libyabause_init(ref CDInt, BiosPipe, GL, SyncSettings.CartType))
throw new Exception("libyabause_init() failed!");
fp.Finish();
@ -670,10 +670,11 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
public bool DispFree = false;
public int GLW = 640;
public int GLH = 480;
public LibYabause.CartType CartType = LibYabause.CartType.NONE;
public static bool NeedsReboot(SaturnSyncSettings x, SaturnSyncSettings y)
{
return x.UseGL != y.UseGL;
return x.UseGL != y.UseGL || x.CartType != y.CartType;
}
public SaturnSyncSettings Clone()
{

Binary file not shown.

View File

@ -1479,6 +1479,15 @@ int CartSaveState(FILE * fp)
fwrite((void *)&CartridgeArea->carttype, 4, 1, fp);
// Write the areas associated with the cart type here
switch (CartridgeArea->carttype)
{
case CART_DRAM8MBIT:
fwrite(CartridgeArea->dram, 1, 0x100000, fp);
break;
case CART_DRAM32MBIT:
fwrite(CartridgeArea->dram, 1, 0x400000, fp);
break;
}
return StateFinishHeader(fp, offset);
}
@ -1494,6 +1503,19 @@ int CartLoadState(FILE * fp, UNUSED int version, int size)
// Check to see if old cart type and new cart type match, if they don't,
// reallocate memory areas
if (CartridgeArea->carttype != newtype)
{
// ...
}
switch (CartridgeArea->carttype)
{
case CART_DRAM8MBIT:
fread(CartridgeArea->dram, 1, 0x100000, fp);
break;
case CART_DRAM32MBIT:
fread(CartridgeArea->dram, 1, 0x400000, fp);
break;
}
// Read the areas associated with the cart type here

View File

@ -507,7 +507,7 @@ void vdp2newhook(u16 v)
}
}
extern "C" __declspec(dllexport) int libyabause_init(CDInterface *_CD, const char *biosfn, int usegl)
extern "C" __declspec(dllexport) int libyabause_init(CDInterface *_CD, const char *biosfn, int usegl, int carttype)
{
usinggl = usegl;
if (usegl && (!StartGLContext() || !LoadExtensions()))
@ -544,7 +544,7 @@ extern "C" __declspec(dllexport) int libyabause_init(CDInterface *_CD, const cha
yinit.cdpath = "Saturnus"; //NULL;
yinit.buppath = NULL;
yinit.mpegpath = NULL;
yinit.cartpath = NULL;
yinit.carttype = carttype;
yinit.netlinksetting = NULL;
yinit.videoformattype = VIDEOFORMATTYPE_NTSC;