Added SCX/SCY display in the VRAM viewer. Closes #168
This commit is contained in:
parent
274760746e
commit
d0bd741049
@ -936,6 +936,7 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
|
||||
(GB_map_type_t) self.tilemapMapButton.indexOfSelectedItem,
|
||||
(GB_tileset_type_t) self.TilemapSetButton.indexOfSelectedItem);
|
||||
|
||||
self.tilemapImageView.scrollRect = NSMakeRect(gb.io_registers[GB_IO_SCX], gb.io_registers[GB_IO_SCY], 160, 144);
|
||||
self.tilemapImageView.image = [Document imageFromData:data width:256 height:256 scale:1.0];
|
||||
self.tilemapImageView.layer.magnificationFilter = kCAFilterNearest;
|
||||
}
|
||||
@ -1192,6 +1193,11 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height,
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)toggleScrollingDisplay:(NSButton *)sender
|
||||
{
|
||||
self.tilemapImageView.displayScrollRect = sender.state;
|
||||
}
|
||||
|
||||
- (IBAction)vramTabChanged:(NSSegmentedControl *)sender
|
||||
{
|
||||
[self.vramTabView selectTabViewItemAtIndex:[sender selectedSegment]];
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12120" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12120"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@ -83,9 +83,9 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="EQe-Ad-L7S">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="376"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textView editable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" baseWritingDirection="leftToRight" findStyle="bar" allowsNonContiguousLayout="YES" id="doS-dM-hnl">
|
||||
<textView editable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsNonContiguousLayout="YES" id="doS-dM-hnl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="376"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
@ -109,7 +109,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<textField focusRingType="none" verticalHuggingPriority="750" mirrorLayoutDirectionWhenInternationalizing="never" allowsCharacterPickerTouchBarItem="NO" id="l22-S8-uji">
|
||||
<textField focusRingType="none" verticalHuggingPriority="750" mirrorLayoutDirectionWhenInternationalizing="never" id="l22-S8-uji">
|
||||
<rect key="frame" x="0.0" y="0.0" width="921" height="24"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" state="on" focusRingType="none" id="p3j-nS-44f" customClass="GBTerminalTextFieldCell">
|
||||
@ -133,9 +133,9 @@
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" heightSizable="YES"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Cs9-3x-ATg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="328"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textView editable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" baseWritingDirection="leftToRight" findStyle="bar" allowsNonContiguousLayout="YES" spellingCorrection="YES" id="JgV-7E-iwp">
|
||||
<textView editable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsNonContiguousLayout="YES" spellingCorrection="YES" id="JgV-7E-iwp">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="328"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.14901960780000001" green="0.14901960780000001" blue="0.14901960780000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
@ -163,9 +163,9 @@
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="YHx-TM-zIC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="47"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textView drawsBackground="NO" importsGraphics="NO" richText="NO" allowsCharacterPickerTouchBarItem="NO" allowsUndo="YES" allowsNonContiguousLayout="YES" textCompletion="NO" spellingCorrection="YES" id="w0g-eK-jM4">
|
||||
<textView drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" allowsCharacterPickerTouchBarItem="NO" allowsUndo="YES" allowsNonContiguousLayout="YES" textCompletion="NO" spellingCorrection="YES" id="w0g-eK-jM4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="47"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
@ -243,7 +243,7 @@
|
||||
<nil key="toolTip"/>
|
||||
<size key="minSize" width="64" height="22"/>
|
||||
<size key="maxSize" width="64" height="22"/>
|
||||
<textField key="view" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" id="rdV-q6-hc6">
|
||||
<textField key="view" verticalHuggingPriority="750" id="rdV-q6-hc6">
|
||||
<rect key="frame" x="0.0" y="14" width="64" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" id="JCn-Y1-eHS">
|
||||
@ -260,7 +260,7 @@
|
||||
<nil key="toolTip"/>
|
||||
<size key="minSize" width="96" height="22"/>
|
||||
<size key="maxSize" width="128" height="22"/>
|
||||
<textField key="view" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" id="EJd-jG-hmH">
|
||||
<textField key="view" verticalHuggingPriority="750" id="EJd-jG-hmH">
|
||||
<rect key="frame" x="0.0" y="14" width="96" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" state="on" borderStyle="bezel" bezelStyle="round" id="vg5-Nn-abb">
|
||||
@ -285,7 +285,7 @@
|
||||
</window>
|
||||
<menuItem title="Cartridge RAM" id="ylM-ah-PNQ"/>
|
||||
<window title="VRAM Viewer" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="mbr-db-iZh" customClass="NSPanel">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" unifiedTitleAndToolbar="YES"/>
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="283" y="305" width="512" height="432"/>
|
||||
@ -298,7 +298,7 @@
|
||||
<rect key="frame" x="0.0" y="406" width="512" height="5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
</box>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="NO" id="6vK-IP-PmP">
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="6vK-IP-PmP">
|
||||
<rect key="frame" x="-2" y="4" width="516" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="umk-4r-VNg">
|
||||
@ -377,6 +377,17 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="512" height="408"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" misplaced="YES" id="DhM-Em-hj7">
|
||||
<rect key="frame" x="385" y="388" width="63" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="roundRect" title="Scrolling" bezelStyle="roundedRect" alignment="center" controlSize="mini" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="P2E-5t-BN9">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="toggleScrollingDisplay:" target="-2" id="VhQ-9W-sjU"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="LlK-tV-bjv" customClass="GBImageView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="512" height="384"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@ -612,7 +623,7 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<clipView key="contentView" id="bP9-su-zQw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="512" height="408"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="18" id="gfC-d3-dmq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="512" height="408"/>
|
||||
|
@ -11,7 +11,9 @@
|
||||
@interface GBImageView : NSImageView
|
||||
@property (nonatomic) NSArray *horizontalGrids;
|
||||
@property (nonatomic) NSArray *verticalGrids;
|
||||
@property (weak) IBOutlet id<GBImageViewDelegate> delegate;
|
||||
@property (nonatomic) bool displayScrollRect;
|
||||
@property NSRect scrollRect;
|
||||
@property (weak) IBOutlet id<GBImageViewDelegate> delegate;
|
||||
@end
|
||||
|
||||
@protocol GBImageViewDelegate <NSObject>
|
||||
|
@ -25,8 +25,8 @@
|
||||
[conf.color set];
|
||||
for (CGFloat y = conf.size * y_ratio; y < self.frame.size.height; y += conf.size * y_ratio) {
|
||||
NSBezierPath *line = [NSBezierPath bezierPath];
|
||||
[line moveToPoint:NSMakePoint(0, y + 0.5)];
|
||||
[line lineToPoint:NSMakePoint(self.frame.size.width, y + 0.5)];
|
||||
[line moveToPoint:NSMakePoint(0, y - 0.5)];
|
||||
[line lineToPoint:NSMakePoint(self.frame.size.width, y - 0.5)];
|
||||
[line setLineWidth:1.0];
|
||||
[line stroke];
|
||||
}
|
||||
@ -42,6 +42,35 @@
|
||||
[line stroke];
|
||||
}
|
||||
}
|
||||
|
||||
if (self.displayScrollRect) {
|
||||
NSBezierPath *path = [NSBezierPath bezierPathWithRect:CGRectInfinite];
|
||||
for (unsigned x = 0; x < 2; x++) {
|
||||
for (unsigned y = 0; y < 2; y++) {
|
||||
NSRect rect = self.scrollRect;
|
||||
rect.origin.x *= x_ratio;
|
||||
rect.origin.y *= y_ratio;
|
||||
rect.size.width *= x_ratio;
|
||||
rect.size.height *= y_ratio;
|
||||
rect.origin.y = self.frame.size.height - rect.origin.y - rect.size.height;
|
||||
|
||||
rect.origin.x -= self.frame.size.width * x;
|
||||
rect.origin.y += self.frame.size.height * y;
|
||||
|
||||
|
||||
NSBezierPath *subpath = [NSBezierPath bezierPathWithRect:rect];
|
||||
[path appendBezierPath:subpath];
|
||||
}
|
||||
}
|
||||
[path setWindingRule:NSEvenOddWindingRule];
|
||||
[path setLineWidth:4.0];
|
||||
[path setLineJoinStyle:NSRoundLineJoinStyle];
|
||||
[[NSColor colorWithWhite:0.2 alpha:0.5] set];
|
||||
[path fill];
|
||||
[path addClip];
|
||||
[[NSColor colorWithWhite:0.0 alpha:0.6] set];
|
||||
[path stroke];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setHorizontalGrids:(NSArray *)horizontalGrids
|
||||
@ -56,6 +85,12 @@
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setDisplayScrollRect:(bool)displayScrollRect
|
||||
{
|
||||
self->_displayScrollRect = displayScrollRect;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)updateTrackingAreas
|
||||
{
|
||||
if(trackingArea != nil) {
|
||||
|
Loading…
Reference in New Issue
Block a user