diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs index 84a01efa16..b0c2329c84 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs @@ -15,19 +15,18 @@ namespace BizHawk.Emulation.Consoles.Nintendo bool Configure(NES.EDetectionOrigin origin); byte ReadPRG(int addr); byte ReadPPU(int addr); byte PeekPPU(int addr); - byte ReadPRAM(int addr); + byte ReadWRAM(int addr); byte ReadEXP(int addr); void WritePRG(int addr, byte value); void WritePPU(int addr, byte value); - void WritePRAM(int addr, byte value); + void WriteWRAM(int addr, byte value); void WriteEXP(int addr, byte value); byte[] SaveRam { get; } byte[] WRAM { get; set; } byte[] VRAM { get; set; } byte[] ROM { get; set; } byte[] VROM { get; set; } - void SaveStateBinary(BinaryWriter bw); - void LoadStateBinary(BinaryReader br); + void SyncStateBinary(BinarySerializer ser); }; @@ -43,19 +42,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo public CartInfo Cart { get { return NES.cart; } } public NES NES { get; set; } - public virtual void SaveStateBinary(BinaryWriter bw) + public virtual void SyncStateBinary(BinarySerializer ser) { - Util.WriteByteBuffer(bw, VRAM); - Util.WriteByteBuffer(bw, WRAM); - for (int i = 0; i < 4; i++) bw.Write(mirroring[i]); - } - public virtual void LoadStateBinary(BinaryReader br) - { - VRAM = Util.ReadByteBuffer(br, true); - WRAM = Util.ReadByteBuffer(br, true); - for (int i = 0; i < 4; i++) mirroring[i] = br.ReadInt32(); + ser.Sync(ref vram,true); + ser.Sync(ref wram,true); + for (int i = 0; i < 4; i++) ser.Sync(ref mirroring[i]); } + int[] mirroring = new int[4]; protected void SetMirroring(int a, int b, int c, int d) { @@ -108,8 +102,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo public virtual byte ReadPRG(int addr) { return ROM[addr]; } public virtual void WritePRG(int addr, byte value) { } - public virtual void WritePRAM(int addr, byte value) { } - public virtual byte ReadPRAM(int addr) { return 0xFF; } + public virtual void WriteWRAM(int addr, byte value) { } + public virtual byte ReadWRAM(int addr) { return 0xFF; } public virtual void WriteEXP(int addr, byte value) { } public virtual byte ReadEXP(int addr) { return 0xFF; } @@ -144,10 +138,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo } public virtual byte[] SaveRam { get { return null; } } - public byte[] WRAM { get; set; } - public byte[] VRAM { get; set; } + public byte[] WRAM { get { return wram; } set { wram = value; } } + public byte[] VRAM { get { return vram; } set { vram = value; } } public byte[] ROM { get; set; } public byte[] VROM { get; set; } + byte[] wram, vram; protected void Assert(bool test, string comment, params object[] args) { diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/AxROM.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/AxROM.cs index 8fd8de04a1..16bf350044 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/AxROM.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/AxROM.cs @@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo { //configuration bool bus_conflict; - int cram_byte_mask; + int vram_byte_mask; int prg_mask; //state @@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo } prg_mask = (Cart.prg_size / 16) - 1; - cram_byte_mask = 8 * 1024 - 1; //these boards always have 8KB of CRAM + vram_byte_mask = 8 * 1024 - 1; //these boards always have 8KB of VRAM //it is necessary to write during initialization to set the mirroring WritePRG(0, 0); @@ -74,7 +74,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo { if (addr < 0x2000) { - return VRAM[addr & cram_byte_mask]; + return VRAM[addr & vram_byte_mask]; } else return base.ReadPPU(addr); } @@ -83,21 +83,15 @@ namespace BizHawk.Emulation.Consoles.Nintendo { if (addr < 0x2000) { - VRAM[addr & cram_byte_mask] = value; + VRAM[addr & vram_byte_mask] = value; } else base.WritePPU(addr,value); } - public override void SaveStateBinary(BinaryWriter bw) + public override void SyncStateBinary(BinarySerializer ser) { - base.SaveStateBinary(bw); - bw.Write(prg); - } - - public override void LoadStateBinary(BinaryReader br) - { - base.LoadStateBinary(br); - prg = br.ReadInt32(); + base.SyncStateBinary(ser); + ser.Sync(ref prg); } } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CPROM.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CPROM.cs index e51e2c8213..9cc900248d 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CPROM.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CPROM.cs @@ -54,16 +54,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo else base.WritePPU(addr,value); } - public override void SaveStateBinary(BinaryWriter bw) + public override void SyncStateBinary(BinarySerializer ser) { - base.SaveStateBinary(bw); - bw.Write(chr); + base.SyncStateBinary(ser); + ser.Sync(ref chr); } - public override void LoadStateBinary(BinaryReader br) - { - base.LoadStateBinary(br); - chr = br.ReadInt32(); - } + } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CxROM.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CxROM.cs index 0100f00018..a30a97fd35 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CxROM.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CxROM.cs @@ -59,16 +59,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo else return base.ReadPPU(addr); } - public override void SaveStateBinary(BinaryWriter bw) + public override void SyncStateBinary(BinarySerializer ser) { - base.SaveStateBinary(bw); - bw.Write(chr); + base.SyncStateBinary(ser); + ser.Sync(ref chr); } - public override void LoadStateBinary(BinaryReader br) - { - base.LoadStateBinary(br); - chr = br.ReadInt32(); - } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/GxROM.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/GxROM.cs index d190d77aef..5640a6c7b9 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/GxROM.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/GxROM.cs @@ -67,18 +67,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo prg = (((value>>4) & 3) & prg_mask); } - public override void SaveStateBinary(BinaryWriter bw) + public override void SyncStateBinary(BinarySerializer ser) { - base.SaveStateBinary(bw); - bw.Write(chr); - bw.Write(prg); - } - - public override void LoadStateBinary(BinaryReader br) - { - base.LoadStateBinary(br); - chr = br.ReadInt32(); - prg = br.ReadInt32(); + base.SyncStateBinary(ser); + ser.Sync(ref chr); + ser.Sync(ref prg); } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IC_74x377.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IC_74x377.cs index 3ce7a28397..f9e52ff525 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IC_74x377.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/IC_74x377.cs @@ -62,18 +62,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo chr = (value >> 4) & chr_mask; } - public override void SaveStateBinary(BinaryWriter bw) + public override void SyncStateBinary(BinarySerializer ser) { - base.SaveStateBinary(bw); - bw.Write(chr); - bw.Write(prg); + base.SyncStateBinary(ser); + ser.Sync(ref chr); + ser.Sync(ref prg); } - public override void LoadStateBinary(BinaryReader br) - { - base.LoadStateBinary(br); - chr = br.ReadInt32(); - prg = br.ReadInt32(); - } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft1.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft1.cs index 4d76a20dff..ab74e1b659 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft1.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft1.cs @@ -29,6 +29,14 @@ Other chips used: Sunsoft-1 public override bool Configure(NES.EDetectionOrigin origin) { //configure + switch (Cart.board_type) + { + case "SUNSOFT-1": + break; + default: + return false; + } + SetMirrorType(Cart.pad_h, Cart.pad_v); return true; } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs index eb6930cc73..3a2bde78b1 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs @@ -33,31 +33,19 @@ namespace BizHawk.Emulation.Consoles.Nintendo //well, lets leave it. } - public void SaveStateBinary(BinaryWriter bw) + public void SyncStateBinary(BinarySerializer ser) { - bw.Write(shift_count); - bw.Write(shift_val); - bw.Write(chr_mode); - bw.Write(prg_mode); - bw.Write(prg_slot); - bw.Write((int)mirror); - bw.Write(chr_0); - bw.Write(chr_1); - bw.Write(wram_disable); - bw.Write(prg); - } - public void LoadStateBinary(BinaryReader br) - { - shift_count = br.ReadInt32(); - shift_val = br.ReadInt32(); - chr_mode = br.ReadInt32(); - prg_mode = br.ReadInt32(); - prg_slot = br.ReadInt32(); - mirror = (NES.EMirrorType)br.ReadInt32(); - chr_0 = br.ReadInt32(); - chr_1 = br.ReadInt32(); - wram_disable = br.ReadInt32(); - prg = br.ReadInt32(); + ser.Sync(ref shift_count); + ser.Sync(ref shift_val); + ser.Sync(ref chr_mode); + ser.Sync(ref prg_mode); + ser.Sync(ref prg_slot); + ser.Sync(ref chr_0); + ser.Sync(ref chr_1); + ser.Sync(ref wram_disable); + ser.Sync(ref prg); + ser.SyncEnum(ref mirror); + } public enum Rev @@ -173,7 +161,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo { //configuration int prg_mask, chr_mask; - int cram_mask, pram_mask; + int vram_mask, wram_mask; //state MMC1 mmc1; @@ -203,7 +191,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo if (addr < 0x2000) { if (Cart.vram_size != 0) - return VRAM[addr & cram_mask]; + return VRAM[addr & vram_mask]; else return VROM[Gen_CHR_Address(addr)]; } else return base.ReadPPU(addr); @@ -214,22 +202,22 @@ namespace BizHawk.Emulation.Consoles.Nintendo if (addr < 0x2000) { if (Cart.vram_size != 0) - VRAM[addr & cram_mask] = value; + VRAM[addr & vram_mask] = value; } else base.WritePPU(addr, value); } - public override byte ReadPRAM(int addr) + public override byte ReadWRAM(int addr) { if (Cart.wram_size != 0) - return WRAM[addr & pram_mask]; + return WRAM[addr & wram_mask]; else return 0xFF; } - public override void WritePRAM(int addr, byte value) + public override void WriteWRAM(int addr, byte value) { if (Cart.wram_size != 0) - WRAM[addr & pram_mask] = value; + WRAM[addr & wram_mask] = value; } public override byte[] SaveRam @@ -243,19 +231,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo } } - public override void SaveStateBinary(BinaryWriter bw) + public override void SyncStateBinary(BinarySerializer ser) { - base.SaveStateBinary(bw); - mmc1.SaveStateBinary(bw); + base.SyncStateBinary(ser); + mmc1.SyncStateBinary(ser); } - public override void LoadStateBinary(BinaryReader br) - { - base.LoadStateBinary(br); - mmc1.LoadStateBinary(br); - } - - + public override bool Configure(NES.EDetectionOrigin origin) { //analyze board type @@ -334,8 +316,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo mmc1 = new MMC1(); prg_mask = (Cart.prg_size / 16) - 1; - cram_mask = (Cart.vram_size*1024) - 1; - pram_mask = (Cart.wram_size*1024) - 1; + vram_mask = (Cart.vram_size*1024) - 1; + wram_mask = (Cart.wram_size*1024) - 1; chr_mask = (Cart.chr_size / 8 * 2) - 1; SetMirrorType(mmc1.mirror); diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/UxROM.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/UxROM.cs index 326918791d..7def2de820 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/UxROM.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/UxROM.cs @@ -18,7 +18,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo { //configuration int prg_mask; - int cram_byte_mask; + int vram_byte_mask; //state int prg; @@ -42,8 +42,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo default: return false; } - //these boards always have 8KB of CRAM - cram_byte_mask = (Cart.vram_size*1024) - 1; + //these boards always have 8KB of VRAM + vram_byte_mask = (Cart.vram_size*1024) - 1; prg_mask = (Cart.prg_size / 16) - 1; SetMirrorType(Cart.pad_h, Cart.pad_v); @@ -66,7 +66,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo { if (addr < 0x2000) { - return VRAM[addr & cram_byte_mask]; + return VRAM[addr & vram_byte_mask]; } else return base.ReadPPU(addr); } @@ -75,21 +75,15 @@ namespace BizHawk.Emulation.Consoles.Nintendo { if (addr < 0x2000) { - VRAM[addr & cram_byte_mask] = value; + VRAM[addr & vram_byte_mask] = value; } else base.WritePPU(addr,value); } - public override void SaveStateBinary(BinaryWriter bw) + public override void SyncStateBinary(BinarySerializer ser) { - base.SaveStateBinary(bw); - bw.Write(prg); - } - - public override void LoadStateBinary(BinaryReader br) - { - base.LoadStateBinary(br); - prg = br.ReadInt32(); + base.SyncStateBinary(ser); + ser.Sync(ref prg); } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs index 98801500cb..881b078d16 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs @@ -215,7 +215,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo else if (addr < 0x4000) ret = ReadPPUReg(addr & 7); else if (addr < 0x4020) ret = ReadReg(addr); //we're not rebasing the register just to keep register names canonical else if (addr < 0x6000) ret = board.ReadEXP(addr); - else if (addr < 0x8000) ret = board.ReadPRAM(addr); + else if (addr < 0x8000) ret = board.ReadWRAM(addr); else ret = board.ReadPRG(addr - 0x8000); //apply freeze @@ -235,10 +235,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo public void WriteMemory(ushort addr, byte value) { - if (addr >= 0x6000 && addr < 0x6fff) - { - int zzz = 9; - } if (addr < 0x0800) ram[addr] = value; else if (addr < 0x1000) ram[addr - 0x0800] = value; else if (addr < 0x1800) ram[addr - 0x1000] = value; @@ -246,7 +242,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo else if (addr < 0x4000) WritePPUReg(addr & 7, value); else if (addr < 0x4020) WriteReg(addr, value); //we're not rebasing the register just to keep register names canonical else if (addr < 0x6000) board.WriteEXP(addr, value); - else if (addr < 0x8000) board.WritePRAM(addr, value); + else if (addr < 0x8000) board.WriteWRAM(addr, value); else board.WritePRG(addr - 0x8000, value); } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index d33234c2ca..a56a2702fc 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -517,7 +517,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo Util.WriteByteBuffer(bw, ram); Util.WriteByteBuffer(bw, CIRAM); bw.Write(cpu_accumulate); - board.SaveStateBinary(bw); + board.SyncStateBinary(BinarySerializer.CreateWriter(bw)); ppu.SaveStateBinary(bw); bw.Flush(); } @@ -528,7 +528,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo ram = Util.ReadByteBuffer(br, false); CIRAM = Util.ReadByteBuffer(br, false); cpu_accumulate = br.ReadInt32(); - board.LoadStateBinary(br); + board.SyncStateBinary(BinarySerializer.CreateReader(br)); ppu.LoadStateBinary(br); } diff --git a/BizHawk.Emulation/Util.cs b/BizHawk.Emulation/Util.cs index 1062ba7582..5979fe56a4 100644 --- a/BizHawk.Emulation/Util.cs +++ b/BizHawk.Emulation/Util.cs @@ -519,6 +519,8 @@ namespace BizHawk { BinaryReader br; BinaryWriter bw; + public BinaryReader BinaryReader { get { return br; } } + public BinaryWriter BinaryWriter { get { return bw; } } public BinarySerializer() { } public BinarySerializer(BinaryWriter _bw) { StartWrite(_bw); } public BinarySerializer(BinaryReader _br) { StartRead(_br); } @@ -527,7 +529,22 @@ namespace BizHawk public static BinarySerializer CreateWriter(BinaryWriter _bw) { return new BinarySerializer(_bw); } public static BinarySerializer CreateReader(BinaryReader _br) { return new BinarySerializer(_br); } - bool IsReader { get { return br != null; } } + public bool IsReader { get { return br != null; } } + public bool IsWriter { get { return bw != null; } } + + public unsafe void SyncEnum(ref T val) where T : struct + { + if (typeof(T).BaseType != typeof(System.Enum)) + throw new InvalidOperationException(); + if (IsReader) val = (T)Enum.ToObject(typeof(T), br.ReadInt32()); + else bw.Write(Convert.ToInt32(val)); + } + + public void Sync(ref byte[] val, bool use_null) + { + if (IsReader) val = Util.ReadByteBuffer(br, use_null); + else Util.WriteByteBuffer(bw, val); + } public void Sync(ref byte val) { diff --git a/BizHawk.MultiClient/ConfigService.cs b/BizHawk.MultiClient/ConfigService.cs index 308a1366b3..8984543991 100644 --- a/BizHawk.MultiClient/ConfigService.cs +++ b/BizHawk.MultiClient/ConfigService.cs @@ -21,7 +21,8 @@ namespace BizHawk.MultiClient } } catch { } - return config; + if (config == null) return new T(); + else return config; } public static void Save(string filepath, object config) diff --git a/BizHawk.MultiClient/MainForm.Designer.cs b/BizHawk.MultiClient/MainForm.Designer.cs index 1085a6089b..1b0aa925bc 100644 --- a/BizHawk.MultiClient/MainForm.Designer.cs +++ b/BizHawk.MultiClient/MainForm.Designer.cs @@ -125,6 +125,7 @@ this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startPausedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.enableRewindToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.forceGDIPPresentationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.frameSkipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.miLimitFramerate = new System.Windows.Forms.ToolStripMenuItem(); this.miDisplayVsync = new System.Windows.Forms.ToolStripMenuItem(); @@ -163,7 +164,6 @@ this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.forceGDIPPresentationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -280,97 +280,87 @@ this.saveStateToolStripMenuItem.Name = "saveStateToolStripMenuItem"; this.saveStateToolStripMenuItem.Size = new System.Drawing.Size(177, 22); this.saveStateToolStripMenuItem.Text = "Save State"; + this.saveStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened); // // savestate1toolStripMenuItem // this.savestate1toolStripMenuItem.Name = "savestate1toolStripMenuItem"; - this.savestate1toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F1))); - this.savestate1toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate1toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate1toolStripMenuItem.Text = "1"; this.savestate1toolStripMenuItem.Click += new System.EventHandler(this.savestate1toolStripMenuItem_Click); // // savestate2toolStripMenuItem // this.savestate2toolStripMenuItem.Name = "savestate2toolStripMenuItem"; - this.savestate2toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F2))); - this.savestate2toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate2toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate2toolStripMenuItem.Text = "2"; this.savestate2toolStripMenuItem.Click += new System.EventHandler(this.savestate2toolStripMenuItem_Click); // // savestate3toolStripMenuItem // this.savestate3toolStripMenuItem.Name = "savestate3toolStripMenuItem"; - this.savestate3toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F3))); - this.savestate3toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate3toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate3toolStripMenuItem.Text = "3"; this.savestate3toolStripMenuItem.Click += new System.EventHandler(this.savestate3toolStripMenuItem_Click); // // savestate4toolStripMenuItem // this.savestate4toolStripMenuItem.Name = "savestate4toolStripMenuItem"; - this.savestate4toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F4))); - this.savestate4toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate4toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate4toolStripMenuItem.Text = "4"; this.savestate4toolStripMenuItem.Click += new System.EventHandler(this.savestate4toolStripMenuItem_Click); // // savestate5toolStripMenuItem // this.savestate5toolStripMenuItem.Name = "savestate5toolStripMenuItem"; - this.savestate5toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F5))); - this.savestate5toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate5toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate5toolStripMenuItem.Text = "5"; this.savestate5toolStripMenuItem.Click += new System.EventHandler(this.savestate5toolStripMenuItem_Click); // // savestate6toolStripMenuItem // this.savestate6toolStripMenuItem.Name = "savestate6toolStripMenuItem"; - this.savestate6toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F6))); - this.savestate6toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate6toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate6toolStripMenuItem.Text = "6"; this.savestate6toolStripMenuItem.Click += new System.EventHandler(this.savestate6toolStripMenuItem_Click); // // savestate7toolStripMenuItem // this.savestate7toolStripMenuItem.Name = "savestate7toolStripMenuItem"; - this.savestate7toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F7))); - this.savestate7toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate7toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate7toolStripMenuItem.Text = "7"; this.savestate7toolStripMenuItem.Click += new System.EventHandler(this.savestate7toolStripMenuItem_Click); // // savestate8toolStripMenuItem // this.savestate8toolStripMenuItem.Name = "savestate8toolStripMenuItem"; - this.savestate8toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F8))); - this.savestate8toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate8toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate8toolStripMenuItem.Text = "8"; this.savestate8toolStripMenuItem.Click += new System.EventHandler(this.savestate8toolStripMenuItem_Click); // // savestate9toolStripMenuItem // this.savestate9toolStripMenuItem.Name = "savestate9toolStripMenuItem"; - this.savestate9toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F9))); - this.savestate9toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate9toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate9toolStripMenuItem.Text = "9"; this.savestate9toolStripMenuItem.Click += new System.EventHandler(this.savestate9toolStripMenuItem_Click); // // savestate0toolStripMenuItem // this.savestate0toolStripMenuItem.Name = "savestate0toolStripMenuItem"; - this.savestate0toolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F10))); - this.savestate0toolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.savestate0toolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.savestate0toolStripMenuItem.Text = "0"; this.savestate0toolStripMenuItem.Click += new System.EventHandler(this.savestate0toolStripMenuItem_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(209, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(171, 6); // // saveNamedStateToolStripMenuItem // this.saveNamedStateToolStripMenuItem.Name = "saveNamedStateToolStripMenuItem"; - this.saveNamedStateToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.saveNamedStateToolStripMenuItem.Size = new System.Drawing.Size(212, 22); + this.saveNamedStateToolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.saveNamedStateToolStripMenuItem.Text = "Save Named State"; // // loadStateToolStripMenuItem @@ -391,97 +381,87 @@ this.loadStateToolStripMenuItem.Name = "loadStateToolStripMenuItem"; this.loadStateToolStripMenuItem.Size = new System.Drawing.Size(177, 22); this.loadStateToolStripMenuItem.Text = "Load State"; + this.loadStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened); // // loadstate1toolStripMenuItem // this.loadstate1toolStripMenuItem.Name = "loadstate1toolStripMenuItem"; - this.loadstate1toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1; - this.loadstate1toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate1toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate1toolStripMenuItem.Text = "1"; this.loadstate1toolStripMenuItem.Click += new System.EventHandler(this.loadstate1toolStripMenuItem_Click); // // loadstate2toolStripMenuItem // this.loadstate2toolStripMenuItem.Name = "loadstate2toolStripMenuItem"; - this.loadstate2toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2; - this.loadstate2toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate2toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate2toolStripMenuItem.Text = "2"; this.loadstate2toolStripMenuItem.Click += new System.EventHandler(this.loadstate2toolStripMenuItem_Click); // // loadstate3toolStripMenuItem // this.loadstate3toolStripMenuItem.Name = "loadstate3toolStripMenuItem"; - this.loadstate3toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3; - this.loadstate3toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate3toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate3toolStripMenuItem.Text = "3"; this.loadstate3toolStripMenuItem.Click += new System.EventHandler(this.loadstate3toolStripMenuItem_Click); // // loadstate4toolStripMenuItem // this.loadstate4toolStripMenuItem.Name = "loadstate4toolStripMenuItem"; - this.loadstate4toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F4; - this.loadstate4toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate4toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate4toolStripMenuItem.Text = "4"; this.loadstate4toolStripMenuItem.Click += new System.EventHandler(this.loadstate4toolStripMenuItem_Click); // // loadstate5toolStripMenuItem // this.loadstate5toolStripMenuItem.Name = "loadstate5toolStripMenuItem"; - this.loadstate5toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5; - this.loadstate5toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate5toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate5toolStripMenuItem.Text = "5"; this.loadstate5toolStripMenuItem.Click += new System.EventHandler(this.loadstate5toolStripMenuItem_Click); // // loadstate6toolStripMenuItem // this.loadstate6toolStripMenuItem.Name = "loadstate6toolStripMenuItem"; - this.loadstate6toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F6; - this.loadstate6toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate6toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate6toolStripMenuItem.Text = "6"; this.loadstate6toolStripMenuItem.Click += new System.EventHandler(this.loadstate6toolStripMenuItem_Click); // // loadstate7toolStripMenuItem // this.loadstate7toolStripMenuItem.Name = "loadstate7toolStripMenuItem"; - this.loadstate7toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F7; - this.loadstate7toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate7toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate7toolStripMenuItem.Text = "7"; this.loadstate7toolStripMenuItem.Click += new System.EventHandler(this.loadstate7toolStripMenuItem_Click); // // loadstate8toolStripMenuItem // this.loadstate8toolStripMenuItem.Name = "loadstate8toolStripMenuItem"; - this.loadstate8toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F8; - this.loadstate8toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate8toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate8toolStripMenuItem.Text = "8"; this.loadstate8toolStripMenuItem.Click += new System.EventHandler(this.loadstate8toolStripMenuItem_Click); // // loadstate9toolStripMenuItem // this.loadstate9toolStripMenuItem.Name = "loadstate9toolStripMenuItem"; - this.loadstate9toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F9; - this.loadstate9toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate9toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate9toolStripMenuItem.Text = "9"; this.loadstate9toolStripMenuItem.Click += new System.EventHandler(this.loadstate9toolStripMenuItem_Click); // // loadstate0toolStripMenuItem // this.loadstate0toolStripMenuItem.Name = "loadstate0toolStripMenuItem"; - this.loadstate0toolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F10; - this.loadstate0toolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadstate0toolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadstate0toolStripMenuItem.Text = "0"; this.loadstate0toolStripMenuItem.Click += new System.EventHandler(this.loadstate0toolStripMenuItem_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(207, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(170, 6); // // loadNamedStateToolStripMenuItem // this.loadNamedStateToolStripMenuItem.Name = "loadNamedStateToolStripMenuItem"; - this.loadNamedStateToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L))); - this.loadNamedStateToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.loadNamedStateToolStripMenuItem.Size = new System.Drawing.Size(173, 22); this.loadNamedStateToolStripMenuItem.Text = "Load Named State"; // // saveSlotToolStripMenuItem @@ -671,7 +651,6 @@ // screenshotF12ToolStripMenuItem // this.screenshotF12ToolStripMenuItem.Name = "screenshotF12ToolStripMenuItem"; - this.screenshotF12ToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12; this.screenshotF12ToolStripMenuItem.Size = new System.Drawing.Size(177, 22); this.screenshotF12ToolStripMenuItem.Text = "Screenshot"; this.screenshotF12ToolStripMenuItem.Click += new System.EventHandler(this.screenshotF12ToolStripMenuItem_Click); @@ -886,26 +865,26 @@ // controllersToolStripMenuItem // this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem"; - this.controllersToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.controllersToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.controllersToolStripMenuItem.Text = "&Controllers"; this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click); // // hotkeysToolStripMenuItem // this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem"; - this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.hotkeysToolStripMenuItem.Text = "&Hotkeys"; this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click); // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator9.Size = new System.Drawing.Size(140, 6); // // soundToolStripMenuItem // this.soundToolStripMenuItem.Name = "soundToolStripMenuItem"; - this.soundToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.soundToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.soundToolStripMenuItem.Text = "&Sound"; this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click); // @@ -918,7 +897,7 @@ this.enableRewindToolStripMenuItem, this.forceGDIPPresentationToolStripMenuItem}); this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem"; - this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.gUIToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.gUIToolStripMenuItem.Text = "GUI"; this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened); // @@ -950,6 +929,13 @@ this.enableRewindToolStripMenuItem.Text = "&Enable Rewind"; this.enableRewindToolStripMenuItem.Click += new System.EventHandler(this.enableRewindToolStripMenuItem_Click); // + // forceGDIPPresentationToolStripMenuItem + // + this.forceGDIPPresentationToolStripMenuItem.Name = "forceGDIPPresentationToolStripMenuItem"; + this.forceGDIPPresentationToolStripMenuItem.Size = new System.Drawing.Size(220, 22); + this.forceGDIPPresentationToolStripMenuItem.Text = "Force GDI+ Presentation"; + this.forceGDIPPresentationToolStripMenuItem.Click += new System.EventHandler(this.forceGDIPPresentationToolStripMenuItem_Click); + // // frameSkipToolStripMenuItem // this.frameSkipToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -974,7 +960,7 @@ this.miSpeed150, this.miSpeed200}); this.frameSkipToolStripMenuItem.Name = "frameSkipToolStripMenuItem"; - this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.frameSkipToolStripMenuItem.Text = "Speed/Skip"; this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened); // @@ -1117,19 +1103,19 @@ // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; - this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator10.Size = new System.Drawing.Size(140, 6); // // saveConfigToolStripMenuItem // this.saveConfigToolStripMenuItem.Name = "saveConfigToolStripMenuItem"; - this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.saveConfigToolStripMenuItem.Text = "Save Config"; this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click); // // loadConfigToolStripMenuItem // this.loadConfigToolStripMenuItem.Name = "loadConfigToolStripMenuItem"; - this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.loadConfigToolStripMenuItem.Text = "Load Config"; // // toolsToolStripMenuItem @@ -1240,13 +1226,6 @@ this.aboutToolStripMenuItem.Text = "&About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // - // forceGDIPPresentationToolStripMenuItem - // - this.forceGDIPPresentationToolStripMenuItem.Name = "forceGDIPPresentationToolStripMenuItem"; - this.forceGDIPPresentationToolStripMenuItem.Size = new System.Drawing.Size(220, 22); - this.forceGDIPPresentationToolStripMenuItem.Text = "Force GDI+ Presentation"; - this.forceGDIPPresentationToolStripMenuItem.Click += new System.EventHandler(this.forceGDIPPresentationToolStripMenuItem_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 7211aa94f4..7a71552362 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -643,6 +643,7 @@ namespace BizHawk.MultiClient { if (!IsNullEmulator()) SaveState("QuickSave" + i.ToString()); + Global.ClientControls.UnpressButton("LoadSlot" + i.ToString()); Global.ClientControls.UnpressButton("SaveSlot" + i.ToString()); } } @@ -653,6 +654,7 @@ namespace BizHawk.MultiClient if (!IsNullEmulator()) LoadState("QuickSave" + i.ToString()); Global.ClientControls.UnpressButton("LoadSlot" + i.ToString()); + Global.ClientControls.UnpressButton("SaveSlot" + i.ToString()); } } for (int i = 0; i < 10; i++) @@ -973,6 +975,8 @@ namespace BizHawk.MultiClient autoloadMostRecentToolStripMenuItem.Checked = true; else autoloadMostRecentToolStripMenuItem.Checked = false; + + screenshotF12ToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.ScreenshotBinding; } private void recentROMToolStripMenuItem_DropDownOpened(object sender, EventArgs e) @@ -1271,6 +1275,36 @@ namespace BizHawk.MultiClient ConfigService.Save("config.ini", Global.Config); } + private void saveStateToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + savestate1toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot1; + savestate2toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot2; + savestate3toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot3; + savestate4toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot4; + savestate5toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot5; + savestate6toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot6; + savestate7toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot7; + savestate8toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot8; + savestate9toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot9; + savestate0toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.SaveSlot0; + //saveNamedStateToolStripMenuItem.ShortcutKeyDisplayString = Global. //eh? + } + + private void loadStateToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + loadstate1toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot0; + loadstate2toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot1; + loadstate3toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot2; + loadstate4toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot3; + loadstate5toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot4; + loadstate6toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot5; + loadstate7toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot6; + loadstate8toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot7; + loadstate9toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot8; + loadstate0toolStripMenuItem.ShortcutKeyDisplayString = Global.Config.LoadSlot9; + //loadNamedStateToolStripMenuItem //eh? + } + } } \ No newline at end of file