Added spinner
This commit is contained in:
parent
de30f6a28d
commit
a389178a5d
|
@ -17,6 +17,7 @@
|
||||||
@interface AppDelegate : NSObject <NSApplicationDelegate, FBScreenViewDelegate, FBMainThreadDelegate>
|
@interface AppDelegate : NSObject <NSApplicationDelegate, FBScreenViewDelegate, FBMainThreadDelegate>
|
||||||
{
|
{
|
||||||
IBOutlet FBScreenView *screen;
|
IBOutlet FBScreenView *screen;
|
||||||
|
IBOutlet NSView *spinner;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (AppDelegate *) sharedInstance;
|
+ (AppDelegate *) sharedInstance;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// FIXME: errors during load
|
// FIXME: errors during load
|
||||||
// FIXME: starting without ROM selected
|
// FIXME: starting without ROM selected
|
||||||
// FIXME: dropping file into window
|
// FIXME: dropping file into window
|
||||||
// FIXME: sound when load fails
|
// FIXME: focus on visibility toggle
|
||||||
@interface AppDelegate ()
|
@interface AppDelegate ()
|
||||||
|
|
||||||
@property (weak) IBOutlet NSWindow *window;
|
@property (weak) IBOutlet NSWindow *window;
|
||||||
|
@ -27,6 +27,7 @@ static AppDelegate *sharedInstance = nil;
|
||||||
{
|
{
|
||||||
FBMainThread *main;
|
FBMainThread *main;
|
||||||
BOOL _cursorVisible;
|
BOOL _cursorVisible;
|
||||||
|
NSTitlebarAccessoryViewController *tbAccessory;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
@ -39,14 +40,19 @@ static AppDelegate *sharedInstance = nil;
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
sharedInstance = self;
|
sharedInstance = self;
|
||||||
_video = [FBVideo new];
|
|
||||||
_input = [FBInput new];
|
|
||||||
main = [FBMainThread new];
|
|
||||||
|
|
||||||
|
_input = [FBInput new];
|
||||||
_cursorVisible = YES;
|
_cursorVisible = YES;
|
||||||
|
|
||||||
|
tbAccessory = [NSTitlebarAccessoryViewController new];
|
||||||
|
tbAccessory.view = spinner;
|
||||||
|
tbAccessory.layoutAttribute = NSLayoutAttributeRight;
|
||||||
|
|
||||||
|
main = [FBMainThread new];
|
||||||
main.delegate = self;
|
main.delegate = self;
|
||||||
screen.delegate = self;
|
_video = [FBVideo new];
|
||||||
_video.delegate = screen;
|
_video.delegate = screen;
|
||||||
|
screen.delegate = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
|
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||||
|
@ -138,11 +144,26 @@ static AppDelegate *sharedInstance = nil;
|
||||||
if (screenSize.width != 0 && screenSize.height != 0)
|
if (screenSize.width != 0 && screenSize.height != 0)
|
||||||
[self resizeFrame:NSMakeSize(screenSize.width * 2, screenSize.height * 2)
|
[self resizeFrame:NSMakeSize(screenSize.width * 2, screenSize.height * 2)
|
||||||
animate:NO];
|
animate:NO];
|
||||||
|
|
||||||
|
screen.hidden = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) gameSessionDidEnd
|
- (void) gameSessionDidEnd
|
||||||
{
|
{
|
||||||
NSLog(@"gameSessionDidEnd");
|
NSLog(@"gameSessionDidEnd");
|
||||||
|
screen.hidden = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) driverInitDidStart
|
||||||
|
{
|
||||||
|
[spinner.subviews.firstObject startAnimation:self];
|
||||||
|
[_window addTitlebarAccessoryViewController:tbAccessory];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) driverInitDidEnd:(BOOL) success
|
||||||
|
{
|
||||||
|
[spinner.subviews.firstObject stopAnimation:self];
|
||||||
|
[tbAccessory removeFromParentViewController];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Actions
|
#pragma mark - Actions
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
|
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="screen" destination="Jj9-3G-U07" id="7Fv-Ip-Vmf"/>
|
<outlet property="screen" destination="Jj9-3G-U07" id="7Fv-Ip-Vmf"/>
|
||||||
|
<outlet property="spinner" destination="LUr-2W-WhR" id="BLW-Aq-ioS"/>
|
||||||
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
|
@ -181,5 +182,16 @@
|
||||||
</connections>
|
</connections>
|
||||||
<point key="canvasLocation" x="131" y="-153"/>
|
<point key="canvasLocation" x="131" y="-153"/>
|
||||||
</window>
|
</window>
|
||||||
|
<customView id="LUr-2W-WhR">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="24" height="16"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<progressIndicator wantsLayer="YES" fixedFrame="YES" maxValue="100" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="XS4-h5-AoQ">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||||
|
</progressIndicator>
|
||||||
|
</subviews>
|
||||||
|
<point key="canvasLocation" x="66" y="-511"/>
|
||||||
|
</customView>
|
||||||
</objects>
|
</objects>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
@protocol FBMainThreadDelegate<NSObject>
|
@protocol FBMainThreadDelegate<NSObject>
|
||||||
|
|
||||||
- (void) gameSessionDidStart: (NSString *) name;
|
- (void) driverInitDidStart;
|
||||||
|
- (void) driverInitDidEnd:(BOOL) success;
|
||||||
|
- (void) gameSessionDidStart:(NSString *) name;
|
||||||
- (void) gameSessionDidEnd;
|
- (void) gameSessionDidEnd;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -44,9 +44,24 @@ extern int MainEnd();
|
||||||
NSString *setPath = [[pathToLoad stringByDeletingLastPathComponent] stringByAppendingString:@"/"];
|
NSString *setPath = [[pathToLoad stringByDeletingLastPathComponent] stringByAppendingString:@"/"];
|
||||||
NSString *setName = [[pathToLoad lastPathComponent] stringByDeletingPathExtension];
|
NSString *setName = [[pathToLoad lastPathComponent] stringByDeletingPathExtension];
|
||||||
|
|
||||||
|
{
|
||||||
|
id<FBMainThreadDelegate> del = _delegate;
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[del driverInitDidStart];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!MainInit([setPath cStringUsingEncoding:NSUTF8StringEncoding],
|
if (!MainInit([setPath cStringUsingEncoding:NSUTF8StringEncoding],
|
||||||
[setName cStringUsingEncoding:NSUTF8StringEncoding])) {
|
[setName cStringUsingEncoding:NSUTF8StringEncoding])) {
|
||||||
pathToLoad = nil;
|
pathToLoad = nil;
|
||||||
|
|
||||||
|
{
|
||||||
|
id<FBMainThreadDelegate> del = _delegate;
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[del driverInitDidEnd:NO];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +71,7 @@ extern int MainEnd();
|
||||||
{
|
{
|
||||||
id<FBMainThreadDelegate> del = _delegate;
|
id<FBMainThreadDelegate> del = _delegate;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[del driverInitDidEnd:YES];
|
||||||
[del gameSessionDidStart:setName];
|
[del gameSessionDidStart:setName];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,10 @@ int MainInit(const char *path, const char *setname)
|
||||||
}
|
}
|
||||||
|
|
||||||
bCheatsAllowed = false;
|
bCheatsAllowed = false;
|
||||||
|
|
||||||
sprintf(szAppRomPaths[0], path);
|
sprintf(szAppRomPaths[0], path);
|
||||||
DrvInit(i, 0);
|
|
||||||
|
if (DrvInit(i, 0))
|
||||||
|
return 0;
|
||||||
|
|
||||||
MediaInit();
|
MediaInit();
|
||||||
RunInit();
|
RunInit();
|
||||||
|
|
Loading…
Reference in New Issue