From e55dd026447f0eab70aa444ef1e4556116adf0ad Mon Sep 17 00:00:00 2001 From: goyuken Date: Thu, 17 Jul 2014 22:27:09 +0000 Subject: [PATCH] i meant to commit this a few days ago? oops --- .../Consoles/Nintendo/QuickNES/QuickNES.cs | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs index 4358073023..964dabc412 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json; using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; +using BizHawk.Common; namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES { @@ -83,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES BoardName = mappername; CoreComm.VsyncNum = 39375000; CoreComm.VsyncDen = 655171; - PutSettings(Settings ?? QuickNESSettings.GetDefaults()); + PutSettings(Settings ?? new QuickNESSettings()); } catch { @@ -429,15 +430,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES ret._Palette = (byte[])_Palette.Clone(); return ret; } - public static QuickNESSettings GetDefaults() + public QuickNESSettings() { - return new QuickNESSettings - { - NumSprites = 8, - ClipLeftAndRight = false, - ClipTopAndBottom = true, - _Palette = GetDefaultColors() - }; + SettingsUtil.SetDefaultValues(this); + SetDefaultColors(); } public void SetNesHawkPalette(int[,] pal) @@ -470,8 +466,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES } } - QuickNESSettings Settings = QuickNESSettings.GetDefaults(); + QuickNESSettings _Settings; + // what is this for? public class QuickNESSyncSettings { public QuickNESSyncSettings Clone() @@ -482,7 +479,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES public object GetSettings() { - return Settings.Clone(); + return _Settings.Clone(); } public object GetSyncSettings() @@ -492,8 +489,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES public bool PutSettings(object o) { - Settings = (QuickNESSettings)o; - LibQuickNES.qn_set_sprite_limit(Context, Settings.NumSprites); + _Settings = (QuickNESSettings)o; + LibQuickNES.qn_set_sprite_limit(Context, _Settings.NumSprites); RecalculateCrops(); return false; } @@ -531,8 +528,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES void RecalculateCrops() { - cropright = cropleft = Settings.ClipLeftAndRight ? 8 : 0; - cropbottom = croptop = Settings.ClipTopAndBottom ? 8 : 0; + cropright = cropleft = _Settings.ClipLeftAndRight ? 8 : 0; + cropbottom = croptop = _Settings.ClipTopAndBottom ? 8 : 0; BufferWidth = 256 - cropleft - cropright; BufferHeight = 240 - croptop - cropbottom; } @@ -545,7 +542,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES void Blit() { - LibQuickNES.qn_blit(Context, VideoOutputH.AddrOfPinnedObject(), Settings.Palette, cropleft, croptop, cropright, cropbottom); + LibQuickNES.qn_blit(Context, VideoOutputH.AddrOfPinnedObject(), _Settings.Palette, cropleft, croptop, cropright, cropbottom); } public IVideoProvider VideoProvider { get { return this; } }