mirror of
https://github.com/holub/mame
synced 2025-07-06 18:39:28 +03:00
To ArBee with love
Add common debugger commands to global menu bar [Vas Crabb] Also fix occasional crash in Copy Visible Note that copy visible, paste, toggle breakpoint, and view options still require you to use context menus in windows Debug/Run menus only work when a debugger window has focus, so Break is less useful than it could be Hope this is at least a slight improvement for you, ArBee
This commit is contained in:
parent
ee695f12a3
commit
bb0de79a3a
@ -29,6 +29,8 @@
|
||||
#import "osx/debugconsole.h"
|
||||
#import "osx/debugwindowhandler.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
|
||||
//============================================================
|
||||
// MODULE SUPPORT
|
||||
@ -60,10 +62,14 @@ public:
|
||||
private:
|
||||
running_machine *m_machine;
|
||||
MAMEDebugConsole *m_console;
|
||||
|
||||
static std::atomic_bool s_added_menus;
|
||||
};
|
||||
|
||||
MODULE_DEFINITION(DEBUG_OSX, debugger_osx)
|
||||
|
||||
std::atomic_bool debugger_osx::s_added_menus(false);
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::init
|
||||
//============================================================
|
||||
@ -113,7 +119,99 @@ void debugger_osx::wait_for_debugger(device_t &device, bool firststop)
|
||||
|
||||
// create a console window
|
||||
if (m_console == nil)
|
||||
{
|
||||
if (!s_added_menus.exchange(true, std::memory_order_relaxed))
|
||||
{
|
||||
NSMenuItem *item;
|
||||
|
||||
NSMenu *const debugMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Debug"];
|
||||
item = [[NSApp mainMenu] insertItemWithTitle:@"Debug" action:NULL keyEquivalent:@"" atIndex:1];
|
||||
[item setSubmenu:debugMenu];
|
||||
[debugMenu release];
|
||||
|
||||
[debugMenu addItemWithTitle:@"New Memory Window"
|
||||
action:@selector(debugNewMemoryWindow:)
|
||||
keyEquivalent:@"d"];
|
||||
[debugMenu addItemWithTitle:@"New Disassembly Window"
|
||||
action:@selector(debugNewDisassemblyWindow:)
|
||||
keyEquivalent:@"a"];
|
||||
[debugMenu addItemWithTitle:@"New Error Log Window"
|
||||
action:@selector(debugNewErrorLogWindow:)
|
||||
keyEquivalent:@"l"];
|
||||
[debugMenu addItemWithTitle:@"New (Break|Watch)points Window"
|
||||
action:@selector(debugNewPointsWindow:)
|
||||
keyEquivalent:@"b"];
|
||||
[debugMenu addItemWithTitle:@"New Devices Window"
|
||||
action:@selector(debugNewDevicesWindow:)
|
||||
keyEquivalent:@"D"];
|
||||
|
||||
[debugMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
[[debugMenu addItemWithTitle:@"Soft Reset"
|
||||
action:@selector(debugSoftReset:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[debugMenu addItemWithTitle:@"Hard Reset"
|
||||
action:@selector(debugHardReset:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]]
|
||||
setKeyEquivalentModifierMask:NSShiftKeyMask];
|
||||
|
||||
NSMenu *const runMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Run"];
|
||||
item = [[NSApp mainMenu] insertItemWithTitle:@"Run"
|
||||
action:NULL
|
||||
keyEquivalent:@""
|
||||
atIndex:([[NSApp mainMenu] indexOfItemWithSubmenu:debugMenu] + 1)];
|
||||
[item setSubmenu:runMenu];
|
||||
[runMenu release];
|
||||
|
||||
[runMenu addItemWithTitle:@"Break"
|
||||
action:@selector(debugBreak:)
|
||||
keyEquivalent:@""];
|
||||
|
||||
[runMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
[[runMenu addItemWithTitle:@"Run"
|
||||
action:@selector(debugRun:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[runMenu addItemWithTitle:@"Run and Hide Debugger"
|
||||
action:@selector(debugRunAndHide:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF12FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[runMenu addItemWithTitle:@"Run to Next CPU"
|
||||
action:@selector(debugRunToNextCPU:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF6FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[runMenu addItemWithTitle:@"Run until Next Interrupt on Current CPU"
|
||||
action:@selector(debugRunToNextInterrupt:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF7FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[runMenu addItemWithTitle:@"Run until Next VBLANK"
|
||||
action:@selector(debugRunToNextVBLANK:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF8FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[runMenu addItemWithTitle:@"Run to Cursor"
|
||||
action:@selector(debugRunToCursor:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF4FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
|
||||
[runMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
[[runMenu addItemWithTitle:@"Step Into"
|
||||
action:@selector(debugStepInto:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF11FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[runMenu addItemWithTitle:@"Step Over"
|
||||
action:@selector(debugStepOver:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]]
|
||||
setKeyEquivalentModifierMask:0];
|
||||
[[runMenu addItemWithTitle:@"Step Out"
|
||||
action:@selector(debugStepOut:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]]
|
||||
setKeyEquivalentModifierMask:NSShiftKeyMask];
|
||||
}
|
||||
m_console = [[MAMEDebugConsole alloc] initWithMachine:*m_machine];
|
||||
}
|
||||
|
||||
// make sure the debug windows are visible
|
||||
if (firststop)
|
||||
|
@ -63,7 +63,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
|
||||
InactiveSelectedBackground = [[NSColor colorWithCalibratedWhite:0.875 alpha:1.0] retain];
|
||||
InactiveSelectedCurrentBackground = [[NSColor colorWithCalibratedRed:0.875 green:0.5 blue:0.625 alpha:1.0] retain];
|
||||
|
||||
NonWhiteCharacters = [[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet];
|
||||
NonWhiteCharacters = [[[NSCharacterSet whitespaceAndNewlineCharacterSet] invertedSet] retain];
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,6 +38,7 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
|
||||
|
||||
- (void)activate;
|
||||
|
||||
- (IBAction)debugBreak:(id)sender;
|
||||
- (IBAction)debugRun:(id)sender;
|
||||
- (IBAction)debugRunAndHide:(id)sender;
|
||||
- (IBAction)debugRunToNextCPU:(id)sender;
|
||||
|
@ -29,6 +29,10 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
@implementation MAMEDebugWindowHandler
|
||||
|
||||
+ (void)addCommonActionItems:(NSMenu *)menu {
|
||||
[menu addItemWithTitle:@"Break"
|
||||
action:@selector(debugBreak:)
|
||||
keyEquivalent:@""];
|
||||
|
||||
NSMenuItem *runParentItem = [menu addItemWithTitle:@"Run"
|
||||
action:@selector(debugRun:)
|
||||
keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]];
|
||||
@ -181,13 +185,22 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugBreak:(id)sender {
|
||||
if (machine->debug_flags & DEBUG_FLAG_ENABLED)
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->halt_on_next_instruction("User-initiated break\n");
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugRun:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugRunAndHide:(id)sender {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification
|
||||
object:self
|
||||
userInfo:[NSDictionary dictionaryWithObject:[NSValue valueWithPointer:machine]
|
||||
forKey:@"MAMEDebugMachine"]];
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user