Backport cocoa updates from trunk up to r3993
Thanks again Rogerman!
This commit is contained in:
parent
6b9d89e6b6
commit
a09686238d
File diff suppressed because it is too large
Load Diff
|
@ -14,10 +14,26 @@
|
||||||
<key>CFBundleTypeIconFile</key>
|
<key>CFBundleTypeIconFile</key>
|
||||||
<string>DeSmuME</string>
|
<string>DeSmuME</string>
|
||||||
<key>CFBundleTypeName</key>
|
<key>CFBundleTypeName</key>
|
||||||
<string>Nintendo DS Software</string>
|
<string>Nintendo DS ROM</string>
|
||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Viewer</string>
|
<string>Viewer</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>dst</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>DeSmuME</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>DeSmuME Save State</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LSTypeIsPackage</key>
|
||||||
|
<false/>
|
||||||
|
<key>NSPersistentStoreTypeKey</key>
|
||||||
|
<string>Binary</string>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>DeSmuME</string>
|
<string>DeSmuME</string>
|
||||||
|
@ -32,11 +48,11 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.9.3</string>
|
<string>0.9.7</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>DSmM</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.9.3</string>
|
<string>0.9.7</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
|
|
Binary file not shown.
|
@ -19,6 +19,20 @@
|
||||||
|
|
||||||
#import "globals.h"
|
#import "globals.h"
|
||||||
|
|
||||||
|
#define STRING_DESMUME_WEBSITE "http://www.desmume.org"
|
||||||
|
#define STRING_DESMUME_FORUM_SITE "http://forums.desmume.org/index.php"
|
||||||
|
#define STRING_DESMUME_BUG_SITE "http://sourceforge.net/tracker/?group_id=164579&atid=832291"
|
||||||
|
|
||||||
|
#define STRING_FILENAME_README "README"
|
||||||
|
#define STRING_FILENAME_COPYING "COPYING"
|
||||||
|
#define STRING_FILENAME_AUTHORS "AUTHORS"
|
||||||
|
#define STRING_FILENAME_CHANGELOG "ChangeLog"
|
||||||
|
|
||||||
|
#define STRING_TABLABEL_README "Read Me"
|
||||||
|
#define STRING_TABLABEL_LICENSE "License"
|
||||||
|
#define STRING_TABLABEL_AUTHORS "Authors"
|
||||||
|
#define STRING_TABLABEL_CHANGELOG "Change Log"
|
||||||
|
|
||||||
const CGFloat inner_padding = 3;
|
const CGFloat inner_padding = 3;
|
||||||
const CGFloat outer_padding = 3;
|
const CGFloat outer_padding = 3;
|
||||||
const CGFloat tab_view_height = 240;
|
const CGFloat tab_view_height = 240;
|
||||||
|
@ -36,6 +50,8 @@ NSTextField *about_website;
|
||||||
}
|
}
|
||||||
- (void)windowDidResize:(NSNotification*)notification;
|
- (void)windowDidResize:(NSNotification*)notification;
|
||||||
- (void)windowWillClose:(NSNotification*)notification;
|
- (void)windowWillClose:(NSNotification*)notification;
|
||||||
|
|
||||||
|
+ (void) readTextFile:(NSString *)dataPath label:(NSString *)labelName tab:(NSTabView *)tabView;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AboutDelegate
|
@implementation AboutDelegate
|
||||||
|
@ -77,23 +93,52 @@ NSTextField *about_website;
|
||||||
//end our modal session if the about window closses
|
//end our modal session if the about window closses
|
||||||
[NSApp stopModal];
|
[NSApp stopModal];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void) readTextFile:(NSString *)dataPath label:(NSString *)labelName tab:(NSTabView *)tabView
|
||||||
|
{
|
||||||
|
NSRect rect;
|
||||||
|
rect.origin.x = rect.origin.y = 0;
|
||||||
|
|
||||||
|
NSTabViewItem *tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
|
||||||
|
[tab_view_item setLabel:labelName];
|
||||||
|
[tabView addTabViewItem:tab_view_item];
|
||||||
|
|
||||||
|
NSScrollView *scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
|
||||||
|
[scroll_view setDrawsBackground:NO];
|
||||||
|
[scroll_view setHasVerticalScroller:YES];
|
||||||
|
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
||||||
|
[tab_view_item setView:scroll_view];
|
||||||
|
|
||||||
|
rect.size = [[scroll_view contentView] frame].size;
|
||||||
|
NSTextView *text_view = [[NSTextView alloc] initWithFrame:rect];
|
||||||
|
[text_view insertText:[NSString stringWithContentsOfFile:dataPath encoding:NSASCIIStringEncoding error:NULL]];
|
||||||
|
[text_view setDrawsBackground:NO];
|
||||||
|
[text_view setEditable:NO];
|
||||||
|
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
||||||
|
[scroll_view setDocumentView:text_view];
|
||||||
|
[text_view release];
|
||||||
|
|
||||||
|
[scroll_view release];
|
||||||
|
|
||||||
|
[tab_view_item release];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSApplication (helpmenu)
|
@implementation NSApplication (helpmenu)
|
||||||
|
|
||||||
- (void)launchWebsite
|
- (void)launchWebsite
|
||||||
{
|
{
|
||||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://desmume.sourceforge.net"]];
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_WEBSITE]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)launchForums
|
- (void)launchForums
|
||||||
{
|
{
|
||||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://forums.desmume.org/index.php"]];
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_FORUM_SITE]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)bugReport
|
- (void)bugReport
|
||||||
{
|
{
|
||||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://sourceforge.net/tracker/?func=add&group_id=164579&atid=832291"]];
|
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_BUG_SITE]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -201,7 +246,7 @@ NSTextField *about_website;
|
||||||
|
|
||||||
//
|
//
|
||||||
about_website = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 8 + tab_view_height + inner_padding, width, 17)];
|
about_website = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 8 + tab_view_height + inner_padding, width, 17)];
|
||||||
[about_website setStringValue:@"http://www.desmume.org"];//fixme linkize
|
[about_website setStringValue:@STRING_DESMUME_WEBSITE];//fixme linkize
|
||||||
[about_website setEditable:NO];
|
[about_website setEditable:NO];
|
||||||
[about_website setDrawsBackground:NO];
|
[about_website setDrawsBackground:NO];
|
||||||
[about_website setBordered:NO];
|
[about_website setBordered:NO];
|
||||||
|
@ -222,125 +267,32 @@ NSTextField *about_website;
|
||||||
[tab_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
[tab_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
||||||
[[about_window contentView] addSubview:tab_view];
|
[[about_window contentView] addSubview:tab_view];
|
||||||
|
|
||||||
NSRect rect;
|
|
||||||
rect.origin.x = rect.origin.y = 0;
|
|
||||||
|
|
||||||
//fixme if one of the files we read from is missing the entire panel doesn't show
|
|
||||||
|
|
||||||
NSTabViewItem *tab_view_item;
|
|
||||||
NSScrollView *scroll_view;
|
|
||||||
NSTextView *text_view;
|
|
||||||
|
|
||||||
//README
|
//README
|
||||||
NSString *datapath = [main_bundle pathForResource:@"README" ofType:@""];
|
NSString *datapath = [main_bundle pathForResource:@STRING_FILENAME_README ofType:@""];
|
||||||
if(datapath != nil)
|
if(datapath != nil)
|
||||||
{
|
{
|
||||||
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
|
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_README, nil) tab:tab_view];
|
||||||
[tab_view_item setLabel:NSLocalizedString(@"Readme", nil)];
|
|
||||||
[tab_view addTabViewItem:tab_view_item];
|
|
||||||
|
|
||||||
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
|
|
||||||
[scroll_view setDrawsBackground:NO];
|
|
||||||
[scroll_view setHasVerticalScroller:YES];
|
|
||||||
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[tab_view_item setView:scroll_view];
|
|
||||||
|
|
||||||
rect.size = [[scroll_view contentView] frame].size;
|
|
||||||
text_view = [[NSTextView alloc] initWithFrame:rect];
|
|
||||||
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
|
|
||||||
[text_view setDrawsBackground:NO];
|
|
||||||
[text_view setEditable:NO];
|
|
||||||
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[scroll_view setDocumentView:text_view];
|
|
||||||
[text_view release];
|
|
||||||
|
|
||||||
[scroll_view release];
|
|
||||||
|
|
||||||
[tab_view_item release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//LICENSE
|
//LICENSE
|
||||||
datapath = [main_bundle pathForResource:@"COPYING" ofType:@""];
|
datapath = [main_bundle pathForResource:@STRING_FILENAME_COPYING ofType:@""];
|
||||||
if(datapath != nil)
|
if(datapath != nil)
|
||||||
{
|
{
|
||||||
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
|
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_LICENSE, nil) tab:tab_view];
|
||||||
[tab_view_item setLabel:NSLocalizedString(@"License", nil)];
|
|
||||||
[tab_view addTabViewItem:tab_view_item];
|
|
||||||
|
|
||||||
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
|
|
||||||
[scroll_view setDrawsBackground:NO];
|
|
||||||
[scroll_view setHasVerticalScroller:YES];
|
|
||||||
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[tab_view_item setView:scroll_view];
|
|
||||||
|
|
||||||
rect.size = [[scroll_view contentView] frame].size;
|
|
||||||
text_view = [[NSTextView alloc] initWithFrame:rect];
|
|
||||||
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
|
|
||||||
[text_view setDrawsBackground:NO];
|
|
||||||
[text_view setEditable:NO];
|
|
||||||
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[scroll_view setDocumentView:text_view];
|
|
||||||
[text_view release];
|
|
||||||
|
|
||||||
[scroll_view release];
|
|
||||||
|
|
||||||
[tab_view_item release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//AUTHORS
|
//AUTHORS
|
||||||
datapath = [main_bundle pathForResource:@"AUTHORS" ofType:@""];
|
datapath = [main_bundle pathForResource:@STRING_FILENAME_AUTHORS ofType:@""];
|
||||||
if(datapath != nil)
|
if(datapath != nil)
|
||||||
{
|
{
|
||||||
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
|
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_AUTHORS, nil) tab:tab_view];
|
||||||
[tab_view_item setLabel:NSLocalizedString(@"Authors", nil)];
|
|
||||||
[tab_view addTabViewItem:tab_view_item];
|
|
||||||
|
|
||||||
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
|
|
||||||
[scroll_view setDrawsBackground:NO];
|
|
||||||
[scroll_view setHasVerticalScroller:YES];
|
|
||||||
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[tab_view_item setView:scroll_view];
|
|
||||||
|
|
||||||
rect.size = [[scroll_view contentView] frame].size;
|
|
||||||
text_view = [[NSTextView alloc] initWithFrame:rect];
|
|
||||||
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
|
|
||||||
[text_view setDrawsBackground:NO];
|
|
||||||
[text_view setEditable:NO];
|
|
||||||
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[scroll_view setDocumentView:text_view];
|
|
||||||
[text_view release];
|
|
||||||
|
|
||||||
[scroll_view release];
|
|
||||||
|
|
||||||
[tab_view_item release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//CHANGE LOG
|
//CHANGE LOG
|
||||||
datapath = [main_bundle pathForResource:@"ChangeLog" ofType:@""];
|
datapath = [main_bundle pathForResource:@STRING_FILENAME_CHANGELOG ofType:@""];
|
||||||
if(datapath != nil)
|
if(datapath != nil)
|
||||||
{
|
{
|
||||||
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
|
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_CHANGELOG, nil) tab:tab_view];
|
||||||
[tab_view_item setLabel:NSLocalizedString(@"Change Log", nil)];
|
|
||||||
[tab_view addTabViewItem:tab_view_item];
|
|
||||||
|
|
||||||
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
|
|
||||||
[scroll_view setDrawsBackground:NO];
|
|
||||||
[scroll_view setHasVerticalScroller:YES];
|
|
||||||
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[tab_view_item setView:scroll_view];
|
|
||||||
|
|
||||||
rect.size = [[scroll_view contentView] frame].size;
|
|
||||||
text_view = [[NSTextView alloc] initWithFrame:rect];
|
|
||||||
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
|
|
||||||
[text_view setDrawsBackground:NO];
|
|
||||||
[text_view setEditable:NO];
|
|
||||||
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
||||||
[scroll_view setDocumentView:text_view];
|
|
||||||
[text_view release];
|
|
||||||
|
|
||||||
[scroll_view release];
|
|
||||||
|
|
||||||
[tab_view_item release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -350,7 +302,7 @@ NSTextField *about_website;
|
||||||
[tab_view release];
|
[tab_view release];
|
||||||
|
|
||||||
//show the window
|
//show the window
|
||||||
rect = [about_window frame];
|
NSRect rect = [about_window frame];
|
||||||
if(rect.size.width < content_min_width + outer_padding*2)
|
if(rect.size.width < content_min_width + outer_padding*2)
|
||||||
rect.size.width = content_min_width + outer_padding*2;
|
rect.size.width = content_min_width + outer_padding*2;
|
||||||
[about_window setFrame:rect display:NO];
|
[about_window setFrame:rect display:NO];
|
||||||
|
|
|
@ -58,3 +58,110 @@ NSString* openDialog(NSArray *file_types)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CreateAppDirectory(NSString *directoryName)
|
||||||
|
{
|
||||||
|
BOOL result = NO;
|
||||||
|
BOOL isDir = YES;
|
||||||
|
|
||||||
|
NSString *tempPath = nil;
|
||||||
|
NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
|
||||||
|
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
|
||||||
|
|
||||||
|
NSArray *savePaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||||
|
if ([savePaths count] > 0)
|
||||||
|
{
|
||||||
|
tempPath = [savePaths objectAtIndex:0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||||
|
|
||||||
|
/*
|
||||||
|
Mac OS X v10.4 only
|
||||||
|
|
||||||
|
Code for creating new directories based on NSString paths.
|
||||||
|
*/
|
||||||
|
tempPath = [[tempPath stringByAppendingString:@"/"] stringByAppendingString:appName];
|
||||||
|
result = [fileManager createDirectoryAtPath:tempPath attributes:nil];
|
||||||
|
if (result == NO)
|
||||||
|
{
|
||||||
|
if([fileManager fileExistsAtPath:tempPath isDirectory:&isDir] == NO)
|
||||||
|
{
|
||||||
|
[fileManager release];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tempPath = [[tempPath stringByAppendingString:@"/"] stringByAppendingString:appVersion];
|
||||||
|
result = [fileManager createDirectoryAtPath:tempPath attributes:nil];
|
||||||
|
if (result == NO)
|
||||||
|
{
|
||||||
|
if([fileManager fileExistsAtPath:tempPath isDirectory:&isDir] == NO)
|
||||||
|
{
|
||||||
|
[fileManager release];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (directoryName != nil)
|
||||||
|
{
|
||||||
|
tempPath = [[tempPath stringByAppendingString:@"/"] stringByAppendingString:directoryName];
|
||||||
|
result = [fileManager createDirectoryAtPath:tempPath attributes:nil];
|
||||||
|
if (result == NO)
|
||||||
|
{
|
||||||
|
if([fileManager fileExistsAtPath:tempPath isDirectory:&isDir] == NO)
|
||||||
|
{
|
||||||
|
[fileManager release];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
In Mac OS X v10.4, having the File Manager create new directories where they already exist
|
||||||
|
returns NO. Note that this behavior is not per Apple's own documentation. Therefore, we manually
|
||||||
|
set result=YES at the end to make sure the function returns the right result.
|
||||||
|
*/
|
||||||
|
result = YES;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Mac OS X v10.5 and later
|
||||||
|
|
||||||
|
Yes, it's that simple...
|
||||||
|
*/
|
||||||
|
//result = [fileManager createDirectoryAtPath:savePath createIntermediates:YES attributes:nil error:NULL];
|
||||||
|
|
||||||
|
[fileManager release];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString* GetPathUserAppSupport(NSString *directoryName)
|
||||||
|
{
|
||||||
|
NSString *userAppSupportPath = nil;
|
||||||
|
NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
|
||||||
|
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
|
||||||
|
|
||||||
|
NSArray *savePaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||||
|
if ([savePaths count] > 0)
|
||||||
|
{
|
||||||
|
userAppSupportPath = [savePaths objectAtIndex:0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return userAppSupportPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (directoryName == nil)
|
||||||
|
{
|
||||||
|
userAppSupportPath = [[[[userAppSupportPath stringByAppendingString:@"/"] stringByAppendingString:appName] stringByAppendingString:@"/"] stringByAppendingString:appVersion];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
userAppSupportPath = [[[[[[userAppSupportPath stringByAppendingString:@"/"] stringByAppendingString:appName] stringByAppendingString:@"/"] stringByAppendingString:appVersion] stringByAppendingString:@"/"] stringByAppendingString:directoryName];
|
||||||
|
}
|
||||||
|
|
||||||
|
return userAppSupportPath;
|
||||||
|
}
|
|
@ -27,6 +27,8 @@ extern "C"
|
||||||
void messageDialog(NSString *title, NSString *text);
|
void messageDialog(NSString *title, NSString *text);
|
||||||
BOOL messageDialogYN(NSString *title, NSString *text);
|
BOOL messageDialogYN(NSString *title, NSString *text);
|
||||||
NSString* openDialog(NSArray *file_types);
|
NSString* openDialog(NSArray *file_types);
|
||||||
|
BOOL CreateAppDirectory(NSString *directoryName);
|
||||||
|
NSString* GetPathUserAppSupport(NSString *directoryName);
|
||||||
|
|
||||||
//
|
//
|
||||||
#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
|
#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
|
||||||
|
@ -34,7 +36,15 @@ typedef int NSInteger;
|
||||||
typedef unsigned int NSUInteger;
|
typedef unsigned int NSUInteger;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Taken from CIVector.h of the Mac OS X 10.5 SDK.
|
||||||
|
// Defines CGFloat for Mac OS X 10.4 and earlier.
|
||||||
|
#ifndef CGFLOAT_DEFINED
|
||||||
typedef float CGFloat;
|
typedef float CGFloat;
|
||||||
|
# define CGFLOAT_MIN FLT_MIN
|
||||||
|
# define CGFLOAT_MAX FLT_MAX
|
||||||
|
# define CGFLOAT_IS_DOUBLE 0
|
||||||
|
# define CGFLOAT_DEFINED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@class VideoOutputWindow;
|
@class VideoOutputWindow;
|
||||||
|
@class CocoaDSController;
|
||||||
|
|
||||||
@interface InputHandler : NSResponder
|
@interface InputHandler : NSResponder
|
||||||
{
|
{
|
||||||
@private
|
@private
|
||||||
VideoOutputWindow *my_ds;
|
VideoOutputWindow *my_ds;
|
||||||
|
CocoaDSController *dsController;
|
||||||
}
|
}
|
||||||
//preferences
|
//preferences
|
||||||
+ (NSView*)createPreferencesView:(float)width;
|
+ (NSView*)createPreferencesView:(float)width;
|
||||||
|
|
|
@ -166,12 +166,14 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
|
||||||
my_ds = nds;
|
my_ds = nds;
|
||||||
[my_ds retain];
|
[my_ds retain];
|
||||||
|
|
||||||
|
dsController = [nds getDSController];
|
||||||
|
[dsController retain];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[my_ds release];
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,18 +184,18 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
|
||||||
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
|
||||||
NSString *chars = [event characters];
|
NSString *chars = [event characters];
|
||||||
|
|
||||||
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[my_ds pressA];
|
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[dsController pressA];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[my_ds pressB];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[dsController pressB];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[my_ds pressSelect];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[dsController pressSelect];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[my_ds pressStart];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[dsController pressStart];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[my_ds pressRight];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[dsController pressRight];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[my_ds pressLeft];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[dsController pressLeft];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[my_ds pressUp];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[dsController pressUp];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[my_ds pressDown];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[dsController pressDown];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[my_ds pressR];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[dsController pressR];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[my_ds pressL];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[dsController pressL];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[my_ds pressX];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[dsController pressX];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[my_ds pressY];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[dsController pressY];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyUp:(NSEvent*)event
|
- (void)keyUp:(NSEvent*)event
|
||||||
|
@ -201,24 +203,28 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
|
||||||
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
|
||||||
NSString *chars = [event characters];
|
NSString *chars = [event characters];
|
||||||
|
|
||||||
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[my_ds liftA];
|
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[dsController liftA];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[my_ds liftB];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[dsController liftB];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[my_ds liftSelect];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[dsController liftSelect];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[my_ds liftStart];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[dsController liftStart];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[my_ds liftRight];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[dsController liftRight];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[my_ds liftLeft];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[dsController liftLeft];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[my_ds liftUp];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[dsController liftUp];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[my_ds liftDown];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[dsController liftDown];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[my_ds liftR];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[dsController liftR];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[my_ds liftL];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[dsController liftL];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[my_ds liftX];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[dsController liftX];
|
||||||
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[my_ds liftY];
|
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[dsController liftY];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent*)event
|
- (void)mouseDown:(NSEvent*)event
|
||||||
{
|
{
|
||||||
NSPoint temp = [my_ds windowPointToDSCoords:[event locationInWindow]];
|
NSPoint temp = [my_ds windowPointToDSCoords:[event locationInWindow]];
|
||||||
if(temp.x >= 0 && temp.y>=0)[my_ds touch:temp];
|
|
||||||
|
if(temp.x >= 0 && temp.y>=0)
|
||||||
|
{
|
||||||
|
[dsController touch:temp];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDragged:(NSEvent*)event
|
- (void)mouseDragged:(NSEvent*)event
|
||||||
|
@ -228,7 +234,7 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
|
||||||
|
|
||||||
- (void)mouseUp:(NSEvent*)event
|
- (void)mouseUp:(NSEvent*)event
|
||||||
{
|
{
|
||||||
[my_ds releaseTouch];
|
[dsController releaseTouch];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -56,10 +56,12 @@ extern NSMenuItem *topBG0_item;
|
||||||
extern NSMenuItem *topBG1_item;
|
extern NSMenuItem *topBG1_item;
|
||||||
extern NSMenuItem *topBG2_item;
|
extern NSMenuItem *topBG2_item;
|
||||||
extern NSMenuItem *topBG3_item;
|
extern NSMenuItem *topBG3_item;
|
||||||
|
extern NSMenuItem *topOBJ_item;
|
||||||
extern NSMenuItem *subBG0_item;
|
extern NSMenuItem *subBG0_item;
|
||||||
extern NSMenuItem *subBG1_item;
|
extern NSMenuItem *subBG1_item;
|
||||||
extern NSMenuItem *subBG2_item;
|
extern NSMenuItem *subBG2_item;
|
||||||
extern NSMenuItem *subBG3_item;
|
extern NSMenuItem *subBG3_item;
|
||||||
|
extern NSMenuItem *subOBJ_item;
|
||||||
|
|
||||||
extern NSMenuItem *screenshot_to_file_item;
|
extern NSMenuItem *screenshot_to_file_item;
|
||||||
extern NSMenuItem *screenshot_to_window_item;
|
extern NSMenuItem *screenshot_to_window_item;
|
||||||
|
@ -235,7 +237,8 @@ void CreateMenu(AppDelegate *delegate)
|
||||||
[emulation_menu addItem:[NSMenuItem separatorItem]];
|
[emulation_menu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
//Frake skip menu
|
//Frake skip menu
|
||||||
|
// Disabling frame skipping for now since it doesn't yield any significant speed improvements. -rogerman 03/28/2011
|
||||||
|
/*
|
||||||
temp = [emulation_menu addItemWithTitle:NSLocalizedString(@"Frame Skip", nil) action:nil keyEquivalent:@""];
|
temp = [emulation_menu addItemWithTitle:NSLocalizedString(@"Frame Skip", nil) action:nil keyEquivalent:@""];
|
||||||
|
|
||||||
NSMenu *frame_skip_menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Frame Skip", nil)];
|
NSMenu *frame_skip_menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Frame Skip", nil)];
|
||||||
|
@ -256,7 +259,7 @@ void CreateMenu(AppDelegate *delegate)
|
||||||
|
|
||||||
[frame_skip_menu release];
|
[frame_skip_menu release];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//Speed limit menu
|
//Speed limit menu
|
||||||
|
|
||||||
temp = [emulation_menu addItemWithTitle:NSLocalizedString(@"Speed Limit", nil) action:nil keyEquivalent:@""];
|
temp = [emulation_menu addItemWithTitle:NSLocalizedString(@"Speed Limit", nil) action:nil keyEquivalent:@""];
|
||||||
|
@ -366,6 +369,7 @@ void CreateMenu(AppDelegate *delegate)
|
||||||
topBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG1", nil) action:@selector(toggleTopBackground1) keyEquivalent:@""];
|
topBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG1", nil) action:@selector(toggleTopBackground1) keyEquivalent:@""];
|
||||||
topBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG2", nil) action:@selector(toggleTopBackground2) keyEquivalent:@""];
|
topBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG2", nil) action:@selector(toggleTopBackground2) keyEquivalent:@""];
|
||||||
topBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG3", nil) action:@selector(toggleTopBackground3) keyEquivalent:@""];
|
topBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG3", nil) action:@selector(toggleTopBackground3) keyEquivalent:@""];
|
||||||
|
topOBJ_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top OBJ", nil) action:@selector(toggleTopObject) keyEquivalent:@""];
|
||||||
|
|
||||||
[layer_menu addItem:[NSMenuItem separatorItem]];
|
[layer_menu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
|
@ -373,6 +377,7 @@ void CreateMenu(AppDelegate *delegate)
|
||||||
subBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG1", nil) action:@selector(toggleSubBackground1) keyEquivalent:@""];
|
subBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG1", nil) action:@selector(toggleSubBackground1) keyEquivalent:@""];
|
||||||
subBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG2", nil) action:@selector(toggleSubBackground2) keyEquivalent:@""];
|
subBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG2", nil) action:@selector(toggleSubBackground2) keyEquivalent:@""];
|
||||||
subBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG3", nil) action:@selector(toggleSubBackground3) keyEquivalent:@""];
|
subBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG3", nil) action:@selector(toggleSubBackground3) keyEquivalent:@""];
|
||||||
|
subOBJ_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub OBJ", nil) action:@selector(toggleSubObject) keyEquivalent:@""];
|
||||||
|
|
||||||
[layer_menu release];
|
[layer_menu release];
|
||||||
}
|
}
|
||||||
|
@ -496,6 +501,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
[panel setCanChooseDirectories:NO];
|
[panel setCanChooseDirectories:NO];
|
||||||
[panel setCanChooseFiles:YES];
|
[panel setCanChooseFiles:YES];
|
||||||
|
[panel setResolvesAliases:YES];
|
||||||
[panel setAllowsMultipleSelection:NO];
|
[panel setAllowsMultipleSelection:NO];
|
||||||
|
|
||||||
[panel setTitle:NSLocalizedString(@"Open ROM...", nil)];
|
[panel setTitle:NSLocalizedString(@"Open ROM...", nil)];
|
||||||
|
@ -545,12 +551,20 @@ int main(int argc, char *argv[])
|
||||||
- (void)application:(NSApplication*)sender openFiles:(NSArray*)filenames
|
- (void)application:(NSApplication*)sender openFiles:(NSArray*)filenames
|
||||||
{
|
{
|
||||||
//verify everything
|
//verify everything
|
||||||
if(sender != NSApp)goto fail;
|
if(sender != NSApp ||
|
||||||
if(!filenames)goto fail;
|
filenames == nil ||
|
||||||
if([filenames count] == 0)goto fail;
|
[filenames count] == 0)
|
||||||
|
{
|
||||||
|
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NSString *filename = [filenames lastObject];
|
NSString *filename = [filenames lastObject];
|
||||||
if(!filename)goto fail;
|
if(!filename || [filename length] == 0)
|
||||||
if([filename length] == 0)goto fail;
|
{
|
||||||
|
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if([main_window loadROM:filename])
|
if([main_window loadROM:filename])
|
||||||
{
|
{
|
||||||
|
@ -558,9 +572,6 @@ int main(int argc, char *argv[])
|
||||||
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
|
||||||
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillFinishLaunching:(NSNotification*)notification
|
- (void)applicationWillFinishLaunching:(NSNotification*)notification
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
|
|
||||||
bool no_smaller_than_ds;
|
bool no_smaller_than_ds;
|
||||||
bool keep_proportions;
|
bool keep_proportions;
|
||||||
|
|
||||||
|
NSString *pathLoadedRom;
|
||||||
}
|
}
|
||||||
|
|
||||||
//initialization
|
//initialization
|
||||||
|
@ -102,10 +104,12 @@
|
||||||
- (void)toggleTopBackground1;
|
- (void)toggleTopBackground1;
|
||||||
- (void)toggleTopBackground2;
|
- (void)toggleTopBackground2;
|
||||||
- (void)toggleTopBackground3;
|
- (void)toggleTopBackground3;
|
||||||
|
- (void)toggleTopObject;
|
||||||
- (void)toggleSubBackground0;
|
- (void)toggleSubBackground0;
|
||||||
- (void)toggleSubBackground1;
|
- (void)toggleSubBackground1;
|
||||||
- (void)toggleSubBackground2;
|
- (void)toggleSubBackground2;
|
||||||
- (void)toggleSubBackground3;
|
- (void)toggleSubBackground3;
|
||||||
|
- (void)toggleSubObject;
|
||||||
|
|
||||||
//screenshots
|
//screenshots
|
||||||
- (void)saveScreenshot;
|
- (void)saveScreenshot;
|
||||||
|
@ -113,4 +117,7 @@
|
||||||
//delegate
|
//delegate
|
||||||
- (void)windowDidBecomeMain:(NSNotification*)notification;
|
- (void)windowDidBecomeMain:(NSNotification*)notification;
|
||||||
|
|
||||||
|
- (BOOL)saveStateExistsInSlot:(int)slot;
|
||||||
|
- (NSString*) getSaveSlotFileName:(unsigned int)slotNumber;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -88,10 +88,12 @@ NSMenuItem *topBG0_item = nil;
|
||||||
NSMenuItem *topBG1_item = nil;
|
NSMenuItem *topBG1_item = nil;
|
||||||
NSMenuItem *topBG2_item = nil;
|
NSMenuItem *topBG2_item = nil;
|
||||||
NSMenuItem *topBG3_item = nil;
|
NSMenuItem *topBG3_item = nil;
|
||||||
|
NSMenuItem *topOBJ_item = nil;
|
||||||
NSMenuItem *subBG0_item = nil;
|
NSMenuItem *subBG0_item = nil;
|
||||||
NSMenuItem *subBG1_item = nil;
|
NSMenuItem *subBG1_item = nil;
|
||||||
NSMenuItem *subBG2_item = nil;
|
NSMenuItem *subBG2_item = nil;
|
||||||
NSMenuItem *subBG3_item = nil;
|
NSMenuItem *subBG3_item = nil;
|
||||||
|
NSMenuItem *subOBJ_item = nil;
|
||||||
NSMenuItem *screenshot_to_file_item = nil;
|
NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
@implementation VideoOutputWindow
|
@implementation VideoOutputWindow
|
||||||
|
@ -233,6 +235,8 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
[window setNextResponder:input];
|
[window setNextResponder:input];
|
||||||
[input setNextResponder:temp];
|
[input setNextResponder:temp];
|
||||||
|
|
||||||
|
pathLoadedRom = nil;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +248,7 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
[status_view release];
|
[status_view release];
|
||||||
[status_bar_text release];
|
[status_bar_text release];
|
||||||
[input release];
|
[input release];
|
||||||
|
[pathLoadedRom release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -275,6 +280,9 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
//update the rom info window, if needed
|
//update the rom info window, if needed
|
||||||
[ROMInfo changeDS:self];
|
[ROMInfo changeDS:self];
|
||||||
|
|
||||||
|
pathLoadedRom = filename;
|
||||||
|
[pathLoadedRom retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
//reset menu items
|
//reset menu items
|
||||||
|
@ -283,7 +291,7 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < MAX_SLOTS; i++)
|
for(i = 0; i < MAX_SLOTS; i++)
|
||||||
if([saveSlot_item[i] target] == self)
|
if([saveSlot_item[i] target] == self)
|
||||||
if([self saveStateExists:i] == YES)
|
if([self saveStateExistsInSlot:i] == YES)
|
||||||
[saveSlot_item[i] setState:NSOnState];
|
[saveSlot_item[i] setState:NSOnState];
|
||||||
else
|
else
|
||||||
[saveSlot_item[i] setState:NSOffState];
|
[saveSlot_item[i] setState:NSOffState];
|
||||||
|
@ -343,7 +351,7 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
- (void)setFrameSkip:(int)frameskip
|
- (void)setFrameSkip:(int)frameskip
|
||||||
{
|
{
|
||||||
[super setFrameSkip:frameskip];
|
[super setFrameSkip:frameskip];
|
||||||
frameskip = [super frameSkip];
|
frameskip = dsStateBuffer->frame_skip;
|
||||||
|
|
||||||
if([frame_skip_auto_item target] == self)
|
if([frame_skip_auto_item target] == self)
|
||||||
if(frameskip < 0)
|
if(frameskip < 0)
|
||||||
|
@ -385,7 +393,8 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
[super setSpeedLimit:speedLimit];
|
[super setSpeedLimit:speedLimit];
|
||||||
|
|
||||||
//Set the correct menu states
|
//Set the correct menu states
|
||||||
speedLimit = [super speedLimit];
|
speedLimit = dsStateBuffer->speed_limit;
|
||||||
|
|
||||||
int standard_size = 0;
|
int standard_size = 0;
|
||||||
|
|
||||||
if([speed_limit_25_item target] == self)
|
if([speed_limit_25_item target] == self)
|
||||||
|
@ -511,23 +520,65 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (BOOL)saveStateToSlot:(int)slot
|
- (BOOL)saveStateToSlot:(int)slot
|
||||||
{
|
{
|
||||||
if([super saveStateToSlot:slot] == YES)
|
BOOL result = NO;
|
||||||
|
int i = slot;
|
||||||
|
|
||||||
|
NSString *savePath = GetPathUserAppSupport(@"States");
|
||||||
|
if (savePath == nil)
|
||||||
{
|
{
|
||||||
if([saveSlot_item[slot] target] == self);
|
// Throw an error message here...
|
||||||
[saveSlot_item[slot] setState:NSOnState];
|
return result;
|
||||||
|
|
||||||
//if([clear_all_saves_item target] == self);
|
|
||||||
//[clear_all_saves_item setEnabled:YES];
|
|
||||||
|
|
||||||
return YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
result = CreateAppDirectory(@"States");
|
||||||
|
if (result == NO)
|
||||||
|
{
|
||||||
|
// Should throw an error message here...
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *fileName = [self getSaveSlotFileName:slot];
|
||||||
|
if (fileName == nil)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *fullFilePath = [[savePath stringByAppendingString:@"/"] stringByAppendingString:fileName];
|
||||||
|
result = [self saveState:fullFilePath];
|
||||||
|
if(result)
|
||||||
|
{
|
||||||
|
if([saveSlot_item[i] target] == self);
|
||||||
|
{
|
||||||
|
[saveSlot_item[i] setState:NSOnState];
|
||||||
|
}
|
||||||
|
|
||||||
|
result = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)loadStateFromSlot:(int)slot
|
- (BOOL)loadStateFromSlot:(int)slot
|
||||||
{
|
{
|
||||||
return [super loadStateFromSlot:slot];
|
BOOL result = NO;
|
||||||
|
|
||||||
|
NSString *savePath = GetPathUserAppSupport(@"States");
|
||||||
|
if (savePath == nil)
|
||||||
|
{
|
||||||
|
// Should throw an error message here...
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *fileName = [self getSaveSlotFileName:slot];
|
||||||
|
if (fileName == nil)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *fullFilePath = [[savePath stringByAppendingString:@"/"] stringByAppendingString:fileName];
|
||||||
|
result = [self loadState:fullFilePath];
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)saveStateAs
|
- (BOOL)saveStateAs
|
||||||
|
@ -666,32 +717,47 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (NSPoint)windowPointToDSCoords:(NSPoint)location
|
- (NSPoint)windowPointToDSCoords:(NSPoint)location
|
||||||
{
|
{
|
||||||
if(video_output_view == nil)return NSMakePoint(-1, -1);
|
CGFloat rotation;
|
||||||
|
NSSize temp;
|
||||||
|
float statusBarHeight;
|
||||||
|
|
||||||
NSSize temp = [[window contentView] frame].size;
|
if(video_output_view == nil)
|
||||||
|
{
|
||||||
|
return NSMakePoint(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
rotation = [video_output_view boundsRotation];
|
||||||
|
statusBarHeight = [self statusBarHeight];
|
||||||
|
|
||||||
|
temp = [[window contentView] frame].size;
|
||||||
CGFloat x_size = temp.width - WINDOW_BORDER_PADDING*2;
|
CGFloat x_size = temp.width - WINDOW_BORDER_PADDING*2;
|
||||||
CGFloat y_size = temp.height - [self statusBarHeight];
|
CGFloat y_size = temp.height - statusBarHeight;
|
||||||
|
|
||||||
//If the click was to the left or under the opengl view, exit
|
//If the click was to the left or under the opengl view, exit
|
||||||
if((location.x < WINDOW_BORDER_PADDING) || (location.y < [self statusBarHeight]))
|
if((location.x < WINDOW_BORDER_PADDING) || (location.y < statusBarHeight))
|
||||||
|
{
|
||||||
return NSMakePoint(-1, -1);
|
return NSMakePoint(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
location.x -= WINDOW_BORDER_PADDING;
|
location.x -= WINDOW_BORDER_PADDING;
|
||||||
location.y -= [self statusBarHeight];
|
location.y -= statusBarHeight;
|
||||||
|
|
||||||
//If the click was top or right of the view...
|
//If the click was top or right of the view...
|
||||||
if(location.x >= x_size)return NSMakePoint(-1, -1);
|
if(location.x >= x_size)
|
||||||
if(location.y >= y_size)return NSMakePoint(-1, -1);
|
{
|
||||||
|
return NSMakePoint(-1, -1);
|
||||||
|
}
|
||||||
|
if(location.y >= y_size)
|
||||||
|
{
|
||||||
|
return NSMakePoint(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
if([video_output_view boundsRotation] == 0 || [video_output_view boundsRotation] == -180)
|
if(rotation == 0)
|
||||||
{
|
{
|
||||||
if([video_output_view boundsRotation] == -180)
|
if(location.y >= y_size / 2)
|
||||||
{
|
{
|
||||||
if(location.y < y_size / 2)return NSMakePoint(-1, -1);
|
return NSMakePoint(-1, -1);
|
||||||
location.x = x_size - location.x;
|
}
|
||||||
location.y = y_size - location.y;
|
|
||||||
} else
|
|
||||||
if(location.y >= y_size / 2)return NSMakePoint(-1, -1);
|
|
||||||
|
|
||||||
//scale the coordinates
|
//scale the coordinates
|
||||||
location.x *= ((float)DS_SCREEN_WIDTH) / ((float)x_size);
|
location.x *= ((float)DS_SCREEN_WIDTH) / ((float)x_size);
|
||||||
|
@ -699,20 +765,48 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
//invert the y
|
//invert the y
|
||||||
location.y = DS_SCREEN_HEIGHT - location.y - 1;
|
location.y = DS_SCREEN_HEIGHT - location.y - 1;
|
||||||
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
|
|
||||||
if([video_output_view boundsRotation] == -270)
|
|
||||||
{
|
|
||||||
if(location.x < x_size / 2)return NSMakePoint(-1, -1);
|
|
||||||
location.x = x_size - location.x;
|
|
||||||
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
if(location.x >= x_size / 2)return NSMakePoint(-1, -1);
|
|
||||||
location.y = y_size - location.y;
|
|
||||||
}
|
}
|
||||||
|
else if(rotation = -90)
|
||||||
|
{
|
||||||
|
if(location.x >= x_size / 2)
|
||||||
|
{
|
||||||
|
return NSMakePoint(-1, -1);
|
||||||
|
}
|
||||||
|
location.y = y_size - location.y;
|
||||||
|
|
||||||
|
location.x *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)x_size);
|
||||||
|
location.y *= ((float)DS_SCREEN_WIDTH) / ((float)y_size);
|
||||||
|
|
||||||
|
//invert the y
|
||||||
|
location.x = DS_SCREEN_HEIGHT - location.x - 1;
|
||||||
|
|
||||||
|
float temp = location.x;
|
||||||
|
location.x = location.y;
|
||||||
|
location.y = temp;
|
||||||
|
}
|
||||||
|
else if(rotation = -180)
|
||||||
|
{
|
||||||
|
if(location.y < y_size / 2)
|
||||||
|
{
|
||||||
|
return NSMakePoint(-1, -1);
|
||||||
|
}
|
||||||
|
location.x = x_size - location.x;
|
||||||
|
location.y = y_size - location.y;
|
||||||
|
|
||||||
|
//scale the coordinates
|
||||||
|
location.x *= ((float)DS_SCREEN_WIDTH) / ((float)x_size);
|
||||||
|
location.y *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)y_size);
|
||||||
|
|
||||||
|
//invert the y
|
||||||
|
location.y = DS_SCREEN_HEIGHT - location.y - 1;
|
||||||
|
}
|
||||||
|
else if(rotation = -270)
|
||||||
|
{
|
||||||
|
if(location.x < x_size / 2)
|
||||||
|
{
|
||||||
|
return NSMakePoint(-1, -1);
|
||||||
|
}
|
||||||
|
location.x = x_size - location.x;
|
||||||
|
|
||||||
location.x *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)x_size);
|
location.x *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)x_size);
|
||||||
location.y *= ((float)DS_SCREEN_WIDTH) / ((float)y_size);
|
location.y *= ((float)DS_SCREEN_WIDTH) / ((float)y_size);
|
||||||
|
@ -874,10 +968,10 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (void)toggleTopBackground0
|
- (void)toggleTopBackground0
|
||||||
{
|
{
|
||||||
[super toggleTopBackground0];
|
[self toggleSubScreenLayer:0];
|
||||||
|
|
||||||
if([topBG0_item target] == self)
|
if([topBG0_item target] == self)
|
||||||
if([super showingTopBackground0] == NO)
|
if([self isSubScreenLayerDisplayed:0] == NO)
|
||||||
[topBG0_item setState:NSOffState];
|
[topBG0_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[topBG0_item setState:NSOnState];
|
[topBG0_item setState:NSOnState];
|
||||||
|
@ -885,10 +979,10 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (void)toggleTopBackground1
|
- (void)toggleTopBackground1
|
||||||
{
|
{
|
||||||
[super toggleTopBackground1];
|
[self toggleSubScreenLayer:1];
|
||||||
|
|
||||||
if([topBG1_item target] == self)
|
if([topBG1_item target] == self)
|
||||||
if([super showingTopBackground1] == NO)
|
if([self isSubScreenLayerDisplayed:1] == NO)
|
||||||
[topBG1_item setState:NSOffState];
|
[topBG1_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[topBG1_item setState:NSOnState];
|
[topBG1_item setState:NSOnState];
|
||||||
|
@ -896,10 +990,10 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (void)toggleTopBackground2
|
- (void)toggleTopBackground2
|
||||||
{
|
{
|
||||||
[super toggleTopBackground2];
|
[self toggleSubScreenLayer:2];
|
||||||
|
|
||||||
if([topBG2_item target] == self)
|
if([topBG2_item target] == self)
|
||||||
if([super showingTopBackground2] == NO)
|
if([self isSubScreenLayerDisplayed:2] == NO)
|
||||||
[topBG2_item setState:NSOffState];
|
[topBG2_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[topBG2_item setState:NSOnState];
|
[topBG2_item setState:NSOnState];
|
||||||
|
@ -907,21 +1001,32 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (void)toggleTopBackground3
|
- (void)toggleTopBackground3
|
||||||
{
|
{
|
||||||
[super toggleTopBackground3];
|
[self toggleSubScreenLayer:3];
|
||||||
|
|
||||||
if([topBG3_item target] == self)
|
if([topBG3_item target] == self)
|
||||||
if([super showingTopBackground3] == NO)
|
if([self isSubScreenLayerDisplayed:3] == NO)
|
||||||
[topBG3_item setState:NSOffState];
|
[topBG3_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[topBG3_item setState:NSOnState];
|
[topBG3_item setState:NSOnState];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)toggleTopObject
|
||||||
|
{
|
||||||
|
[self toggleSubScreenLayer:4];
|
||||||
|
|
||||||
|
if([topOBJ_item target] == self)
|
||||||
|
if([self isSubScreenLayerDisplayed:4] == NO)
|
||||||
|
[topOBJ_item setState:NSOffState];
|
||||||
|
else
|
||||||
|
[topOBJ_item setState:NSOnState];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)toggleSubBackground0
|
- (void)toggleSubBackground0
|
||||||
{
|
{
|
||||||
[super toggleSubBackground0];
|
[self toggleMainScreenLayer:0];
|
||||||
|
|
||||||
if([subBG0_item target] == self)
|
if([subBG0_item target] == self)
|
||||||
if([super showingSubBackground0] == NO)
|
if([self isMainScreenLayerDisplayed:0] == NO)
|
||||||
[subBG0_item setState:NSOffState];
|
[subBG0_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[subBG0_item setState:NSOnState];
|
[subBG0_item setState:NSOnState];
|
||||||
|
@ -929,10 +1034,10 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (void)toggleSubBackground1
|
- (void)toggleSubBackground1
|
||||||
{
|
{
|
||||||
[super toggleSubBackground1];
|
[self toggleMainScreenLayer:1];
|
||||||
|
|
||||||
if([subBG1_item target] == self)
|
if([subBG1_item target] == self)
|
||||||
if([super showingSubBackground1] == NO)
|
if([self isMainScreenLayerDisplayed:1] == NO)
|
||||||
[subBG1_item setState:NSOffState];
|
[subBG1_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[subBG1_item setState:NSOnState];
|
[subBG1_item setState:NSOnState];
|
||||||
|
@ -940,10 +1045,10 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (void)toggleSubBackground2
|
- (void)toggleSubBackground2
|
||||||
{
|
{
|
||||||
[super toggleSubBackground2];
|
[self toggleMainScreenLayer:2];
|
||||||
|
|
||||||
if([subBG2_item target] == self)
|
if([subBG2_item target] == self)
|
||||||
if([super showingSubBackground2] == NO)
|
if([self isMainScreenLayerDisplayed:2] == NO)
|
||||||
[subBG2_item setState:NSOffState];
|
[subBG2_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[subBG2_item setState:NSOnState];
|
[subBG2_item setState:NSOnState];
|
||||||
|
@ -951,15 +1056,26 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
|
|
||||||
- (void)toggleSubBackground3
|
- (void)toggleSubBackground3
|
||||||
{
|
{
|
||||||
[super toggleSubBackground3];
|
[self toggleMainScreenLayer:3];
|
||||||
|
|
||||||
if([subBG3_item target] == self)
|
if([subBG3_item target] == self)
|
||||||
if([super showingSubBackground3] == NO)
|
if([self isMainScreenLayerDisplayed:3] == NO)
|
||||||
[subBG3_item setState:NSOffState];
|
[subBG3_item setState:NSOffState];
|
||||||
else
|
else
|
||||||
[subBG3_item setState:NSOnState];
|
[subBG3_item setState:NSOnState];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)toggleSubObject
|
||||||
|
{
|
||||||
|
[self toggleMainScreenLayer:4];
|
||||||
|
|
||||||
|
if([subOBJ_item target] == self)
|
||||||
|
if([self isMainScreenLayerDisplayed:4] == NO)
|
||||||
|
[subOBJ_item setState:NSOffState];
|
||||||
|
else
|
||||||
|
[subOBJ_item setState:NSOnState];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)saveScreenshot
|
- (void)saveScreenshot
|
||||||
{//todo: this should work even if video_output_view doesn't exist
|
{//todo: this should work even if video_output_view doesn't exist
|
||||||
BOOL executing = [self executing];
|
BOOL executing = [self executing];
|
||||||
|
@ -1145,7 +1261,7 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
[saveSlot_item[i] setTarget:self];
|
[saveSlot_item[i] setTarget:self];
|
||||||
[loadSlot_item[i] setTarget:self];
|
[loadSlot_item[i] setTarget:self];
|
||||||
|
|
||||||
if([self saveStateExists:i] == YES)
|
if([self saveStateExistsInSlot:i] == YES)
|
||||||
{
|
{
|
||||||
[saveSlot_item[i] setState:NSOnState];
|
[saveSlot_item[i] setState:NSOnState];
|
||||||
} else
|
} else
|
||||||
|
@ -1211,10 +1327,12 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
[topBG1_item setTarget:self];
|
[topBG1_item setTarget:self];
|
||||||
[topBG2_item setTarget:self];
|
[topBG2_item setTarget:self];
|
||||||
[topBG3_item setTarget:self];
|
[topBG3_item setTarget:self];
|
||||||
|
[topOBJ_item setTarget:self];
|
||||||
[subBG0_item setTarget:self];
|
[subBG0_item setTarget:self];
|
||||||
[subBG1_item setTarget:self];
|
[subBG1_item setTarget:self];
|
||||||
[subBG2_item setTarget:self];
|
[subBG2_item setTarget:self];
|
||||||
[subBG3_item setTarget:self];
|
[subBG3_item setTarget:self];
|
||||||
|
[subOBJ_item setTarget:self];
|
||||||
[screenshot_to_file_item setTarget:self];
|
[screenshot_to_file_item setTarget:self];
|
||||||
|
|
||||||
//set checks for view window based on the options of this window
|
//set checks for view window based on the options of this window
|
||||||
|
@ -1222,39 +1340,57 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
[constrain_item setState:keep_proportions?NSOnState:NSOffState];
|
[constrain_item setState:keep_proportions?NSOnState:NSOffState];
|
||||||
[min_size_item setState:no_smaller_than_ds?NSOnState:NSOffState];
|
[min_size_item setState:no_smaller_than_ds?NSOnState:NSOffState];
|
||||||
[toggle_status_bar_item setState:(status_view!=nil)?NSOnState:NSOffState];
|
[toggle_status_bar_item setState:(status_view!=nil)?NSOnState:NSOffState];
|
||||||
if([self showingTopBackground0])
|
|
||||||
|
if([self isSubScreenLayerDisplayed:0] == YES)
|
||||||
[topBG0_item setState:NSOnState];
|
[topBG0_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[topBG0_item setState:NSOffState];
|
[topBG0_item setState:NSOffState];
|
||||||
if([self showingTopBackground1])
|
|
||||||
|
if([self isSubScreenLayerDisplayed:1] == YES)
|
||||||
[topBG1_item setState:NSOnState];
|
[topBG1_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[topBG1_item setState:NSOffState];
|
[topBG1_item setState:NSOffState];
|
||||||
if([self showingTopBackground2])
|
|
||||||
|
if([self isSubScreenLayerDisplayed:2] == YES)
|
||||||
[topBG2_item setState:NSOnState];
|
[topBG2_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[topBG2_item setState:NSOffState];
|
[topBG2_item setState:NSOffState];
|
||||||
if([self showingTopBackground3])
|
|
||||||
|
if([self isSubScreenLayerDisplayed:3] == YES)
|
||||||
[topBG3_item setState:NSOnState];
|
[topBG3_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[topBG3_item setState:NSOffState];
|
[topBG3_item setState:NSOffState];
|
||||||
if([self showingSubBackground0])
|
|
||||||
|
if([self isSubScreenLayerDisplayed:4] == YES)
|
||||||
|
[topOBJ_item setState:NSOnState];
|
||||||
|
else
|
||||||
|
[topOBJ_item setState:NSOffState];
|
||||||
|
|
||||||
|
if([self isMainScreenLayerDisplayed:0] == YES)
|
||||||
[subBG0_item setState:NSOnState];
|
[subBG0_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[subBG0_item setState:NSOffState];
|
[subBG0_item setState:NSOffState];
|
||||||
if([self showingSubBackground1])
|
|
||||||
|
if([self isMainScreenLayerDisplayed:1] == YES)
|
||||||
[subBG1_item setState:NSOnState];
|
[subBG1_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[subBG1_item setState:NSOffState];
|
[subBG1_item setState:NSOffState];
|
||||||
if([self showingSubBackground2])
|
|
||||||
|
if([self isMainScreenLayerDisplayed:2] == YES)
|
||||||
[subBG2_item setState:NSOnState];
|
[subBG2_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[subBG2_item setState:NSOffState];
|
[subBG2_item setState:NSOffState];
|
||||||
if([self showingSubBackground3])
|
|
||||||
|
if([self isMainScreenLayerDisplayed:3] == YES)
|
||||||
[subBG3_item setState:NSOnState];
|
[subBG3_item setState:NSOnState];
|
||||||
else
|
else
|
||||||
[subBG3_item setState:NSOffState];
|
[subBG3_item setState:NSOffState];
|
||||||
|
|
||||||
|
if([self isMainScreenLayerDisplayed:4] == YES)
|
||||||
|
[subOBJ_item setState:NSOnState];
|
||||||
|
else
|
||||||
|
[subOBJ_item setState:NSOffState];
|
||||||
|
|
||||||
[self setRotation:[self rotation]];
|
[self setRotation:[self rotation]];
|
||||||
|
|
||||||
//SOUND Menu
|
//SOUND Menu
|
||||||
|
@ -1315,7 +1451,7 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
else
|
else
|
||||||
for(i = 0; i < MAX_SLOTS; i++)
|
for(i = 0; i < MAX_SLOTS; i++)
|
||||||
if(item == loadSlot_item[i])
|
if(item == loadSlot_item[i])
|
||||||
if([self saveStateExists:i]==NO)return NO;
|
if([self saveStateExistsInSlot:i] == NO)return NO;
|
||||||
|
|
||||||
if(video_output_view == nil)
|
if(video_output_view == nil)
|
||||||
{
|
{
|
||||||
|
@ -1340,4 +1476,33 @@ NSMenuItem *screenshot_to_file_item = nil;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)saveStateExistsInSlot:(int)slot
|
||||||
|
{
|
||||||
|
BOOL exists = false;
|
||||||
|
|
||||||
|
NSString *searchPath = GetPathUserAppSupport(@"States");
|
||||||
|
NSString *searchFileName = [self getSaveSlotFileName:slot];
|
||||||
|
|
||||||
|
if (searchPath == nil || searchFileName == nil)
|
||||||
|
{
|
||||||
|
return exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||||
|
NSString *searchFullPath = [[searchPath stringByAppendingString:@"/"] stringByAppendingString:searchFileName];
|
||||||
|
|
||||||
|
exists = [fileManager isReadableFileAtPath:searchFullPath];
|
||||||
|
|
||||||
|
[fileManager release];
|
||||||
|
|
||||||
|
return exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*) getSaveSlotFileName:(unsigned int)slotNumber
|
||||||
|
{
|
||||||
|
NSString *fileExtension = [NSString stringWithFormat:@".ds%d", slotNumber];
|
||||||
|
|
||||||
|
return [[[pathLoadedRom lastPathComponent] stringByDeletingPathExtension] stringByAppendingString:fileExtension];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "globals.h"
|
#import "globals.h"
|
||||||
|
#import "cocoa_input.h"
|
||||||
|
|
||||||
@class ScreenState;
|
@class ScreenState;
|
||||||
|
|
||||||
|
@ -29,6 +30,17 @@
|
||||||
#define MAX_SLOTS 10
|
#define MAX_SLOTS 10
|
||||||
#define MAX_FRAME_SKIP 10
|
#define MAX_FRAME_SKIP 10
|
||||||
|
|
||||||
|
@interface CocoaDSStateBuffer : NSObject
|
||||||
|
{
|
||||||
|
@public
|
||||||
|
int frame_skip;
|
||||||
|
int speed_limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) init;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
//This class is a compelte objective-c wrapper for
|
//This class is a compelte objective-c wrapper for
|
||||||
//the core emulation features, other objective-c code inherit
|
//the core emulation features, other objective-c code inherit
|
||||||
//upon or instanciate this to add interfaces for these features
|
//upon or instanciate this to add interfaces for these features
|
||||||
|
@ -66,6 +78,11 @@
|
||||||
NSString *current_file;
|
NSString *current_file;
|
||||||
NSString *flash_file;
|
NSString *flash_file;
|
||||||
|
|
||||||
|
bool doesConfigNeedUpdate;
|
||||||
|
NSTimeInterval calcTimeBudget;
|
||||||
|
|
||||||
|
CocoaDSController *dsController;
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
NSInteger arm9_gdb_port;
|
NSInteger arm9_gdb_port;
|
||||||
NSInteger arm7_gdb_port;
|
NSInteger arm7_gdb_port;
|
||||||
|
@ -74,6 +91,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned char gpu_buff[256 * 256 * 5]; //this is where the 3D rendering of the NDS is stored
|
unsigned char gpu_buff[256 * 256 * 5]; //this is where the 3D rendering of the NDS is stored
|
||||||
|
|
||||||
|
@public
|
||||||
|
CocoaDSStateBuffer *dsStateBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Instanciating, setup, and deconstruction
|
//Instanciating, setup, and deconstruction
|
||||||
|
@ -82,6 +102,9 @@
|
||||||
- (void)setErrorCallback:(SEL)callback withObject:(id)object;
|
- (void)setErrorCallback:(SEL)callback withObject:(id)object;
|
||||||
- (void)dealloc;
|
- (void)dealloc;
|
||||||
|
|
||||||
|
// Data accessors
|
||||||
|
- (CocoaDSController*) getDSController;
|
||||||
|
|
||||||
//Firmware control
|
//Firmware control
|
||||||
- (void)setPlayerName:(NSString*)player_name;
|
- (void)setPlayerName:(NSString*)player_name;
|
||||||
|
|
||||||
|
@ -116,73 +139,19 @@
|
||||||
- (int)speedLimit;
|
- (int)speedLimit;
|
||||||
- (void)setSaveType:(int)savetype; // see save_types in src/mmu.h
|
- (void)setSaveType:(int)savetype; // see save_types in src/mmu.h
|
||||||
- (int)saveType; // default is 0, which is autodetect
|
- (int)saveType; // default is 0, which is autodetect
|
||||||
|
- (void) updateConfig;
|
||||||
//touch screen
|
- (void) emulateDS;
|
||||||
- (void)touch:(NSPoint)point;
|
- (void) drawFrame;
|
||||||
- (void)releaseTouch;
|
- (void) padTime:(NSTimeInterval)timePad;
|
||||||
|
|
||||||
//button input
|
|
||||||
- (void)pressStart;
|
|
||||||
- (void)liftStart;
|
|
||||||
- (BOOL)start;
|
|
||||||
- (void)pressSelect;
|
|
||||||
- (void)liftSelect;
|
|
||||||
- (BOOL)select;
|
|
||||||
- (void)pressLeft;
|
|
||||||
- (void)liftLeft;
|
|
||||||
- (BOOL)left;
|
|
||||||
- (void)pressRight;
|
|
||||||
- (void)liftRight;
|
|
||||||
- (BOOL)right;
|
|
||||||
- (void)pressUp;
|
|
||||||
- (void)liftUp;
|
|
||||||
- (BOOL)up;
|
|
||||||
- (void)pressDown;
|
|
||||||
- (void)liftDown;
|
|
||||||
- (BOOL)down;
|
|
||||||
- (void)pressA;
|
|
||||||
- (void)liftA;
|
|
||||||
- (BOOL)A;
|
|
||||||
- (void)pressB;
|
|
||||||
- (void)liftB;
|
|
||||||
- (BOOL)B;
|
|
||||||
- (void)pressX;
|
|
||||||
- (void)liftX;
|
|
||||||
- (BOOL)X;
|
|
||||||
- (void)pressY;
|
|
||||||
- (void)liftY;
|
|
||||||
- (BOOL)Y;
|
|
||||||
- (void)pressL;
|
|
||||||
- (void)liftL;
|
|
||||||
- (BOOL)L;
|
|
||||||
- (void)pressR;
|
|
||||||
- (void)liftR;
|
|
||||||
- (BOOL)R;
|
|
||||||
|
|
||||||
//save states
|
//save states
|
||||||
- (BOOL)saveState:(NSString*)file;
|
- (BOOL)saveState:(NSString*)file;
|
||||||
- (BOOL)loadState:(NSString*)file;
|
- (BOOL)loadState:(NSString*)file;
|
||||||
- (BOOL)saveStateToSlot:(int)slot; //0 to MAX_SLOTS-1, anything else is ignored
|
|
||||||
- (BOOL)loadStateFromSlot:(int)slot;
|
|
||||||
- (BOOL)saveStateExists:(int)slot;
|
|
||||||
|
|
||||||
//layers
|
- (BOOL) isSubScreenLayerDisplayed:(int)i;
|
||||||
- (void)toggleTopBackground0;
|
- (BOOL) isMainScreenLayerDisplayed:(int)i;
|
||||||
- (BOOL)showingTopBackground0;
|
- (void) toggleMainScreenLayer:(int)i;
|
||||||
- (void)toggleTopBackground1;
|
- (void) toggleSubScreenLayer:(int)i;
|
||||||
- (BOOL)showingTopBackground1;
|
|
||||||
- (void)toggleTopBackground2;
|
|
||||||
- (BOOL)showingTopBackground2;
|
|
||||||
- (void)toggleTopBackground3;
|
|
||||||
- (BOOL)showingTopBackground3;
|
|
||||||
- (void)toggleSubBackground0;
|
|
||||||
- (BOOL)showingSubBackground0;
|
|
||||||
- (void)toggleSubBackground1;
|
|
||||||
- (BOOL)showingSubBackground1;
|
|
||||||
- (void)toggleSubBackground2;
|
|
||||||
- (BOOL)showingSubBackground2;
|
|
||||||
- (void)toggleSubBackground3;
|
|
||||||
- (BOOL)showingSubBackground3;
|
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
- (BOOL)hasSound;
|
- (BOOL)hasSound;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,9 +17,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define OBJ_C
|
|
||||||
#include "../SPU.h"
|
#include "../SPU.h"
|
||||||
#undef OBJ_C
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
|
@ -29,9 +29,7 @@
|
||||||
#include <AudioToolbox/AudioToolbox.h>
|
#include <AudioToolbox/AudioToolbox.h>
|
||||||
|
|
||||||
//desmume includes
|
//desmume includes
|
||||||
#define OBJ_C
|
|
||||||
#include "sndOSX.h"
|
#include "sndOSX.h"
|
||||||
#undef BOOL
|
|
||||||
|
|
||||||
//globals
|
//globals
|
||||||
AudioUnit output_unit = NULL; //pointer to our audio device
|
AudioUnit output_unit = NULL; //pointer to our audio device
|
||||||
|
|
Loading…
Reference in New Issue