diff options
author | 2015-02-17 02:07:33 +1100 | |
---|---|---|
committer | 2015-02-17 17:31:52 +1100 | |
commit | e05a076b9426eb098428b14f5acc0ec3c8a5cd91 (patch) | |
tree | e260f53a41c41c94bb0e6a709ee4fcf5f37d686f | |
parent | 87e38fd1d30e53413bc1f94f0dfd340051a71253 (diff) |
* Map visited to a background colour
* Allocate colours once only
* Make disassembly view context menu easier to use again
* Console feedback for breakpoint changes
* Update views for breakpoint changes
* Map Option-/Command-click to middle/right click
* Disassembly/memory views inherit focus from parent window
-rw-r--r-- | src/osd/modules/debugger/debugosx.m | 6 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugconsole.h | 3 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugconsole.m | 136 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugview.h | 2 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugview.m | 251 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugwindowhandler.h | 3 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/debugwindowhandler.m | 23 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/disassemblyview.h | 6 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/disassemblyview.m | 108 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/disassemblyviewer.h | 4 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/disassemblyviewer.m | 37 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/memoryview.h | 6 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/memoryview.m | 50 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/memoryviewer.h | 4 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/memoryviewer.m | 38 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/registersview.h | 2 | ||||
-rw-r--r-- | src/osd/modules/debugger/osx/registersview.m | 2 |
17 files changed, 483 insertions, 198 deletions
diff --git a/src/osd/modules/debugger/debugosx.m b/src/osd/modules/debugger/debugosx.m index 7e713fc2e60..460a666a5fb 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 // * 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 @@ -97,6 +97,8 @@ void debugger_osx::wait_for_debugger(device_t &device, bool 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/osx/debugconsole.h b/src/osd/modules/debugger/osx/debugconsole.h index 862c035cbb4..24ed021fcb4 100644 --- a/src/osd/modules/debugger/osx/debugconsole.h +++ b/src/osd/modules/debugger/osx/debugconsole.h @@ -42,6 +42,9 @@ - (IBAction)debugNewErrorLogWindow:(id)sender; - (IBAction)debugNewPointsWindow:(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/debugconsole.m b/src/osd/modules/debugger/osx/debugconsole.m index d3aec2bb88a..3df65689e4f 100644 --- a/src/osd/modules/debugger/osx/debugconsole.m +++ b/src/osd/modules/debugger/osx/debugconsole.m @@ -135,50 +135,47 @@ [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 +203,8 @@ - (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 +258,44 @@ } +- (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 +344,16 @@ - (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/debugview.h b/src/osd/modules/debugger/osx/debugview.h index 06c25ea7c21..56afd03351b 100644 --- a/src/osd/modules/debugger/osx/debugview.h +++ b/src/osd/modules/debugger/osx/debugview.h @@ -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/debugview.m b/src/osd/modules/debugger/osx/debugview.m index c70801c3f75..2167e4321be 100644 --- a/src/osd/modules/debugger/osx/debugview.m +++ b/src/osd/modules/debugger/osx/debugview.m @@ -14,6 +14,24 @@ #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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) 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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) } -- (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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) 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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) - (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 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) 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/debugwindowhandler.h b/src/osd/modules/debugger/osx/debugwindowhandler.h index ba0f75fadad..4c157d825f8 100644 --- a/src/osd/modules/debugger/osx/debugwindowhandler.h +++ b/src/osd/modules/debugger/osx/debugwindowhandler.h @@ -90,6 +90,9 @@ extern NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification; - (id <MAMEDebugViewExpressionSupport>)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/debugwindowhandler.m b/src/osd/modules/debugger/osx/debugwindowhandler.m index 3b4ed3eb590..d26ca25979b 100644 --- a/src/osd/modules/debugger/osx/debugwindowhandler.m +++ b/src/osd/modules/debugger/osx/debugwindowhandler.m @@ -231,8 +231,9 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD - (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 +241,9 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD - (void)hideDebugger:(NSNotification *)notification { - [window orderOut:self]; + running_machine *m = (running_machine *)[[[notification userInfo] objectForKey:@"MAMEDebugMachine"] pointerValue]; + if (m == machine) + [window orderOut:self]; } @end @@ -309,9 +312,9 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD desired.height -= current.height; windowFrame.size.width += desired.width; + windowFrame.size.width = MIN(windowFrame.size.width, available.size.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.origin.x = available.origin.x + available.size.width - windowFrame.size.width; windowFrame.origin.y = available.origin.y; [window setFrame:windowFrame display:YES]; @@ -352,6 +355,18 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD } +- (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/disassemblyview.h b/src/osd/modules/debugger/osx/disassemblyview.h index 6c261dcaa60..534f6f7fb40 100644 --- a/src/osd/modules/debugger/osx/disassemblyview.h +++ b/src/osd/modules/debugger/osx/disassemblyview.h @@ -14,6 +14,7 @@ #import "debugview.h" #include "emu.h" +#include "debug/dvdisasm.h" #import <Cocoa/Cocoa.h> @@ -30,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/disassemblyview.m b/src/osd/modules/debugger/osx/disassemblyview.m index 2592aeefdfc..16f70404c41 100644 --- a/src/osd/modules/debugger/osx/disassemblyview.m +++ b/src/osd/modules/debugger/osx/disassemblyview.m @@ -11,10 +11,10 @@ #import "disassemblyview.h" +#include "debugger.h" #include "debug/debugcon.h" #include "debug/debugcpu.h" #include "debug/debugvw.h" -#include "debug/dvdisasm.h" @implementation MAMEDisassemblyView @@ -199,13 +199,43 @@ } -- (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<debug_view_disasm_source const *>(view->first_source()); + while ((source != NULL) && (&source->space() != space)) + source = downcast<debug_view_disasm_source *>(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 +250,82 @@ } +- (debug_view_disasm_source const *)source { + return downcast<debug_view_disasm_source const *>(view->source()); +} + + - (IBAction)debugToggleBreakpoint:(id)sender { - if (view->cursor_visible()) { + if (view->cursor_visible()) + { address_space &space = downcast<const debug_view_disasm_source *>(view->source())->space(); - if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &space.device())) { - offs_t address = downcast<debug_view_disasm *>(view)->selected_address(); + if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &space.device())) + { + offs_t const address = downcast<debug_view_disasm *>(view)->selected_address(); device_debug::breakpoint *bp = [self findBreakpointAtAddress:address inAddressSpace:space]; // 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 = space.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(); + space.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()) { + if (view->cursor_visible()) + { address_space &space = downcast<const debug_view_disasm_source *>(view->source())->space(); - if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &space.device())) { - offs_t address = downcast<debug_view_disasm *>(view)->selected_address(); + if (!useConsole || (debug_cpu_get_visible_cpu(*machine) == &space.device())) + { + offs_t const address = downcast<debug_view_disasm *>(view)->selected_address(); device_debug::breakpoint *bp = [self findBreakpointAtAddress:address inAddressSpace:space]; - - if (bp != NULL) { - NSString *command; - if (useConsole) { + 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 { + } + else + { space.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); } } } diff --git a/src/osd/modules/debugger/osx/disassemblyviewer.h b/src/osd/modules/debugger/osx/disassemblyviewer.h index fc2598249aa..6027d3c13da 100644 --- a/src/osd/modules/debugger/osx/disassemblyviewer.h +++ b/src/osd/modules/debugger/osx/disassemblyviewer.h @@ -23,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/disassemblyviewer.m b/src/osd/modules/debugger/osx/disassemblyviewer.m index 6b4272202bb..0342ad83315 100644 --- a/src/osd/modules/debugger/osx/disassemblyviewer.m +++ b/src/osd/modules/debugger/osx/disassemblyviewer.m @@ -11,6 +11,7 @@ #import "disassemblyviewer.h" +#import "debugconsole.h" #import "debugview.h" #import "disassemblyview.h" @@ -22,7 +23,7 @@ - (id)initWithMachine:(running_machine &)m console:(MAMEDebugConsole *)c { NSScrollView *dasmScroll; NSView *expressionContainer; - NSPopUpButton *actionButton, *subviewButton; + NSPopUpButton *actionButton; NSRect contentBounds, expressionFrame; if (!(self = [super initWithMachine:m title:@"Disassembly" console:c])) @@ -98,7 +99,7 @@ [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]; @@ -130,6 +131,38 @@ } +- (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/memoryview.h b/src/osd/modules/debugger/osx/memoryview.h index a0cb51ba7c1..c6bd9c65baf 100644 --- a/src/osd/modules/debugger/osx/memoryview.h +++ b/src/osd/modules/debugger/osx/memoryview.h @@ -14,6 +14,7 @@ #import "debugview.h" #include "emu.h" +#include "debug/dvmemory.h" #import <Cocoa/Cocoa.h> @@ -29,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/memoryview.m b/src/osd/modules/debugger/osx/memoryview.m index b35701df757..8883fc303d7 100644 --- a/src/osd/modules/debugger/osx/memoryview.m +++ b/src/osd/modules/debugger/osx/memoryview.m @@ -13,7 +13,6 @@ #include "debug/debugcpu.h" #include "debug/debugvw.h" -#include "debug/dvmemory.h" @implementation MAMEMemoryView @@ -107,13 +106,43 @@ } -- (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<debug_view_memory_source const *>(view->first_source()); + while ((source != NULL) && (source->space() != space)) + source = downcast<debug_view_memory_source *>(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 @@ } +- (debug_view_memory_source const *)source { + return downcast<debug_view_memory_source const *>(view->source()); +} + + - (IBAction)showChunkSize:(id)sender { downcast<debug_view_memory *>(view)->set_bytes_per_chunk([sender tag]); } diff --git a/src/osd/modules/debugger/osx/memoryviewer.h b/src/osd/modules/debugger/osx/memoryviewer.h index 45db9c21051..4180f0a6ee7 100644 --- a/src/osd/modules/debugger/osx/memoryviewer.h +++ b/src/osd/modules/debugger/osx/memoryviewer.h @@ -23,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/memoryviewer.m b/src/osd/modules/debugger/osx/memoryviewer.m index 044f0f442df..5412cc6457d 100644 --- a/src/osd/modules/debugger/osx/memoryviewer.m +++ b/src/osd/modules/debugger/osx/memoryviewer.m @@ -11,10 +11,12 @@ #import "memoryviewer.h" +#import "debugconsole.h" #import "debugview.h" #import "memoryview.h" #include "debug/debugcpu.h" +#include "debug/dvmemory.h" @implementation MAMEMemoryViewer @@ -22,7 +24,7 @@ - (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 @@ [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 @@ } +- (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/registersview.h b/src/osd/modules/debugger/osx/registersview.h index 5b1ab6a54e5..ec6f6cca5f8 100644 --- a/src/osd/modules/debugger/osx/registersview.h +++ b/src/osd/modules/debugger/osx/registersview.h @@ -29,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/registersview.m b/src/osd/modules/debugger/osx/registersview.m index ba2cf93cd09..5768635f127 100644 --- a/src/osd/modules/debugger/osx/registersview.m +++ b/src/osd/modules/debugger/osx/registersview.m @@ -64,7 +64,7 @@ } -- (void)selectSubviewForCPU:(device_t *)device { +- (void)selectSubviewForDevice:(device_t *)device { view->set_source(*view->source_for_device(device)); } |