From eab8d6ac1924f2070f1552d8d8a250d263ef1f95 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 18 Jul 2015 11:42:05 -0500 Subject: [PATCH 1/5] fix saturn disc booting --- BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs index 322e440347..bc6f31b450 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs @@ -396,13 +396,14 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn int[] rTOC = new int[102]; var ses = CD.Session1; - int ntrk = ses.Tracks.Count; + int ntrk = ses.InformationTrackCount; - for (int i = 1; i <= 99; i++) + for (int i = 0; i < 99; i++) { - if (i < ntrk) + int tnum = i + 1; + if (tnum <= ntrk) { - var trk = ses.Tracks[i]; + var trk = ses.Tracks[tnum]; uint t = (uint)trk.LBA + 150; From f8497507f7440fb50b391a1a10a3886b44a3dc7e Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 18 Jul 2015 12:32:48 -0500 Subject: [PATCH 2/5] proof of concept: handle VirtualItemsSelectionRangeChanged on VirtualListView to fix some bugs when shift+clicking. Better fix is to correct all this stuff at the base class level and turn it into a more normalized event that works the way you expect. --- .../tools/Watch/RamWatch.Designer.cs | 145 +++++++++--------- .../tools/Watch/RamWatch.cs | 10 +- 2 files changed, 82 insertions(+), 73 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs index d57f63046d..d018a85109 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs @@ -40,6 +40,9 @@ this.FreezeContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.UnfreezeAllContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ViewInHexEditorContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.Separator4 = new System.Windows.Forms.ToolStripSeparator(); + this.ReadBreakpointContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.WriteBreakpointContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.Separator6 = new System.Windows.Forms.ToolStripSeparator(); this.InsertSeperatorContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MoveUpContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -113,9 +116,6 @@ this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.NotesColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.ReadBreakpointContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.Separator4 = new System.Windows.Forms.ToolStripSeparator(); - this.WriteBreakpointContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ListViewContextMenu.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); @@ -159,7 +159,7 @@ this.MoveUpContextMenuItem, this.MoveDownContextMenuItem}); this.ListViewContextMenu.Name = "contextMenuStrip1"; - this.ListViewContextMenu.Size = new System.Drawing.Size(204, 280); + this.ListViewContextMenu.Size = new System.Drawing.Size(191, 280); this.ListViewContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ListViewContextMenu_Opening); // // EditContextMenuItem @@ -167,7 +167,7 @@ this.EditContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.CutHS; this.EditContextMenuItem.Name = "EditContextMenuItem"; this.EditContextMenuItem.ShortcutKeyDisplayString = "Ctrl+E"; - this.EditContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.EditContextMenuItem.Size = new System.Drawing.Size(190, 22); this.EditContextMenuItem.Text = "&Edit"; this.EditContextMenuItem.Click += new System.EventHandler(this.EditWatchMenuItem_Click); // @@ -176,7 +176,7 @@ this.RemoveContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveContextMenuItem.Name = "RemoveContextMenuItem"; this.RemoveContextMenuItem.ShortcutKeyDisplayString = "Ctrl+R"; - this.RemoveContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.RemoveContextMenuItem.Size = new System.Drawing.Size(190, 22); this.RemoveContextMenuItem.Text = "&Remove"; this.RemoveContextMenuItem.Click += new System.EventHandler(this.RemoveWatchMenuItem_Click); // @@ -185,7 +185,7 @@ this.DuplicateContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate; this.DuplicateContextMenuItem.Name = "DuplicateContextMenuItem"; this.DuplicateContextMenuItem.ShortcutKeyDisplayString = "Ctrl+D"; - this.DuplicateContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.DuplicateContextMenuItem.Size = new System.Drawing.Size(190, 22); this.DuplicateContextMenuItem.Text = "&Duplicate"; this.DuplicateContextMenuItem.Click += new System.EventHandler(this.DuplicateWatchMenuItem_Click); // @@ -194,7 +194,7 @@ this.PokeContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke; this.PokeContextMenuItem.Name = "PokeContextMenuItem"; this.PokeContextMenuItem.ShortcutKeyDisplayString = "Ctrl+P"; - this.PokeContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.PokeContextMenuItem.Size = new System.Drawing.Size(190, 22); this.PokeContextMenuItem.Text = "&Poke"; this.PokeContextMenuItem.Click += new System.EventHandler(this.PokeAddressMenuItem_Click); // @@ -203,7 +203,7 @@ this.FreezeContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze; this.FreezeContextMenuItem.Name = "FreezeContextMenuItem"; this.FreezeContextMenuItem.ShortcutKeyDisplayString = "Ctrl+F"; - this.FreezeContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.FreezeContextMenuItem.Size = new System.Drawing.Size(190, 22); this.FreezeContextMenuItem.Text = "&Freeze"; this.FreezeContextMenuItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click); // @@ -211,28 +211,47 @@ // this.UnfreezeAllContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Unfreeze; this.UnfreezeAllContextMenuItem.Name = "UnfreezeAllContextMenuItem"; - this.UnfreezeAllContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.UnfreezeAllContextMenuItem.Size = new System.Drawing.Size(190, 22); this.UnfreezeAllContextMenuItem.Text = "Unfreeze &All"; this.UnfreezeAllContextMenuItem.Click += new System.EventHandler(this.UnfreezeAllContextMenuItem_Click); // // ViewInHexEditorContextMenuItem // this.ViewInHexEditorContextMenuItem.Name = "ViewInHexEditorContextMenuItem"; - this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(190, 22); this.ViewInHexEditorContextMenuItem.Text = "View in Hex Editor"; this.ViewInHexEditorContextMenuItem.Click += new System.EventHandler(this.ViewInHexEditorContextMenuItem_Click); // + // Separator4 + // + this.Separator4.Name = "Separator4"; + this.Separator4.Size = new System.Drawing.Size(187, 6); + // + // ReadBreakpointContextMenuItem + // + this.ReadBreakpointContextMenuItem.Name = "ReadBreakpointContextMenuItem"; + this.ReadBreakpointContextMenuItem.Size = new System.Drawing.Size(190, 22); + this.ReadBreakpointContextMenuItem.Text = "Set Read Breakpoint"; + this.ReadBreakpointContextMenuItem.Click += new System.EventHandler(this.ReadBreakpointContextMenuItem_Click); + // + // WriteBreakpointContextMenuItem + // + this.WriteBreakpointContextMenuItem.Name = "WriteBreakpointContextMenuItem"; + this.WriteBreakpointContextMenuItem.Size = new System.Drawing.Size(190, 22); + this.WriteBreakpointContextMenuItem.Text = "Set Write Breakpoint"; + this.WriteBreakpointContextMenuItem.Click += new System.EventHandler(this.WriteBreakpointContextMenuItem_Click); + // // Separator6 // this.Separator6.Name = "Separator6"; - this.Separator6.Size = new System.Drawing.Size(200, 6); + this.Separator6.Size = new System.Drawing.Size(187, 6); // // InsertSeperatorContextMenuItem // this.InsertSeperatorContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.InsertSeparator; this.InsertSeperatorContextMenuItem.Name = "InsertSeperatorContextMenuItem"; this.InsertSeperatorContextMenuItem.ShortcutKeyDisplayString = "Ctrl+I"; - this.InsertSeperatorContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.InsertSeperatorContextMenuItem.Size = new System.Drawing.Size(190, 22); this.InsertSeperatorContextMenuItem.Text = "&Insert Separator"; this.InsertSeperatorContextMenuItem.Click += new System.EventHandler(this.InsertSeparatorMenuItem_Click); // @@ -241,7 +260,7 @@ this.MoveUpContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveUp; this.MoveUpContextMenuItem.Name = "MoveUpContextMenuItem"; this.MoveUpContextMenuItem.ShortcutKeyDisplayString = "Ctrl+Up"; - this.MoveUpContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.MoveUpContextMenuItem.Size = new System.Drawing.Size(190, 22); this.MoveUpContextMenuItem.Text = "Move &Up"; this.MoveUpContextMenuItem.Click += new System.EventHandler(this.MoveUpMenuItem_Click); // @@ -250,7 +269,7 @@ this.MoveDownContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveDown; this.MoveDownContextMenuItem.Name = "MoveDownContextMenuItem"; this.MoveDownContextMenuItem.ShortcutKeyDisplayString = "Ctrl+Down"; - this.MoveDownContextMenuItem.Size = new System.Drawing.Size(203, 22); + this.MoveDownContextMenuItem.Size = new System.Drawing.Size(190, 22); this.MoveDownContextMenuItem.Text = "Move &Down"; this.MoveDownContextMenuItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click); // @@ -496,7 +515,7 @@ this.toolStripSeparator1, this.ExitMenuItem}); this.FileSubMenu.Name = "FileSubMenu"; - this.FileSubMenu.Size = new System.Drawing.Size(42, 20); + this.FileSubMenu.Size = new System.Drawing.Size(40, 20); this.FileSubMenu.Text = "&Files"; this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened); // @@ -505,7 +524,7 @@ this.NewListMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile; this.NewListMenuItem.Name = "NewListMenuItem"; this.NewListMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.NewListMenuItem.Size = new System.Drawing.Size(195, 22); + this.NewListMenuItem.Size = new System.Drawing.Size(193, 22); this.NewListMenuItem.Text = "&New List"; this.NewListMenuItem.Click += new System.EventHandler(this.NewListMenuItem_Click); // @@ -514,7 +533,7 @@ this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile; this.OpenMenuItem.Name = "OpenMenuItem"; this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.OpenMenuItem.Size = new System.Drawing.Size(195, 22); + this.OpenMenuItem.Size = new System.Drawing.Size(193, 22); this.OpenMenuItem.Text = "&Open..."; this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // @@ -523,7 +542,7 @@ this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; this.SaveMenuItem.Name = "SaveMenuItem"; this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.SaveMenuItem.Size = new System.Drawing.Size(195, 22); + this.SaveMenuItem.Size = new System.Drawing.Size(193, 22); this.SaveMenuItem.Text = "&Save"; this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click); // @@ -532,14 +551,14 @@ this.SaveAsMenuItem.Name = "SaveAsMenuItem"; this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.S))); - this.SaveAsMenuItem.Size = new System.Drawing.Size(195, 22); + this.SaveAsMenuItem.Size = new System.Drawing.Size(193, 22); this.SaveAsMenuItem.Text = "Save &As..."; this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click); // // AppendMenuItem // this.AppendMenuItem.Name = "AppendMenuItem"; - this.AppendMenuItem.Size = new System.Drawing.Size(195, 22); + this.AppendMenuItem.Size = new System.Drawing.Size(193, 22); this.AppendMenuItem.Text = "A&ppend File..."; this.AppendMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // @@ -549,26 +568,26 @@ this.noneToolStripMenuItem}); this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent; this.RecentSubMenu.Name = "RecentSubMenu"; - this.RecentSubMenu.Size = new System.Drawing.Size(195, 22); + this.RecentSubMenu.Size = new System.Drawing.Size(193, 22); this.RecentSubMenu.Text = "Recent"; this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened); // // noneToolStripMenuItem // this.noneToolStripMenuItem.Name = "noneToolStripMenuItem"; - this.noneToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22); this.noneToolStripMenuItem.Text = "None"; // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(192, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(190, 6); // // ExitMenuItem // this.ExitMenuItem.Name = "ExitMenuItem"; this.ExitMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.ExitMenuItem.Size = new System.Drawing.Size(195, 22); + this.ExitMenuItem.Size = new System.Drawing.Size(193, 22); this.ExitMenuItem.Text = "&Close"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // @@ -592,7 +611,7 @@ this.toolStripSeparator2, this.PauseMenuItem}); this.WatchesSubMenu.Name = "WatchesSubMenu"; - this.WatchesSubMenu.Size = new System.Drawing.Size(64, 20); + this.WatchesSubMenu.Size = new System.Drawing.Size(61, 20); this.WatchesSubMenu.Text = "&Watches"; this.WatchesSubMenu.DropDownOpened += new System.EventHandler(this.WatchesSubMenu_DropDownOpened); // @@ -601,7 +620,7 @@ this.MemoryDomainsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Separator2}); this.MemoryDomainsSubMenu.Name = "MemoryDomainsSubMenu"; - this.MemoryDomainsSubMenu.Size = new System.Drawing.Size(224, 22); + this.MemoryDomainsSubMenu.Size = new System.Drawing.Size(211, 22); this.MemoryDomainsSubMenu.Text = "Memory Domains"; this.MemoryDomainsSubMenu.DropDownOpened += new System.EventHandler(this.MemoryDomainsSubMenu_DropDownOpened); // @@ -613,14 +632,14 @@ // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(221, 6); + this.toolStripSeparator8.Size = new System.Drawing.Size(208, 6); // // NewWatchMenuItem // this.NewWatchMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.FindHS; this.NewWatchMenuItem.Name = "NewWatchMenuItem"; this.NewWatchMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W))); - this.NewWatchMenuItem.Size = new System.Drawing.Size(224, 22); + this.NewWatchMenuItem.Size = new System.Drawing.Size(211, 22); this.NewWatchMenuItem.Text = "&New Watch"; this.NewWatchMenuItem.Click += new System.EventHandler(this.NewWatchMenuItem_Click); // @@ -629,7 +648,7 @@ this.EditWatchMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.CutHS; this.EditWatchMenuItem.Name = "EditWatchMenuItem"; this.EditWatchMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); - this.EditWatchMenuItem.Size = new System.Drawing.Size(224, 22); + this.EditWatchMenuItem.Size = new System.Drawing.Size(211, 22); this.EditWatchMenuItem.Text = "&Edit Watch"; this.EditWatchMenuItem.Click += new System.EventHandler(this.EditWatchMenuItem_Click); // @@ -638,7 +657,7 @@ this.RemoveWatchMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveWatchMenuItem.Name = "RemoveWatchMenuItem"; this.RemoveWatchMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R))); - this.RemoveWatchMenuItem.Size = new System.Drawing.Size(224, 22); + this.RemoveWatchMenuItem.Size = new System.Drawing.Size(211, 22); this.RemoveWatchMenuItem.Text = "&Remove Watch"; this.RemoveWatchMenuItem.Click += new System.EventHandler(this.RemoveWatchMenuItem_Click); // @@ -647,7 +666,7 @@ this.DuplicateWatchMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate; this.DuplicateWatchMenuItem.Name = "DuplicateWatchMenuItem"; this.DuplicateWatchMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - this.DuplicateWatchMenuItem.Size = new System.Drawing.Size(224, 22); + this.DuplicateWatchMenuItem.Size = new System.Drawing.Size(211, 22); this.DuplicateWatchMenuItem.Text = "&Duplicate Watch"; this.DuplicateWatchMenuItem.Click += new System.EventHandler(this.DuplicateWatchMenuItem_Click); // @@ -656,7 +675,7 @@ this.PokeAddressMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke; this.PokeAddressMenuItem.Name = "PokeAddressMenuItem"; this.PokeAddressMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); - this.PokeAddressMenuItem.Size = new System.Drawing.Size(224, 22); + this.PokeAddressMenuItem.Size = new System.Drawing.Size(211, 22); this.PokeAddressMenuItem.Text = "Poke Address"; this.PokeAddressMenuItem.Click += new System.EventHandler(this.PokeAddressMenuItem_Click); // @@ -665,7 +684,7 @@ this.FreezeAddressMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze; this.FreezeAddressMenuItem.Name = "FreezeAddressMenuItem"; this.FreezeAddressMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); - this.FreezeAddressMenuItem.Size = new System.Drawing.Size(224, 22); + this.FreezeAddressMenuItem.Size = new System.Drawing.Size(211, 22); this.FreezeAddressMenuItem.Text = "Freeze Address"; this.FreezeAddressMenuItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click); // @@ -674,7 +693,7 @@ this.InsertSeparatorMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.InsertSeparator; this.InsertSeparatorMenuItem.Name = "InsertSeparatorMenuItem"; this.InsertSeparatorMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); - this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(224, 22); + this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(211, 22); this.InsertSeparatorMenuItem.Text = "Insert Separator"; this.InsertSeparatorMenuItem.Click += new System.EventHandler(this.InsertSeparatorMenuItem_Click); // @@ -682,21 +701,21 @@ // this.ClearChangeCountsMenuItem.Name = "ClearChangeCountsMenuItem"; this.ClearChangeCountsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.C))); - this.ClearChangeCountsMenuItem.Size = new System.Drawing.Size(224, 22); + this.ClearChangeCountsMenuItem.Size = new System.Drawing.Size(211, 22); this.ClearChangeCountsMenuItem.Text = "&Clear Change Counts"; this.ClearChangeCountsMenuItem.Click += new System.EventHandler(this.ClearChangeCountsMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(221, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(208, 6); // // MoveUpMenuItem // this.MoveUpMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveUp; this.MoveUpMenuItem.Name = "MoveUpMenuItem"; this.MoveUpMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Up))); - this.MoveUpMenuItem.Size = new System.Drawing.Size(224, 22); + this.MoveUpMenuItem.Size = new System.Drawing.Size(211, 22); this.MoveUpMenuItem.Text = "Move &Up"; this.MoveUpMenuItem.Click += new System.EventHandler(this.MoveUpMenuItem_Click); // @@ -705,7 +724,7 @@ this.MoveDownMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveDown; this.MoveDownMenuItem.Name = "MoveDownMenuItem"; this.MoveDownMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Down))); - this.MoveDownMenuItem.Size = new System.Drawing.Size(224, 22); + this.MoveDownMenuItem.Size = new System.Drawing.Size(211, 22); this.MoveDownMenuItem.Text = "Move &Down"; this.MoveDownMenuItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click); // @@ -713,20 +732,20 @@ // this.SelectAllMenuItem.Name = "SelectAllMenuItem"; this.SelectAllMenuItem.ShortcutKeyDisplayString = "Ctrl+A"; - this.SelectAllMenuItem.Size = new System.Drawing.Size(224, 22); + this.SelectAllMenuItem.Size = new System.Drawing.Size(211, 22); this.SelectAllMenuItem.Text = "Select &All"; this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(221, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(208, 6); // // PauseMenuItem // this.PauseMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Pause; this.PauseMenuItem.Name = "PauseMenuItem"; - this.PauseMenuItem.Size = new System.Drawing.Size(224, 22); + this.PauseMenuItem.Size = new System.Drawing.Size(211, 22); this.PauseMenuItem.Text = "&Pause"; this.PauseMenuItem.Click += new System.EventHandler(this.PauseMenuItem_Click); // @@ -741,7 +760,7 @@ this.toolStripSeparator7, this.RestoreWindowSizeMenuItem}); this.OptionsSubMenu.Name = "OptionsSubMenu"; - this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20); + this.OptionsSubMenu.Size = new System.Drawing.Size(56, 20); this.OptionsSubMenu.Text = "&Options"; this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened); // @@ -752,68 +771,68 @@ this.LastChangeMenuItem, this.OriginalMenuItem}); this.DefinePreviousValueSubMenu.Name = "DefinePreviousValueSubMenu"; - this.DefinePreviousValueSubMenu.Size = new System.Drawing.Size(217, 22); + this.DefinePreviousValueSubMenu.Size = new System.Drawing.Size(206, 22); this.DefinePreviousValueSubMenu.Text = "Define Previous Value"; this.DefinePreviousValueSubMenu.DropDownOpened += new System.EventHandler(this.DefinePreviousValueSubMenu_DropDownOpened); // // PreviousFrameMenuItem // this.PreviousFrameMenuItem.Name = "PreviousFrameMenuItem"; - this.PreviousFrameMenuItem.Size = new System.Drawing.Size(155, 22); + this.PreviousFrameMenuItem.Size = new System.Drawing.Size(148, 22); this.PreviousFrameMenuItem.Text = "Previous Frame"; this.PreviousFrameMenuItem.Click += new System.EventHandler(this.PreviousFrameMenuItem_Click); // // LastChangeMenuItem // this.LastChangeMenuItem.Name = "LastChangeMenuItem"; - this.LastChangeMenuItem.Size = new System.Drawing.Size(155, 22); + this.LastChangeMenuItem.Size = new System.Drawing.Size(148, 22); this.LastChangeMenuItem.Text = "Last Change"; this.LastChangeMenuItem.Click += new System.EventHandler(this.LastChangeMenuItem_Click); // // OriginalMenuItem // this.OriginalMenuItem.Name = "OriginalMenuItem"; - this.OriginalMenuItem.Size = new System.Drawing.Size(155, 22); + this.OriginalMenuItem.Size = new System.Drawing.Size(148, 22); this.OriginalMenuItem.Text = "&Original"; this.OriginalMenuItem.Click += new System.EventHandler(this.OriginalMenuItem_Click); // // WatchesOnScreenMenuItem // this.WatchesOnScreenMenuItem.Name = "WatchesOnScreenMenuItem"; - this.WatchesOnScreenMenuItem.Size = new System.Drawing.Size(217, 22); + this.WatchesOnScreenMenuItem.Size = new System.Drawing.Size(206, 22); this.WatchesOnScreenMenuItem.Text = "Display Watches On Screen"; this.WatchesOnScreenMenuItem.Click += new System.EventHandler(this.WatchesOnScreenMenuItem_Click); // // SaveWindowPositionMenuItem // this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem"; - this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(217, 22); + this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(206, 22); this.SaveWindowPositionMenuItem.Text = "Save Window Position"; this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click); // // AlwaysOnTopMenuItem // this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem"; - this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(217, 22); + this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(206, 22); this.AlwaysOnTopMenuItem.Text = "&Always On Top"; this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click); // // FloatingWindowMenuItem // this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem"; - this.FloatingWindowMenuItem.Size = new System.Drawing.Size(217, 22); + this.FloatingWindowMenuItem.Size = new System.Drawing.Size(206, 22); this.FloatingWindowMenuItem.Text = "&Floating Window"; this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(214, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(203, 6); // // RestoreWindowSizeMenuItem // this.RestoreWindowSizeMenuItem.Name = "RestoreWindowSizeMenuItem"; - this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(217, 22); + this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(206, 22); this.RestoreWindowSizeMenuItem.Text = "Restore Default Settings"; this.RestoreWindowSizeMenuItem.Click += new System.EventHandler(this.RestoreDefaultsMenuItem_Click); // @@ -850,6 +869,7 @@ this.WatchListView.View = System.Windows.Forms.View.Details; this.WatchListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.WatchListView_ColumnClick); this.WatchListView.SelectedIndexChanged += new System.EventHandler(this.WatchListView_SelectedIndexChanged); + this.WatchListView.VirtualItemsSelectionRangeChanged += new System.Windows.Forms.ListViewVirtualItemsSelectionRangeChangedEventHandler(this.WatchListView_VirtualItemsSelectionRangeChanged); this.WatchListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragDrop); this.WatchListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewRamWatch_DragEnter); this.WatchListView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WatchListView_KeyDown); @@ -900,25 +920,6 @@ this.NotesColumn.Text = "Notes"; this.NotesColumn.Width = 128; // - // ReadBreakpointContextMenuItem - // - this.ReadBreakpointContextMenuItem.Name = "ReadBreakpointContextMenuItem"; - this.ReadBreakpointContextMenuItem.Size = new System.Drawing.Size(203, 22); - this.ReadBreakpointContextMenuItem.Text = "Set Read Breakpoint"; - this.ReadBreakpointContextMenuItem.Click += new System.EventHandler(this.ReadBreakpointContextMenuItem_Click); - // - // Separator4 - // - this.Separator4.Name = "Separator4"; - this.Separator4.Size = new System.Drawing.Size(200, 6); - // - // WriteBreakpointContextMenuItem - // - this.WriteBreakpointContextMenuItem.Name = "WriteBreakpointContextMenuItem"; - this.WriteBreakpointContextMenuItem.Size = new System.Drawing.Size(203, 22); - this.WriteBreakpointContextMenuItem.Text = "Set Write Breakpoint"; - this.WriteBreakpointContextMenuItem.Click += new System.EventHandler(this.WriteBreakpointContextMenuItem_Click); - // // RamWatch // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index 29b874e936..478f604a3d 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -1197,7 +1197,15 @@ namespace BizHawk.Client.EmuHawk } #endregion - #endregion + + + private void WatchListView_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e) + { + PokeAddressToolBarItem.Enabled = + FreezeAddressToolBarItem.Enabled = + SelectedIndices.Any() && + SelectedWatches.All(w => w.Domain.CanPoke()); + } } } From 7e23b06dd3916e51b9d85821587ee400d95ed2ee Mon Sep 17 00:00:00 2001 From: scrimpeh Date: Sat, 18 Jul 2015 20:41:06 +0200 Subject: [PATCH 3/5] Debugger/Breakpoints - Add edit and duplicate Breakpoint buttons, refine AddBreakpoint dialog --- .../Debugger/AddBreakpointDialog.Designer.cs | 60 +++++++----- .../tools/Debugger/AddBreakpointDialog.cs | 68 +++++++++++++- .../tools/Debugger/Breakpoint.cs | 9 ++ .../Debugger/BreakpointControl.Designer.cs | 83 +++++++++++------ .../tools/Debugger/BreakpointControl.cs | 92 ++++++++++++++++--- 5 files changed, 249 insertions(+), 63 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs index c7b88092b9..b6c93e725d 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs @@ -29,27 +29,28 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.AddButton = new System.Windows.Forms.Button(); + this.AddBtn = new System.Windows.Forms.Button(); this.BreakpointTypeGroupbox = new System.Windows.Forms.GroupBox(); this.ExecuteRadio = new System.Windows.Forms.RadioButton(); this.WriteRadio = new System.Windows.Forms.RadioButton(); this.ReadRadio = new System.Windows.Forms.RadioButton(); - this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox(); this.label1 = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.CancelBtn = new System.Windows.Forms.Button(); + this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox(); this.BreakpointTypeGroupbox.SuspendLayout(); this.SuspendLayout(); // - // AddButton + // AddBtn // - this.AddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.AddButton.Location = new System.Drawing.Point(152, 92); - this.AddButton.Name = "AddButton"; - this.AddButton.Size = new System.Drawing.Size(60, 23); - this.AddButton.TabIndex = 100; - this.AddButton.Text = "&Add"; - this.AddButton.UseVisualStyleBackColor = true; - this.AddButton.Click += new System.EventHandler(this.AddButton_Click); + this.AddBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.AddBtn.Location = new System.Drawing.Point(152, 92); + this.AddBtn.Name = "AddBtn"; + this.AddBtn.Size = new System.Drawing.Size(60, 23); + this.AddBtn.TabIndex = 100; + this.AddBtn.Text = "&Add"; + this.AddBtn.UseVisualStyleBackColor = true; + this.AddBtn.Click += new System.EventHandler(this.AddButton_Click); // // BreakpointTypeGroupbox // @@ -94,6 +95,26 @@ this.ReadRadio.Text = "Read"; this.ReadRadio.UseVisualStyleBackColor = true; // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(59, 13); + this.label1.TabIndex = 3; + this.label1.Text = "Address 0x"; + // + // CancelBtn + // + this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CancelBtn.Location = new System.Drawing.Point(83, 92); + this.CancelBtn.Name = "CancelBtn"; + this.CancelBtn.Size = new System.Drawing.Size(60, 23); + this.CancelBtn.TabIndex = 101; + this.CancelBtn.Text = "&Cancel"; + this.CancelBtn.UseVisualStyleBackColor = true; + this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); + // // AddressBox // this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; @@ -104,24 +125,18 @@ this.AddressBox.TabIndex = 1; this.AddressBox.Text = "0"; // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(59, 13); - this.label1.TabIndex = 3; - this.label1.Text = "Address 0x"; - // // AddBreakpointDialog // + this.AcceptButton = this.AddBtn; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.CancelBtn; this.ClientSize = new System.Drawing.Size(224, 123); + this.Controls.Add(this.CancelBtn); this.Controls.Add(this.label1); this.Controls.Add(this.AddressBox); this.Controls.Add(this.BreakpointTypeGroupbox); - this.Controls.Add(this.AddButton); + this.Controls.Add(this.AddBtn); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; @@ -139,7 +154,7 @@ #endregion - private System.Windows.Forms.Button AddButton; + private System.Windows.Forms.Button AddBtn; private System.Windows.Forms.GroupBox BreakpointTypeGroupbox; private System.Windows.Forms.RadioButton ExecuteRadio; private System.Windows.Forms.RadioButton WriteRadio; @@ -147,5 +162,6 @@ private HexTextBox AddressBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.Button CancelBtn; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs index d14da0c99d..0b18de4cda 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs @@ -13,9 +13,42 @@ namespace BizHawk.Client.EmuHawk { public partial class AddBreakpointDialog : Form { - public AddBreakpointDialog() + public AddBreakpointDialog(BreakpointOperation op) { InitializeComponent(); + Operation = op; + } + + public AddBreakpointDialog(BreakpointOperation op, uint address, MemoryCallbackType type):this(op) + { + Address = address; + BreakType = type; + } + + private BreakpointOperation _operation; + + private BreakpointOperation Operation + { + get + { + return _operation; + } + set + { + switch (value) + { + case BreakpointOperation.Add: + Text = "Add Breakpoint"; + break; + case BreakpointOperation.Duplicate: + Text = "Duplicate Breakpoint"; + break; + case BreakpointOperation.Edit: + Text = "Edit Breakpoint"; + break; + } + _operation = value; + } } public void DisableExecuteOption() @@ -29,7 +62,7 @@ namespace BizHawk.Client.EmuHawk } - public MemoryCallbackType BreakType + public MemoryCallbackType BreakType { get { @@ -50,11 +83,29 @@ namespace BizHawk.Client.EmuHawk return MemoryCallbackType.Read; } + + set + { + ReadRadio.Checked = WriteRadio.Checked = ExecuteRadio.Checked = false; + switch (value) + { + case MemoryCallbackType.Read: + ReadRadio.Checked = true; + break; + case MemoryCallbackType.Write: + WriteRadio.Checked = true; + break; + case MemoryCallbackType.Execute: + ExecuteRadio.Checked = true; + break; + } + } } public uint Address { get { return (uint)AddressBox.ToRawInt().Value; } + set { AddressBox.SetFromLong(value); } } public long MaxAddressSize @@ -63,7 +114,6 @@ namespace BizHawk.Client.EmuHawk { return AddressBox.GetMax(); } - set { AddressBox.SetHexProperties(value); @@ -76,9 +126,21 @@ namespace BizHawk.Client.EmuHawk Close(); } + private void CancelBtn_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + private void AddBreakpointDialog_Load(object sender, EventArgs e) { } + + public enum BreakpointOperation + { + Add, Edit, Duplicate + } + } } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs index f993cd0cc4..e704cf470b 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs @@ -160,5 +160,14 @@ namespace BizHawk.Client.EmuHawk { _core.MemoryCallbacks.Remove(Callback); } + + public void ResetCallback() + { + if (Active) + { + RemoveCallback(); + AddCallback(); + } + } } } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs index aebf906517..1ebc95fae6 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs @@ -32,12 +32,14 @@ this.AddBreakpointButton = new System.Windows.Forms.Button(); this.BreakpointStatsLabel = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.ToggleButton = new System.Windows.Forms.Button(); + this.RemoveBreakpointButton = new System.Windows.Forms.Button(); + this.DuplicateBreakpointButton = new System.Windows.Forms.Button(); + this.EditBreakpointButton = new System.Windows.Forms.Button(); this.BreakpointView = new BizHawk.Client.EmuHawk.VirtualListView(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.ToggleButton = new System.Windows.Forms.Button(); - this.RemoveBreakpointButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // AddBreakpointButton @@ -61,6 +63,55 @@ this.BreakpointStatsLabel.TabIndex = 8; this.BreakpointStatsLabel.Text = "label1"; // + // ToggleButton + // + this.ToggleButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ToggleButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh; + this.ToggleButton.Location = new System.Drawing.Point(138, 387); + this.ToggleButton.Name = "ToggleButton"; + this.ToggleButton.Size = new System.Drawing.Size(23, 23); + this.ToggleButton.TabIndex = 9; + this.toolTip1.SetToolTip(this.ToggleButton, "Toggle the selected breakpoints"); + this.ToggleButton.UseVisualStyleBackColor = true; + this.ToggleButton.Click += new System.EventHandler(this.ToggleButton_Click); + // + // RemoveBreakpointButton + // + this.RemoveBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.RemoveBreakpointButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; + this.RemoveBreakpointButton.Location = new System.Drawing.Point(167, 387); + this.RemoveBreakpointButton.Name = "RemoveBreakpointButton"; + this.RemoveBreakpointButton.Size = new System.Drawing.Size(23, 23); + this.RemoveBreakpointButton.TabIndex = 7; + this.toolTip1.SetToolTip(this.RemoveBreakpointButton, "Remove selected breakpoints"); + this.RemoveBreakpointButton.UseVisualStyleBackColor = true; + this.RemoveBreakpointButton.Click += new System.EventHandler(this.RemoveBreakpointButton_Click); + // + // DuplicateBreakpointButton + // + this.DuplicateBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.DuplicateBreakpointButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate; + this.DuplicateBreakpointButton.Location = new System.Drawing.Point(109, 387); + this.DuplicateBreakpointButton.Name = "DuplicateBreakpointButton"; + this.DuplicateBreakpointButton.Size = new System.Drawing.Size(23, 23); + this.DuplicateBreakpointButton.TabIndex = 10; + this.toolTip1.SetToolTip(this.DuplicateBreakpointButton, "Duplicate the selected breakpoint"); + this.DuplicateBreakpointButton.UseVisualStyleBackColor = true; + this.DuplicateBreakpointButton.Click += new System.EventHandler(this.DuplicateBreakpointButton_Click); + // + // EditBreakpointButton + // + this.EditBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.EditBreakpointButton.BackgroundImage = global::BizHawk.Client.EmuHawk.Properties.Resources.pencil; + this.EditBreakpointButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.EditBreakpointButton.Location = new System.Drawing.Point(80, 387); + this.EditBreakpointButton.Name = "EditBreakpointButton"; + this.EditBreakpointButton.Size = new System.Drawing.Size(23, 23); + this.EditBreakpointButton.TabIndex = 11; + this.toolTip1.SetToolTip(this.EditBreakpointButton, "Edit the selected breakpoint"); + this.EditBreakpointButton.UseVisualStyleBackColor = true; + this.EditBreakpointButton.Click += new System.EventHandler(this.EditBreakpointButton_Click); + // // BreakpointView // this.BreakpointView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -106,33 +157,11 @@ this.columnHeader3.Text = "Name"; this.columnHeader3.Width = 80; // - // ToggleButton - // - this.ToggleButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.ToggleButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh; - this.ToggleButton.Location = new System.Drawing.Point(138, 387); - this.ToggleButton.Name = "ToggleButton"; - this.ToggleButton.Size = new System.Drawing.Size(23, 23); - this.ToggleButton.TabIndex = 9; - this.toolTip1.SetToolTip(this.ToggleButton, "Toggle the selected breakpoints"); - this.ToggleButton.UseVisualStyleBackColor = true; - this.ToggleButton.Click += new System.EventHandler(this.ToggleButton_Click); - // - // RemoveBreakpointButton - // - this.RemoveBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.RemoveBreakpointButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; - this.RemoveBreakpointButton.Location = new System.Drawing.Point(167, 387); - this.RemoveBreakpointButton.Name = "RemoveBreakpointButton"; - this.RemoveBreakpointButton.Size = new System.Drawing.Size(23, 23); - this.RemoveBreakpointButton.TabIndex = 7; - this.toolTip1.SetToolTip(this.RemoveBreakpointButton, "Remove selected breakpoints"); - this.RemoveBreakpointButton.UseVisualStyleBackColor = true; - this.RemoveBreakpointButton.Click += new System.EventHandler(this.RemoveBreakpointButton_Click); - // // BreakpointControl // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; + this.Controls.Add(this.EditBreakpointButton); + this.Controls.Add(this.DuplicateBreakpointButton); this.Controls.Add(this.ToggleButton); this.Controls.Add(this.BreakpointStatsLabel); this.Controls.Add(this.RemoveBreakpointButton); @@ -157,5 +186,7 @@ private System.Windows.Forms.Label BreakpointStatsLabel; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Button ToggleButton; + private System.Windows.Forms.Button DuplicateBreakpointButton; + private System.Windows.Forms.Button EditBreakpointButton; } } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs index d0414c7e36..f08317eb36 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs @@ -154,16 +154,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger private void AddBreakpointButton_Click(object sender, EventArgs e) { - var b = new AddBreakpointDialog - { - // TODO: don't use Global.Emulator! Pass in an IMemoryDomains implementation from the parent tool - MaxAddressSize = Global.Emulator.AsMemoryDomains().SystemBus.Size - 1 - }; - - if (!MCS.ExecuteCallbacksAvailable) - { - b.DisableExecuteOption(); - } + var b = CreateAddBreakpointDialog(BreakpointOperation.Add); if (b.ShowHawkDialog() == DialogResult.OK) { @@ -231,8 +222,12 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger private void UpdateBreakpointRemoveButton() { ToggleButton.Enabled = - RemoveBreakpointButton.Enabled = - EditableItems.Any(); + RemoveBreakpointButton.Enabled = + EditableItems.Any(); + + DuplicateBreakpointButton.Enabled = + EditBreakpointButton.Enabled = + EditableItems.Count() == 1; } private void BreakpointView_SelectedIndexChanged(object sender, EventArgs e) @@ -282,5 +277,78 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger BreakpointView.ItemCount = Breakpoints.Count; UpdateStatsLabel(); } + + private void DuplicateBreakpointButton_Click(object sender, EventArgs e) + { + var breakpoint = SelectedItems.FirstOrDefault(); + + if (breakpoint != null && !breakpoint.ReadOnly) + { + var b = CreateAddBreakpointDialog(BreakpointOperation.Duplicate, breakpoint.Type, breakpoint.Address); + + if (b.ShowHawkDialog() == DialogResult.OK) + { + Breakpoints.Add(new Breakpoint(Core, breakpoint.Callback, b.Address, b.BreakType, breakpoint.Active)); + } + } + + BreakpointView.ItemCount = Breakpoints.Count; + UpdateBreakpointRemoveButton(); + UpdateStatsLabel(); + } + + private void EditBreakpointButton_Click(object sender, EventArgs e) + { + var breakpoint = SelectedItems.FirstOrDefault(); + + if (breakpoint != null && !breakpoint.ReadOnly) + { + var b = CreateAddBreakpointDialog(BreakpointOperation.Edit, breakpoint.Type, breakpoint.Address); + + if (b.ShowHawkDialog() == DialogResult.OK) + { + breakpoint.Type = b.BreakType; + breakpoint.Address = b.Address; + breakpoint.ResetCallback(); + } + } + + BreakpointView.ItemCount = Breakpoints.Count; + UpdateBreakpointRemoveButton(); + UpdateStatsLabel(); + } + + private AddBreakpointDialog CreateAddBreakpointDialog(BreakpointOperation op, MemoryCallbackType? type = null, uint? address = null) + { + var operation = (AddBreakpointDialog.BreakpointOperation)op; + + var b = new AddBreakpointDialog(operation) + { + // TODO: don't use Global.Emulator! Pass in an IMemoryDomains implementation from the parent tool + MaxAddressSize = Global.Emulator.AsMemoryDomains().SystemBus.Size - 1 + }; + + if (type != null) + { + b.BreakType = (MemoryCallbackType)type; + } + + if (address != null) + { + b.Address = (uint)address; + } + + if (!MCS.ExecuteCallbacksAvailable) + { + b.DisableExecuteOption(); + } + + return b; + } + + public enum BreakpointOperation + { + Add, Edit, Duplicate + } } } From 4d2e3573f184dae243bdda4122542e617eaa21f5 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 18 Jul 2015 17:55:33 -0500 Subject: [PATCH 4/5] disc - fix the SeekTrack method --- BizHawk.Emulation.DiscSystem/DiscIdentifier.cs | 9 +++++++-- BizHawk.Emulation.DiscSystem/DiscStructure.cs | 18 +++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs b/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs index dad81a20cb..b0d0370958 100644 --- a/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs +++ b/BizHawk.Emulation.DiscSystem/DiscIdentifier.cs @@ -54,6 +54,9 @@ namespace BizHawk.Emulation.DiscSystem { this.disc = disc; dsr = new DiscSectorReader(disc); + + //the first check for mode 0 should be sufficient for blocking attempts to read audio sectors, so dont do this + //dsr.Policy.ThrowExceptions2048 = false; } Disc disc; @@ -66,8 +69,10 @@ namespace BizHawk.Emulation.DiscSystem /// public DiscType DetectDiscType() { - //check track 0. if it's an audio track, further data-track testing is useless - if (dsr.ReadLBA_Mode(0) == 0) return DiscType.AudioDisc; + //check track 1's data type. if it's an audio track, further data-track testing is useless + //furthermore, it's probably senseless (no binary data there to read) + //however a sector could mark itself as audio without actually being.. we'll just wait for that one. + if (dsr.ReadLBA_Mode(disc.TOC.TOCItems[1].LBATimestamp.Sector) == 0) return DiscType.AudioDisc; //sega doesnt put anything identifying in the cdfs volume info. but its consistent about putting its own header here in sector 0 if (DetectSegaSaturn()) return DiscType.SegaSaturn; diff --git a/BizHawk.Emulation.DiscSystem/DiscStructure.cs b/BizHawk.Emulation.DiscSystem/DiscStructure.cs index 588de48072..d6a9905df0 100644 --- a/BizHawk.Emulation.DiscSystem/DiscStructure.cs +++ b/BizHawk.Emulation.DiscSystem/DiscStructure.cs @@ -35,13 +35,13 @@ namespace BizHawk.Emulation.DiscSystem /// /// The number of user information tracks in the session. - /// This excludes track 0 and the lead-out track. + /// This excludes the lead-in and lead-out tracks /// Use this instead of Tracks.Count /// public int InformationTrackCount { get { return Tracks.Count - 2; } } /// - /// All the tracks in the session.. but... Tracks[0] is the lead-in track placeholder. Tracks[1] should be "Track 1". So beware of this. + /// All the tracks in the session.. but... Tracks[0] is the lead-in track. Tracks[1] should be "Track 1". So beware of this. /// For a disc with "3 tracks", Tracks.Count will be 5: it includes that lead-in track as well as the leadout track. /// Perhaps we should turn this into a special collection type with no Count or Length, or a method to GetTrack() /// @@ -65,22 +65,26 @@ namespace BizHawk.Emulation.DiscSystem /// public Track LeadoutTrack { get { return Tracks[Tracks.Count - 1]; } } + /// + /// A reference to the lead-in track + /// + public Track LeadinTrack { get { return Tracks[0]; } } + /// /// Determines which track of the session is at the specified LBA. - /// Returns null if it's before track 1 /// public Track SeekTrack(int lba) { var ses = this; - //take care with this loop bounds: - for (int i = 1; i <= ses.InformationTrackCount; i++) + for (int i = 1; i < Tracks.Count; i++) { var track = ses.Tracks[i]; + //funny logic here: if the current track's LBA is > the requested track number, it means the previous track is the one we wanted if (track.LBA > lba) - return (i == 1) ? null : ses.Tracks[i]; + return ses.Tracks[i - 1]; } - return ses.Tracks[ses.Tracks.Count]; + return ses.LeadoutTrack; } } From 37aca2bc921278db0f847dd67d36af1c5622a8be Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 18 Jul 2015 20:08:45 -0500 Subject: [PATCH 5/5] change rom status text to reference accurate PSX menu Hash Discs tool name --- BizHawk.Client.Common/RomLoader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs index aa10a779e4..ba7f0442b0 100644 --- a/BizHawk.Client.Common/RomLoader.cs +++ b/BizHawk.Client.Common/RomLoader.cs @@ -278,7 +278,7 @@ namespace BizHawk.Client.Common sw.WriteLine("Nonetheless it could be an unrecognized romhack or patched version."); sw.WriteLine("According to redump.org, the ideal hash for entire disc is: CRC32:{0:X8}", game.GetStringValue("dh")); sw.WriteLine("The file you loaded hasn't been hashed entirely (it would take too long)"); - sw.WriteLine("Compare it with the full hash calculated by the PSX menu's disc hasher tool"); + sw.WriteLine("Compare it with the full hash calculated by the PSX menu's Hash Discs tool"); } } else @@ -376,7 +376,7 @@ namespace BizHawk.Client.Common sw.WriteLine("Nonetheless it could be an unrecognized romhack or patched version."); sw.WriteLine("According to redump.org, the ideal hash for entire disc is: CRC32:{0:X8}", game.GetStringValue("dh")); sw.WriteLine("The file you loaded hasn't been hashed entirely (it would take too long)"); - sw.WriteLine("Compare it with the full hash calculated by the PSX menu's disc hasher tool"); + sw.WriteLine("Compare it with the full hash calculated by the PSX menu's Hash Discs tool"); nextEmulator.CoreComm.RomStatusDetails = sw.ToString(); } break;