diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 3136b0e97b..3b32531857 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -190,6 +190,7 @@ + diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index 56e78d8df1..6a31b4d635 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -313,6 +313,7 @@ namespace BizHawk.Emulation.Consoles.Calculator public TI83() { + CoreOutputComm = new CoreOutputComm(); cpu.ReadMemory = ReadMemory; cpu.WriteMemory = WriteMemory; cpu.ReadHardware = ReadHardware; @@ -333,6 +334,10 @@ namespace BizHawk.Emulation.Consoles.Calculator cpu.NonMaskableInterrupt = false; } + + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } + protected byte[] vram = new byte[0x300]; class MyVideoProvider : IVideoProvider { @@ -569,12 +574,6 @@ namespace BizHawk.Emulation.Consoles.Calculator public IList MemoryDomains { get { return memoryDomains; } } public MemoryDomain MainMemory { get { return memoryDomains[0]; } } - - public object Query(EmulatorQuery query) - { - return null; - } - public void Dispose() { } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs b/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs index 4670a61551..0169ee841e 100644 --- a/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs +++ b/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs @@ -262,6 +262,7 @@ namespace BizHawk.Emulation.Consoles.Gameboy public Gameboy() { + CoreOutputComm = new CoreOutputComm(); } public void LoadGame(IGame game) @@ -637,6 +638,10 @@ namespace BizHawk.Emulation.Consoles.Gameboy //Cpu.ExecuteCycles(4096); } + + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } + public IVideoProvider VideoProvider { get { return new NullEmulator(); } @@ -850,12 +855,6 @@ namespace BizHawk.Emulation.Consoles.Gameboy public IList MemoryDomains { get { throw new NotImplementedException(); } } public MemoryDomain MainMemory { get { throw new NotImplementedException(); } } - - public object Query(EmulatorQuery query) - { - return null; - } - public void Dispose() {} } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index 887816b384..06acfb7bc0 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -38,6 +38,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo public NES() { + CoreOutputComm = new CoreOutputComm(); BootGodDB.Initialize(); SetPalette(Palettes.FCEUX_Standard); videoProvider = new MyVideoProvider(this); @@ -126,6 +127,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo NESWatch[] watches; } + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } + class MyVideoProvider : IVideoProvider { NES emu; @@ -137,10 +141,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo int[] pixels = new int[256 * 240]; public int[] GetVideoBuffer() { + int backdrop = emu.CoreInputComm.NES_BackdropColor; + bool useBackdrop = (backdrop & 0xFF000000) != 0; //TODO - we could recalculate this on the fly (and invalidate/recalculate it when the palette is changed) for (int i = 0; i < 256*240; i++) { - pixels[i] = emu.palette_compiled[emu.ppu.xbuf[i]]; + short pixel = emu.ppu.xbuf[i]; + if((pixel&0x8000)!=0 && useBackdrop) + { + pixels[i] = backdrop; + } + else pixels[i] = emu.palette_compiled[pixel&0x7FFF]; } return pixels; } @@ -326,12 +337,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo public IList MemoryDomains { get { return memoryDomains; } } public MemoryDomain MainMemory { get { return memoryDomains[0]; } } - - public object Query(EmulatorQuery query) - { - return null; - } - public string GameName { get { return game_name; } } public enum EDetectionOrigin diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs index 7d038ec8dc..b99c7a3e9d 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs @@ -157,8 +157,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo int rasterpos = xstart; //check all the conditions that can cause things to render in these 8px - bool renderspritenow = reg_2001.show_obj && (xt > 0 || reg_2001.show_obj_leftmost); - bool renderbgnow = reg_2001.show_bg && (xt > 0 || reg_2001.show_bg_leftmost); + bool renderspritenow = reg_2001.show_obj && (xt > 0 || reg_2001.show_obj_leftmost) && nes.CoreInputComm.NES_ShowOBJ; + bool renderbgnow = reg_2001.show_bg && (xt > 0 || reg_2001.show_bg_leftmost) && nes.CoreInputComm.NES_ShowBG; for (int xp = 0; xp < 8; xp++, rasterpos++) { @@ -176,10 +176,15 @@ namespace BizHawk.Emulation.Consoles.Nintendo byte pt_0 = bgdata[bgtile].pt_0; byte pt_1 = bgdata[bgtile].pt_1; pixel = ((pt_0 >> (7 - bgpx)) & 1) | (((pt_1 >> (7 - bgpx)) & 1) << 1); - if(pixel != 0) - pixel |= bgdata[bgtile].at; + if (pixel != 0) + pixel |= bgdata[bgtile].at; + pixelcolor = PALRAM[pixel]; + } + else + { + pixelcolor = PALRAM[pixel]; + pixelcolor |= 0x8000; } - pixelcolor = PALRAM[pixel]; //look for a sprite to be drawn bool havepixel = false; @@ -272,9 +277,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo //set the flag and bail out. if (oamcount >= 8 && reg_2001.PPUON) { - Reg2002_objoverflow = true; - if (SPRITELIMIT) + //should we set this flag anyway?? + if (!nes.CoreInputComm.NES_UnlimitedSprites) + { + Reg2002_objoverflow = true; break; + } } //just copy some bytes into the internal sprite buffer diff --git a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs index e9bf9c2246..dfcb75aaa0 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/PCEngine.cs @@ -41,6 +41,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx public PCEngine(NecSystemType type) { + CoreOutputComm = new CoreOutputComm(); Type = type; Controller = NullController.GetNullController(); Cpu = new HuC6280(); @@ -124,6 +125,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx islag = false; } + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } + public IVideoProvider VideoProvider { get { return (IVideoProvider) VPC ?? VDC1; } @@ -298,17 +302,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx public IList MemoryDomains { get { return memoryDomains; } } public MemoryDomain MainMemory { get { return memoryDomains[0]; } } - public object Query(EmulatorQuery query) - { - switch (query) - { - case EmulatorQuery.VsyncRate: - return 60.0; - default: - return null; - } - } - public void Dispose() {} } } diff --git a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs index 8ca3602158..9ee49c3f9a 100644 --- a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs +++ b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.cs @@ -52,6 +52,8 @@ namespace BizHawk.Emulation.Consoles.Sega public Genesis(bool sega360) { + CoreOutputComm = new CoreOutputComm(); + if (sega360) MainCPU = new MC68K(this); _MainCPU = new M68000(); SoundCPU = new Z80A(); @@ -127,9 +129,14 @@ namespace BizHawk.Emulation.Consoles.Sega } } PSG.EndFrame(SoundCPU.TotalExecutedCycles); - } + } - public IVideoProvider VideoProvider + + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } + + + public IVideoProvider VideoProvider { get { return VDP; } } @@ -191,11 +198,6 @@ namespace BizHawk.Emulation.Consoles.Sega public MemoryDomain MainMemory { get { throw new NotImplementedException(); } } - public object Query(EmulatorQuery query) - { - return null; - } - public void Dispose() {} } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs index 8b09211d19..1b9b7ccd51 100644 --- a/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation/Consoles/Sega/SMS/SMS.cs @@ -58,6 +58,11 @@ namespace BizHawk.Emulation.Consoles.Sega public DisplayType DisplayType { get; set; } public bool DeterministicEmulation { get; set; } + public SMS() + { + CoreOutputComm = new CoreOutputComm(); + } + public void Init() { if (Controller == null) @@ -111,6 +116,7 @@ namespace BizHawk.Emulation.Consoles.Sega RomBanks = (byte)(RomData.Length/BankSize); Options = game.GetOptions(); DisplayType = DisplayType.NTSC; + CoreOutputComm.VsyncRate = DisplayType == DisplayType.NTSC ? 60d : 50d; foreach (string option in Options) { var args = option.Split('='); @@ -324,6 +330,8 @@ namespace BizHawk.Emulation.Consoles.Sega } public IVideoProvider VideoProvider { get { return Vdp; } } + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } private ISoundProvider ActiveSoundProvider; public ISoundProvider SoundProvider { get { return ActiveSoundProvider; } } @@ -372,14 +380,6 @@ namespace BizHawk.Emulation.Consoles.Sega public IList MemoryDomains { get { return memoryDomains; } } public MemoryDomain MainMemory { get { return memoryDomains[0]; } } - // TODO I have concerns about this .Query thing- at least for target fps, but I leave it for now - public object Query(EmulatorQuery query) - { - if (query == EmulatorQuery.VsyncRate) - return DisplayType == DisplayType.NTSC ? 60d : 50d; - return null; - } - public void Dispose() {} } } \ No newline at end of file diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs index d9542e28b3..74b1877295 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs @@ -11,6 +11,8 @@ namespace BizHawk private int[] frameBuffer = new int[256 * 192]; private Random rand = new Random(); + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } public IVideoProvider VideoProvider { get { return this; } } public ISoundProvider SoundProvider { get { return this; } } public NullEmulator() @@ -51,10 +53,6 @@ namespace BizHawk public IList MemoryDomains { get { return memoryDomains; } } public MemoryDomain MainMemory { get { return memoryDomains[0]; } } public void Dispose() { } - public object Query(EmulatorQuery query) - { - return null; - } } public class NullSound : ISoundProvider diff --git a/BizHawk.Emulation/Interfaces/CoreComms.cs b/BizHawk.Emulation/Interfaces/CoreComms.cs new file mode 100644 index 0000000000..eb5e3d4a1c --- /dev/null +++ b/BizHawk.Emulation/Interfaces/CoreComms.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace BizHawk +{ + public class CoreInputComm + { + public int NES_BackdropColor; + public bool NES_UnlimitedSprites; + public bool NES_ShowBG, NES_ShowOBJ; + } + + public class CoreOutputComm + { + public double VsyncRate = 60; + } + +} \ No newline at end of file diff --git a/BizHawk.Emulation/Interfaces/IEmulator.cs b/BizHawk.Emulation/Interfaces/IEmulator.cs index 556972289c..df4af92c88 100644 --- a/BizHawk.Emulation/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation/Interfaces/IEmulator.cs @@ -33,8 +33,9 @@ namespace BizHawk void LoadStateBinary(BinaryReader reader); byte[] SaveStateBinary(); - //arbitrary extensible query mechanism - object Query(EmulatorQuery query); + //arbitrary extensible core comm mechanism + CoreInputComm CoreInputComm { get; set; } + CoreOutputComm CoreOutputComm { get; } // ----- Client Debugging API stuff ----- IList MemoryDomains { get; } @@ -100,9 +101,4 @@ namespace BizHawk public enum Endian { Big, Little, Unknown } public enum DisplayType { NTSC, PAL } - - public enum EmulatorQuery - { - VsyncRate - } } diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/Global.cs index 49a9dc9951..45b24ef2bf 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/Global.cs @@ -12,6 +12,7 @@ namespace BizHawk.MultiClient public static IRenderer RenderPanel; public static Config Config; public static IEmulator Emulator; + public static CoreInputComm CoreInputComm; public static RomGame Game; public static Controller ClientControls; public static Controller SMSControls; diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index 2169173517..36c43b0351 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -705,6 +705,7 @@ namespace BizHawk.MultiClient { NESGraphicsConfig g = new NESGraphicsConfig(); g.ShowDialog(); + SyncCoreInputComm(); } } } \ No newline at end of file diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 0627e6a712..89aa806e15 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -77,6 +77,8 @@ namespace BizHawk.MultiClient return Util.ReadAllBytes(NesCartFile.GetStream()); }; Global.MainForm = this; + Global.CoreInputComm = new CoreInputComm(); + SyncCoreInputComm(); Database.LoadDatabase(PathManager.GetExePathAbsolute() + "\\gamedb.txt"); @@ -214,6 +216,14 @@ namespace BizHawk.MultiClient InputLog = new Movie(PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "") + "\\log.tas", m); } + void SyncCoreInputComm() + { + Global.CoreInputComm.NES_BackdropColor = Global.Config.NESBackgroundColor; + Global.CoreInputComm.NES_UnlimitedSprites = Global.Config.NESAllowMoreThanEightSprites; + Global.CoreInputComm.NES_ShowBG = Global.Config.NESDispBackground; + Global.CoreInputComm.NES_ShowOBJ = Global.Config.NESDispSprites; + } + void SyncPresentationMode() { bool gdi = Global.Config.ForceGDI; @@ -786,6 +796,7 @@ namespace BizHawk.MultiClient try { + nextEmulator.CoreInputComm = Global.CoreInputComm; nextEmulator.LoadGame(game); } catch (Exception ex) @@ -825,10 +836,7 @@ namespace BizHawk.MultiClient //setup the throttle based on platform's specifications //(one day later for some systems we will need to modify it at runtime as the display mode changes) { - object o = Global.Emulator.Query(EmulatorQuery.VsyncRate); - if (o is double) - throttle.SetCoreFps((double)o); - else throttle.SetCoreFps(60); + throttle.SetCoreFps( Global.Emulator.CoreOutputComm.VsyncRate); SyncThrottle(); } RamSearch1.Restart(); @@ -1931,7 +1939,7 @@ namespace BizHawk.MultiClient private void loadConfigToolStripMenuItem_Click(object sender, EventArgs e) { - Global.Config = ConfigService.Load("config.ini"); + Global.Config = ConfigService.Load(PathManager.DefaultIniPath); Global.RenderPanel.AddMessage("Saved loaded"); } @@ -1953,7 +1961,7 @@ namespace BizHawk.MultiClient RamSearch1.SaveConfigSettings(); if (!HexEditor1.IsDisposed) HexEditor1.SaveConfigSettings(); - ConfigService.Save("config.ini", Global.Config); + ConfigService.Save(PathManager.DefaultIniPath, Global.Config); } private void PreviousSlot() diff --git a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs index 54304d07f5..b0deafb673 100644 --- a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs +++ b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.Designer.cs @@ -41,13 +41,13 @@ this.groupBox3 = new System.Windows.Forms.GroupBox(); this.ChangeBGColor = new System.Windows.Forms.Button(); this.BackGroundColorNumber = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.BackgroundColorPanel = new System.Windows.Forms.Panel(); this.DispBackground = new System.Windows.Forms.CheckBox(); this.DispSprites = new System.Windows.Forms.CheckBox(); this.BGColorDialog = new System.Windows.Forms.ColorDialog(); + this.checkUseBackdropColor = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -157,6 +157,7 @@ // ClipLeftAndRightCheckBox // this.ClipLeftAndRightCheckBox.AutoSize = true; + this.ClipLeftAndRightCheckBox.Enabled = false; this.ClipLeftAndRightCheckBox.Location = new System.Drawing.Point(9, 42); this.ClipLeftAndRightCheckBox.Name = "ClipLeftAndRightCheckBox"; this.ClipLeftAndRightCheckBox.Size = new System.Drawing.Size(186, 17); @@ -168,9 +169,9 @@ // this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox3.Controls.Add(this.checkUseBackdropColor); this.groupBox3.Controls.Add(this.ChangeBGColor); this.groupBox3.Controls.Add(this.BackGroundColorNumber); - this.groupBox3.Controls.Add(this.label3); this.groupBox3.Controls.Add(this.label2); this.groupBox3.Controls.Add(this.groupBox4); this.groupBox3.Controls.Add(this.DispBackground); @@ -180,11 +181,11 @@ this.groupBox3.Size = new System.Drawing.Size(352, 128); this.groupBox3.TabIndex = 5; this.groupBox3.TabStop = false; - this.groupBox3.Text = "Background and Sprites"; + this.groupBox3.Text = "BG and Sprites"; // // ChangeBGColor // - this.ChangeBGColor.Location = new System.Drawing.Point(136, 98); + this.ChangeBGColor.Location = new System.Drawing.Point(112, 98); this.ChangeBGColor.Name = "ChangeBGColor"; this.ChangeBGColor.Size = new System.Drawing.Size(52, 23); this.ChangeBGColor.TabIndex = 35; @@ -194,30 +195,21 @@ // // BackGroundColorNumber // - this.BackGroundColorNumber.Location = new System.Drawing.Point(62, 100); + this.BackGroundColorNumber.Location = new System.Drawing.Point(47, 100); this.BackGroundColorNumber.MaxLength = 8; this.BackGroundColorNumber.Name = "BackGroundColorNumber"; this.BackGroundColorNumber.ReadOnly = true; this.BackGroundColorNumber.Size = new System.Drawing.Size(59, 20); this.BackGroundColorNumber.TabIndex = 5; // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(43, 102); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(18, 13); - this.label3.TabIndex = 4; - this.label3.Text = "0x"; - // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(9, 79); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(246, 13); + this.label2.Size = new System.Drawing.Size(178, 13); this.label2.TabIndex = 3; - this.label2.Text = "Background color when Backgrounds are disabled"; + this.label2.Text = "Backdrop color when BG is disabled"; // // groupBox4 // @@ -242,9 +234,9 @@ this.DispBackground.CheckState = System.Windows.Forms.CheckState.Checked; this.DispBackground.Location = new System.Drawing.Point(9, 42); this.DispBackground.Name = "DispBackground"; - this.DispBackground.Size = new System.Drawing.Size(121, 17); + this.DispBackground.Size = new System.Drawing.Size(78, 17); this.DispBackground.TabIndex = 30; - this.DispBackground.Text = "Display Background"; + this.DispBackground.Text = "Display BG"; this.DispBackground.UseVisualStyleBackColor = true; // // DispSprites @@ -259,6 +251,18 @@ this.DispSprites.Text = "Display Sprites"; this.DispSprites.UseVisualStyleBackColor = true; // + // checkUseBackdropColor + // + this.checkUseBackdropColor.AutoSize = true; + this.checkUseBackdropColor.Checked = true; + this.checkUseBackdropColor.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkUseBackdropColor.Location = new System.Drawing.Point(170, 100); + this.checkUseBackdropColor.Name = "checkUseBackdropColor"; + this.checkUseBackdropColor.Size = new System.Drawing.Size(59, 17); + this.checkUseBackdropColor.TabIndex = 36; + this.checkUseBackdropColor.Text = "Enable"; + this.checkUseBackdropColor.UseVisualStyleBackColor = true; + // // NESGraphicsConfig // this.AcceptButton = this.OK; @@ -306,9 +310,9 @@ private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.Panel BackgroundColorPanel; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox BackGroundColorNumber; private System.Windows.Forms.Button ChangeBGColor; private System.Windows.Forms.ColorDialog BGColorDialog; + private System.Windows.Forms.CheckBox checkUseBackdropColor; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs index 5567afa638..6e92d7a375 100644 --- a/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs +++ b/BizHawk.MultiClient/NEStools/NESGraphicsConfig.cs @@ -42,7 +42,8 @@ namespace BizHawk.MultiClient PalettePath.Text = Global.Config.NESPaletteFile; DispSprites.Checked = Global.Config.NESDispSprites; DispBackground.Checked = Global.Config.NESDispBackground; - BGColorDialog.Color = Color.FromArgb(Global.Config.NESBackgroundColor); + BGColorDialog.Color = Color.FromArgb(unchecked(Global.Config.NESBackgroundColor | (int)0xFF000000)); + checkUseBackdropColor.Checked = (Global.Config.NESBackgroundColor & 0xFF000000) != 0; SetColorBox(); } @@ -89,6 +90,9 @@ namespace BizHawk.MultiClient Global.Config.NESAutoLoadPalette = AutoLoadPalette.Checked; Global.Config.NESDispSprites = DispSprites.Checked; Global.Config.NESDispBackground = DispBackground.Checked; + Global.Config.NESBackgroundColor = BGColorDialog.Color.ToArgb(); + if (!checkUseBackdropColor.Checked) + Global.Config.NESBackgroundColor &= 0x00FFFFFF; this.Close(); } @@ -96,7 +100,7 @@ namespace BizHawk.MultiClient private void SetColorBox() { int color = BGColorDialog.Color.ToArgb(); - BackGroundColorNumber.Text = String.Format("{0:X8}", color); + BackGroundColorNumber.Text = String.Format("#{0:X8}", color).Substring(2,6); BackgroundColorPanel.BackColor = BGColorDialog.Color; } diff --git a/BizHawk.MultiClient/Program.cs b/BizHawk.MultiClient/Program.cs index 5adfc427ca..fdf3f335a6 100644 --- a/BizHawk.MultiClient/Program.cs +++ b/BizHawk.MultiClient/Program.cs @@ -14,7 +14,7 @@ namespace BizHawk.MultiClient Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Global.Config = ConfigService.Load(PathManager.GetExePathAbsolute() + "\\config.ini"); + Global.Config = ConfigService.Load(PathManager.DefaultIniPath); try { Global.DSound = new DirectSound(); } catch { diff --git a/BizHawk.MultiClient/config/PathManager.cs b/BizHawk.MultiClient/config/PathManager.cs index eb818a66c7..87f915a01e 100644 --- a/BizHawk.MultiClient/config/PathManager.cs +++ b/BizHawk.MultiClient/config/PathManager.cs @@ -18,10 +18,22 @@ namespace BizHawk.MultiClient return p; } + /// + /// Makes a path relative to the %exe% dir + /// + public static string MakeProgramRelativePath(string path) { return MakeAbsolutePath("%exe%/" + path, ""); } + + /// + /// The location of the default INI file + /// + public static string DefaultIniPath { get { return MakeProgramRelativePath("config.ini"); } } + + /// + /// Gets absolute base as derived from EXE + /// + /// public static string GetBasePathAbsolute() { - //Gets absolute base as derived from EXE - if (Global.Config.BasePath.Length < 1) //If empty, then EXE path return GetExePathAbsolute();