saturn: expose skip bios and RTC options as syncsettings

This commit is contained in:
goyuken 2014-05-28 17:31:22 +00:00
parent fd6a1fdac8
commit d24658888b
13 changed files with 181 additions and 497 deletions

View File

@ -384,12 +384,6 @@
<Compile Include="config\RewindConfig.Designer.cs">
<DependentUpon>RewindConfig.cs</DependentUpon>
</Compile>
<Compile Include="config\Saturn\SaturnPrefs.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="config\Saturn\SaturnPrefs.Designer.cs">
<DependentUpon>SaturnPrefs.cs</DependentUpon>
</Compile>
<Compile Include="config\SMS\SMSGraphicsConfig.cs">
<SubType>Form</SubType>
</Compile>
@ -1091,9 +1085,6 @@
<EmbeddedResource Include="config\RewindConfig.resx">
<DependentUpon>RewindConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\Saturn\SaturnPrefs.resx">
<DependentUpon>SaturnPrefs.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\SMS\SMSGraphicsConfig.resx">
<DependentUpon>SMSGraphicsConfig.cs</DependentUpon>
</EmbeddedResource>
@ -1594,7 +1585,9 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="config\Saturn\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1689,10 +1689,13 @@ namespace BizHawk.Client.EmuHawk
private void SaturnPreferencesMenuItem_Click(object sender, EventArgs e)
{
GenericCoreConfig.DoDialog(this, "Saturn Settings");
/* -- delete me, out of date
using (var dlg = new SaturnPrefs())
{
dlg.ShowDialog(this);
}
* */
}
#endregion

View File

@ -1,294 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class SaturnPrefs
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </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.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[] {
1024,
0,
0,
0});
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[] {
224,
0,
0,
0});
//
// 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[] {
2048,
0,
0,
0});
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[] {
320,
0,
0,
0});
//
// 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[] {
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[] {
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(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);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton radioButtonGL;
private System.Windows.Forms.RadioButton radioButtonSoft;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.NumericUpDown numericUpDownFactor;
private System.Windows.Forms.RadioButton radioButtonFree;
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

@ -1,62 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Sega.Saturn;
namespace BizHawk.Client.EmuHawk
{
public partial class SaturnPrefs : Form
{
public SaturnPrefs()
{
InitializeComponent();
comboBoxCartType.Items.AddRange(Enum.GetNames(typeof(LibYabause.CartType)));
try
{
var ss = (Yabause.SaturnSyncSettings)Global.Emulator.GetSyncSettings();
radioButtonGL.Checked = ss.UseGL;
radioButtonSoft.Checked = !ss.UseGL;
radioButtonFree.Checked = ss.DispFree;
radioButtonFactor.Checked = !ss.DispFree;
numericUpDownFactor.Value = ss.DispFactor;
numericUpDown1.Value = ss.GLW;
numericUpDown2.Value = ss.GLH;
comboBoxCartType.SelectedItem = Enum.GetName(typeof(LibYabause.CartType), ss.CartType);
}
catch (ArgumentOutOfRangeException)
{
}
}
private void radioButtonSoft_CheckedChanged(object sender, EventArgs e)
{
groupBox2.Enabled = radioButtonGL.Checked;
}
private void radioButtonFactor_CheckedChanged(object sender, EventArgs e)
{
numericUpDownFactor.Enabled = radioButtonFactor.Checked;
numericUpDown1.Enabled = numericUpDown2.Enabled = radioButtonFree.Checked;
}
private void buttonOK_Click(object sender, EventArgs e)
{
var ss = (Yabause.SaturnSyncSettings)Global.Emulator.GetSyncSettings();
ss.UseGL = radioButtonGL.Checked;
ss.DispFree = radioButtonFree.Checked;
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

@ -1,120 +0,0 @@
<?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

@ -65,6 +65,7 @@
<Compile Include="QuickCollections.cs" />
<Compile Include="ReflectionUtil.cs" />
<Compile Include="Serializer.cs" />
<Compile Include="SettingsUtil.cs" />
<Compile Include="SwitcherStream.cs" />
<Compile Include="UndoHistory.cs" />
<Compile Include="Util.cs" />

View File

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Reflection.Emit;
using System.Collections.Concurrent;
using System.ComponentModel;
namespace BizHawk.Common
{
public class SettingsUtil
{
private class DefaultValueSetter
{
public Action<object, object[]> SetDefaultValues;
public Type Type;
public object[] DefaultValues;
}
private static IDictionary<Type, DefaultValueSetter> DefaultValueSetters = new ConcurrentDictionary<Type, DefaultValueSetter>();
public static void SetDefaultValues<T>(T obj)
{
DefaultValueSetter f;
if (!DefaultValueSetters.TryGetValue(typeof(T), out f))
{
f = CreateSetter(typeof(T));
DefaultValueSetters[typeof(T)] = f;
}
f.SetDefaultValues(obj, f.DefaultValues);
}
private static DefaultValueSetter CreateSetter(Type t)
{
//var dyn = new DynamicMethod("SetDefaultValues_" + t.Name, null, new[] { t }, true);
var dyn = new DynamicMethod("SetDefaultValues_" + t.Name, null, new[] { typeof(object), typeof(object[]) }, false);
var il = dyn.GetILGenerator();
List<object> DefaultValues = new List<object>();
il.Emit(OpCodes.Ldarg_0); // arg0: object to set properties of
il.Emit(OpCodes.Castclass, t); // cast to appropriate type
foreach (var prop in t.GetProperties())
{
if (!prop.CanWrite)
continue;
MethodInfo method = prop.GetSetMethod(true);
foreach (object attr in prop.GetCustomAttributes(true))
{
if (attr is DefaultValueAttribute)
{
object value = (attr as DefaultValueAttribute).Value;
Type desiredType = method.GetParameters()[0].ParameterType;
if (!desiredType.IsAssignableFrom(value.GetType()))
throw new InvalidOperationException(string.Format("Default value assignment will fail for {0}.{1}", t.Name, prop.Name));
int idx = DefaultValues.Count;
DefaultValues.Add(value);
il.Emit(OpCodes.Dup); // object to act on
il.Emit(OpCodes.Ldarg_1); // arg1: array of default values
il.Emit(OpCodes.Ldc_I4, idx); // load index
il.Emit(OpCodes.Ldelem, typeof(object)); // get default value at appropriate index
il.Emit(OpCodes.Unbox_Any, desiredType); // cast to expected type of set method
il.Emit(OpCodes.Callvirt, method);
}
}
}
il.Emit(OpCodes.Pop);
il.Emit(OpCodes.Ret);
return new DefaultValueSetter
{
SetDefaultValues = (Action<object, object[]>)dyn.CreateDelegate(typeof(Action<object, object[]>)),
Type = t,
DefaultValues = DefaultValues.ToArray()
};
}
}
}

View File

@ -177,9 +177,12 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
/// <param name="intf">cd interface. struct need not persist after call, but the function pointers better</param>
/// <param name="biosfn">path to bios, pass null to use built in bios emulation</param>
/// <param name="usegl">true for opengl</param>
/// <param name="quickload">if true, skip bios opening</param>
/// <param name="clocksync">if true, sync RTC to actual emulated time; if false, use real real time</param>
/// <param name="clockbase">if non-zero, initial emulation time in unix format</param>
/// <returns></returns>
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool libyabause_init(ref CDInterface intf, string biosfn, bool usegl, CartType carttype);
public static extern bool libyabause_init(ref CDInterface intf, string biosfn, bool usegl, CartType carttype, bool quickload, bool clocksync, int clockbase);
public struct CDInterface
{

View File

@ -4,11 +4,14 @@ using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
using System.ComponentModel;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.DiscSystem;
using Newtonsoft.Json;
namespace BizHawk.Emulation.Cores.Sega.Saturn
{
[CoreAttributes(
@ -88,7 +91,23 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
string BiosPipe = fp.GetPipeNameNative();
fp.Offer(bios);
if (!LibYabause.libyabause_init(ref CDInt, BiosPipe, GL, SyncSettings.CartType))
int basetime;
if (SyncSettings.RealTimeRTC)
basetime = 0;
else
basetime = (int)((SyncSettings.RTCInitialTime - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds);
if (!LibYabause.libyabause_init
(
ref CDInt,
BiosPipe,
GL,
SyncSettings.CartType,
SyncSettings.SkipBios,
!SyncSettings.RealTimeRTC,
basetime
))
throw new Exception("libyabause_init() failed!");
fp.Finish();
@ -664,21 +683,60 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
public class SaturnSyncSettings
{
public bool UseGL = false;
public int DispFactor = 1;
public bool DispFree = false;
public int GLW = 640;
public int GLH = 480;
public LibYabause.CartType CartType = LibYabause.CartType.NONE;
[Description("Use OpenGL mode for rendering instead of software.")]
[DefaultValue(false)]
public bool UseGL { get; set; }
[Description("In OpenGL mode, the internal resolution as a multiple of the normal internal resolution (1x, 2x, 3x, 4x). Ignored in software mode or when a custom resolution is used.")]
[DefaultValue(1)]
public int DispFactor { get { return _DispFactor; } set { _DispFactor = Math.Max(1, Math.Min(value, 4)); } }
[JsonIgnore]
private int _DispFactor;
[Description("In OpenGL mode, set to true to use a custom resolution and ignore DispFactor.")]
[DefaultValue(false)]
public bool DispFree { get; set; }
[Description("In OpenGL mode and when DispFree is true, the width of the final resolution.")]
[DefaultValue(640)]
public int GLW { get { return _GLW; } set { _GLW = Math.Max(320, Math.Min(value, 2048)); } }
[JsonIgnore]
private int _GLW;
[Description("In OpenGL mode and when DispFree is true, the height of the final resolution.")]
[DefaultValue(480)]
public int GLH { get { return _GLH; } set { _GLH = Math.Max(224, Math.Min(value, 1024)); } }
[JsonIgnore]
private int _GLH;
[Description("The type of the attached RAM cart. Most games will not use this.")]
[DefaultValue(LibYabause.CartType.NONE)]
public LibYabause.CartType CartType { get; set; }
[Description("Skip the Bios Intro screen.")]
[DefaultValue(false)]
public bool SkipBios { get; set; }
[Description("If true, the real time clock will reflect real time, instead of emulated time. Ignored (forced to false) when a movie is recording.")]
[DefaultValue(false)]
public bool RealTimeRTC { get; set; }
[Description("Set the initial RTC time. Only used when RealTimeRTC is false.")]
[DefaultValue(typeof(DateTime), "2010-01-01")]
public DateTime RTCInitialTime { get; set; }
public static bool NeedsReboot(SaturnSyncSettings x, SaturnSyncSettings y)
{
return x.UseGL != y.UseGL || x.CartType != y.CartType;
return x.UseGL != y.UseGL || x.CartType != y.CartType || x.SkipBios != y.SkipBios || x.RealTimeRTC != y.RealTimeRTC || x.RTCInitialTime != y.RTCInitialTime;
}
public SaturnSyncSettings Clone()
{
return (SaturnSyncSettings)MemberwiseClone();
}
public SaturnSyncSettings()
{
SettingsUtil.SetDefaultValues<SaturnSyncSettings>(this);
}
}
}
}

Binary file not shown.

View File

@ -57,6 +57,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /y $(TargetDir)$(TargetFileName) $(ProjectDir)..\..\..\output\dll\$(TargetFileName)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@ -76,6 +79,9 @@
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /y $(TargetDir)$(TargetFileName) $(ProjectDir)..\..\..\output\dll\$(TargetFileName)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\bios.c" />

View File

@ -507,7 +507,16 @@ void vdp2newhook(u16 v)
}
}
extern "C" __declspec(dllexport) int libyabause_init(CDInterface *_CD, const char *biosfn, int usegl, int carttype)
extern "C" __declspec(dllexport) int libyabause_init
(
CDInterface *_CD,
const char *biosfn,
int usegl,
int carttype,
int quickload,
int clocksync,
int clockbase
)
{
usinggl = usegl;
if (usegl && (!StartGLContext() || !LoadExtensions()))
@ -547,6 +556,11 @@ extern "C" __declspec(dllexport) int libyabause_init(CDInterface *_CD, const cha
yinit.carttype = carttype;
yinit.netlinksetting = NULL;
yinit.videoformattype = VIDEOFORMATTYPE_NTSC;
yabsys.usequickload = quickload;
yinit.usethreads = 0;
yinit.frameskip = 0;
yinit.clocksync = clocksync;
yinit.basetime = clockbase; // same format as return from time(); 0 to use time()
if (usegl && !vdp2hookfcn)
{

View File

@ -250,7 +250,7 @@ int YabauseInit(yabauseinit_struct *init)
else
yabsys.emulatebios = 1;
yabsys.usequickload = 0;
//yabsys.usequickload = 0;
#if defined(SH2_DYNAREC)
if(SH2Core->id==2) {