preliminary work on accuracy core in sneshawk. it's building and usable, but savestates are utterly trashed.

This commit is contained in:
zeromus 2014-05-18 05:13:54 +00:00
parent 1f3809b08f
commit e9522af326
8 changed files with 221 additions and 142 deletions

View File

@ -28,134 +28,152 @@
/// </summary>
private void InitializeComponent()
{
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.rbCompatibility = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbPerformance = new System.Windows.Forms.RadioButton();
this.cbRingbuf = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.cbDoubleSize = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
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(141, 249);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
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(222, 249);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// rbCompatibility
//
this.rbCompatibility.AutoSize = true;
this.rbCompatibility.Location = new System.Drawing.Point(6, 19);
this.rbCompatibility.Name = "rbCompatibility";
this.rbCompatibility.Size = new System.Drawing.Size(83, 17);
this.rbCompatibility.TabIndex = 2;
this.rbCompatibility.TabStop = true;
this.rbCompatibility.Text = "Compatibility";
this.rbCompatibility.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rbPerformance);
this.groupBox1.Controls.Add(this.rbCompatibility);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(277, 70);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Core Selection";
//
// rbPerformance
//
this.rbPerformance.AutoSize = true;
this.rbPerformance.Location = new System.Drawing.Point(6, 42);
this.rbPerformance.Name = "rbPerformance";
this.rbPerformance.Size = new System.Drawing.Size(202, 17);
this.rbPerformance.TabIndex = 3;
this.rbPerformance.TabStop = true;
this.rbPerformance.Text = "Performance (only for casual gaming!)";
this.rbPerformance.UseVisualStyleBackColor = true;
//
// cbRingbuf
//
this.cbRingbuf.AutoSize = true;
this.cbRingbuf.Location = new System.Drawing.Point(18, 97);
this.cbRingbuf.Name = "cbRingbuf";
this.cbRingbuf.Size = new System.Drawing.Size(115, 17);
this.cbRingbuf.TabIndex = 4;
this.cbRingbuf.Text = "Use Ring Buffer IO";
this.cbRingbuf.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Location = new System.Drawing.Point(34, 117);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(254, 45);
this.label1.TabIndex = 5;
this.label1.Text = "This was designed as an optimization but it isn\'t clear whether it works. Feel fr" +
"ee to try different settings and let us know the results.";
//
// cbDoubleSize
//
this.cbDoubleSize.AutoSize = true;
this.cbDoubleSize.Location = new System.Drawing.Point(18, 165);
this.cbDoubleSize.Name = "cbDoubleSize";
this.cbDoubleSize.Size = new System.Drawing.Size(178, 17);
this.cbDoubleSize.TabIndex = 6;
this.cbDoubleSize.Text = "Always Double-Size Framebuffer";
this.cbDoubleSize.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.Location = new System.Drawing.Point(36, 186);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(254, 45);
this.label2.TabIndex = 7;
this.label2.Text = "Some games are changing the resolution constantly (e.g. SD3) so this option can f" +
"orce the SNES output to stay double-size always.";
//
// 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(300, 275);
this.Controls.Add(this.label2);
this.Controls.Add(this.cbDoubleSize);
this.Controls.Add(this.label1);
this.Controls.Add(this.cbRingbuf);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Name = "SNESOptions";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SNES Options";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.rbCompatibility = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbAccuracy = new System.Windows.Forms.RadioButton();
this.rbPerformance = new System.Windows.Forms.RadioButton();
this.cbRingbuf = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.cbDoubleSize = new System.Windows.Forms.CheckBox();
this.lblDoubleSize = new System.Windows.Forms.Label();
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, 254);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
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, 254);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// rbCompatibility
//
this.rbCompatibility.AutoSize = true;
this.rbCompatibility.Location = new System.Drawing.Point(6, 19);
this.rbCompatibility.Name = "rbCompatibility";
this.rbCompatibility.Size = new System.Drawing.Size(202, 17);
this.rbCompatibility.TabIndex = 2;
this.rbCompatibility.TabStop = true;
this.rbCompatibility.Text = "Compatibility (more debug tools work!)";
this.rbCompatibility.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rbAccuracy);
this.groupBox1.Controls.Add(this.rbPerformance);
this.groupBox1.Controls.Add(this.rbCompatibility);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(277, 90);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Core Selection";
//
// rbAccuracy
//
this.rbAccuracy.AutoSize = true;
this.rbAccuracy.Location = new System.Drawing.Point(6, 65);
this.rbAccuracy.Name = "rbAccuracy";
this.rbAccuracy.Size = new System.Drawing.Size(224, 17);
this.rbAccuracy.TabIndex = 4;
this.rbAccuracy.TabStop = true;
this.rbAccuracy.Text = "Accuracy (only to fix bugs in Compatibility!)";
this.rbAccuracy.UseVisualStyleBackColor = true;
this.rbAccuracy.CheckedChanged += new System.EventHandler(this.rbAccuracy_CheckedChanged);
//
// rbPerformance
//
this.rbPerformance.AutoSize = true;
this.rbPerformance.Location = new System.Drawing.Point(6, 42);
this.rbPerformance.Name = "rbPerformance";
this.rbPerformance.Size = new System.Drawing.Size(202, 17);
this.rbPerformance.TabIndex = 3;
this.rbPerformance.TabStop = true;
this.rbPerformance.Text = "Performance (only for casual gaming!)";
this.rbPerformance.UseVisualStyleBackColor = true;
//
// cbRingbuf
//
this.cbRingbuf.AutoSize = true;
this.cbRingbuf.Location = new System.Drawing.Point(17, 112);
this.cbRingbuf.Name = "cbRingbuf";
this.cbRingbuf.Size = new System.Drawing.Size(115, 17);
this.cbRingbuf.TabIndex = 4;
this.cbRingbuf.Text = "Use Ring Buffer IO";
this.cbRingbuf.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Location = new System.Drawing.Point(33, 132);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(254, 45);
this.label1.TabIndex = 5;
this.label1.Text = "Performance-affecting option; results differ for different users\' systems.";
//
// cbDoubleSize
//
this.cbDoubleSize.AutoSize = true;
this.cbDoubleSize.Location = new System.Drawing.Point(16, 167);
this.cbDoubleSize.Name = "cbDoubleSize";
this.cbDoubleSize.Size = new System.Drawing.Size(178, 17);
this.cbDoubleSize.TabIndex = 6;
this.cbDoubleSize.Text = "Always Double-Size Framebuffer";
this.cbDoubleSize.UseVisualStyleBackColor = true;
this.cbDoubleSize.CheckedChanged += new System.EventHandler(this.cbDoubleSize_CheckedChanged);
//
// lblDoubleSize
//
this.lblDoubleSize.Location = new System.Drawing.Point(34, 188);
this.lblDoubleSize.Name = "lblDoubleSize";
this.lblDoubleSize.Size = new System.Drawing.Size(254, 57);
this.lblDoubleSize.TabIndex = 7;
this.lblDoubleSize.Text = "Some games are changing the resolution constantly (e.g. SD3) so this option can f" +
"orce the SNES output to stay double-size always. NOTE: The Accuracy core runs as" +
" if this is selected.\r\n";
//
// 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, 289);
this.Controls.Add(this.lblDoubleSize);
this.Controls.Add(this.cbDoubleSize);
this.Controls.Add(this.label1);
this.Controls.Add(this.cbRingbuf);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SNESOptions";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SNES Options";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -169,6 +187,7 @@
private System.Windows.Forms.CheckBox cbRingbuf;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox cbDoubleSize;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lblDoubleSize;
private System.Windows.Forms.RadioButton rbAccuracy;
}
}

View File

@ -12,13 +12,24 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
}
bool SuppressDoubleSize;
bool UserDoubleSizeOption;
public string Profile
{
get { return rbCompatibility.Checked ? "Compatibility" : "Performance"; }
get
{
if (rbCompatibility.Checked) return "Compatibility";
else if (rbPerformance.Checked) return "Performance";
else if (rbAccuracy.Checked) return "Accuracy";
else throw new InvalidOperationException();
}
set
{
rbCompatibility.Checked = (value == "Compatibility");
rbPerformance.Checked = (value == "Performance");
rbAccuracy.Checked = (value == "Accuracy");
}
}
@ -30,8 +41,8 @@ namespace BizHawk.Client.EmuHawk
public bool AlwaysDoubleSize
{
get { return cbDoubleSize.Checked; }
set { cbDoubleSize.Checked = value; }
get { return UserDoubleSizeOption; }
set { UserDoubleSizeOption = value; RefreshDoubleSizeOption(); }
}
private void btnOk_Click(object sender, EventArgs e)
@ -67,5 +78,28 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.PutCoreSyncSettings(ss);
}
}
private void rbAccuracy_CheckedChanged(object sender, EventArgs e)
{
cbDoubleSize.Enabled = !rbAccuracy.Checked;
lblDoubleSize.ForeColor = cbDoubleSize.Enabled ? System.Drawing.SystemColors.ControlText : System.Drawing.SystemColors.GrayText;
RefreshDoubleSizeOption();
}
void RefreshDoubleSizeOption()
{
SuppressDoubleSize = true;
if (cbDoubleSize.Enabled)
cbDoubleSize.Checked = UserDoubleSizeOption;
else cbDoubleSize.Checked = true;
SuppressDoubleSize = false;
}
private void cbDoubleSize_CheckedChanged(object sender, EventArgs e)
{
if (SuppressDoubleSize) return;
UserDoubleSizeOption = cbDoubleSize.Checked;
}
}
}

View File

@ -6,6 +6,8 @@
./bizwinclean.sh
./bizwinmakeone.sh 32 performance compress
./bizwinclean.sh
./bizwinmakeone.sh 32 accuracy compress
./bizwinclean.sh
./bizwinmakeone.sh 32 compatibility compress
#leave compatibility built as objs because thats more useful to us while devving

View File

@ -225,7 +225,8 @@ void DSP::power() {
memset(&state.regs, 0, sizeof state.regs);
//zero 01-dec-2012 - gotta reset these sometime, somewhere
state.echo_hist[0] = state.echo_hist[1] = 0;
//zero 17-may-2014 - WHAT?
//state.echo_hist[0] = state.echo_hist[1] = 0;
state.echo_hist_pos = 0;
state.every_other_sample = false;

View File

@ -90,9 +90,13 @@ void PPU::power() {
ppu1_version = config.ppu1.version;
ppu2_version = config.ppu2.version;
for(auto &n : vram) n = random(0x00);
for(auto &n : oam) n = random(0x00);
for(auto &n : cgram) n = random(0x00);
for(int i=0;i<128*1024;i++) vram[i] = 0;
for(int i=0;i<544;i++) oam[i] = 0;
for(int i=0;i<512;i++) cgram[i] = 0;
//not sure about this
reset();
}
void PPU::reset() {
@ -138,6 +142,20 @@ void PPU::frame() {
display.overscan = regs.overscan;
}
void PPU::layer_enable(unsigned layer, unsigned priority, bool enable)
{
//TODO
}
void PPU::initialize()
{
vram = (uint8*)interface()->allocSharedMemory("VRAM",128 * 1024);
oam = (uint8*)interface()->allocSharedMemory("OAM",544);
cgram = (uint8*)interface()->allocSharedMemory("CGRAM",512);
surface = new uint32[512 * 512];
output = surface + 16 * 512;
}
PPU::PPU() :
bg1(*this, Background::ID::BG1),
bg2(*this, Background::ID::BG2),
@ -146,12 +164,14 @@ bg4(*this, Background::ID::BG4),
sprite(*this),
window(*this),
screen(*this) {
surface = new uint32[512 * 512];
output = surface + 16 * 512;
}
PPU::~PPU() {
delete[] surface;
interface()->freeSharedMemory(vram);
interface()->freeSharedMemory(oam);
interface()->freeSharedMemory(cgram);
}
}

View File

@ -1,7 +1,7 @@
struct PPU : public Processor, public PPUcounter {
uint8 vram[64 * 1024];
uint8 oam[544];
uint8 cgram[512];
uint8 *vram; //[64 * 1024];
uint8 *oam; //[544];
uint8 *cgram; //[512];
enum : bool { Threaded = true };
alwaysinline void step(unsigned clocks);
@ -16,8 +16,10 @@ struct PPU : public Processor, public PPUcounter {
void enable();
void power();
void reset();
void layer_enable(unsigned layer, unsigned priority, bool enable);
void serialize(serializer&);
void initialize();
PPU();
~PPU();

View File

@ -367,7 +367,8 @@ int snes_peek_logical_register(int reg)
switch(reg)
{
//$2105
#if !defined(PROFILE_PERFORMANCE)
//zero 17-may-2014 TODO - enable these for other profiles
#if !defined(PROFILE_PERFORMANCE) && !defined(PROFILE_ACCURACY)
case SNES_REG_BG_MODE: return SNES::ppu.regs.bg_mode;
case SNES_REG_BG3_PRIORITY: return SNES::ppu.regs.bg3_priority;
case SNES_REG_BG1_TILESIZE: return SNES::ppu.regs.bg_tilesize[SNES::PPU::BG1];

Binary file not shown.