diff --git a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs index 539d79fa5a..44c47ea804 100644 --- a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs @@ -28,134 +28,152 @@ /// 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; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs index e417028b4e..1c18ae1958 100644 --- a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs +++ b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs @@ -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; + } + } } diff --git a/libsnes/bizwinmakedistro.sh b/libsnes/bizwinmakedistro.sh index a2de094ed4..f90258df83 100644 --- a/libsnes/bizwinmakedistro.sh +++ b/libsnes/bizwinmakedistro.sh @@ -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 diff --git a/libsnes/bsnes/snes/dsp/dsp.cpp b/libsnes/bsnes/snes/dsp/dsp.cpp index 69011aada1..f03b319e81 100644 --- a/libsnes/bsnes/snes/dsp/dsp.cpp +++ b/libsnes/bsnes/snes/dsp/dsp.cpp @@ -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; diff --git a/libsnes/bsnes/snes/ppu/ppu.cpp b/libsnes/bsnes/snes/ppu/ppu.cpp index 34fde2449a..ba0ca1c2fb 100644 --- a/libsnes/bsnes/snes/ppu/ppu.cpp +++ b/libsnes/bsnes/snes/ppu/ppu.cpp @@ -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); } } diff --git a/libsnes/bsnes/snes/ppu/ppu.hpp b/libsnes/bsnes/snes/ppu/ppu.hpp index 08acf4b056..01748c472f 100644 --- a/libsnes/bsnes/snes/ppu/ppu.hpp +++ b/libsnes/bsnes/snes/ppu/ppu.hpp @@ -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(); diff --git a/libsnes/bsnes/target-libsnes/libsnes.cpp b/libsnes/bsnes/target-libsnes/libsnes.cpp index e70716c39a..0c7a578910 100644 --- a/libsnes/bsnes/target-libsnes/libsnes.cpp +++ b/libsnes/bsnes/target-libsnes/libsnes.cpp @@ -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]; diff --git a/output/dll/libsneshawk-32-accuracy.exe b/output/dll/libsneshawk-32-accuracy.exe new file mode 100644 index 0000000000..3aaab2e708 Binary files /dev/null and b/output/dll/libsneshawk-32-accuracy.exe differ