diff --git a/src/osd/modules/debugger/debugosx.m b/src/osd/modules/debugger/debugosx.m index 440a201a2bfd2..491aefbedda64 100644 --- a/src/osd/modules/debugger/debugosx.m +++ b/src/osd/modules/debugger/debugosx.m @@ -12,11 +12,11 @@ // TODO: // * Automatic scrolling for console and log views -// * Using alpha for disabled foreground colours doesn't really work -// * New windows created from auxiliary windows should inherit focus rather than pointing at current CPU -// * Keyboard shortcuts in error log windows +// * Keyboard shortcuts in error log and devices windows // * Don't accept keyboard input while the game is running // * Interior focus rings - standard/exterior focus rings look really ugly here +// * Improve automatic window sizing - it isn't working all that well +// * Updates causing debug views' widths to change are sometimes obscured by the scroll views' opaque backgrounds // * Scroll views with content narrower than clipping area are flaky under Tiger - nothing I can do about this @@ -30,8 +30,8 @@ #include "osdsdl.h" #include "debug_module.h" -#import "osx/debugosxdebugconsole.h" -#import "osx/debugosxdebugwindowhandler.h" +#import "osx/debugconsole.h" +#import "osx/debugwindowhandler.h" //============================================================ @@ -54,14 +54,8 @@ [m_console release]; } - virtual int init() - { - return 0; - } - - virtual void exit() - { - } + virtual int init(); + virtual void exit(); virtual void init_debugger(running_machine &machine); virtual void wait_for_debugger(device_t &device, bool firststop); @@ -74,13 +68,41 @@ virtual void exit() MODULE_DEFINITION(DEBUG_OSX, debugger_osx) +//============================================================ +// debugger_osx::init +//============================================================ + +int debugger_osx::init() +{ + return 0; +} + +//============================================================ +// debugger_osx::exit +//============================================================ + +void debugger_osx::exit() +{ + if (m_console) + { + NSDictionary *info = [NSDictionary dictionaryWithObject:[NSValue valueWithPointer:m_machine] + forKey:@"MAMEDebugMachine"]; + [[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification + object:m_console + userInfo:info]; + [m_console release]; + m_console = nil; + m_machine = NULL; + } +} + //============================================================ // debugger_osx::init_debugger //============================================================ void debugger_osx::init_debugger(running_machine &machine) { - m_machine = &machine; + m_machine = &machine; } //============================================================ @@ -94,9 +116,12 @@ virtual void exit() m_console = [[MAMEDebugConsole alloc] initWithMachine:*m_machine]; // make sure the debug windows are visible - if (firststop) { + if (firststop) + { NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithPointer:&device], @"MAMEDebugDevice", + [NSValue valueWithPointer:m_machine], + @"MAMEDebugMachine", nil]; [[NSNotificationCenter defaultCenter] postNotificationName:MAMEShowDebuggerNotification object:m_console diff --git a/src/osd/modules/debugger/debugqt.c b/src/osd/modules/debugger/debugqt.c index ce675a0180d14..22614949735dd 100644 --- a/src/osd/modules/debugger/debugqt.c +++ b/src/osd/modules/debugger/debugqt.c @@ -26,13 +26,13 @@ #include "debugger.h" #include "modules/lib/osdobj_common.h" -#include "qt/debugqtlogwindow.h" -#include "qt/debugqtmainwindow.h" -#include "qt/debugqtdasmwindow.h" -#include "qt/debugqtmemorywindow.h" -#include "qt/debugqtbreakpointswindow.h" -#include "qt/debugqtdeviceswindow.h" -#include "qt/debugqtdeviceinformationwindow.h" +#include "qt/logwindow.h" +#include "qt/mainwindow.h" +#include "qt/dasmwindow.h" +#include "qt/memorywindow.h" +#include "qt/breakpointswindow.h" +#include "qt/deviceswindow.h" +#include "qt/deviceinformationwindow.h" class debug_qt : public osd_module, public debug_module { diff --git a/src/osd/modules/debugger/osx/debugosxbreakpointsview.h b/src/osd/modules/debugger/osx/breakpointsview.h similarity index 83% rename from src/osd/modules/debugger/osx/debugosxbreakpointsview.h rename to src/osd/modules/debugger/osx/breakpointsview.h index 16dd78f84209c..e31a63aebed90 100644 --- a/src/osd/modules/debugger/osx/debugosxbreakpointsview.h +++ b/src/osd/modules/debugger/osx/breakpointsview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxbreakpointsview.h - MacOS X Cocoa debug window handling +// breakpointsview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugview.h" + +#import "debugview.h" #include "emu.h" diff --git a/src/osd/modules/debugger/osx/debugosxbreakpointsview.m b/src/osd/modules/debugger/osx/breakpointsview.m similarity index 85% rename from src/osd/modules/debugger/osx/debugosxbreakpointsview.m rename to src/osd/modules/debugger/osx/breakpointsview.m index a244e17fe7e3b..97545370955dd 100644 --- a/src/osd/modules/debugger/osx/debugosxbreakpointsview.m +++ b/src/osd/modules/debugger/osx/breakpointsview.m @@ -2,14 +2,14 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxbreakpointsview.m - MacOS X Cocoa debug window handling +// breakpointsview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxbreakpointsview.h" +#import "breakpointsview.h" #include "debug/debugvw.h" diff --git a/src/osd/modules/debugger/osx/debugosxconsoleview.h b/src/osd/modules/debugger/osx/consoleview.h similarity index 84% rename from src/osd/modules/debugger/osx/debugosxconsoleview.h rename to src/osd/modules/debugger/osx/consoleview.h index 0c9740f02db0a..5538ea49f28e1 100644 --- a/src/osd/modules/debugger/osx/debugosxconsoleview.h +++ b/src/osd/modules/debugger/osx/consoleview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxconsoleview.h - MacOS X Cocoa debug window handling +// consoleview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugview.h" + +#import "debugview.h" #include "emu.h" diff --git a/src/osd/modules/debugger/osx/debugosxconsoleview.m b/src/osd/modules/debugger/osx/consoleview.m similarity index 85% rename from src/osd/modules/debugger/osx/debugosxconsoleview.m rename to src/osd/modules/debugger/osx/consoleview.m index 746fa26cf9382..3e2e29b9202d7 100644 --- a/src/osd/modules/debugger/osx/debugosxconsoleview.m +++ b/src/osd/modules/debugger/osx/consoleview.m @@ -2,14 +2,14 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxconsoleview.m - MacOS X Cocoa debug window handling +// consoleview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxconsoleview.h" +#import "consoleview.h" #include "debug/debugvw.h" diff --git a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h b/src/osd/modules/debugger/osx/debugcommandhistory.h similarity index 91% rename from src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h rename to src/osd/modules/debugger/osx/debugcommandhistory.h index 3cb0f23d06cf7..1e77b1f6cfb5e 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.h +++ b/src/osd/modules/debugger/osx/debugcommandhistory.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugcommandhistory.h - MacOS X Cocoa debug window handling +// debugcommandhistory.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. diff --git a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m b/src/osd/modules/debugger/osx/debugcommandhistory.m similarity index 95% rename from src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m rename to src/osd/modules/debugger/osx/debugcommandhistory.m index 0d9967370a51a..882c313000eb3 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugcommandhistory.m +++ b/src/osd/modules/debugger/osx/debugcommandhistory.m @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugcommandhistory.m - MacOS X Cocoa debug window handling +// debugcommandhistory.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -13,7 +13,7 @@ // MAMEDebugView class //============================================================ -#import "debugosxdebugcommandhistory.h" +#import "debugcommandhistory.h" @implementation MAMEDebugCommandHistory diff --git a/src/osd/modules/debugger/osx/debugosxdebugconsole.h b/src/osd/modules/debugger/osx/debugconsole.h similarity index 82% rename from src/osd/modules/debugger/osx/debugosxdebugconsole.h rename to src/osd/modules/debugger/osx/debugconsole.h index 941a6ab2b9e9a..bf210458ed7c3 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugconsole.h +++ b/src/osd/modules/debugger/osx/debugconsole.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugconsole.h - MacOS X Cocoa debug window handling +// debugconsole.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugwindowhandler.h" + +#import "debugwindowhandler.h" #include "emu.h" @@ -40,6 +41,10 @@ - (IBAction)debugNewDisassemblyWindow:(id)sender; - (IBAction)debugNewErrorLogWindow:(id)sender; - (IBAction)debugNewPointsWindow:(id)sender; +- (IBAction)debugNewDevicesWindow:(id)sender; + +- (void)debugNewMemoryWindowForSpace:(address_space *)space device:(device_t *)device expression:(NSString *)expression; +- (void)debugNewDisassemblyWindowForSpace:(address_space *)space device:(device_t *)device expression:(NSString *)expression; - (void)showDebugger:(NSNotification *)notification; - (void)auxiliaryWindowWillClose:(NSNotification *)notification; diff --git a/src/osd/modules/debugger/osx/debugosxdebugconsole.m b/src/osd/modules/debugger/osx/debugconsole.m similarity index 71% rename from src/osd/modules/debugger/osx/debugosxdebugconsole.m rename to src/osd/modules/debugger/osx/debugconsole.m index 2b6785b3b9e9e..bc290db2df88d 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugconsole.m +++ b/src/osd/modules/debugger/osx/debugconsole.m @@ -2,24 +2,25 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugconsole.m - MacOS X Cocoa debug window handling +// debugconsole.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxdebugconsole.h" +#import "debugconsole.h" -#import "debugosxdebugcommandhistory.h" -#import "debugosxconsoleview.h" -#import "debugosxdebugview.h" -#import "debugosxdisassemblyview.h" -#import "debugosxdisassemblyviewer.h" -#import "debugosxerrorlogviewer.h" -#import "debugosxmemoryviewer.h" -#import "debugosxpointsviewer.h" -#import "debugosxregistersview.h" +#import "debugcommandhistory.h" +#import "consoleview.h" +#import "debugview.h" +#import "devicesviewer.h" +#import "disassemblyview.h" +#import "disassemblyviewer.h" +#import "errorlogviewer.h" +#import "memoryviewer.h" +#import "pointsviewer.h" +#import "registersview.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" @@ -135,50 +136,47 @@ - (id)initWithMachine:(running_machine &)m { [window makeFirstResponder:commandField]; // calculate the optimal size for everything - { - NSRect available = [[NSScreen mainScreen] visibleFrame]; - NSRect windowFrame = [window frame]; - NSSize regCurrent = [regScroll frame].size; - NSSize regSize = [NSScrollView frameSizeForContentSize:[regView maximumFrameSize] - hasHorizontalScroller:YES - hasVerticalScroller:YES - borderType:[regScroll borderType]]; - NSSize dasmCurrent = [dasmScroll frame].size; - NSSize dasmSize = [NSScrollView frameSizeForContentSize:[dasmView maximumFrameSize] + NSRect available = [[NSScreen mainScreen] visibleFrame]; + NSRect windowFrame = [window frame]; + NSSize regCurrent = [regScroll frame].size; + NSSize regSize = [NSScrollView frameSizeForContentSize:[regView maximumFrameSize] + hasHorizontalScroller:YES + hasVerticalScroller:YES + borderType:[regScroll borderType]]; + NSSize dasmCurrent = [dasmScroll frame].size; + NSSize dasmSize = [NSScrollView frameSizeForContentSize:[dasmView maximumFrameSize] + hasHorizontalScroller:YES + hasVerticalScroller:YES + borderType:[dasmScroll borderType]]; + NSSize consoleCurrent = [consoleContainer frame].size; + NSSize consoleSize = [NSScrollView frameSizeForContentSize:[consoleView maximumFrameSize] hasHorizontalScroller:YES hasVerticalScroller:YES - borderType:[dasmScroll borderType]]; - NSSize consoleCurrent = [consoleContainer frame].size; - NSSize consoleSize = [NSScrollView frameSizeForContentSize:[consoleView maximumFrameSize] - hasHorizontalScroller:YES - hasVerticalScroller:YES - borderType:[consoleScroll borderType]]; - NSSize adjustment; - NSRect lhsFrame, rhsFrame; - - consoleSize.width += consoleCurrent.width - [consoleScroll frame].size.width; - consoleSize.height += consoleCurrent.height - [consoleScroll frame].size.height; - adjustment.width = regSize.width - regCurrent.width; - adjustment.height = regSize.height - regCurrent.height; - adjustment.width += MAX(dasmSize.width - dasmCurrent.width, consoleSize.width - consoleCurrent.width); - - windowFrame.size.width += adjustment.width; - windowFrame.size.height += adjustment.height; // not used - better to go for fixed height - windowFrame.size.height = MIN(512.0, available.size.height); - windowFrame.size.width = MIN(windowFrame.size.width, available.size.width); - windowFrame.origin.x = available.origin.x + available.size.width - windowFrame.size.width; - windowFrame.origin.y = available.origin.y; - [window setFrame:windowFrame display:YES]; - - lhsFrame = [regScroll frame]; - rhsFrame = [dasmSplit frame]; - adjustment.width = MIN(regSize.width, ([regSplit frame].size.width - [regSplit dividerThickness]) / 2); - rhsFrame.origin.x -= lhsFrame.size.width - adjustment.width; - rhsFrame.size.width += lhsFrame.size.width - adjustment.width; - lhsFrame.size.width = adjustment.width; - [regScroll setFrame:lhsFrame]; - [dasmSplit setFrame:rhsFrame]; - } + borderType:[consoleScroll borderType]]; + NSSize adjustment; + + consoleSize.width += consoleCurrent.width - [consoleScroll frame].size.width; + consoleSize.height += consoleCurrent.height - [consoleScroll frame].size.height; + adjustment.width = regSize.width - regCurrent.width; + adjustment.height = regSize.height - regCurrent.height; + adjustment.width += MAX(dasmSize.width - dasmCurrent.width, consoleSize.width - consoleCurrent.width); + + windowFrame.size.width += adjustment.width; + windowFrame.size.height += adjustment.height; // not used - better to go for fixed height + windowFrame.size.height = MIN(512.0, available.size.height); + windowFrame.size.width = MIN(windowFrame.size.width, available.size.width); + windowFrame.origin.x = available.origin.x + available.size.width - windowFrame.size.width; + windowFrame.origin.y = available.origin.y; + [window setFrame:windowFrame display:YES]; + + NSRect lhsFrame = [regScroll frame]; + NSRect rhsFrame = [dasmSplit frame]; + adjustment.width = MIN(regSize.width, ([regSplit frame].size.width - [regSplit dividerThickness]) / 2); + rhsFrame.origin.x -= lhsFrame.size.width - adjustment.width; + rhsFrame.size.width += lhsFrame.size.width - adjustment.width; + lhsFrame.size.width = adjustment.width; + [regScroll setFrame:lhsFrame]; + [dasmSplit setFrame:rhsFrame]; // select the current processor [self setCPU:machine->firstcpu]; @@ -206,8 +204,8 @@ - (void)dealloc { - (void)setCPU:(device_t *)device { - [regView selectSubviewForCPU:device]; - [dasmView selectSubviewForCPU:device]; + [regView selectSubviewForDevice:device]; + [dasmView selectSubviewForDevice:device]; [window setTitle:[NSString stringWithFormat:@"Debug: %s - %s '%s'", device->machine().system().name, device->name(), @@ -261,9 +259,52 @@ - (IBAction)debugNewPointsWindow:(id)sender{ } +- (IBAction)debugNewDevicesWindow:(id)sender { + MAMEDevicesViewer *win = [[MAMEDevicesViewer alloc] initWithMachine:*machine console:self]; + [auxiliaryWindows addObject:win]; + [win release]; + [win activate]; +} + + +- (void)debugNewMemoryWindowForSpace:(address_space *)space device:(device_t *)device expression:(NSString *)expression { + MAMEMemoryViewer *win = [[MAMEMemoryViewer alloc] initWithMachine:*machine console:self]; + [auxiliaryWindows addObject:win]; + [win release]; + if ([win selectSubviewForSpace:space]) + { + if (expression != nil) + [win setExpression:expression]; + } + else + { + [win selectSubviewForDevice:device]; + } + [win activate]; +} + + +- (void)debugNewDisassemblyWindowForSpace:(address_space *)space device:(device_t *)device expression:(NSString *)expression { + MAMEDisassemblyViewer *win = [[MAMEDisassemblyViewer alloc] initWithMachine:*machine console:self]; + [auxiliaryWindows addObject:win]; + [win release]; + if ([win selectSubviewForSpace:space]) + { + if (expression != nil) + [win setExpression:expression]; + } + else + { + [win selectSubviewForDevice:device]; + } + [win activate]; +} + + - (void)showDebugger:(NSNotification *)notification { device_t *device = (device_t * )[[[notification userInfo] objectForKey:@"MAMEDebugDevice"] pointerValue]; - if (&device->machine() == machine) { + if (&device->machine() == machine) + { [self setCPU:device]; [window makeKeyAndOrderFront:self]; } @@ -312,10 +353,16 @@ - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBy - (void)windowWillClose:(NSNotification *)notification { - if ([notification object] != window) - return; - [[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification object:self]; - debug_cpu_get_visible_cpu(*machine)->debug()->go(); + if ([notification object] == window) + { + NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithPointer:machine], + @"MAMEDebugMachine", + nil]; + [[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification + object:self + userInfo:info]; + debug_cpu_get_visible_cpu(*machine)->debug()->go(); + } } diff --git a/src/osd/modules/debugger/osx/debugosx.h b/src/osd/modules/debugger/osx/debugosx.h index 8971955dacbcf..016ea752e3468 100644 --- a/src/osd/modules/debugger/osx/debugosx.h +++ b/src/osd/modules/debugger/osx/debugosx.h @@ -46,6 +46,9 @@ typedef float CGFloat; @protocol NSTextFieldDelegate @end +@protocol NSOutlineViewDataSource +@end + #endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1060 #endif // MAC_OS_X_VERSION_MAX_ALLOWED diff --git a/src/osd/modules/debugger/osx/debugosxdebugview.h b/src/osd/modules/debugger/osx/debugview.h similarity index 92% rename from src/osd/modules/debugger/osx/debugosxdebugview.h rename to src/osd/modules/debugger/osx/debugview.h index 06c25ea7c218e..abb53efb852d8 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugview.h +++ b/src/osd/modules/debugger/osx/debugview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugview.h - MacOS X Cocoa debug window handling +// debugview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -55,7 +55,7 @@ - (NSString *)selectedSubviewName; - (int)selectedSubviewIndex; - (void)selectSubviewAtIndex:(int)index; -- (void)selectSubviewForCPU:(device_t *)device; +- (BOOL)selectSubviewForDevice:(device_t *)device; @end diff --git a/src/osd/modules/debugger/osx/debugosxdebugview.m b/src/osd/modules/debugger/osx/debugview.m similarity index 62% rename from src/osd/modules/debugger/osx/debugosxdebugview.m rename to src/osd/modules/debugger/osx/debugview.m index b9c6d49098d8b..8ce77b59cc337 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugview.m +++ b/src/osd/modules/debugger/osx/debugview.m @@ -2,18 +2,36 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugview.h - MacOS X Cocoa debug window handling +// debugview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxdebugview.h" +#import "debugview.h" #include "debug/debugcpu.h" +static NSColor *DefaultForeground; +static NSColor *ChangedForeground; +static NSColor *InvalidForeground; +static NSColor *CommentForeground; +static NSColor *DisabledChangedForeground; +static NSColor *DisabledInvalidForeground; +static NSColor *DisabledCommentForeground; + +static NSColor *DefaultBackground; +static NSColor *VisitedBackground; +static NSColor *AncillaryBackground; +static NSColor *SelectedBackground; +static NSColor *CurrentBackground; +static NSColor *SelectedCurrentBackground; +static NSColor *InactiveSelectedBackground; +static NSColor *InactiveSelectedCurrentBackground; + + static void debugwin_view_update(debug_view &view, void *osdprivate) { [(MAMEDebugView *)osdprivate update]; @@ -22,37 +40,52 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) @implementation MAMEDebugView ++ (void)initialize { + DefaultForeground = [[NSColor colorWithCalibratedWhite:0.0 alpha:1.0] retain]; + ChangedForeground = [[NSColor colorWithCalibratedRed:0.875 green:0.0 blue:0.0 alpha:1.0] retain]; + InvalidForeground = [[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:1.0 alpha:1.0] retain]; + CommentForeground = [[NSColor colorWithCalibratedRed:0.0 green:0.375 blue:0.0 alpha:1.0] retain]; + DisabledChangedForeground = [[NSColor colorWithCalibratedRed:0.5 green:0.125 blue:0.125 alpha:1.0] retain]; + DisabledInvalidForeground = [[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.5 alpha:1.0] retain]; + DisabledCommentForeground = [[NSColor colorWithCalibratedRed:0.0 green:0.25 blue:0.0 alpha:1.0] retain]; + + DefaultBackground = [[NSColor colorWithCalibratedWhite:1.0 alpha:1.0] retain]; + VisitedBackground = [[NSColor colorWithCalibratedRed:0.75 green:1.0 blue:0.75 alpha:1.0] retain]; + AncillaryBackground = [[NSColor colorWithCalibratedWhite:0.75 alpha:1.0] retain]; + SelectedBackground = [[NSColor colorWithCalibratedRed:0.75 green:0.875 blue:1.0 alpha:1.0] retain]; + CurrentBackground = [[NSColor colorWithCalibratedRed:1.0 green:0.75 blue:0.75 alpha:1.0] retain]; + SelectedCurrentBackground = [[NSColor colorWithCalibratedRed:0.875 green:0.625 blue:0.875 alpha:1.0] retain]; + InactiveSelectedBackground = [[NSColor colorWithCalibratedWhite:0.875 alpha:1.0] retain]; + InactiveSelectedCurrentBackground = [[NSColor colorWithCalibratedRed:0.875 green:0.5 blue:0.625 alpha:1.0] retain]; +} + + - (NSColor *)foregroundForAttribute:(UINT8)attrib { - const CGFloat alpha = (attrib & DCA_DISABLED) ? 0.5 : 1.0; if (attrib & DCA_COMMENT) - return [NSColor colorWithCalibratedRed:0.0 green:0.375 blue:0.0 alpha:1.0]; + return (attrib & DCA_DISABLED) ? DisabledCommentForeground : CommentForeground; else if (attrib & DCA_INVALID) - return [NSColor colorWithCalibratedRed:0.0 green:0.0 blue:1.0 alpha:alpha]; + return (attrib & DCA_DISABLED) ? DisabledInvalidForeground : InvalidForeground; else if (attrib & DCA_CHANGED) - return [NSColor colorWithCalibratedRed:0.875 green:0.0 blue:0.0 alpha:alpha]; + return (attrib & DCA_DISABLED) ? DisabledChangedForeground : ChangedForeground; else - return [NSColor colorWithCalibratedWhite:0.0 alpha:alpha]; + return DefaultForeground; } - (NSColor *)backgroundForAttribute:(UINT8)attrib { - if ((attrib & DCA_SELECTED) && (attrib & DCA_CURRENT)) { - if ([[self window] isKeyWindow] && ([[self window] firstResponder] == self)) - return [NSColor colorWithCalibratedRed:0.875 green:0.625 blue:0.875 alpha:1.0]; - else - return [NSColor colorWithCalibratedRed:0.875 green:0.5 blue:0.625 alpha:1.0]; - } else if (attrib & DCA_CURRENT) { - return [NSColor colorWithCalibratedRed:1.0 green:0.625 blue:0.625 alpha:1.0]; - } else if (attrib & DCA_SELECTED) { - if ([[self window] isKeyWindow] && ([[self window] firstResponder] == self)) - return [NSColor colorWithCalibratedRed:0.75 green:0.875 blue:1.0 alpha:1.0]; - else - return [NSColor colorWithCalibratedWhite:0.875 alpha:1.0]; - } else if (attrib & DCA_ANCILLARY) { - return [NSColor colorWithCalibratedWhite:0.75 alpha:1.0]; - } else { - return [NSColor colorWithCalibratedWhite:1.0 alpha:1.0]; - } + BOOL const active = [[self window] isKeyWindow] && ([[self window] firstResponder] == self); + if ((attrib & DCA_SELECTED) && (attrib & DCA_CURRENT)) + return active ? SelectedCurrentBackground : InactiveSelectedCurrentBackground; + else if (attrib & DCA_CURRENT) + return CurrentBackground; + else if (attrib & DCA_SELECTED) + return active ? SelectedBackground : InactiveSelectedBackground; + else if (attrib & DCA_ANCILLARY) + return AncillaryBackground; + else if (attrib & DCA_VISITED) + return VisitedBackground; + else + return DefaultBackground; } @@ -71,7 +104,7 @@ - (debug_view_xy)convertLocation:(NSPoint)location { if (!data || (position.y < origin.y) || (position.y >= origin.y + size.y)) { // y coordinate outside visible area, x will be a guess - position.x = lround(floor(location.x / fontWidth)); + position.x = lround(floor((location.x - [textContainer lineFragmentPadding]) / fontWidth)); } else { @@ -121,26 +154,18 @@ - (debug_view_xy)convertLocation:(NSPoint)location { } -- (void)convertBounds:(NSRect)b toPosition:(debug_view_xy *)origin size:(debug_view_xy *)size { - origin->x = lround(floor(b.origin.x / fontWidth)); - origin->y = lround(floor(b.origin.y / fontHeight)); - - // FIXME: this is not using proper font metrics horizontally - size->x = lround(ceil((b.origin.x + b.size.width) / fontWidth)) - origin->x; - size->y = lround(ceil((b.origin.y + b.size.height) / fontHeight)) - origin->y; +- (void)convertBounds:(NSRect)b toFirstAffectedLine:(INT32 *)f count:(INT32 *)c { + *f = lround(floor(b.origin.y / fontHeight)); + *c = lround(ceil((b.origin.y + b.size.height) / fontHeight)) - *f; } - (void)recomputeVisible { - if ([self window] != nil) { - debug_view_xy origin, size; - - // this gets all the characters that are at least paritally visible - [self convertBounds:[self visibleRect] toPosition:&origin size:&size]; - - // need to render entire lines or we get screwed up characters when widening views - origin.x = 0; - size.x = totalWidth; + if ([self window] != nil) + { + // this gets all the lines that are at least partially visible + debug_view_xy origin(0, 0), size(totalWidth, totalHeight); + [self convertBounds:[self visibleRect] toFirstAffectedLine:&origin.y count:&size.y]; // tell them what we think view->set_visible_size(size); @@ -152,17 +177,18 @@ - (void)recomputeVisible { - (void)typeCharacterAndScrollToCursor:(char)ch { - if (view->cursor_supported()) { - debug_view_xy oldPos = view->cursor_position(); + if (view->cursor_supported()) + { + debug_view_xy const oldPos = view->cursor_position(); view->process_char(ch); + debug_view_xy const newPos = view->cursor_position(); + if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) { - debug_view_xy newPos = view->cursor_position(); - if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) { - [self scrollRectToVisible:NSMakeRect(newPos.x * fontWidth, // FIXME - use proper metrics - newPos.y * fontHeight, - fontWidth, - fontHeight)]; - } + // FIXME - use proper font metrics + [self scrollRectToVisible:NSMakeRect((newPos.x * fontWidth) + [textContainer lineFragmentPadding], + newPos.y * fontHeight, + fontWidth, + fontHeight)]; } } else { view->process_char(ch); @@ -211,19 +237,21 @@ - (void)dealloc { - (void)update { - debug_view_xy newSize, newOrigin; - // resize our frame if the total size has changed - newSize = view->total_size(); - if ((newSize.x != totalWidth) || (newSize.y != totalHeight)) { - [self setFrameSize:NSMakeSize(fontWidth * newSize.x, fontHeight * newSize.y)]; // FIXME: metrics + debug_view_xy const newSize = view->total_size(); + BOOL const resized = (newSize.x != totalWidth) || (newSize.y != totalHeight); + if (resized) + { + [self setFrameSize:NSMakeSize((fontWidth * newSize.x) + (2 * [textContainer lineFragmentPadding]), + fontHeight * newSize.y)]; totalWidth = newSize.x; totalHeight = newSize.y; } // scroll the view if we're being told to - newOrigin = view->visible_position(); - if (newOrigin.y != originTop) { + debug_view_xy const newOrigin = view->visible_position(); + if (newOrigin.y != originTop) + { [self scrollPoint:NSMakePoint([self visibleRect].origin.x, newOrigin.y * fontHeight)]; originTop = newOrigin.y; } @@ -235,8 +263,9 @@ - (void)update { - (NSSize)maximumFrameSize { - debug_view_xy max = view->total_size(); - return NSMakeSize(max.x * fontWidth, max.y * fontHeight); + debug_view_xy const max = view->total_size(); + return NSMakeSize((max.x * fontWidth) + (2 * [textContainer lineFragmentPadding]), + max.y * fontHeight); } @@ -281,7 +310,7 @@ - (BOOL)becomeFirstResponder { debug_view_xy pos; view->set_cursor_visible(true); pos = view->cursor_position(); - [self scrollRectToVisible:NSMakeRect(pos.x * fontWidth, pos.y * fontHeight, fontWidth, fontHeight)]; // FIXME: metrics + [self scrollRectToVisible:NSMakeRect((pos.x * fontWidth) + [textContainer lineFragmentPadding], pos.y * fontHeight, fontWidth, fontHeight)]; // FIXME: metrics [self setNeedsDisplay:YES]; return [super becomeFirstResponder]; } else { @@ -326,21 +355,21 @@ - (BOOL)isFlipped { - (void)drawRect:(NSRect)dirtyRect { - debug_view_xy position, clip; + INT32 position, clip; // work out how much we need to draw [self recomputeVisible]; debug_view_xy const origin = view->visible_position(); debug_view_xy const size = view->visible_size(); - [self convertBounds:dirtyRect toPosition:&position size:&clip]; + [self convertBounds:dirtyRect toFirstAffectedLine:&position count:&clip]; // this gets the text for the whole visible area debug_view_char const *data = view->viewdata(); if (!data) return; - data += ((position.y - origin.y) * size.x); - for (UINT32 row = position.y; row < position.y + clip.y; row++, data += size.x) + data += ((position - origin.y) * size.x); + for (UINT32 row = position; row < position + clip; row++, data += size.x) { if ((row < origin.y) || (row >= origin.y + size.y)) continue; @@ -402,15 +431,23 @@ - (void)drawRect:(NSRect)dirtyRect { - (void)mouseDown:(NSEvent *)event { NSPoint const location = [self convertPoint:[event locationInWindow] fromView:nil]; - view->process_click(DCK_LEFT_CLICK, [self convertLocation:location]); + NSUInteger const modifiers = [event modifierFlags]; + view->process_click((modifiers & NSCommandKeyMask) ? DCK_RIGHT_CLICK + : (modifiers & NSAlternateKeyMask) ? DCK_MIDDLE_CLICK + : DCK_LEFT_CLICK, + [self convertLocation:location]); [self setNeedsDisplay:YES]; } - (void)rightMouseDown:(NSEvent *)event { NSPoint const location = [self convertPoint:[event locationInWindow] fromView:nil]; - view->process_click(DCK_RIGHT_CLICK, [self convertLocation:location]); - [self setNeedsDisplay:YES]; + if (view->cursor_supported()) + { + view->set_cursor_position([self convertLocation:location]); + view->set_cursor_visible(true); + [self setNeedsDisplay:YES]; + } [super rightMouseDown:event]; } @@ -419,50 +456,58 @@ - (void)keyDown:(NSEvent *)event { NSUInteger modifiers = [event modifierFlags]; NSString *str = [event charactersIgnoringModifiers]; - if ([str length] == 1) { - if (modifiers & NSNumericPadKeyMask) { - switch ([str characterAtIndex:0]) { - case NSUpArrowFunctionKey: - if (modifiers & NSCommandKeyMask) - view->process_char(DCH_CTRLHOME); - else - view->process_char(DCH_UP); - return; - case NSDownArrowFunctionKey: - if (modifiers & NSCommandKeyMask) - view->process_char(DCH_CTRLEND); - else - view->process_char(DCH_DOWN); - return; - case NSLeftArrowFunctionKey: - if (modifiers & NSCommandKeyMask) - [self typeCharacterAndScrollToCursor:DCH_HOME]; - else if (modifiers & NSAlternateKeyMask) - [self typeCharacterAndScrollToCursor:DCH_CTRLLEFT]; - else - [self typeCharacterAndScrollToCursor:DCH_LEFT]; - return; - case NSRightArrowFunctionKey: - if (modifiers & NSCommandKeyMask) - [self typeCharacterAndScrollToCursor:DCH_END]; - else if (modifiers & NSAlternateKeyMask) - [self typeCharacterAndScrollToCursor:DCH_CTRLRIGHT]; - else - [self typeCharacterAndScrollToCursor:DCH_RIGHT]; - return; - default: - [self interpretKeyEvents:[NSArray arrayWithObject:event]]; - return; + if ([str length] == 1) + { + if (modifiers & NSNumericPadKeyMask) + { + switch ([str characterAtIndex:0]) + { + case NSUpArrowFunctionKey: + if (modifiers & NSCommandKeyMask) + view->process_char(DCH_CTRLHOME); + else + view->process_char(DCH_UP); + return; + case NSDownArrowFunctionKey: + if (modifiers & NSCommandKeyMask) + view->process_char(DCH_CTRLEND); + else + view->process_char(DCH_DOWN); + return; + case NSLeftArrowFunctionKey: + if (modifiers & NSCommandKeyMask) + [self typeCharacterAndScrollToCursor:DCH_HOME]; + else if (modifiers & NSAlternateKeyMask) + [self typeCharacterAndScrollToCursor:DCH_CTRLLEFT]; + else + [self typeCharacterAndScrollToCursor:DCH_LEFT]; + return; + case NSRightArrowFunctionKey: + if (modifiers & NSCommandKeyMask) + [self typeCharacterAndScrollToCursor:DCH_END]; + else if (modifiers & NSAlternateKeyMask) + [self typeCharacterAndScrollToCursor:DCH_CTRLRIGHT]; + else + [self typeCharacterAndScrollToCursor:DCH_RIGHT]; + return; + default: + [self interpretKeyEvents:[NSArray arrayWithObject:event]]; + return; } - } else if (modifiers & NSFunctionKeyMask) { - switch ([str characterAtIndex:0]) { + } + else if (modifiers & NSFunctionKeyMask) + { + switch ([str characterAtIndex:0]) + { case NSPageUpFunctionKey: - if (modifiers & NSAlternateKeyMask) { + if (modifiers & NSAlternateKeyMask) + { view->process_char(DCH_PUP); return; } case NSPageDownFunctionKey: - if (modifiers & NSAlternateKeyMask) { + if (modifiers & NSAlternateKeyMask) + { view->process_char(DCH_PDOWN); return; } diff --git a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h b/src/osd/modules/debugger/osx/debugwindowhandler.h similarity index 93% rename from src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h rename to src/osd/modules/debugger/osx/debugwindowhandler.h index ba0f75fadad3e..56f3c98f9df7f 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.h +++ b/src/osd/modules/debugger/osx/debugwindowhandler.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugwindowhandler.h - MacOS X Cocoa debug window handling +// debugwindowhandler.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -72,6 +72,7 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification; - (IBAction)debugNewDisassemblyWindow:(id)sender; - (IBAction)debugNewErrorLogWindow:(id)sender; - (IBAction)debugNewPointsWindow:(id)sender; +- (IBAction)debugNewDevicesWindow:(id)sender; - (void)windowWillClose:(NSNotification *)notification; @@ -90,6 +91,9 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification; - (id )documentView; +- (NSString *)expression; +- (void)setExpression:(NSString *)expression; + - (IBAction)doExpression:(id)sender; - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor; diff --git a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m b/src/osd/modules/debugger/osx/debugwindowhandler.m similarity index 65% rename from src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m rename to src/osd/modules/debugger/osx/debugwindowhandler.m index edfbb2a27fb06..ba0a0d8335104 100644 --- a/src/osd/modules/debugger/osx/debugosxdebugwindowhandler.m +++ b/src/osd/modules/debugger/osx/debugwindowhandler.m @@ -2,17 +2,17 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdebugwindowhandler.m - MacOS X Cocoa debug window handling +// debugwindowhandler.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxdebugwindowhandler.h" +#import "debugwindowhandler.h" -#import "debugosxdebugcommandhistory.h" -#import "debugosxdebugview.h" +#import "debugcommandhistory.h" +#import "debugview.h" #include "debug/debugcpu.h" @@ -33,85 +33,86 @@ @implementation MAMEDebugWindowHandler + (void)addCommonActionItems:(NSMenu *)menu { - { - NSMenuItem *runParentItem = [menu addItemWithTitle:@"Run" - action:@selector(debugRun:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]]; - NSMenu *runMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Run"]; - [runParentItem setSubmenu:runMenu]; - [runMenu release]; - [runParentItem setKeyEquivalentModifierMask:0]; - [[runMenu addItemWithTitle:@"and Hide Debugger" - action:@selector(debugRunAndHide:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF12FunctionKey]] - setKeyEquivalentModifierMask:0]; - [[runMenu addItemWithTitle:@"to Next CPU" - action:@selector(debugRunToNextCPU:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF6FunctionKey]] - setKeyEquivalentModifierMask:0]; - [[runMenu addItemWithTitle:@"until Next Interrupt on Current CPU" - action:@selector(debugRunToNextInterrupt:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF7FunctionKey]] - setKeyEquivalentModifierMask:0]; - [[runMenu addItemWithTitle:@"until Next VBLANK" - action:@selector(debugRunToNextVBLANK:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF8FunctionKey]] - setKeyEquivalentModifierMask:0]; - } - { - NSMenuItem *stepParentItem = [menu addItemWithTitle:@"Step" action:NULL keyEquivalent:@""]; - NSMenu *stepMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Step"]; - [stepParentItem setSubmenu:stepMenu]; - [stepMenu release]; - [[stepMenu addItemWithTitle:@"Into" - action:@selector(debugStepInto:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF11FunctionKey]] - setKeyEquivalentModifierMask:0]; - [[stepMenu addItemWithTitle:@"Over" - action:@selector(debugStepOver:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] - setKeyEquivalentModifierMask:0]; - [[stepMenu addItemWithTitle:@"Out" - action:@selector(debugStepOut:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] - setKeyEquivalentModifierMask:NSShiftKeyMask]; - } - { - NSMenuItem *resetParentItem = [menu addItemWithTitle:@"Reset" action:NULL keyEquivalent:@""]; - NSMenu *resetMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Reset"]; - [resetParentItem setSubmenu:resetMenu]; - [resetMenu release]; - [[resetMenu addItemWithTitle:@"Soft" - action:@selector(debugSoftReset:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] - setKeyEquivalentModifierMask:0]; - [[resetMenu addItemWithTitle:@"Hard" - action:@selector(debugHardReset:) - keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] - setKeyEquivalentModifierMask:NSShiftKeyMask]; - } + NSMenuItem *runParentItem = [menu addItemWithTitle:@"Run" + action:@selector(debugRun:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF5FunctionKey]]; + NSMenu *runMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Run"]; + [runParentItem setSubmenu:runMenu]; + [runMenu release]; + [runParentItem setKeyEquivalentModifierMask:0]; + [[runMenu addItemWithTitle:@"and Hide Debugger" + action:@selector(debugRunAndHide:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF12FunctionKey]] + setKeyEquivalentModifierMask:0]; + [[runMenu addItemWithTitle:@"to Next CPU" + action:@selector(debugRunToNextCPU:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF6FunctionKey]] + setKeyEquivalentModifierMask:0]; + [[runMenu addItemWithTitle:@"until Next Interrupt on Current CPU" + action:@selector(debugRunToNextInterrupt:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF7FunctionKey]] + setKeyEquivalentModifierMask:0]; + [[runMenu addItemWithTitle:@"until Next VBLANK" + action:@selector(debugRunToNextVBLANK:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF8FunctionKey]] + setKeyEquivalentModifierMask:0]; + + NSMenuItem *stepParentItem = [menu addItemWithTitle:@"Step" action:NULL keyEquivalent:@""]; + NSMenu *stepMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Step"]; + [stepParentItem setSubmenu:stepMenu]; + [stepMenu release]; + [[stepMenu addItemWithTitle:@"Into" + action:@selector(debugStepInto:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF11FunctionKey]] + setKeyEquivalentModifierMask:0]; + [[stepMenu addItemWithTitle:@"Over" + action:@selector(debugStepOver:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] + setKeyEquivalentModifierMask:0]; + [[stepMenu addItemWithTitle:@"Out" + action:@selector(debugStepOut:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF10FunctionKey]] + setKeyEquivalentModifierMask:NSShiftKeyMask]; + + NSMenuItem *resetParentItem = [menu addItemWithTitle:@"Reset" action:NULL keyEquivalent:@""]; + NSMenu *resetMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Reset"]; + [resetParentItem setSubmenu:resetMenu]; + [resetMenu release]; + [[resetMenu addItemWithTitle:@"Soft" + action:@selector(debugSoftReset:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] + setKeyEquivalentModifierMask:0]; + [[resetMenu addItemWithTitle:@"Hard" + action:@selector(debugHardReset:) + keyEquivalent:[NSString stringWithFormat:@"%C", (short)NSF3FunctionKey]] + setKeyEquivalentModifierMask:NSShiftKeyMask]; + [menu addItem:[NSMenuItem separatorItem]]; - { - NSMenuItem *newParentItem = [menu addItemWithTitle:@"New" action:NULL keyEquivalent:@""]; - NSMenu *newMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"New"]; - [newParentItem setSubmenu:newMenu]; - [newMenu release]; - [newMenu addItemWithTitle:@"Memory Window" - action:@selector(debugNewMemoryWindow:) - keyEquivalent:@"d"]; - [newMenu addItemWithTitle:@"Disassembly Window" - action:@selector(debugNewDisassemblyWindow:) - keyEquivalent:@"a"]; - [newMenu addItemWithTitle:@"Error Log Window" - action:@selector(debugNewErrorLogWindow:) - keyEquivalent:@"l"]; - [newMenu addItemWithTitle:@"(Break|Watch)points Window" - action:@selector(debugNewPointsWindow:) - keyEquivalent:@"b"]; - } + + NSMenuItem *newParentItem = [menu addItemWithTitle:@"New" action:NULL keyEquivalent:@""]; + NSMenu *newMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"New"]; + [newParentItem setSubmenu:newMenu]; + [newMenu release]; + [newMenu addItemWithTitle:@"Memory Window" + action:@selector(debugNewMemoryWindow:) + keyEquivalent:@"d"]; + [newMenu addItemWithTitle:@"Disassembly Window" + action:@selector(debugNewDisassemblyWindow:) + keyEquivalent:@"a"]; + [newMenu addItemWithTitle:@"Error Log Window" + action:@selector(debugNewErrorLogWindow:) + keyEquivalent:@"l"]; + [newMenu addItemWithTitle:@"(Break|Watch)points Window" + action:@selector(debugNewPointsWindow:) + keyEquivalent:@"b"]; + [newMenu addItemWithTitle:@"Devices Window" + action:@selector(debugNewDevicesWindow:) + keyEquivalent:@"D"]; + [menu addItem:[NSMenuItem separatorItem]]; + [menu addItemWithTitle:@"Close Window" action:@selector(performClose:) keyEquivalent:@"w"]; - [menu addItemWithTitle:@"Exit" action:@selector(debugExit:) keyEquivalent:@""]; + [menu addItemWithTitle:@"Quit" action:@selector(debugExit:) keyEquivalent:@"q"]; } @@ -231,8 +232,9 @@ - (IBAction)debugExit:(id)sender { - (void)showDebugger:(NSNotification *)notification { - device_t *device = (device_t *) [[[notification userInfo] objectForKey:@"MAMEDebugDevice"] pointerValue]; - if (&device->machine() == machine) { + running_machine *m = (running_machine *)[[[notification userInfo] objectForKey:@"MAMEDebugMachine"] pointerValue]; + if (m == machine) + { if (![window isVisible] && ![window isMiniaturized]) [window orderFront:self]; } @@ -240,7 +242,9 @@ - (void)showDebugger:(NSNotification *)notification { - (void)hideDebugger:(NSNotification *)notification { - [window orderOut:self]; + running_machine *m = (running_machine *)[[[notification userInfo] objectForKey:@"MAMEDebugMachine"] pointerValue]; + if (m == machine) + [window orderOut:self]; } @end @@ -295,6 +299,11 @@ - (IBAction)debugNewPointsWindow:(id)sender { } +- (IBAction)debugNewDevicesWindow:(id)sender { + [console debugNewDevicesWindow:sender]; +} + + - (void)windowWillClose:(NSNotification *)notification { [[NSNotificationCenter defaultCenter] postNotificationName:MAMEAuxiliaryDebugWindowWillCloseNotification object:self]; @@ -309,9 +318,9 @@ - (void)cascadeWindowWithDesiredSize:(NSSize)desired forView:(NSView *)view { desired.height -= current.height; windowFrame.size.width += desired.width; - windowFrame.size.height += desired.height; - windowFrame.size.height = MIN(MIN(windowFrame.size.height, 240), available.size.height); windowFrame.size.width = MIN(windowFrame.size.width, available.size.width); + windowFrame.size.height += desired.height; + windowFrame.size.height = MIN(MIN(windowFrame.size.height, 320), available.size.height); windowFrame.origin.x = available.origin.x + available.size.width - windowFrame.size.width; windowFrame.origin.y = available.origin.y; [window setFrame:windowFrame display:YES]; @@ -352,6 +361,18 @@ - (void)dealloc { } +- (NSString *)expression { + return [[self documentView] expression]; +} + +- (void)setExpression:(NSString *)expression { + [history add:expression]; + [[self documentView] setExpression:expression]; + [expressionField setStringValue:expression]; + [expressionField selectText:self]; +} + + - (IBAction)doExpression:(id)sender { NSString *expr = [sender stringValue]; if ([expr length] > 0) { diff --git a/src/osd/modules/debugger/osx/devicesviewer.h b/src/osd/modules/debugger/osx/devicesviewer.h new file mode 100644 index 0000000000000..3737a497163ed --- /dev/null +++ b/src/osd/modules/debugger/osx/devicesviewer.h @@ -0,0 +1,31 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +//============================================================ +// +// devicesviewer.h - MacOS X Cocoa debug window handling +// +// Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. +// Visit http://mamedev.org for licensing and usage restrictions. +// +//============================================================ + +#import "debugosx.h" + +#import "debugwindowhandler.h" + +#include "emu.h" + +#import + + +@class MAMEDebugConsole, MAMEDeviceWrapper; + +@interface MAMEDevicesViewer : MAMEAuxiliaryDebugWindowHandler +{ + MAMEDeviceWrapper *root; + NSOutlineView *devicesView; +} + +- (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c; + +@end diff --git a/src/osd/modules/debugger/osx/devicesviewer.m b/src/osd/modules/debugger/osx/devicesviewer.m new file mode 100644 index 0000000000000..29910c57c4069 --- /dev/null +++ b/src/osd/modules/debugger/osx/devicesviewer.m @@ -0,0 +1,210 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +//============================================================ +// +// devicesviewer.m - MacOS X Cocoa debug window handling +// +// Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. +// Visit http://mamedev.org for licensing and usage restrictions. +// +//============================================================ + +#import "devicesviewer.h" + + +@interface MAMEDeviceWrapper : NSObject +{ + running_machine *machine; + device_t *device; + NSArray *children; +} + +- (id)initWithMachine:(running_machine &)m device:(device_t &)d; + +- (running_machine &)machine; +- (device_t &)device; +- (NSString *)tag; +- (NSString *)name; +- (NSUInteger)children; +- (MAMEDeviceWrapper *)childAtIndex:(NSUInteger)index; + +@end + + +@implementation MAMEDeviceWrapper + +- (void)wrapChildren { + NSMutableArray *const tmp = [[NSMutableArray alloc] init]; + for (device_t *child = device->first_subdevice(); child != NULL; child = child->next()) + { + MAMEDeviceWrapper *const wrap = [[MAMEDeviceWrapper alloc] initWithMachine:*machine + device:*child]; + [tmp addObject:wrap]; + [wrap release]; + } + children = [[NSArray alloc] initWithArray:tmp]; + [tmp release]; +} + + +- (id)initWithMachine:(running_machine &)m device:(device_t &)d { + if (!(self = [super init])) + return nil; + machine = &m; + device = &d; + children = nil; + return self; +} + + +- (void)dealloc { + if (children != nil) + [children release]; + [super dealloc]; +} + + +- (running_machine &)machine { + return *machine; +} + + +- (device_t &)device { + return *device; +} + + +- (NSString *)tag { + return (device == &machine->root_device()) ? @"" + : [NSString stringWithUTF8String:device->basetag()]; +} + + +- (NSString *)name { + return [NSString stringWithUTF8String:device->name()]; +} + + +- (NSUInteger)children { + if (children == nil) + [self wrapChildren]; + return [children count]; +} + + +- (MAMEDeviceWrapper *)childAtIndex:(NSUInteger)index { + if (children == nil) + [self wrapChildren]; + return (index < [children count]) ? [children objectAtIndex:index] : nil; +} + +@end + + +@implementation MAMEDevicesViewer + +- (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { + NSScrollView *devicesScroll; + NSTableColumn *tagColumn, *nameColumn; + + if (!(self = [super initWithMachine:m title:@"All Devices" console:c])) + return nil; + root = [[MAMEDeviceWrapper alloc] initWithMachine:m device:m.root_device()]; + + // create the devices view + devicesView = [[NSOutlineView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; + [devicesView setUsesAlternatingRowBackgroundColors:YES]; + [devicesView setAllowsColumnReordering:YES]; + [devicesView setAllowsColumnResizing:YES]; + [devicesView setColumnAutoresizingStyle:NSTableViewUniformColumnAutoresizingStyle]; + [devicesView setAllowsEmptySelection:YES]; + [devicesView setAllowsMultipleSelection:NO]; + [devicesView setAllowsColumnSelection:NO]; + tagColumn = [[NSTableColumn alloc] initWithIdentifier:@"tag"]; + [[tagColumn headerCell] setStringValue:@"Tag"]; + [tagColumn setEditable:NO]; + [tagColumn setMinWidth:100]; + [tagColumn setWidth:120]; + [tagColumn setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)]; + [devicesView addTableColumn:tagColumn]; + [tagColumn release]; + nameColumn = [[NSTableColumn alloc] initWithIdentifier:@"name"]; + [[nameColumn headerCell] setStringValue:@"Name"]; + [nameColumn setEditable:NO]; + [nameColumn setMinWidth:100]; + [nameColumn setMinWidth:360]; + [nameColumn setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)]; + [devicesView addTableColumn:nameColumn]; + [nameColumn release]; + [devicesView setOutlineTableColumn:tagColumn]; + [devicesView setAutoresizesOutlineColumn:YES]; + [devicesView setDataSource:self]; + devicesScroll = [[NSScrollView alloc] initWithFrame:[[window contentView] bounds]]; + [devicesScroll setDrawsBackground:YES]; + [devicesScroll setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + [devicesScroll setHasHorizontalScroller:YES]; + [devicesScroll setHasVerticalScroller:YES]; + [devicesScroll setAutohidesScrollers:YES]; + [devicesScroll setBorderType:NSNoBorder]; + [devicesScroll setDocumentView:devicesView]; + [devicesView release]; + [[window contentView] addSubview:devicesScroll]; + [devicesScroll release]; + + // set default state + [devicesView expandItem:root expandChildren:YES]; + [window makeFirstResponder:devicesView]; + [window setTitle:[NSString stringWithFormat:@"All Devices"]]; + + // calculate the optimal size for everything + NSSize const desired = [NSScrollView frameSizeForContentSize:NSMakeSize(480, 320) + hasHorizontalScroller:YES + hasVerticalScroller:YES + borderType:[devicesScroll borderType]]; + [self cascadeWindowWithDesiredSize:desired forView:devicesScroll]; + + // don't forget the result + return self; +} + + +- (void)dealloc { + if (root != nil) + [root release]; + [super dealloc]; +} + + +- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { + return [(MAMEDeviceWrapper *)item children] > 0; +} + + +- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { + if (item != nil) + return [(MAMEDeviceWrapper *)item children]; + else + return 1; +} + + +- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item { + if (item != nil) + return [(MAMEDeviceWrapper *)item childAtIndex:index]; + else if (index == 0) + return root; + else + return nil; +} + + +- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { + if ([[tableColumn identifier] isEqualToString:@"tag"]) + return [(MAMEDeviceWrapper *)item tag]; + else if ([[tableColumn identifier] isEqualToString:@"name"]) + return [(MAMEDeviceWrapper *)item name]; + else + return nil; +} + +@end diff --git a/src/osd/modules/debugger/osx/debugosxdisassemblyview.h b/src/osd/modules/debugger/osx/disassemblyview.h similarity index 81% rename from src/osd/modules/debugger/osx/debugosxdisassemblyview.h rename to src/osd/modules/debugger/osx/disassemblyview.h index 32e61a967e6a1..40d2b04f379a7 100644 --- a/src/osd/modules/debugger/osx/debugosxdisassemblyview.h +++ b/src/osd/modules/debugger/osx/disassemblyview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdisassemblyview.h - MacOS X Cocoa debug window handling +// disassemblyview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,9 +10,11 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugview.h" + +#import "debugview.h" #include "emu.h" +#include "debug/dvdisasm.h" #import @@ -29,11 +31,14 @@ - (NSString *)selectedSubviewName; - (int)selectedSubviewIndex; - (void)selectSubviewAtIndex:(int)index; -- (void)selectSubviewForCPU:(device_t *)device; +- (BOOL)selectSubviewForDevice:(device_t *)device; +- (BOOL)selectSubviewForSpace:(address_space *)space; - (NSString *)expression; - (void)setExpression:(NSString *)exp; +- (debug_view_disasm_source const *)source; + - (IBAction)debugToggleBreakpoint:(id)sender; - (IBAction)debugToggleBreakpointEnable:(id)sender; - (IBAction)debugRunToCursor:(id)sender; diff --git a/src/osd/modules/debugger/osx/debugosxdisassemblyview.m b/src/osd/modules/debugger/osx/disassemblyview.m similarity index 68% rename from src/osd/modules/debugger/osx/debugosxdisassemblyview.m rename to src/osd/modules/debugger/osx/disassemblyview.m index 7a482cd8504c3..f5e5864372bb1 100644 --- a/src/osd/modules/debugger/osx/debugosxdisassemblyview.m +++ b/src/osd/modules/debugger/osx/disassemblyview.m @@ -2,27 +2,27 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdisassemblyview.m - MacOS X Cocoa debug window handling +// disassemblyview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxdisassemblyview.h" +#import "disassemblyview.h" +#include "debugger.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" #include "debug/debugvw.h" -#include "debug/dvdisasm.h" @implementation MAMEDisassemblyView -- (device_debug::breakpoint *)findBreakpointAtAddress:(offs_t)address inAddressSpace:(address_space &)space { - device_debug *cpuinfo = space.device().debug(); +- (device_debug::breakpoint *)findBreakpointAtAddress:(offs_t)address forDevice:(device_t &)device { + device_debug *cpuinfo = device.debug(); device_debug::breakpoint *bp; - for (bp = cpuinfo->breakpoint_first(); (bp != NULL) && (address != bp->address()); bp = bp->next()) {} + for (bp = cpuinfo->breakpoint_first(); (bp != NULL) && (address != bp->address()); bp = bp->next()) { } return bp; } @@ -90,75 +90,87 @@ - (void)dealloc { - (BOOL)validateMenuItem:(NSMenuItem *)item { - SEL action = [item action]; - BOOL inContextMenu = ([item menu] == [self menu]); - BOOL haveCursor = NO, isCurrent = NO; - device_debug::breakpoint *breakpoint = NULL; - - if (view->cursor_visible()) { - if (debug_cpu_get_visible_cpu(*machine) == view->source()->device()) { - isCurrent = YES; - if (!useConsole || isCurrent) { - offs_t address = downcast(view)->selected_address(); - haveCursor = YES; - breakpoint = [self findBreakpointAtAddress:address inAddressSpace:downcast(view->source())->space()]; - } - } + SEL const action = [item action]; + BOOL const inContextMenu = ([item menu] == [self menu]); + BOOL haveCursor = view->cursor_visible(); + BOOL const isCurrent = (debug_cpu_get_visible_cpu(*machine) == view->source()->device()); + + device_debug::breakpoint *breakpoint = NULL; + if (haveCursor) + { + offs_t const address = downcast(view)->selected_address(); + breakpoint = [self findBreakpointAtAddress:address forDevice:[self source]->device()]; } - if (action == @selector(debugToggleBreakpoint:)) { - if (haveCursor) { - if (breakpoint != NULL) { + if (action == @selector(debugToggleBreakpoint:)) + { + if (haveCursor) + { + if (breakpoint != NULL) + { if (inContextMenu) [item setTitle:@"Clear Breakpoint"]; else [item setTitle:@"Clear Breakpoint at Cursor"]; - } else { + } + else + { if (inContextMenu) [item setTitle:@"Set Breakpoint"]; else [item setTitle:@"Set Breakpoint at Cursor"]; } - } else { + } + else + { if (inContextMenu) [item setTitle:@"Toggle Breakpoint"]; else [item setTitle:@"Toggle Breakpoint at Cursor"]; } - return haveCursor; - } else if (action == @selector(debugToggleBreakpointEnable:)) { - if ((breakpoint != NULL) && !breakpoint->enabled()) { + return haveCursor && (!useConsole || isCurrent); + } + else if (action == @selector(debugToggleBreakpointEnable:)) + { + if ((breakpoint != NULL) && !breakpoint->enabled()) + { if (inContextMenu) [item setTitle:@"Enable Breakpoint"]; else [item setTitle:@"Enable Breakpoint at Cursor"]; - } else { + } + else + { if (inContextMenu) [item setTitle:@"Disable Breakpoint"]; else [item setTitle:@"Disable Breakpoint at Cursor"]; } - return (breakpoint != NULL); - } else if (action == @selector(debugRunToCursor:)) { - return isCurrent; - } else if (action == @selector(showRightColumn:)) { + return (breakpoint != NULL) && (!useConsole || isCurrent); + } + else if (action == @selector(debugRunToCursor:)) + { + return !useConsole || isCurrent; + } + else if (action == @selector(showRightColumn:)) + { [item setState:((downcast(view)->right_column() == [item tag]) ? NSOnState : NSOffState)]; return YES; - } else { + } + else + { return YES; } } - (NSSize)maximumFrameSize { - debug_view_xy max; - device_t *curcpu = debug_cpu_get_visible_cpu(*machine); - const debug_view_source *source = view->source_for_device(curcpu); + debug_view_xy max(0, 0); + const debug_view_source *source = view->source(); - max.x = max.y = 0; for (const debug_view_source *source = view->source_list().first(); source != NULL; source = source->next()) { - debug_view_xy current; + debug_view_xy current; view->set_source(*source); current = view->total_size(); if (current.x > max.x) @@ -199,13 +211,43 @@ - (void)selectSubviewAtIndex:(int)index { } -- (void)selectSubviewForCPU:(device_t *)device { - const debug_view_source *selected = view->source(); - const debug_view_source *source = view->source_for_device(device); - if ( selected != source ) { - view->set_source(*source); - if ([[self window] firstResponder] != self) - view->set_cursor_visible(false); +- (BOOL)selectSubviewForDevice:(device_t *)device { + debug_view_source const *const source = view->source_for_device(device); + if (source != NULL) + { + if (view->source() != source) + { + view->set_source(*source); + if ([[self window] firstResponder] != self) + view->set_cursor_visible(false); + } + return YES; + } + else + { + return NO; + } +} + + +- (BOOL)selectSubviewForSpace:(address_space *)space { + if (space == NULL) return NO; + debug_view_disasm_source const *source = downcast(view->first_source()); + while ((source != NULL) && (&source->space() != space)) + source = downcast(source->next()); + if (source != NULL) + { + if (view->source() != source) + { + view->set_source(*source); + if ([[self window] firstResponder] != self) + view->set_cursor_visible(false); + } + return YES; + } + else + { + return NO; } } @@ -220,50 +262,82 @@ - (void)setExpression:(NSString *)exp { } +- (debug_view_disasm_source const *)source { + return downcast(view->source()); +} + + - (IBAction)debugToggleBreakpoint:(id)sender { - if (view->cursor_visible()) { - address_space &space = downcast(view->source())->space(); - if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &space.device())) { - offs_t address = downcast(view)->selected_address(); - device_debug::breakpoint *bp = [self findBreakpointAtAddress:address inAddressSpace:space]; + if (view->cursor_visible()) + { + device_t &device = [self source]->device(); + if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &device)) + { + offs_t const address = downcast(view)->selected_address(); + device_debug::breakpoint *bp = [self findBreakpointAtAddress:address forDevice:device]; // if it doesn't exist, add a new one - if (useConsole) { + if (useConsole) + { NSString *command; if (bp == NULL) command = [NSString stringWithFormat:@"bpset %lX", (unsigned long)address]; else command = [NSString stringWithFormat:@"bpclear %X", (unsigned)bp->index()]; debug_console_execute_command(*machine, [command UTF8String], 1); - } else { + } + else + { if (bp == NULL) - space.device().debug()->breakpoint_set(address, NULL, NULL); + { + UINT32 const bpnum = device.debug()->breakpoint_set(address, NULL, NULL); + debug_console_printf(*machine, "Breakpoint %X set\n", bpnum); + } else - space.device().debug()->breakpoint_clear(bp->index()); + { + int const bpnum = bp->index(); + device.debug()->breakpoint_clear(bpnum); + debug_console_printf(*machine, "Breakpoint %X cleared\n", (UINT32)bpnum); + } } + + // fail to do this and the display doesn't update + machine->debug_view().update_all(); + debugger_refresh_display(*machine); } } } - (IBAction)debugToggleBreakpointEnable:(id)sender { - if (view->cursor_visible()) { - address_space &space = downcast(view->source())->space(); - if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &space.device())) { - offs_t address = downcast(view)->selected_address(); - device_debug::breakpoint *bp = [self findBreakpointAtAddress:address inAddressSpace:space]; - - if (bp != NULL) { - NSString *command; - if (useConsole) { + if (view->cursor_visible()) + { + device_t &device = [self source]->device(); + if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &device)) + { + offs_t const address = downcast(view)->selected_address(); + device_debug::breakpoint *bp = [self findBreakpointAtAddress:address forDevice:device]; + if (bp != NULL) + { + if (useConsole) + { + NSString *command; if (bp->enabled()) command = [NSString stringWithFormat:@"bpdisable %X", (unsigned)bp->index()]; else command = [NSString stringWithFormat:@"bpenable %X", (unsigned)bp->index()]; debug_console_execute_command(*machine, [command UTF8String], 1); - } else { - space.device().debug()->breakpoint_enable(bp->index(), !bp->enabled()); } + else + { + device.debug()->breakpoint_enable(bp->index(), !bp->enabled()); + debug_console_printf(*machine, + "Breakpoint %X %s\n", + (UINT32)bp->index(), + bp->enabled() ? "enabled" : "disabled"); + } + machine->debug_view().update_all(); + debugger_refresh_display(*machine); } } } @@ -271,15 +345,20 @@ - (IBAction)debugToggleBreakpointEnable:(id)sender { - (IBAction)debugRunToCursor:(id)sender { - if (view->cursor_visible()) { - address_space &space = downcast(view->source())->space(); - if (debug_cpu_get_visible_cpu(*machine) == &space.device()) { - offs_t address = downcast(view)->selected_address(); - if (useConsole) { + if (view->cursor_visible()) + { + device_t &device = [self source]->device(); + if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &device)) + { + offs_t const address = downcast(view)->selected_address(); + if (useConsole) + { NSString *command = [NSString stringWithFormat:@"go 0x%lX", (unsigned long)address]; debug_console_execute_command(*machine, [command UTF8String], 1); - } else { - debug_cpu_get_visible_cpu(*machine)->debug()->go(address); + } + else + { + device.debug()->go(address); } } } diff --git a/src/osd/modules/debugger/osx/debugosxdisassemblyviewer.h b/src/osd/modules/debugger/osx/disassemblyviewer.h similarity index 74% rename from src/osd/modules/debugger/osx/debugosxdisassemblyviewer.h rename to src/osd/modules/debugger/osx/disassemblyviewer.h index fa4f76bd8135f..27099aa9dc7ab 100644 --- a/src/osd/modules/debugger/osx/debugosxdisassemblyviewer.h +++ b/src/osd/modules/debugger/osx/disassemblyviewer.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdisassemblyviewer.h - MacOS X Cocoa debug window handling +// disassemblyviewer.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugwindowhandler.h" + +#import "debugwindowhandler.h" #include "emu.h" @@ -22,10 +23,14 @@ @interface MAMEDisassemblyViewer : MAMEExpressionAuxiliaryDebugWindowHandler { MAMEDisassemblyView *dasmView; + NSPopUpButton *subviewButton; } - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c; +- (BOOL)selectSubviewForDevice:(device_t *)device; +- (BOOL)selectSubviewForSpace:(address_space *)space; + - (IBAction)changeSubview:(id)sender; @end diff --git a/src/osd/modules/debugger/osx/debugosxdisassemblyviewer.m b/src/osd/modules/debugger/osx/disassemblyviewer.m similarity index 72% rename from src/osd/modules/debugger/osx/debugosxdisassemblyviewer.m rename to src/osd/modules/debugger/osx/disassemblyviewer.m index 3a965fe140449..7fcbb842b2da6 100644 --- a/src/osd/modules/debugger/osx/debugosxdisassemblyviewer.m +++ b/src/osd/modules/debugger/osx/disassemblyviewer.m @@ -2,17 +2,18 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxdisassemblyviewer.m - MacOS X Cocoa debug window handling +// disassemblyviewer.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxdisassemblyviewer.h" +#import "disassemblyviewer.h" -#import "debugosxdebugview.h" -#import "debugosxdisassemblyview.h" +#import "debugconsole.h" +#import "debugview.h" +#import "disassemblyview.h" #include "debug/debugcpu.h" @@ -22,12 +23,12 @@ @implementation MAMEDisassemblyViewer - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { NSScrollView *dasmScroll; NSView *expressionContainer; - NSPopUpButton *actionButton, *subviewButton; - NSRect contentBounds, expressionFrame; + NSPopUpButton *actionButton; + NSRect expressionFrame; if (!(self = [super initWithMachine:m title:@"Disassembly" console:c])) return nil; - contentBounds = [[window contentView] bounds]; + NSRect const contentBounds = [[window contentView] bounds]; // create the expression field expressionField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)]; @@ -98,7 +99,7 @@ - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { [actionButton release]; // set default state - [dasmView selectSubviewForCPU:debug_cpu_get_visible_cpu(*machine)]; + [dasmView selectSubviewForDevice:debug_cpu_get_visible_cpu(*machine)]; [dasmView setExpression:@"curpc"]; [expressionField setStringValue:@"curpc"]; [expressionField selectText:self]; @@ -107,13 +108,11 @@ - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { [window setTitle:[NSString stringWithFormat:@"Disassembly: %@", [dasmView selectedSubviewName]]]; // calculate the optimal size for everything - { - NSSize desired = [NSScrollView frameSizeForContentSize:[dasmView maximumFrameSize] - hasHorizontalScroller:YES - hasVerticalScroller:YES - borderType:[dasmScroll borderType]]; - [self cascadeWindowWithDesiredSize:desired forView:dasmScroll]; - } + NSSize const desired = [NSScrollView frameSizeForContentSize:[dasmView maximumFrameSize] + hasHorizontalScroller:YES + hasVerticalScroller:YES + borderType:[dasmScroll borderType]]; + [self cascadeWindowWithDesiredSize:desired forView:dasmScroll]; // don't forget the result return self; @@ -130,6 +129,38 @@ - (void)dealloc { } +- (IBAction)debugNewMemoryWindow:(id)sender { + debug_view_disasm_source const *source = [dasmView source]; + [console debugNewMemoryWindowForSpace:&source->space() + device:&source->device() + expression:nil]; +} + + +- (IBAction)debugNewDisassemblyWindow:(id)sender { + debug_view_disasm_source const *source = [dasmView source]; + [console debugNewDisassemblyWindowForSpace:&source->space() + device:&source->device() + expression:[dasmView expression]]; +} + + +- (BOOL)selectSubviewForDevice:(device_t *)device { + BOOL const result = [dasmView selectSubviewForDevice:device]; + [subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[dasmView selectedSubviewIndex]]]; + [window setTitle:[NSString stringWithFormat:@"Disassembly: %@", [dasmView selectedSubviewName]]]; + return result; +} + + +- (BOOL)selectSubviewForSpace:(address_space *)space { + BOOL const result = [dasmView selectSubviewForSpace:space]; + [subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[dasmView selectedSubviewIndex]]]; + [window setTitle:[NSString stringWithFormat:@"Disassembly: %@", [dasmView selectedSubviewName]]]; + return result; +} + + - (IBAction)changeSubview:(id)sender { [dasmView selectSubviewAtIndex:[[sender selectedItem] tag]]; [window setTitle:[NSString stringWithFormat:@"Disassembly: %@", [dasmView selectedSubviewName]]]; diff --git a/src/osd/modules/debugger/osx/debugosxerrorlogview.h b/src/osd/modules/debugger/osx/errorlogview.h similarity index 84% rename from src/osd/modules/debugger/osx/debugosxerrorlogview.h rename to src/osd/modules/debugger/osx/errorlogview.h index 7f85a06147f7f..bcb6a541a8cbc 100644 --- a/src/osd/modules/debugger/osx/debugosxerrorlogview.h +++ b/src/osd/modules/debugger/osx/errorlogview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxerrorlogview.h - MacOS X Cocoa debug window handling +// errorlogview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugview.h" + +#import "debugview.h" #include "emu.h" diff --git a/src/osd/modules/debugger/osx/debugosxerrorlogview.m b/src/osd/modules/debugger/osx/errorlogview.m similarity index 85% rename from src/osd/modules/debugger/osx/debugosxerrorlogview.m rename to src/osd/modules/debugger/osx/errorlogview.m index 49ffac807b0da..80380bc1e161e 100644 --- a/src/osd/modules/debugger/osx/debugosxerrorlogview.m +++ b/src/osd/modules/debugger/osx/errorlogview.m @@ -2,14 +2,14 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxerrorlogview.m - MacOS X Cocoa debug window handling +// errorlogview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxerrorlogview.h" +#import "errorlogview.h" #include "debug/debugvw.h" diff --git a/src/osd/modules/debugger/osx/debugosxerrorlogviewer.h b/src/osd/modules/debugger/osx/errorlogviewer.h similarity index 85% rename from src/osd/modules/debugger/osx/debugosxerrorlogviewer.h rename to src/osd/modules/debugger/osx/errorlogviewer.h index caab178d854f9..22538f81307b0 100644 --- a/src/osd/modules/debugger/osx/debugosxerrorlogviewer.h +++ b/src/osd/modules/debugger/osx/errorlogviewer.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxerrorlogviewer.h - MacOS X Cocoa debug window handling +// errorlogviewer.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugwindowhandler.h" + +#import "debugwindowhandler.h" #include "emu.h" diff --git a/src/osd/modules/debugger/osx/debugosxerrorlogviewer.m b/src/osd/modules/debugger/osx/errorlogviewer.m similarity index 93% rename from src/osd/modules/debugger/osx/debugosxerrorlogviewer.m rename to src/osd/modules/debugger/osx/errorlogviewer.m index b0abaeaeca63c..f049286aaa48b 100644 --- a/src/osd/modules/debugger/osx/debugosxerrorlogviewer.m +++ b/src/osd/modules/debugger/osx/errorlogviewer.m @@ -2,16 +2,16 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxerrorlogviewer.m - MacOS X Cocoa debug window handling +// errorlogviewer.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxerrorlogviewer.h" +#import "errorlogviewer.h" -#import "debugosxerrorlogview.h" +#import "errorlogview.h" @implementation MAMEErrorLogViewer diff --git a/src/osd/modules/debugger/osx/debugosxmemoryview.h b/src/osd/modules/debugger/osx/memoryview.h similarity index 81% rename from src/osd/modules/debugger/osx/debugosxmemoryview.h rename to src/osd/modules/debugger/osx/memoryview.h index 45f39787c5a60..1336426c8966d 100644 --- a/src/osd/modules/debugger/osx/debugosxmemoryview.h +++ b/src/osd/modules/debugger/osx/memoryview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxmemoryview.h - MacOS X Cocoa debug window handling +// memoryview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,9 +10,11 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugview.h" + +#import "debugview.h" #include "emu.h" +#include "debug/dvmemory.h" #import @@ -28,11 +30,14 @@ - (NSString *)selectedSubviewName; - (int)selectedSubviewIndex; - (void)selectSubviewAtIndex:(int)index; -- (void)selectSubviewForCPU:(device_t *)device; +- (BOOL)selectSubviewForDevice:(device_t *)device; +- (BOOL)selectSubviewForSpace:(address_space *)space; - (NSString *)expression; - (void)setExpression:(NSString *)exp; +- (debug_view_memory_source const *)source; + - (IBAction)showChunkSize:(id)sender; - (IBAction)showPhysicalAddresses:(id)sender; - (IBAction)showReverseView:(id)sender; diff --git a/src/osd/modules/debugger/osx/debugosxmemoryview.m b/src/osd/modules/debugger/osx/memoryview.m similarity index 85% rename from src/osd/modules/debugger/osx/debugosxmemoryview.m rename to src/osd/modules/debugger/osx/memoryview.m index 3bebe290c7986..0f02fac83ef33 100644 --- a/src/osd/modules/debugger/osx/debugosxmemoryview.m +++ b/src/osd/modules/debugger/osx/memoryview.m @@ -2,18 +2,17 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxmemoryview.m - MacOS X Cocoa debug window handling +// memoryview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxmemoryview.h" +#import "memoryview.h" #include "debug/debugcpu.h" #include "debug/debugvw.h" -#include "debug/dvmemory.h" @implementation MAMEMemoryView @@ -107,13 +106,43 @@ - (void)selectSubviewAtIndex:(int)index { } -- (void)selectSubviewForCPU:(device_t *)device { - debug_view_source const *selected = view->source(); - debug_view_source const *source = view->source_for_device(device); - if ( selected != source ) { - view->set_source(*source); - if ([[self window] firstResponder] != self) - view->set_cursor_visible(false); +- (BOOL)selectSubviewForDevice:(device_t *)device { + debug_view_source const *const source = view->source_for_device(device); + if (source != NULL) + { + if (view->source() != source) + { + view->set_source(*source); + if ([[self window] firstResponder] != self) + view->set_cursor_visible(false); + } + return YES; + } + else + { + return NO; + } +} + + +- (BOOL)selectSubviewForSpace:(address_space *)space { + if (space == NULL) return NO; + debug_view_memory_source const *source = downcast(view->first_source()); + while ((source != NULL) && (source->space() != space)) + source = downcast(source->next()); + if (source != NULL) + { + if (view->source() != source) + { + view->set_source(*source); + if ([[self window] firstResponder] != self) + view->set_cursor_visible(false); + } + return YES; + } + else + { + return NO; } } @@ -128,6 +157,11 @@ - (void)setExpression:(NSString *)exp { } +- (debug_view_memory_source const *)source { + return downcast(view->source()); +} + + - (IBAction)showChunkSize:(id)sender { downcast(view)->set_bytes_per_chunk([sender tag]); } diff --git a/src/osd/modules/debugger/osx/debugosxmemoryviewer.h b/src/osd/modules/debugger/osx/memoryviewer.h similarity index 74% rename from src/osd/modules/debugger/osx/debugosxmemoryviewer.h rename to src/osd/modules/debugger/osx/memoryviewer.h index 4ea37140fdce1..63c9d4eea2b12 100644 --- a/src/osd/modules/debugger/osx/debugosxmemoryviewer.h +++ b/src/osd/modules/debugger/osx/memoryviewer.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxmemoryviewer.h - MacOS X Cocoa debug window handling +// memoryviewer.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugwindowhandler.h" + +#import "debugwindowhandler.h" #include "emu.h" @@ -22,10 +23,14 @@ @interface MAMEMemoryViewer : MAMEExpressionAuxiliaryDebugWindowHandler { MAMEMemoryView *memoryView; + NSPopUpButton *subviewButton; } - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c; +- (BOOL)selectSubviewForDevice:(device_t *)device; +- (BOOL)selectSubviewForSpace:(address_space *)space; + - (IBAction)changeSubview:(id)sender; @end diff --git a/src/osd/modules/debugger/osx/debugosxmemoryviewer.m b/src/osd/modules/debugger/osx/memoryviewer.m similarity index 77% rename from src/osd/modules/debugger/osx/debugosxmemoryviewer.m rename to src/osd/modules/debugger/osx/memoryviewer.m index d3413e58a9929..517efa9fd0a33 100644 --- a/src/osd/modules/debugger/osx/debugosxmemoryviewer.m +++ b/src/osd/modules/debugger/osx/memoryviewer.m @@ -2,19 +2,21 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxmemoryviewer.m - MacOS X Cocoa debug window handling +// memoryviewer.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxmemoryviewer.h" +#import "memoryviewer.h" -#import "debugosxdebugview.h" -#import "debugosxmemoryview.h" +#import "debugconsole.h" +#import "debugview.h" +#import "memoryview.h" #include "debug/debugcpu.h" +#include "debug/dvmemory.h" @implementation MAMEMemoryViewer @@ -22,7 +24,7 @@ @implementation MAMEMemoryViewer - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { NSScrollView *memoryScroll; NSView *expressionContainer; - NSPopUpButton *actionButton, *subviewButton; + NSPopUpButton *actionButton; NSRect contentBounds, expressionFrame; if (!(self = [super initWithMachine:m title:@"Memory" console:c])) @@ -97,7 +99,7 @@ - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { [actionButton release]; // set default state - [memoryView selectSubviewForCPU:debug_cpu_get_visible_cpu(*machine)]; + [memoryView selectSubviewForDevice:debug_cpu_get_visible_cpu(*machine)]; [memoryView setExpression:@"0"]; [expressionField setStringValue:@"0"]; [expressionField selectText:self]; @@ -127,6 +129,38 @@ - (void)dealloc { } +- (IBAction)debugNewMemoryWindow:(id)sender { + debug_view_memory_source const *source = [memoryView source]; + [console debugNewMemoryWindowForSpace:source->space() + device:source->device() + expression:[memoryView expression]]; +} + + +- (IBAction)debugNewDisassemblyWindow:(id)sender { + debug_view_memory_source const *source = [memoryView source]; + [console debugNewDisassemblyWindowForSpace:source->space() + device:source->device() + expression:[memoryView expression]]; +} + + +- (BOOL)selectSubviewForDevice:(device_t *)device { + BOOL const result = [memoryView selectSubviewForDevice:device]; + [subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[memoryView selectedSubviewIndex]]]; + [window setTitle:[NSString stringWithFormat:@"Memory: %@", [memoryView selectedSubviewName]]]; + return result; +} + + +- (BOOL)selectSubviewForSpace:(address_space *)space { + BOOL const result = [memoryView selectSubviewForSpace:space]; + [subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[memoryView selectedSubviewIndex]]]; + [window setTitle:[NSString stringWithFormat:@"Memory: %@", [memoryView selectedSubviewName]]]; + return result; +} + + - (IBAction)changeSubview:(id)sender { [memoryView selectSubviewAtIndex:[[sender selectedItem] tag]]; [window setTitle:[NSString stringWithFormat:@"Memory: %@", [memoryView selectedSubviewName]]]; diff --git a/src/osd/modules/debugger/osx/debugosxpointsviewer.h b/src/osd/modules/debugger/osx/pointsviewer.h similarity index 85% rename from src/osd/modules/debugger/osx/debugosxpointsviewer.h rename to src/osd/modules/debugger/osx/pointsviewer.h index 885affcc0a671..3943f6b486fa9 100644 --- a/src/osd/modules/debugger/osx/debugosxpointsviewer.h +++ b/src/osd/modules/debugger/osx/pointsviewer.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxpointsviewer.h - MacOS X Cocoa debug window handling +// pointsviewer.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugwindowhandler.h" + +#import "debugwindowhandler.h" #include "emu.h" diff --git a/src/osd/modules/debugger/osx/debugosxpointsviewer.m b/src/osd/modules/debugger/osx/pointsviewer.m similarity index 96% rename from src/osd/modules/debugger/osx/debugosxpointsviewer.m rename to src/osd/modules/debugger/osx/pointsviewer.m index b5667581af11c..7c85324fd70c6 100644 --- a/src/osd/modules/debugger/osx/debugosxpointsviewer.m +++ b/src/osd/modules/debugger/osx/pointsviewer.m @@ -2,17 +2,17 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxpointsviewer.m - MacOS X Cocoa debug window handling +// pointsviewer.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxpointsviewer.h" +#import "pointsviewer.h" -#import "debugosxbreakpointsview.h" -#import "debugosxwatchpointsview.h" +#import "breakpointsview.h" +#import "watchpointsview.h" @implementation MAMEPointsViewer diff --git a/src/osd/modules/debugger/osx/debugosxregistersview.h b/src/osd/modules/debugger/osx/registersview.h similarity index 82% rename from src/osd/modules/debugger/osx/debugosxregistersview.h rename to src/osd/modules/debugger/osx/registersview.h index 5951cef4dc284..90e656104fc9a 100644 --- a/src/osd/modules/debugger/osx/debugosxregistersview.h +++ b/src/osd/modules/debugger/osx/registersview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxregistersview.h - MacOS X Cocoa debug window handling +// registersview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugview.h" + +#import "debugview.h" #include "emu.h" @@ -28,6 +29,6 @@ - (NSString *)selectedSubviewName; - (int)selectedSubviewIndex; - (void)selectSubviewAtIndex:(int)index; -- (void)selectSubviewForCPU:(device_t *)device; +- (void)selectSubviewForDevice:(device_t *)device; @end diff --git a/src/osd/modules/debugger/osx/debugosxregistersview.m b/src/osd/modules/debugger/osx/registersview.m similarity index 90% rename from src/osd/modules/debugger/osx/debugosxregistersview.m rename to src/osd/modules/debugger/osx/registersview.m index 49c635250ebcf..50191b4c9a5b1 100644 --- a/src/osd/modules/debugger/osx/debugosxregistersview.m +++ b/src/osd/modules/debugger/osx/registersview.m @@ -2,14 +2,14 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxregistersview.m - MacOS X Cocoa debug window handling +// registersview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxregistersview.h" +#import "registersview.h" #include "debug/debugcpu.h" #include "debug/debugvw.h" @@ -64,7 +64,7 @@ - (void)selectSubviewAtIndex:(int)index { } -- (void)selectSubviewForCPU:(device_t *)device { +- (void)selectSubviewForDevice:(device_t *)device { view->set_source(*view->source_for_device(device)); } diff --git a/src/osd/modules/debugger/osx/debugosxwatchpointsview.h b/src/osd/modules/debugger/osx/watchpointsview.h similarity index 83% rename from src/osd/modules/debugger/osx/debugosxwatchpointsview.h rename to src/osd/modules/debugger/osx/watchpointsview.h index 02a2c885dfc4f..0480c685d2033 100644 --- a/src/osd/modules/debugger/osx/debugosxwatchpointsview.h +++ b/src/osd/modules/debugger/osx/watchpointsview.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxwatchpointsview.h - MacOS X Cocoa debug window handling +// watchpointsview.h - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. @@ -10,7 +10,8 @@ //============================================================ #import "debugosx.h" -#import "debugosxdebugview.h" + +#import "debugview.h" #include "emu.h" diff --git a/src/osd/modules/debugger/osx/debugosxwatchpointsview.m b/src/osd/modules/debugger/osx/watchpointsview.m similarity index 85% rename from src/osd/modules/debugger/osx/debugosxwatchpointsview.m rename to src/osd/modules/debugger/osx/watchpointsview.m index a023351eb777f..0b1ab9ae39c68 100644 --- a/src/osd/modules/debugger/osx/debugosxwatchpointsview.m +++ b/src/osd/modules/debugger/osx/watchpointsview.m @@ -2,14 +2,14 @@ // copyright-holders:Vas Crabb //============================================================ // -// debugosxwatchpointsview.m - MacOS X Cocoa debug window handling +// watchpointsview.m - MacOS X Cocoa debug window handling // // Copyright (c) 1996-2015, Nicola Salmoria and the MAME Team. // Visit http://mamedev.org for licensing and usage restrictions. // //============================================================ -#import "debugosxwatchpointsview.h" +#import "watchpointsview.h" #include "debug/debugvw.h" diff --git a/src/osd/modules/debugger/qt/debugqtbreakpointswindow.c b/src/osd/modules/debugger/qt/breakpointswindow.c similarity index 98% rename from src/osd/modules/debugger/qt/debugqtbreakpointswindow.c rename to src/osd/modules/debugger/qt/breakpointswindow.c index 31000e26c514e..ff14fdfb67c22 100644 --- a/src/osd/modules/debugger/qt/debugqtbreakpointswindow.c +++ b/src/osd/modules/debugger/qt/breakpointswindow.c @@ -1,6 +1,6 @@ #define NO_MEM_TRACKING -#include "debugqtbreakpointswindow.h" +#include "breakpointswindow.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" diff --git a/src/osd/modules/debugger/qt/debugqtbreakpointswindow.h b/src/osd/modules/debugger/qt/breakpointswindow.h similarity index 95% rename from src/osd/modules/debugger/qt/debugqtbreakpointswindow.h rename to src/osd/modules/debugger/qt/breakpointswindow.h index 0506ca37abb2b..fedad23b84a9d 100644 --- a/src/osd/modules/debugger/qt/debugqtbreakpointswindow.h +++ b/src/osd/modules/debugger/qt/breakpointswindow.h @@ -3,8 +3,8 @@ #include -#include "debugqtview.h" -#include "debugqtwindow.h" +#include "debuggerview.h" +#include "windowqt.h" //============================================================ diff --git a/src/osd/modules/debugger/qt/debugqtdasmwindow.c b/src/osd/modules/debugger/qt/dasmwindow.c similarity index 99% rename from src/osd/modules/debugger/qt/debugqtdasmwindow.c rename to src/osd/modules/debugger/qt/dasmwindow.c index ca9a5045d695c..b88ace8613ac4 100644 --- a/src/osd/modules/debugger/qt/debugqtdasmwindow.c +++ b/src/osd/modules/debugger/qt/dasmwindow.c @@ -1,6 +1,6 @@ #define NO_MEM_TRACKING -#include "debugqtdasmwindow.h" +#include "dasmwindow.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" diff --git a/src/osd/modules/debugger/qt/debugqtdasmwindow.h b/src/osd/modules/debugger/qt/dasmwindow.h similarity index 96% rename from src/osd/modules/debugger/qt/debugqtdasmwindow.h rename to src/osd/modules/debugger/qt/dasmwindow.h index 7b31b67667801..0954f80d61fcd 100644 --- a/src/osd/modules/debugger/qt/debugqtdasmwindow.h +++ b/src/osd/modules/debugger/qt/dasmwindow.h @@ -3,8 +3,8 @@ #include -#include "debugqtview.h" -#include "debugqtwindow.h" +#include "debuggerview.h" +#include "windowqt.h" //============================================================ diff --git a/src/osd/modules/debugger/qt/debugqtview.c b/src/osd/modules/debugger/qt/debuggerview.c similarity index 99% rename from src/osd/modules/debugger/qt/debugqtview.c rename to src/osd/modules/debugger/qt/debuggerview.c index 971bd44d17a47..7befa5978f8d0 100644 --- a/src/osd/modules/debugger/qt/debugqtview.c +++ b/src/osd/modules/debugger/qt/debuggerview.c @@ -1,6 +1,6 @@ #define NO_MEM_TRACKING -#include "debugqtview.h" +#include "debuggerview.h" DebuggerView::DebuggerView(const debug_view_type& type, running_machine* machine, diff --git a/src/osd/modules/debugger/qt/debugqtview.h b/src/osd/modules/debugger/qt/debuggerview.h similarity index 91% rename from src/osd/modules/debugger/qt/debugqtview.h rename to src/osd/modules/debugger/qt/debuggerview.h index 16ce1f48fbde7..2e4e8d9603a73 100644 --- a/src/osd/modules/debugger/qt/debugqtview.h +++ b/src/osd/modules/debugger/qt/debuggerview.h @@ -1,5 +1,5 @@ -#ifndef __DEBUG_QT_VIEW_H__ -#define __DEBUG_QT_VIEW_H__ +#ifndef __DEBUG_QT_DEBUGGER_VIEW_H__ +#define __DEBUG_QT_DEBUGGER_VIEW_H__ #include diff --git a/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c b/src/osd/modules/debugger/qt/deviceinformationwindow.c similarity index 98% rename from src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c rename to src/osd/modules/debugger/qt/deviceinformationwindow.c index 66baf08bdfa87..cc2945b7613c7 100644 --- a/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.c @@ -1,6 +1,6 @@ #define NO_MEM_TRACKING -#include "debugqtdeviceinformationwindow.h" +#include "deviceinformationwindow.h" DeviceInformationWindow::DeviceInformationWindow(running_machine* machine, device_t* device, QWidget* parent) : diff --git a/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h b/src/osd/modules/debugger/qt/deviceinformationwindow.h similarity index 97% rename from src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h rename to src/osd/modules/debugger/qt/deviceinformationwindow.h index cb7ade44c00c4..eb32398e9b394 100644 --- a/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.h @@ -3,7 +3,7 @@ #include -#include "debugqtwindow.h" +#include "windowqt.h" //============================================================ // The Device Information Window. diff --git a/src/osd/modules/debugger/qt/debugqtdeviceswindow.c b/src/osd/modules/debugger/qt/deviceswindow.c similarity index 98% rename from src/osd/modules/debugger/qt/debugqtdeviceswindow.c rename to src/osd/modules/debugger/qt/deviceswindow.c index 09b2fa8d7a514..ac1f46e347fcc 100644 --- a/src/osd/modules/debugger/qt/debugqtdeviceswindow.c +++ b/src/osd/modules/debugger/qt/deviceswindow.c @@ -1,7 +1,7 @@ #define NO_MEM_TRACKING -#include "debugqtdeviceswindow.h" -#include "debugqtdeviceinformationwindow.h" +#include "deviceswindow.h" +#include "deviceinformationwindow.h" DevicesWindowModel::DevicesWindowModel(running_machine *machine, QObject *parent) { diff --git a/src/osd/modules/debugger/qt/debugqtdeviceswindow.h b/src/osd/modules/debugger/qt/deviceswindow.h similarity index 98% rename from src/osd/modules/debugger/qt/debugqtdeviceswindow.h rename to src/osd/modules/debugger/qt/deviceswindow.h index f541f303efd5e..bf647b27ec56c 100644 --- a/src/osd/modules/debugger/qt/debugqtdeviceswindow.h +++ b/src/osd/modules/debugger/qt/deviceswindow.h @@ -3,7 +3,7 @@ #include -#include "debugqtwindow.h" +#include "windowqt.h" //============================================================ diff --git a/src/osd/modules/debugger/qt/debugqtlogwindow.c b/src/osd/modules/debugger/qt/logwindow.c similarity index 97% rename from src/osd/modules/debugger/qt/debugqtlogwindow.c rename to src/osd/modules/debugger/qt/logwindow.c index d9bc1e12b51d3..ac6fbd6fc12a2 100644 --- a/src/osd/modules/debugger/qt/debugqtlogwindow.c +++ b/src/osd/modules/debugger/qt/logwindow.c @@ -1,6 +1,6 @@ #define NO_MEM_TRACKING -#include "debugqtlogwindow.h" +#include "logwindow.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" diff --git a/src/osd/modules/debugger/qt/debugqtlogwindow.h b/src/osd/modules/debugger/qt/logwindow.h similarity index 95% rename from src/osd/modules/debugger/qt/debugqtlogwindow.h rename to src/osd/modules/debugger/qt/logwindow.h index e936a5ae647fd..4179132dc1e37 100644 --- a/src/osd/modules/debugger/qt/debugqtlogwindow.h +++ b/src/osd/modules/debugger/qt/logwindow.h @@ -3,8 +3,8 @@ #include -#include "debugqtview.h" -#include "debugqtwindow.h" +#include "debuggerview.h" +#include "windowqt.h" //============================================================ diff --git a/src/osd/modules/debugger/qt/debugqtmainwindow.c b/src/osd/modules/debugger/qt/mainwindow.c similarity index 99% rename from src/osd/modules/debugger/qt/debugqtmainwindow.c rename to src/osd/modules/debugger/qt/mainwindow.c index 4a5b95946368c..f493741aceddb 100644 --- a/src/osd/modules/debugger/qt/debugqtmainwindow.c +++ b/src/osd/modules/debugger/qt/mainwindow.c @@ -1,6 +1,6 @@ #define NO_MEM_TRACKING -#include "debugqtmainwindow.h" +#include "mainwindow.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" diff --git a/src/osd/modules/debugger/qt/debugqtmainwindow.h b/src/osd/modules/debugger/qt/mainwindow.h similarity index 98% rename from src/osd/modules/debugger/qt/debugqtmainwindow.h rename to src/osd/modules/debugger/qt/mainwindow.h index 864f1c0f66282..d3a6a6b33fc72 100644 --- a/src/osd/modules/debugger/qt/debugqtmainwindow.h +++ b/src/osd/modules/debugger/qt/mainwindow.h @@ -6,8 +6,8 @@ #include "debug/dvdisasm.h" -#include "debugqtview.h" -#include "debugqtwindow.h" +#include "debuggerview.h" +#include "windowqt.h" class DasmDockWidget; class ProcessorDockWidget; diff --git a/src/osd/modules/debugger/qt/debugqtmemorywindow.c b/src/osd/modules/debugger/qt/memorywindow.c similarity index 99% rename from src/osd/modules/debugger/qt/debugqtmemorywindow.c rename to src/osd/modules/debugger/qt/memorywindow.c index 9c3c0c20881eb..d04fa1071afa6 100644 --- a/src/osd/modules/debugger/qt/debugqtmemorywindow.c +++ b/src/osd/modules/debugger/qt/memorywindow.c @@ -1,6 +1,6 @@ #define NO_MEM_TRACKING -#include "debugqtmemorywindow.h" +#include "memorywindow.h" #include "debug/dvmemory.h" #include "debug/debugcon.h" diff --git a/src/osd/modules/debugger/qt/debugqtmemorywindow.h b/src/osd/modules/debugger/qt/memorywindow.h similarity index 97% rename from src/osd/modules/debugger/qt/debugqtmemorywindow.h rename to src/osd/modules/debugger/qt/memorywindow.h index 1f97c414eeebd..2dc731f400695 100644 --- a/src/osd/modules/debugger/qt/debugqtmemorywindow.h +++ b/src/osd/modules/debugger/qt/memorywindow.h @@ -3,8 +3,8 @@ #include -#include "debugqtview.h" -#include "debugqtwindow.h" +#include "debuggerview.h" +#include "windowqt.h" class DebuggerMemView; diff --git a/src/osd/modules/debugger/qt/debugqtwindow.c b/src/osd/modules/debugger/qt/windowqt.c similarity index 97% rename from src/osd/modules/debugger/qt/debugqtwindow.c rename to src/osd/modules/debugger/qt/windowqt.c index 9570ad83d5eaf..851a73a359f4a 100644 --- a/src/osd/modules/debugger/qt/debugqtwindow.c +++ b/src/osd/modules/debugger/qt/windowqt.c @@ -1,11 +1,11 @@ #define NO_MEM_TRACKING -#include "debugqtwindow.h" -#include "debugqtlogwindow.h" -#include "debugqtdasmwindow.h" -#include "debugqtmemorywindow.h" -#include "debugqtbreakpointswindow.h" -#include "debugqtdeviceswindow.h" +#include "windowqt.h" +#include "logwindow.h" +#include "dasmwindow.h" +#include "memorywindow.h" +#include "breakpointswindow.h" +#include "deviceswindow.h" bool WindowQt::s_refreshAll = false; bool WindowQt::s_hideAll = false; diff --git a/src/osd/modules/debugger/qt/debugqtwindow.h b/src/osd/modules/debugger/qt/windowqt.h similarity index 97% rename from src/osd/modules/debugger/qt/debugqtwindow.h rename to src/osd/modules/debugger/qt/windowqt.h index ecaf1c2421708..6bb7f646522e2 100644 --- a/src/osd/modules/debugger/qt/debugqtwindow.h +++ b/src/osd/modules/debugger/qt/windowqt.h @@ -1,5 +1,5 @@ -#ifndef __DEBUG_QT_WINDOW_H__ -#define __DEBUG_QT_WINDOW_H__ +#ifndef __DEBUG_QT_WINDOW_QT_H__ +#define __DEBUG_QT_WINDOW_QT_H__ #include diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak index f44cdd76c086c..198ef34c3397d 100644 --- a/src/osd/sdl/sdl.mak +++ b/src/osd/sdl/sdl.mak @@ -289,21 +289,22 @@ OBJDIRS += $(OSDOBJ)/modules/debugger/osx DEBUGOBJS = \ $(OSDOBJ)/modules/debugger/debugosx.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxbreakpointsview.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxconsoleview.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxdebugcommandhistory.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxdebugconsole.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxdebugview.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxdebugwindowhandler.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxdisassemblyview.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxdisassemblyviewer.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxerrorlogview.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxerrorlogviewer.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxmemoryview.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxmemoryviewer.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxpointsviewer.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxregistersview.o \ - $(OSDOBJ)/modules/debugger/osx/debugosxwatchpointsview.o + $(OSDOBJ)/modules/debugger/osx/breakpointsview.o \ + $(OSDOBJ)/modules/debugger/osx/consoleview.o \ + $(OSDOBJ)/modules/debugger/osx/debugcommandhistory.o \ + $(OSDOBJ)/modules/debugger/osx/debugconsole.o \ + $(OSDOBJ)/modules/debugger/osx/debugview.o \ + $(OSDOBJ)/modules/debugger/osx/debugwindowhandler.o \ + $(OSDOBJ)/modules/debugger/osx/devicesviewer.o \ + $(OSDOBJ)/modules/debugger/osx/disassemblyview.o \ + $(OSDOBJ)/modules/debugger/osx/disassemblyviewer.o \ + $(OSDOBJ)/modules/debugger/osx/errorlogview.o \ + $(OSDOBJ)/modules/debugger/osx/errorlogviewer.o \ + $(OSDOBJ)/modules/debugger/osx/memoryview.o \ + $(OSDOBJ)/modules/debugger/osx/memoryviewer.o \ + $(OSDOBJ)/modules/debugger/osx/pointsviewer.o \ + $(OSDOBJ)/modules/debugger/osx/registersview.o \ + $(OSDOBJ)/modules/debugger/osx/watchpointsview.o endif @@ -728,24 +729,24 @@ $(OSDOBJ)/%.moc.c: $(OSDSRC)/%.h $(MOC) $(MOCINCPATH) $(DEFS) $< -o $@ DEBUGOBJS = \ - $(OSDOBJ)/modules/debugger/qt/debugqtview.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtdeviceswindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtview.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtwindow.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtdeviceswindow.moc.o \ - $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.moc.o + $(OSDOBJ)/modules/debugger/qt/debuggerview.o \ + $(OSDOBJ)/modules/debugger/qt/windowqt.o \ + $(OSDOBJ)/modules/debugger/qt/logwindow.o \ + $(OSDOBJ)/modules/debugger/qt/dasmwindow.o \ + $(OSDOBJ)/modules/debugger/qt/mainwindow.o \ + $(OSDOBJ)/modules/debugger/qt/memorywindow.o \ + $(OSDOBJ)/modules/debugger/qt/breakpointswindow.o \ + $(OSDOBJ)/modules/debugger/qt/deviceswindow.o \ + $(OSDOBJ)/modules/debugger/qt/deviceinformationwindow.o \ + $(OSDOBJ)/modules/debugger/qt/debuggerview.moc.o \ + $(OSDOBJ)/modules/debugger/qt/windowqt.moc.o \ + $(OSDOBJ)/modules/debugger/qt/logwindow.moc.o \ + $(OSDOBJ)/modules/debugger/qt/dasmwindow.moc.o \ + $(OSDOBJ)/modules/debugger/qt/mainwindow.moc.o \ + $(OSDOBJ)/modules/debugger/qt/memorywindow.moc.o \ + $(OSDOBJ)/modules/debugger/qt/breakpointswindow.moc.o \ + $(OSDOBJ)/modules/debugger/qt/deviceswindow.moc.o \ + $(OSDOBJ)/modules/debugger/qt/deviceinformationwindow.moc.o DEFS += -DUSE_QTDEBUG=1