mirror of
https://github.com/holub/mame
synced 2025-06-07 21:33:45 +03:00
Added basic support for saving/restoring Cocoa debugger window state, compatible with Qt debugger where possible
This commit is contained in:
parent
a549c6408a
commit
c36c1572ec
@ -18,6 +18,7 @@
|
||||
|
||||
// MAME headers
|
||||
#include "emu.h"
|
||||
#include "config.h"
|
||||
#include "debugger.h"
|
||||
|
||||
// MAMEOS headers
|
||||
@ -39,10 +40,11 @@
|
||||
class debugger_osx : public osd_module, public debug_module
|
||||
{
|
||||
public:
|
||||
debugger_osx()
|
||||
: osd_module(OSD_DEBUG_PROVIDER, "osx"), debug_module(),
|
||||
m_machine(nullptr),
|
||||
m_console(nil)
|
||||
debugger_osx() :
|
||||
osd_module(OSD_DEBUG_PROVIDER, "osx"),
|
||||
debug_module(),
|
||||
m_machine(nullptr),
|
||||
m_console(nil)
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,6 +62,11 @@ public:
|
||||
virtual void debugger_update();
|
||||
|
||||
private:
|
||||
void create_console();
|
||||
void build_menus();
|
||||
void config_load(config_type cfgtype, util::xml::data_node const *parentnode);
|
||||
void config_save(config_type cfgtype, util::xml::data_node *parentnode);
|
||||
|
||||
running_machine *m_machine;
|
||||
MAMEDebugConsole *m_console;
|
||||
|
||||
@ -70,8 +77,10 @@ MODULE_DEFINITION(DEBUG_OSX, debugger_osx)
|
||||
|
||||
std::atomic_bool debugger_osx::s_added_menus(false);
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::init
|
||||
// initialise debugger module
|
||||
//============================================================
|
||||
|
||||
int debugger_osx::init(const osd_options &options)
|
||||
@ -79,38 +88,47 @@ int debugger_osx::init(const osd_options &options)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::exit
|
||||
// clean up debugger module
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::exit()
|
||||
{
|
||||
NSAutoreleasePool *const pool = [[NSAutoreleasePool alloc] init];
|
||||
if (m_console)
|
||||
{
|
||||
NSAutoreleasePool *const pool = [[NSAutoreleasePool alloc] init];
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObject:[NSValue valueWithPointer:m_machine]
|
||||
forKey:@"MAMEDebugMachine"];
|
||||
forKey:@"MAMEDebugMachine"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification
|
||||
object:m_console
|
||||
userInfo:info];
|
||||
[m_console release];
|
||||
m_console = nil;
|
||||
m_machine = nullptr;
|
||||
[pool release];
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::init_debugger
|
||||
// attach debugger module to a machine
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::init_debugger(running_machine &machine)
|
||||
{
|
||||
m_machine = &machine;
|
||||
machine.configuration().config_register(
|
||||
"debugger",
|
||||
config_load_delegate(&debugger_osx::config_load, this),
|
||||
config_save_delegate(&debugger_osx::config_save, this));
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::wait_for_debugger
|
||||
// perform debugger event processing
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::wait_for_debugger(device_t &device, bool firststop)
|
||||
@ -118,100 +136,7 @@ void debugger_osx::wait_for_debugger(device_t &device, bool firststop)
|
||||
NSAutoreleasePool *const pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
// 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];
|
||||
}
|
||||
create_console();
|
||||
|
||||
// make sure the debug windows are visible
|
||||
if (firststop)
|
||||
@ -239,9 +164,164 @@ void debugger_osx::wait_for_debugger(device_t &device, bool firststop)
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_update
|
||||
// debugger_osx::debugger_update
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::debugger_update()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::create_console
|
||||
// create main debugger window if we haven't already done so
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::create_console()
|
||||
{
|
||||
if (m_console == nil)
|
||||
{
|
||||
build_menus();
|
||||
m_console = [[MAMEDebugConsole alloc] initWithMachine:*m_machine];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::build_menus
|
||||
// extend global menu bar with debugging options
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::build_menus()
|
||||
{
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::config_load
|
||||
// restore state based on configuration XML
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::config_load(config_type cfgtype, util::xml::data_node const *parentnode)
|
||||
{
|
||||
if ((config_type::GAME == cfgtype) && parentnode)
|
||||
{
|
||||
NSAutoreleasePool *const pool = [[NSAutoreleasePool alloc] init];
|
||||
create_console();
|
||||
[m_console loadConfiguration:parentnode];
|
||||
[pool release];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// debugger_osx::config_save
|
||||
// save state to system XML
|
||||
//============================================================
|
||||
|
||||
void debugger_osx::config_save(config_type cfgtype, util::xml::data_node *parentnode)
|
||||
{
|
||||
if ((config_type::GAME == cfgtype) && m_console)
|
||||
{
|
||||
NSAutoreleasePool *const pool = [[NSAutoreleasePool alloc] init];
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithPointer:m_machine],
|
||||
@"MAMEDebugMachine",
|
||||
[NSValue valueWithPointer:parentnode],
|
||||
@"MAMEDebugParentNode",
|
||||
nil];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MAMESaveDebuggerConfigurationNotification
|
||||
object:m_console
|
||||
userInfo:info];
|
||||
[pool release];
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,10 @@
|
||||
- (void)showDebugger:(NSNotification *)notification;
|
||||
- (void)auxiliaryWindowWillClose:(NSNotification *)notification;
|
||||
|
||||
- (void)loadConfiguration:(util::xml::data_node const *)parentnode;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@implementation MAMEDebugConsole
|
||||
|
||||
@ -378,6 +380,55 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)loadConfiguration:(util::xml::data_node const *)parentnode {
|
||||
util::xml::data_node const *node = nullptr;
|
||||
for (node = parentnode->get_child("window"); node; node = node->get_next_sibling("window"))
|
||||
{
|
||||
MAMEDebugWindowHandler *win = nil;
|
||||
switch (node->get_attribute_int("type", -1))
|
||||
{
|
||||
case MAME_DEBUGGER_WINDOW_TYPE_CONSOLE:
|
||||
[self restoreConfigurationFromNode:node];
|
||||
break;
|
||||
case MAME_DEBUGGER_WINDOW_TYPE_MEMORY_VIEWER:
|
||||
win = [[MAMEMemoryViewer alloc] initWithMachine:*machine console:self];
|
||||
break;
|
||||
case MAME_DEBUGGER_WINDOW_TYPE_DISASSEMBLY_VIEWER:
|
||||
win = [[MAMEDisassemblyViewer alloc] initWithMachine:*machine console:self];
|
||||
break;
|
||||
case MAME_DEBUGGER_WINDOW_TYPE_ERROR_LOG_VIEWER:
|
||||
win = [[MAMEErrorLogViewer alloc] initWithMachine:*machine console:self];
|
||||
break;
|
||||
case MAME_DEBUGGER_WINDOW_TYPE_POINTS_VIEWER:
|
||||
win = [[MAMEPointsViewer alloc] initWithMachine:*machine console:self];
|
||||
break;
|
||||
case MAME_DEBUGGER_WINDOW_TYPE_DEVICES_VIEWER:
|
||||
win = [[MAMEDevicesViewer alloc] initWithMachine:*machine console:self];
|
||||
break;
|
||||
case MAME_DEBUGGER_WINDOW_TYPE_DEVICE_INFO_VIEWER:
|
||||
// FIXME: needs device info on init, make another variant
|
||||
//win = [[MAMEDeviceInfoViewer alloc] initWithMachine:*machine console:self];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (win)
|
||||
{
|
||||
[auxiliaryWindows addObject:win];
|
||||
[win restoreConfigurationFromNode:node];
|
||||
[win release];
|
||||
[win activate];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_CONSOLE);
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor {
|
||||
if (control == commandField)
|
||||
[history edit];
|
||||
|
@ -20,6 +20,20 @@
|
||||
extern NSString *const MAMEHideDebuggerNotification;
|
||||
extern NSString *const MAMEShowDebuggerNotification;
|
||||
extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
|
||||
extern NSString *const MAMESaveDebuggerConfigurationNotification;
|
||||
|
||||
|
||||
// for compatibility with the Qt debugger
|
||||
enum
|
||||
{
|
||||
MAME_DEBUGGER_WINDOW_TYPE_CONSOLE = 1,
|
||||
MAME_DEBUGGER_WINDOW_TYPE_MEMORY_VIEWER,
|
||||
MAME_DEBUGGER_WINDOW_TYPE_DISASSEMBLY_VIEWER,
|
||||
MAME_DEBUGGER_WINDOW_TYPE_ERROR_LOG_VIEWER,
|
||||
MAME_DEBUGGER_WINDOW_TYPE_POINTS_VIEWER,
|
||||
MAME_DEBUGGER_WINDOW_TYPE_DEVICES_VIEWER,
|
||||
MAME_DEBUGGER_WINDOW_TYPE_DEVICE_INFO_VIEWER
|
||||
};
|
||||
|
||||
|
||||
@interface MAMEDebugWindowHandler : NSObject <NSWindowDelegate>
|
||||
@ -55,6 +69,10 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
|
||||
|
||||
- (void)showDebugger:(NSNotification *)notification;
|
||||
- (void)hideDebugger:(NSNotification *)notification;
|
||||
- (void)saveConfig:(NSNotification *)notification;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
@end
|
||||
|
||||
@ -99,4 +117,7 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification;
|
||||
- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor;
|
||||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
@end
|
||||
|
@ -15,6 +15,9 @@
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
//============================================================
|
||||
// NOTIFICATIONS
|
||||
//============================================================
|
||||
@ -22,6 +25,7 @@
|
||||
NSString *const MAMEHideDebuggerNotification = @"MAMEHideDebuggerNotification";
|
||||
NSString *const MAMEShowDebuggerNotification = @"MAMEShowDebuggerNotification";
|
||||
NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryDebugWindowWillCloseNotification";
|
||||
NSString *const MAMESaveDebuggerConfigurationNotification = @"MAMESaveDebuggerConfigurationNotification";
|
||||
|
||||
|
||||
//============================================================
|
||||
@ -154,6 +158,10 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
[window setTitle:t];
|
||||
[window setContentMinSize:NSMakeSize(320, 240)];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(saveConfig:)
|
||||
name:MAMESaveDebuggerConfigurationNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(showDebugger:)
|
||||
name:MAMEShowDebuggerNotification
|
||||
@ -269,6 +277,46 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
[window orderOut:self];
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfig:(NSNotification *)notification {
|
||||
running_machine *m = (running_machine *)[[[notification userInfo] objectForKey:@"MAMEDebugMachine"] pointerValue];
|
||||
if (m == machine)
|
||||
{
|
||||
util::xml::data_node *parentnode = (util::xml::data_node *)[[[notification userInfo] objectForKey:@"MAMEDebugParentNode"] pointerValue];
|
||||
util::xml::data_node *node = parentnode->add_child("window", nullptr);
|
||||
if (node)
|
||||
[self saveConfigurationToNode:node];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
NSRect frame = [window frame];
|
||||
node->set_attribute_float("position_x", frame.origin.x);
|
||||
node->set_attribute_float("position_y", frame.origin.y);
|
||||
node->set_attribute_float("size_x", frame.size.width);
|
||||
node->set_attribute_float("size_y", frame.size.height);
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
NSRect frame = [window frame];
|
||||
frame.origin.x = node->get_attribute_float("position_x", frame.origin.x);
|
||||
frame.origin.y = node->get_attribute_float("position_y", frame.origin.y);
|
||||
frame.size.width = node->get_attribute_float("size_x", frame.size.width);
|
||||
frame.size.height = node->get_attribute_float("size_y", frame.size.height);
|
||||
|
||||
NSSize min = [window minSize];
|
||||
frame.size.width = std::max(frame.size.width, min.width);
|
||||
frame.size.height = std::max(frame.size.height, min.height);
|
||||
|
||||
NSSize max = [window maxSize];
|
||||
frame.size.width = std::min(frame.size.width, max.width);
|
||||
frame.size.height = std::min(frame.size.height, max.height);
|
||||
|
||||
[window setFrame:frame display:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -449,4 +497,18 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->add_child("expression", [[self expression] UTF8String]);
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
[super restoreConfigurationFromNode:node];
|
||||
util::xml::data_node const *const expr = node->get_child("expression");
|
||||
if (expr && expr->get_value())
|
||||
[self setExpression:[NSString stringWithUTF8String:expr->get_value()]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -23,4 +23,6 @@
|
||||
|
||||
- (id)initWithDevice:(device_t &)d machine:(running_machine &)m console:(MAMEDebugConsole *)c;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
|
||||
@end
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "emu.h"
|
||||
#import "deviceinfoviewer.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@interface MAMEDeviceInfoView : NSView
|
||||
{
|
||||
@ -232,4 +234,10 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_DEVICE_INFO_VIEWER);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -26,4 +26,6 @@
|
||||
|
||||
- (IBAction)showDeviceDetail:(id)sender;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
|
||||
@end
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#import "debugconsole.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@interface MAMEDeviceWrapper : NSObject
|
||||
{
|
||||
@ -181,6 +183,12 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_DEVICES_VIEWER);
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
|
||||
return [(MAMEDeviceWrapper *)item children] > 0;
|
||||
}
|
||||
|
@ -33,4 +33,6 @@
|
||||
|
||||
- (IBAction)changeSubview:(id)sender;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
|
||||
@end
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@implementation MAMEDisassemblyViewer
|
||||
|
||||
@ -227,6 +229,12 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_DISASSEMBLY_VIEWER);
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item {
|
||||
SEL const action = [item action];
|
||||
BOOL const inContextMenu = ([item menu] == [dasmView menu]);
|
||||
|
@ -23,4 +23,6 @@
|
||||
|
||||
- (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
|
||||
@end
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#import "errorlogview.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@implementation MAMEErrorLogViewer
|
||||
|
||||
@ -59,4 +61,10 @@
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_ERROR_LOG_VIEWER);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -40,6 +40,9 @@
|
||||
- (IBAction)showReverseViewToggle:(id)sender;
|
||||
- (IBAction)changeBytesPerLine:(id)sender;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
- (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
|
||||
- (void)insertSubviewItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index;
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debug/debugvw.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@implementation MAMEMemoryView
|
||||
|
||||
@ -107,7 +109,8 @@
|
||||
|
||||
- (void)selectSubviewAtIndex:(int)index {
|
||||
int const selected = view->source_list().indexof(*view->source());
|
||||
if (selected != index) {
|
||||
if (selected != index)
|
||||
{
|
||||
view->set_source(*view->source_list().find(index));
|
||||
if ([[self window] firstResponder] != self)
|
||||
view->set_cursor_visible(false);
|
||||
@ -197,6 +200,24 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
debug_view_memory *const memView = downcast<debug_view_memory *>(view);
|
||||
node->set_attribute_int("memoryregion", [self selectedSubviewIndex]);
|
||||
node->set_attribute_int("reverse", memView->reverse() ? 1 : 0);
|
||||
node->set_attribute_int("addressmode", memView->physical() ? 1 : 0);
|
||||
node->set_attribute_int("dataformat", memView->get_data_format());
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
debug_view_memory *const memView = downcast<debug_view_memory *>(view);
|
||||
[self selectSubviewAtIndex:node->get_attribute_int("memoryregion", [self selectedSubviewIndex])];
|
||||
memView->set_reverse(0 != node->get_attribute_int("reverse", memView->reverse() ? 1 : 0));
|
||||
memView->set_physical(0 != node->get_attribute_int("addressmode", memView->physical() ? 1 : 0));
|
||||
memView->set_data_format(node->get_attribute_int("dataformat", memView->get_data_format()));
|
||||
}
|
||||
|
||||
|
||||
- (void)insertActionItemsInMenu:(NSMenu *)menu atIndex:(NSInteger)index {
|
||||
NSInteger tag;
|
||||
for (tag = 1; tag <= 8; tag <<= 1) {
|
||||
|
@ -29,4 +29,7 @@
|
||||
|
||||
- (IBAction)changeSubview:(id)sender;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node;
|
||||
|
||||
@end
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debug/dvmemory.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@implementation MAMEMemoryViewer
|
||||
|
||||
@ -173,4 +175,17 @@
|
||||
[window setTitle:[NSString stringWithFormat:@"Memory: %@", [memoryView selectedSubviewName]]];
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_MEMORY_VIEWER);
|
||||
[memoryView saveConfigurationToNode:node];
|
||||
}
|
||||
|
||||
|
||||
- (void)restoreConfigurationFromNode:(util::xml::data_node const *)node {
|
||||
[super restoreConfigurationFromNode:node];
|
||||
[memoryView restoreConfigurationFromNode:node];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -25,4 +25,6 @@
|
||||
|
||||
- (IBAction)changeSubview:(id)sender;
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node;
|
||||
|
||||
@end
|
||||
|
@ -12,6 +12,8 @@
|
||||
#import "breakpointsview.h"
|
||||
#import "watchpointsview.h"
|
||||
|
||||
#include "util/xmlfile.h"
|
||||
|
||||
|
||||
@implementation MAMEPointsViewer
|
||||
|
||||
@ -141,4 +143,10 @@
|
||||
[window setTitle:[[sender selectedItem] title]];
|
||||
}
|
||||
|
||||
|
||||
- (void)saveConfigurationToNode:(util::xml::data_node *)node {
|
||||
[super saveConfigurationToNode:node];
|
||||
node->set_attribute_int("type", MAME_DEBUGGER_WINDOW_TYPE_POINTS_VIEWER);
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user