fix #1701
fix #1285

Co-authored-by: nattthebear <goyuken@gmail.com>
This commit is contained in:
feos 2020-05-18 21:11:18 +03:00 committed by GitHub
parent 4555be85bc
commit e075012b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 239 additions and 211 deletions

Binary file not shown.

View File

@ -35,21 +35,22 @@
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.cbCropSGBFrame = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.Obj1Checkbox = new System.Windows.Forms.CheckBox();
this.Obj2Checkbox = new System.Windows.Forms.CheckBox();
this.Obj3Checkbox = new System.Windows.Forms.CheckBox();
this.Obj4Checkbox = new System.Windows.Forms.CheckBox();
this.Bg1Checkbox = new System.Windows.Forms.CheckBox();
this.Bg2Checkbox = new System.Windows.Forms.CheckBox();
this.Bg3Checkbox = new System.Windows.Forms.CheckBox();
this.Bg4Checkbox = new System.Windows.Forms.CheckBox();
this.Bg3Checkbox = new System.Windows.Forms.CheckBox();
this.Bg2Checkbox = new System.Windows.Forms.CheckBox();
this.Bg1Checkbox = new System.Windows.Forms.CheckBox();
this.Obj4Checkbox = new System.Windows.Forms.CheckBox();
this.Obj3Checkbox = new System.Windows.Forms.CheckBox();
this.Obj2Checkbox = new System.Windows.Forms.CheckBox();
this.Obj1Checkbox = new System.Windows.Forms.CheckBox();
this.cbRandomizedInitialState = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.Location = new System.Drawing.Point(136, 288);
this.btnOk.Location = new System.Drawing.Point(136, 303);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
@ -61,7 +62,7 @@
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(217, 288);
this.btnCancel.Location = new System.Drawing.Point(217, 303);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
@ -113,8 +114,7 @@
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.Bg4Checkbox);
this.groupBox1.Controls.Add(this.Bg3Checkbox);
@ -124,83 +124,13 @@
this.groupBox1.Controls.Add(this.Obj3Checkbox);
this.groupBox1.Controls.Add(this.Obj2Checkbox);
this.groupBox1.Controls.Add(this.Obj1Checkbox);
this.groupBox1.Location = new System.Drawing.Point(18, 142);
this.groupBox1.Location = new System.Drawing.Point(18, 165);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(274, 140);
this.groupBox1.Size = new System.Drawing.Size(274, 132);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Display";
//
// Obj1Checkbox
//
this.Obj1Checkbox.AutoSize = true;
this.Obj1Checkbox.Location = new System.Drawing.Point(21, 29);
this.Obj1Checkbox.Name = "Obj1Checkbox";
this.Obj1Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj1Checkbox.TabIndex = 0;
this.Obj1Checkbox.Text = "OBJ 1";
this.Obj1Checkbox.UseVisualStyleBackColor = true;
//
// Obj2Checkbox
//
this.Obj2Checkbox.AutoSize = true;
this.Obj2Checkbox.Location = new System.Drawing.Point(22, 52);
this.Obj2Checkbox.Name = "Obj2Checkbox";
this.Obj2Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj2Checkbox.TabIndex = 1;
this.Obj2Checkbox.Text = "OBJ 2";
this.Obj2Checkbox.UseVisualStyleBackColor = true;
//
// Obj3Checkbox
//
this.Obj3Checkbox.AutoSize = true;
this.Obj3Checkbox.Location = new System.Drawing.Point(21, 75);
this.Obj3Checkbox.Name = "Obj3Checkbox";
this.Obj3Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj3Checkbox.TabIndex = 2;
this.Obj3Checkbox.Text = "OBJ 3";
this.Obj3Checkbox.UseVisualStyleBackColor = true;
//
// Obj4Checkbox
//
this.Obj4Checkbox.AutoSize = true;
this.Obj4Checkbox.Location = new System.Drawing.Point(21, 98);
this.Obj4Checkbox.Name = "Obj4Checkbox";
this.Obj4Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj4Checkbox.TabIndex = 3;
this.Obj4Checkbox.Text = "OBJ 4";
this.Obj4Checkbox.UseVisualStyleBackColor = true;
//
// Bg1Checkbox
//
this.Bg1Checkbox.AutoSize = true;
this.Bg1Checkbox.Location = new System.Drawing.Point(150, 29);
this.Bg1Checkbox.Name = "Bg1Checkbox";
this.Bg1Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg1Checkbox.TabIndex = 4;
this.Bg1Checkbox.Text = "BG 1";
this.Bg1Checkbox.UseVisualStyleBackColor = true;
//
// Bg2Checkbox
//
this.Bg2Checkbox.AutoSize = true;
this.Bg2Checkbox.Location = new System.Drawing.Point(150, 52);
this.Bg2Checkbox.Name = "Bg2Checkbox";
this.Bg2Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg2Checkbox.TabIndex = 5;
this.Bg2Checkbox.Text = "BG 2";
this.Bg2Checkbox.UseVisualStyleBackColor = true;
//
// Bg3Checkbox
//
this.Bg3Checkbox.AutoSize = true;
this.Bg3Checkbox.Location = new System.Drawing.Point(150, 75);
this.Bg3Checkbox.Name = "Bg3Checkbox";
this.Bg3Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg3Checkbox.TabIndex = 6;
this.Bg3Checkbox.Text = "BG 3";
this.Bg3Checkbox.UseVisualStyleBackColor = true;
//
// Bg4Checkbox
//
this.Bg4Checkbox.AutoSize = true;
@ -211,13 +141,94 @@
this.Bg4Checkbox.Text = "BG 4";
this.Bg4Checkbox.UseVisualStyleBackColor = true;
//
// Bg3Checkbox
//
this.Bg3Checkbox.AutoSize = true;
this.Bg3Checkbox.Location = new System.Drawing.Point(150, 75);
this.Bg3Checkbox.Name = "Bg3Checkbox";
this.Bg3Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg3Checkbox.TabIndex = 6;
this.Bg3Checkbox.Text = "BG 3";
this.Bg3Checkbox.UseVisualStyleBackColor = true;
//
// Bg2Checkbox
//
this.Bg2Checkbox.AutoSize = true;
this.Bg2Checkbox.Location = new System.Drawing.Point(150, 52);
this.Bg2Checkbox.Name = "Bg2Checkbox";
this.Bg2Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg2Checkbox.TabIndex = 5;
this.Bg2Checkbox.Text = "BG 2";
this.Bg2Checkbox.UseVisualStyleBackColor = true;
//
// Bg1Checkbox
//
this.Bg1Checkbox.AutoSize = true;
this.Bg1Checkbox.Location = new System.Drawing.Point(150, 29);
this.Bg1Checkbox.Name = "Bg1Checkbox";
this.Bg1Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg1Checkbox.TabIndex = 4;
this.Bg1Checkbox.Text = "BG 1";
this.Bg1Checkbox.UseVisualStyleBackColor = true;
//
// Obj4Checkbox
//
this.Obj4Checkbox.AutoSize = true;
this.Obj4Checkbox.Location = new System.Drawing.Point(21, 98);
this.Obj4Checkbox.Name = "Obj4Checkbox";
this.Obj4Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj4Checkbox.TabIndex = 3;
this.Obj4Checkbox.Text = "OBJ 4";
this.Obj4Checkbox.UseVisualStyleBackColor = true;
//
// Obj3Checkbox
//
this.Obj3Checkbox.AutoSize = true;
this.Obj3Checkbox.Location = new System.Drawing.Point(21, 75);
this.Obj3Checkbox.Name = "Obj3Checkbox";
this.Obj3Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj3Checkbox.TabIndex = 2;
this.Obj3Checkbox.Text = "OBJ 3";
this.Obj3Checkbox.UseVisualStyleBackColor = true;
//
// Obj2Checkbox
//
this.Obj2Checkbox.AutoSize = true;
this.Obj2Checkbox.Location = new System.Drawing.Point(22, 52);
this.Obj2Checkbox.Name = "Obj2Checkbox";
this.Obj2Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj2Checkbox.TabIndex = 1;
this.Obj2Checkbox.Text = "OBJ 2";
this.Obj2Checkbox.UseVisualStyleBackColor = true;
//
// Obj1Checkbox
//
this.Obj1Checkbox.AutoSize = true;
this.Obj1Checkbox.Location = new System.Drawing.Point(21, 29);
this.Obj1Checkbox.Name = "Obj1Checkbox";
this.Obj1Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj1Checkbox.TabIndex = 0;
this.Obj1Checkbox.Text = "OBJ 1";
this.Obj1Checkbox.UseVisualStyleBackColor = true;
//
// cbRandomizedInitialState
//
this.cbRandomizedInitialState.AutoSize = true;
this.cbRandomizedInitialState.Location = new System.Drawing.Point(15, 133);
this.cbRandomizedInitialState.Name = "cbRandomizedInitialState";
this.cbRandomizedInitialState.Size = new System.Drawing.Size(140, 17);
this.cbRandomizedInitialState.TabIndex = 12;
this.cbRandomizedInitialState.Text = "Randomized Initial State";
this.cbRandomizedInitialState.UseVisualStyleBackColor = true;
//
// SNESOptions
//
this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(304, 323);
this.ClientSize = new System.Drawing.Size(304, 338);
this.Controls.Add(this.cbRandomizedInitialState);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.cbCropSGBFrame);
this.Controls.Add(this.lblDoubleSize);
@ -255,5 +266,6 @@
private System.Windows.Forms.CheckBox Obj3Checkbox;
private System.Windows.Forms.CheckBox Obj2Checkbox;
private System.Windows.Forms.CheckBox Obj1Checkbox;
private System.Windows.Forms.CheckBox cbRandomizedInitialState;
}
}

View File

@ -20,6 +20,7 @@ namespace BizHawk.Client.EmuHawk
var ss = bsnes.GetSyncSettings();
using var dlg = new SNESOptions
{
RandomizedInitialState = ss.RandomizedInitialState,
AlwaysDoubleSize = s.AlwaysDoubleSize,
CropSGBFrame = s.CropSGBFrame,
ShowObj1 = s.ShowOBJ_0,
@ -37,6 +38,7 @@ namespace BizHawk.Client.EmuHawk
{
s.AlwaysDoubleSize = dlg.AlwaysDoubleSize;
s.CropSGBFrame = dlg.CropSGBFrame;
ss.RandomizedInitialState = dlg.RandomizedInitialState;
s.ShowOBJ_0 = dlg.ShowObj1;
s.ShowOBJ_1 = dlg.ShowObj2;
s.ShowOBJ_2 = dlg.ShowObj3;
@ -67,6 +69,12 @@ namespace BizHawk.Client.EmuHawk
set => cbCropSGBFrame.Checked = value;
}
private bool RandomizedInitialState
{
get => cbRandomizedInitialState.Checked;
set => cbRandomizedInitialState.Checked = value;
}
private bool ShowObj1 { get => Obj1Checkbox.Checked; set => Obj1Checkbox.Checked = value;
}
private bool ShowObj2 { get => Obj2Checkbox.Checked; set => Obj2Checkbox.Checked = value; }

View File

@ -18,11 +18,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
}
}
public void CMD_init()
public void CMD_init(bool randomize)
{
using (_exe.EnterExit())
{
_comm->value = randomize ? 1u : 0u;
_core.Message(eMessage.eMessage_CMD_init);
WaitForCMD();
}
}
public void CMD_power()
{
_core.Message(eMessage.eMessage_CMD_power);

View File

@ -30,7 +30,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{
bool ret = o.LeftPort != _syncSettings.LeftPort
|| o.RightPort != _syncSettings.RightPort
|| o.LimitAnalogChangeSensitivity != _syncSettings.LimitAnalogChangeSensitivity;
|| o.LimitAnalogChangeSensitivity != _syncSettings.LimitAnalogChangeSensitivity
|| o.RandomizedInitialState != _syncSettings.RandomizedInitialState;
_syncSettings = o;
return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None;
@ -71,6 +72,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public bool LimitAnalogChangeSensitivity { get; set; } = true;
public bool RandomizedInitialState { get; set; } = true;
public SnesSyncSettings Clone()
{
return (SnesSyncSettings)MemberwiseClone();

View File

@ -76,7 +76,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
_controllerDeck = new LibsnesControllerDeck(_syncSettings);
_controllerDeck.NativeInit(Api);
Api.CMD_init();
Api.CMD_init(_syncSettings.RandomizedInitialState);
Api.QUERY_set_path_request(snes_path_request);

View File

@ -59,7 +59,7 @@ void Cartridge::load(System::Revision revision, const string &markup, const uint
case Mapper::HuC3: mapper = &huc3; break;
}
ramdata = (uint8_t*)interface->allocSharedMemory("SGB_CARTRAM",ramsize = info.ramsize);
ramdata = (uint8_t*)interface->allocSharedMemory("SGB_CARTRAM",ramsize = info.ramsize, 0xff);
system.load(revision);
loaded = true;

View File

@ -414,6 +414,7 @@ void CMD_LoadCartridgeSGB()
void CMD_init()
{
SNES::config.random = !!comm.value;
snes_init();
SNES::input.connect(SNES::Controller::Port1, comm.inports[0]);