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> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.btnOk = new System.Windows.Forms.Button(); this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.rbCompatibility = new System.Windows.Forms.RadioButton(); this.rbCompatibility = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbPerformance = new System.Windows.Forms.RadioButton(); this.rbAccuracy = new System.Windows.Forms.RadioButton();
this.cbRingbuf = new System.Windows.Forms.CheckBox(); this.rbPerformance = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label(); this.cbRingbuf = new System.Windows.Forms.CheckBox();
this.cbDoubleSize = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.cbDoubleSize = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.lblDoubleSize = new System.Windows.Forms.Label();
this.SuspendLayout(); this.groupBox1.SuspendLayout();
// this.SuspendLayout();
// btnOk //
// // 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.Name = "btnOk"; this.btnOk.Location = new System.Drawing.Point(136, 254);
this.btnOk.Size = new System.Drawing.Size(75, 23); this.btnOk.Name = "btnOk";
this.btnOk.TabIndex = 0; this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.Text = "OK"; this.btnOk.TabIndex = 0;
this.btnOk.UseVisualStyleBackColor = true; this.btnOk.Text = "OK";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click); this.btnOk.UseVisualStyleBackColor = true;
// this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
// btnCancel //
// // 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(222, 249); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Name = "btnCancel"; this.btnCancel.Location = new System.Drawing.Point(217, 254);
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 1; this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.Text = "Cancel"; this.btnCancel.TabIndex = 1;
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Text = "Cancel";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.UseVisualStyleBackColor = true;
// this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// rbCompatibility //
// // rbCompatibility
this.rbCompatibility.AutoSize = true; //
this.rbCompatibility.Location = new System.Drawing.Point(6, 19); this.rbCompatibility.AutoSize = true;
this.rbCompatibility.Name = "rbCompatibility"; this.rbCompatibility.Location = new System.Drawing.Point(6, 19);
this.rbCompatibility.Size = new System.Drawing.Size(83, 17); this.rbCompatibility.Name = "rbCompatibility";
this.rbCompatibility.TabIndex = 2; this.rbCompatibility.Size = new System.Drawing.Size(202, 17);
this.rbCompatibility.TabStop = true; this.rbCompatibility.TabIndex = 2;
this.rbCompatibility.Text = "Compatibility"; this.rbCompatibility.TabStop = true;
this.rbCompatibility.UseVisualStyleBackColor = true; this.rbCompatibility.Text = "Compatibility (more debug tools work!)";
// this.rbCompatibility.UseVisualStyleBackColor = true;
// groupBox1 //
// // groupBox1
this.groupBox1.Controls.Add(this.rbPerformance); //
this.groupBox1.Controls.Add(this.rbCompatibility); this.groupBox1.Controls.Add(this.rbAccuracy);
this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Controls.Add(this.rbPerformance);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Controls.Add(this.rbCompatibility);
this.groupBox1.Size = new System.Drawing.Size(277, 70); this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.TabIndex = 3; this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false; this.groupBox1.Size = new System.Drawing.Size(277, 90);
this.groupBox1.Text = "Core Selection"; this.groupBox1.TabIndex = 3;
// this.groupBox1.TabStop = false;
// rbPerformance this.groupBox1.Text = "Core Selection";
// //
this.rbPerformance.AutoSize = true; // rbAccuracy
this.rbPerformance.Location = new System.Drawing.Point(6, 42); //
this.rbPerformance.Name = "rbPerformance"; this.rbAccuracy.AutoSize = true;
this.rbPerformance.Size = new System.Drawing.Size(202, 17); this.rbAccuracy.Location = new System.Drawing.Point(6, 65);
this.rbPerformance.TabIndex = 3; this.rbAccuracy.Name = "rbAccuracy";
this.rbPerformance.TabStop = true; this.rbAccuracy.Size = new System.Drawing.Size(224, 17);
this.rbPerformance.Text = "Performance (only for casual gaming!)"; this.rbAccuracy.TabIndex = 4;
this.rbPerformance.UseVisualStyleBackColor = true; this.rbAccuracy.TabStop = true;
// this.rbAccuracy.Text = "Accuracy (only to fix bugs in Compatibility!)";
// cbRingbuf this.rbAccuracy.UseVisualStyleBackColor = true;
// this.rbAccuracy.CheckedChanged += new System.EventHandler(this.rbAccuracy_CheckedChanged);
this.cbRingbuf.AutoSize = true; //
this.cbRingbuf.Location = new System.Drawing.Point(18, 97); // rbPerformance
this.cbRingbuf.Name = "cbRingbuf"; //
this.cbRingbuf.Size = new System.Drawing.Size(115, 17); this.rbPerformance.AutoSize = true;
this.cbRingbuf.TabIndex = 4; this.rbPerformance.Location = new System.Drawing.Point(6, 42);
this.cbRingbuf.Text = "Use Ring Buffer IO"; this.rbPerformance.Name = "rbPerformance";
this.cbRingbuf.UseVisualStyleBackColor = true; this.rbPerformance.Size = new System.Drawing.Size(202, 17);
// this.rbPerformance.TabIndex = 3;
// label1 this.rbPerformance.TabStop = true;
// this.rbPerformance.Text = "Performance (only for casual gaming!)";
this.label1.Location = new System.Drawing.Point(34, 117); this.rbPerformance.UseVisualStyleBackColor = true;
this.label1.Name = "label1"; //
this.label1.Size = new System.Drawing.Size(254, 45); // cbRingbuf
this.label1.TabIndex = 5; //
this.label1.Text = "This was designed as an optimization but it isn\'t clear whether it works. Feel fr" + this.cbRingbuf.AutoSize = true;
"ee to try different settings and let us know the results."; this.cbRingbuf.Location = new System.Drawing.Point(17, 112);
// this.cbRingbuf.Name = "cbRingbuf";
// cbDoubleSize this.cbRingbuf.Size = new System.Drawing.Size(115, 17);
// this.cbRingbuf.TabIndex = 4;
this.cbDoubleSize.AutoSize = true; this.cbRingbuf.Text = "Use Ring Buffer IO";
this.cbDoubleSize.Location = new System.Drawing.Point(18, 165); this.cbRingbuf.UseVisualStyleBackColor = true;
this.cbDoubleSize.Name = "cbDoubleSize"; //
this.cbDoubleSize.Size = new System.Drawing.Size(178, 17); // label1
this.cbDoubleSize.TabIndex = 6; //
this.cbDoubleSize.Text = "Always Double-Size Framebuffer"; this.label1.Location = new System.Drawing.Point(33, 132);
this.cbDoubleSize.UseVisualStyleBackColor = true; this.label1.Name = "label1";
// this.label1.Size = new System.Drawing.Size(254, 45);
// label2 this.label1.TabIndex = 5;
// this.label1.Text = "Performance-affecting option; results differ for different users\' systems.";
this.label2.Location = new System.Drawing.Point(36, 186); //
this.label2.Name = "label2"; // cbDoubleSize
this.label2.Size = new System.Drawing.Size(254, 45); //
this.label2.TabIndex = 7; this.cbDoubleSize.AutoSize = true;
this.label2.Text = "Some games are changing the resolution constantly (e.g. SD3) so this option can f" + this.cbDoubleSize.Location = new System.Drawing.Point(16, 167);
"orce the SNES output to stay double-size always."; this.cbDoubleSize.Name = "cbDoubleSize";
// this.cbDoubleSize.Size = new System.Drawing.Size(178, 17);
// SNESOptions this.cbDoubleSize.TabIndex = 6;
// this.cbDoubleSize.Text = "Always Double-Size Framebuffer";
this.AcceptButton = this.btnOk; this.cbDoubleSize.UseVisualStyleBackColor = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.cbDoubleSize.CheckedChanged += new System.EventHandler(this.cbDoubleSize_CheckedChanged);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; //
this.CancelButton = this.btnCancel; // lblDoubleSize
this.ClientSize = new System.Drawing.Size(300, 275); //
this.Controls.Add(this.label2); this.lblDoubleSize.Location = new System.Drawing.Point(34, 188);
this.Controls.Add(this.cbDoubleSize); this.lblDoubleSize.Name = "lblDoubleSize";
this.Controls.Add(this.label1); this.lblDoubleSize.Size = new System.Drawing.Size(254, 57);
this.Controls.Add(this.cbRingbuf); this.lblDoubleSize.TabIndex = 7;
this.Controls.Add(this.groupBox1); this.lblDoubleSize.Text = "Some games are changing the resolution constantly (e.g. SD3) so this option can f" +
this.Controls.Add(this.btnCancel); "orce the SNES output to stay double-size always. NOTE: The Accuracy core runs as" +
this.Controls.Add(this.btnOk); " if this is selected.\r\n";
this.Name = "SNESOptions"; //
this.ShowIcon = false; // SNESOptions
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; //
this.Text = "SNES Options"; this.AcceptButton = this.btnOk;
this.groupBox1.ResumeLayout(false); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.groupBox1.PerformLayout(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ResumeLayout(false); this.CancelButton = this.btnCancel;
this.PerformLayout(); 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.CheckBox cbRingbuf;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox cbDoubleSize; 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(); InitializeComponent();
} }
bool SuppressDoubleSize;
bool UserDoubleSizeOption;
public string Profile 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 set
{ {
rbCompatibility.Checked = (value == "Compatibility"); rbCompatibility.Checked = (value == "Compatibility");
rbPerformance.Checked = (value == "Performance"); rbPerformance.Checked = (value == "Performance");
rbAccuracy.Checked = (value == "Accuracy");
} }
} }
@ -30,8 +41,8 @@ namespace BizHawk.Client.EmuHawk
public bool AlwaysDoubleSize public bool AlwaysDoubleSize
{ {
get { return cbDoubleSize.Checked; } get { return UserDoubleSizeOption; }
set { cbDoubleSize.Checked = value; } set { UserDoubleSizeOption = value; RefreshDoubleSizeOption(); }
} }
private void btnOk_Click(object sender, EventArgs e) private void btnOk_Click(object sender, EventArgs e)
@ -67,5 +78,28 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.PutCoreSyncSettings(ss); 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 ./bizwinclean.sh
./bizwinmakeone.sh 32 performance compress ./bizwinmakeone.sh 32 performance compress
./bizwinclean.sh ./bizwinclean.sh
./bizwinmakeone.sh 32 accuracy compress
./bizwinclean.sh
./bizwinmakeone.sh 32 compatibility compress ./bizwinmakeone.sh 32 compatibility compress
#leave compatibility built as objs because thats more useful to us while devving #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); memset(&state.regs, 0, sizeof state.regs);
//zero 01-dec-2012 - gotta reset these sometime, somewhere //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.echo_hist_pos = 0;
state.every_other_sample = false; state.every_other_sample = false;

View File

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

View File

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

View File

@ -367,7 +367,8 @@ int snes_peek_logical_register(int reg)
switch(reg) switch(reg)
{ {
//$2105 //$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_BG_MODE: return SNES::ppu.regs.bg_mode;
case SNES_REG_BG3_PRIORITY: return SNES::ppu.regs.bg3_priority; 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]; case SNES_REG_BG1_TILESIZE: return SNES::ppu.regs.bg_tilesize[SNES::PPU::BG1];

Binary file not shown.