Console output is now configurable in the Cocoa port as "Developer Mode"
This commit is contained in:
parent
d580a33a7f
commit
c97033b81c
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||||
|
|
||||||
|
- (IBAction)toggleDeveloperMode:(id)sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -6,12 +6,19 @@
|
|||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
- (IBAction)toggleDeveloperMode:(id)sender {
|
||||||
// Insert code here to initialize your application
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults setBool:![defaults boolForKey:@"DeveloperMode"] forKey:@"DeveloperMode"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
- (BOOL)validateMenuItem:(NSMenuItem *)anItem
|
||||||
// Insert code here to tear down your application
|
{
|
||||||
|
if ([anItem action] == @selector(toggleDeveloperMode:)) {
|
||||||
|
[(NSMenuItem*)anItem setState:[[NSUserDefaults standardUserDefaults] boolForKey:@"DeveloperMode"]];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <CoreAudio/CoreAudio.h>
|
#include <CoreAudio/CoreAudio.h>
|
||||||
#include "AudioClient.h"
|
#include "AudioClient.h"
|
||||||
#import "Document.h"
|
#include "Document.h"
|
||||||
|
#include "AppDelegate.h"
|
||||||
#include "gb.h"
|
#include "gb.h"
|
||||||
|
|
||||||
@interface Document ()
|
@interface Document ()
|
||||||
@ -234,15 +235,20 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, unsigned char r, unsigned char g, un
|
|||||||
if([anItem action] == @selector(mute:)) {
|
if([anItem action] == @selector(mute:)) {
|
||||||
[(NSMenuItem*)anItem setState:!self.audioClient.isPlaying];
|
[(NSMenuItem*)anItem setState:!self.audioClient.isPlaying];
|
||||||
}
|
}
|
||||||
if ([anItem action] == @selector(togglePause:)) {
|
else if ([anItem action] == @selector(togglePause:)) {
|
||||||
[(NSMenuItem*)anItem setState:!running];
|
[(NSMenuItem*)anItem setState:!running];
|
||||||
}
|
}
|
||||||
if ([anItem action] == @selector(reset:) && anItem.tag != 0) {
|
else if ([anItem action] == @selector(reset:) && anItem.tag != 0) {
|
||||||
[(NSMenuItem*)anItem setState:(anItem.tag == 1 && !gb.is_cgb) || (anItem.tag == 2 && gb.is_cgb)];
|
[(NSMenuItem*)anItem setState:(anItem.tag == 1 && !gb.is_cgb) || (anItem.tag == 2 && gb.is_cgb)];
|
||||||
}
|
}
|
||||||
if([anItem action] == @selector(toggleBlend:)) {
|
else if ([anItem action] == @selector(toggleBlend:)) {
|
||||||
[(NSMenuItem*)anItem setState:self.view.shouldBlendFrameWithPrevious];
|
[(NSMenuItem*)anItem setState:self.view.shouldBlendFrameWithPrevious];
|
||||||
}
|
}
|
||||||
|
else if ([anItem action] == @selector(interrupt:)) {
|
||||||
|
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"DeveloperMode"]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return [super validateUserInterfaceItem:anItem];
|
return [super validateUserInterfaceItem:anItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +313,9 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, unsigned char r, unsigned char g, un
|
|||||||
[self log:"[...]\n"];
|
[self log:"[...]\n"];
|
||||||
}
|
}
|
||||||
[self.consoleOutput scrollToEndOfDocument:nil];
|
[self.consoleOutput scrollToEndOfDocument:nil];
|
||||||
[self.consoleWindow orderBack:nil];
|
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DeveloperMode"]) {
|
||||||
|
[self.consoleWindow orderBack:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pendingLogLines--;
|
pendingLogLines--;
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1509" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||||
@ -342,6 +342,13 @@
|
|||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<menu key="submenu" title="Developer" id="UVb-cc-at0">
|
<menu key="submenu" title="Developer" id="UVb-cc-at0">
|
||||||
<items>
|
<items>
|
||||||
|
<menuItem title="Developer Mode" id="Qx6-Tt-zZR">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="toggleDeveloperMode:" target="Voe-Tx-rLC" id="PIc-o3-bzb"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="66c-T0-8pW"/>
|
||||||
<menuItem title="Show Console" id="Wse-UY-Y9l">
|
<menuItem title="Show Console" id="Wse-UY-Y9l">
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<connections>
|
<connections>
|
||||||
@ -353,6 +360,7 @@
|
|||||||
<action selector="clearConsole:" target="-1" id="1UW-8J-Uwl"/>
|
<action selector="clearConsole:" target="-1" id="1UW-8J-Uwl"/>
|
||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="3If-Yf-U7B"/>
|
||||||
<menuItem title="Break Debugger" keyEquivalent="c" id="uBD-GY-Doi">
|
<menuItem title="Break Debugger" keyEquivalent="c" id="uBD-GY-Doi">
|
||||||
<modifierMask key="keyEquivalentModifierMask" control="YES"/>
|
<modifierMask key="keyEquivalentModifierMask" control="YES"/>
|
||||||
<connections>
|
<connections>
|
||||||
|
Loading…
Reference in New Issue
Block a user