Launcher now the initial window

This commit is contained in:
Akop Karapetyan 2019-12-01 21:04:29 -08:00 committed by tmaul
parent 7c0c671f2e
commit 8a0eab0b30
8 changed files with 82 additions and 38 deletions

View File

@ -10,6 +10,7 @@
FE0A7E9723938CE7001E6997 /* FBLauncherController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE0A7E9523938CE6001E6997 /* FBLauncherController.m */; };
FE0A7E9A23938E9F001E6997 /* Launcher.xib in Resources */ = {isa = PBXBuildFile; fileRef = FE0A7E9823938E9F001E6997 /* Launcher.xib */; };
FE0A7E9D2393A1FF001E6997 /* FBScanner.mm in Sources */ = {isa = PBXBuildFile; fileRef = FE0A7E9C2393A1FE001E6997 /* FBScanner.mm */; };
FE0A7EA12394B87B001E6997 /* FBRomSetStatusAsNSImage.m in Sources */ = {isa = PBXBuildFile; fileRef = FE0A7E9F2394B87B001E6997 /* FBRomSetStatusAsNSImage.m */; };
FE1B1092235615940065200C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FE1B1091235615940065200C /* AppDelegate.m */; };
FE1B1094235615950065200C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FE1B1093235615950065200C /* Assets.xcassets */; };
FE1B1097235615950065200C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = FE1B1095235615950065200C /* MainMenu.xib */; };
@ -1044,6 +1045,8 @@
FE0A7E9923938E9F001E6997 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/Launcher.xib; sourceTree = "<group>"; };
FE0A7E9B2393A1FE001E6997 /* FBScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBScanner.h; sourceTree = "<group>"; };
FE0A7E9C2393A1FE001E6997 /* FBScanner.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FBScanner.mm; sourceTree = "<group>"; };
FE0A7E9F2394B87B001E6997 /* FBRomSetStatusAsNSImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBRomSetStatusAsNSImage.m; sourceTree = "<group>"; };
FE0A7EA02394B87B001E6997 /* FBRomSetStatusAsNSImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBRomSetStatusAsNSImage.h; sourceTree = "<group>"; };
FE1B108D235615940065200C /* FinalBurn Neo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FinalBurn Neo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
FE1B1090235615940065200C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
FE1B1091235615940065200C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@ -2553,6 +2556,15 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
FE0A7E9E2394B87B001E6997 /* Views */ = {
isa = PBXGroup;
children = (
FE0A7EA02394B87B001E6997 /* FBRomSetStatusAsNSImage.h */,
FE0A7E9F2394B87B001E6997 /* FBRomSetStatusAsNSImage.m */,
);
path = Views;
sourceTree = "<group>";
};
FE1B1084235615940065200C = {
isa = PBXGroup;
children = (
@ -2578,6 +2590,7 @@
children = (
FE2BC6BD2362BF9200B9D150 /* Nibs */,
FE2BC6AF23615BBC00B9D150 /* Controllers */,
FE0A7E9E2394B87B001E6997 /* Views */,
FE1B1090235615940065200C /* AppDelegate.h */,
FE1B1091235615940065200C /* AppDelegate.m */,
FE1B1093235615950065200C /* Assets.xcassets */,
@ -5217,6 +5230,7 @@
FE1B264C23561A770065200C /* taito_m68705.cpp in Sources */,
FE1B263C23561A770065200C /* ps_z.cpp in Sources */,
FE1B261923561A770065200C /* d_wardner.cpp in Sources */,
FE0A7EA12394B87B001E6997 /* FBRomSetStatusAsNSImage.m in Sources */,
FE1B24C823561A750065200C /* d_esprade.cpp in Sources */,
FE1B25F823561A760065200C /* d_wunit.cpp in Sources */,
FE1B26F923561A780065200C /* d_quizo.cpp in Sources */,

View File

@ -81,8 +81,9 @@ static AppDelegate *sharedInstance = nil;
- (void) applicationDidFinishLaunching:(NSNotification *) aNotification {
NSLog(@"applicationDidFinishLaunching");
launcher = [FBLauncherController new];
emulator = [FBEmulatorController new];
[emulator showWindow:self];
[launcher showWindow:self];
[_runloop start];
}
@ -148,6 +149,8 @@ static AppDelegate *sharedInstance = nil;
{
[_runloop load:path];
[NSDocumentController.sharedDocumentController noteNewRecentDocumentURL:[NSURL fileURLWithPath:path]];
[emulator showWindow:self];
}
- (void) suppressScreenSaver

View File

@ -47,12 +47,15 @@
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="dxk-DU-Pc5">
<font key="font" metaFont="menu" size="11"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<imageCell key="dataCell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="37K-uV-JwN"/>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
<binding destination="IZb-g9-uEr" name="value" keyPath="arrangedObjects.status" id="D1U-05-p70">
<dictionary key="options">
<string key="NSValueTransformerName">FBRomSetStatusAsNSImage</string>
</dictionary>
</binding>
</connections>
</tableColumn>
<tableColumn editable="NO" width="116" minWidth="40" maxWidth="1000" id="SfF-mw-sk3">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Name">
@ -112,21 +115,6 @@
</scrollView>
</subviews>
</view>
<toolbar key="toolbar" implicitIdentifier="45801F3E-846E-4D62-9F9C-403E0D3C379B" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="regular" id="9cL-0S-sWb">
<allowedToolbarItems>
<toolbarItem implicitItemIdentifier="NSToolbarShowColorsItem" id="rRr-0R-A7H"/>
<toolbarItem implicitItemIdentifier="NSToolbarShowFontsItem" id="B2k-1t-iyn"/>
<toolbarItem implicitItemIdentifier="NSToolbarPrintItem" id="gMd-QL-JPh"/>
<toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="p3s-o2-ixw"/>
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="ZKR-9D-uds"/>
</allowedToolbarItems>
<defaultToolbarItems>
<toolbarItem reference="rRr-0R-A7H"/>
<toolbarItem reference="B2k-1t-iyn"/>
<toolbarItem reference="ZKR-9D-uds"/>
<toolbarItem reference="gMd-QL-JPh"/>
</defaultToolbarItems>
</toolbar>
<connections>
<outlet property="delegate" destination="-2" id="uIo-I6-8Np"/>
</connections>

View File

@ -110,21 +110,6 @@
[self.appDelegate restoreScreenSaver];
}
- (void) windowWillClose:(NSNotification *) notification
{
NSLog(@"windowWillClose");
for (NSString *key in defaultsToObserve)
[NSUserDefaults.standardUserDefaults removeObserver:self
forKeyPath:key
context:NULL];
NSLog(@"Emulator window closed; shutting down");
if (NSApplication.sharedApplication.isRunning)
dispatch_async(dispatch_get_main_queue(), ^{
[NSApplication.sharedApplication terminate:nil];
});
}
- (NSSize) windowWillResize:(NSWindow *) sender
toSize:(NSSize) frameSize
{

View File

@ -135,11 +135,14 @@
- (void) launchSet:(id) sender
{
FBLauncherItem *item = romSetTreeController.selectedObjects.lastObject;
if (!item || item.status != FBROMSET_STATUS_OK)
if (!item || item.status == FBROMSET_STATUS_UNPLAYABLE)
return;
// FIXME: hack!
// Ask emulator to load a (possibly) non-existent file
// The loader doesn't really care whether the file exists - it only
// uses the set's path and file name to determine which set to load
// and from where.
NSString *file = [item.name stringByAppendingPathExtension:@"zip"];
[self.appDelegate loadPath:[self.appDelegate.romPath stringByAppendingPathComponent:file]];
}

View File

@ -0,0 +1,13 @@
//
// FBRomSetStatusAsNSImage.h
// FinalBurnNeo
//
// Created by Akop Karapetyan on 12/01/19.
// Copyright © 2019 Akop Karapetyan. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface FBRomSetStatusAsNSImage : NSValueTransformer
@end

View File

@ -0,0 +1,37 @@
//
// FBRomSetStatusAsNSImage.m
// FinalBurnNeo
//
// Created by Akop Karapetyan on 12/01/19.
// Copyright © 2019 Akop Karapetyan. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "FBRomSetStatusAsNSImage.h"
#import "FBScanner.h"
@implementation FBRomSetStatusAsNSImage
+ (Class) transformedValueClass
{
return [NSImage class];
}
+ (BOOL) allowsReverseTransformation
{
return NO;
}
- (id) transformedValue:(id) value
{
switch ([value integerValue]) {
case FBROMSET_STATUS_OK:
case 1:
return [NSImage imageNamed:@"NSStatusAvailable"];
default:
return [NSImage imageNamed:@"NSStatusNone"];
}
}
@end

View File

@ -8,7 +8,8 @@
#import <Foundation/Foundation.h>
#define FBROMSET_STATUS_OK 0
#define FBROMSET_STATUS_OK 0
#define FBROMSET_STATUS_UNPLAYABLE 2
@interface FBROMSet: NSObject<NSCoding>