mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-25 21:04:40 +00:00
(Apple) More fixes for building on snow leopard.
This commit is contained in:
parent
02f2dec2cd
commit
b1767601b0
@ -27,20 +27,16 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@interface RetroArch_OSX : NSObject<RetroArch_Platform, NSApplicationDelegate>
|
@interface RetroArch_OSX : NSObject<RetroArch_Platform, NSApplicationDelegate>
|
||||||
{
|
@property (nonatomic, retain) NSWindow IBOutlet* window;
|
||||||
@public
|
@property (nonatomic, copy) NSString* configDirectory; // e.g. /var/mobile/Documents/.RetroArch
|
||||||
NSWindow IBOutlet *window;
|
@property (nonatomic, copy) NSString* globalConfigFile; // e.g. /var/mobile/Documents/.RetroArch/retroarch.cfg
|
||||||
}
|
@property (nonatomic, copy) NSString* coreDirectory; // e.g. /Applications/RetroArch.app/modules
|
||||||
|
|
||||||
+ (RetroArch_OSX*)get;
|
+ (RetroArch_OSX*)get;
|
||||||
|
|
||||||
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
|
- (void)loadingCore:(NSString*)core withFile:(const char*)file;
|
||||||
- (void)unloadingCore:(NSString*)core;
|
- (void)unloadingCore:(NSString*)core;
|
||||||
|
|
||||||
@property (nonatomic) NSString* configDirectory; // e.g. /var/mobile/Documents/.RetroArch
|
|
||||||
@property (nonatomic) NSString* globalConfigFile; // e.g. /var/mobile/Documents/.RetroArch/retroarch.cfg
|
|
||||||
@property (nonatomic) NSString* coreDirectory; // e.g. /Applications/RetroArch.app/modules
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
static const void* const associated_core_key = &associated_core_key;
|
static void* const associated_core_key = (void*)&associated_core_key;
|
||||||
|
|
||||||
@interface RApplication : NSApplication
|
@interface RApplication : NSApplication
|
||||||
@end
|
@end
|
||||||
@ -72,15 +72,40 @@ static const void* const associated_core_key = &associated_core_key;
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface RetroArch_OSX()
|
||||||
|
@property (nonatomic, retain) NSWindowController* settingsWindow;
|
||||||
|
@property (nonatomic, retain) NSWindow IBOutlet* coreSelectSheet;
|
||||||
|
@property (nonatomic, copy) NSString* file;
|
||||||
|
@property (nonatomic, copy) NSString* core;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation RetroArch_OSX
|
@implementation RetroArch_OSX
|
||||||
{
|
{
|
||||||
NSWindow IBOutlet* _coreSelectSheet;
|
|
||||||
|
|
||||||
bool _isTerminating;
|
bool _isTerminating;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
bool _wantReload;
|
bool _wantReload;
|
||||||
NSString* _file;
|
}
|
||||||
NSString* _core;
|
|
||||||
|
@synthesize window = _window;
|
||||||
|
@synthesize configDirectory = _configDirectory;
|
||||||
|
@synthesize globalConfigFile = _globalConfigFile;
|
||||||
|
@synthesize coreDirectory = _coreDirectory;
|
||||||
|
@synthesize settingsWindow = _settingsWindow;
|
||||||
|
@synthesize coreSelectSheet = _coreSelectSheet;
|
||||||
|
@synthesize file = _file;
|
||||||
|
@synthesize core = _core;
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[_window release];
|
||||||
|
[_configDirectory release];
|
||||||
|
[_globalConfigFile release];
|
||||||
|
[_coreDirectory release];
|
||||||
|
[_coreSelectSheet release];
|
||||||
|
[_settingsWindow release];
|
||||||
|
[_file release];
|
||||||
|
[_core release];
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (RetroArch_OSX*)get
|
+ (RetroArch_OSX*)get
|
||||||
@ -94,20 +119,21 @@ static const void* const associated_core_key = &associated_core_key;
|
|||||||
_loaded = true;
|
_loaded = true;
|
||||||
|
|
||||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||||
self.configDirectory = [paths[0] stringByAppendingPathComponent:@"RetroArch"];
|
self.configDirectory = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"RetroArch"];
|
||||||
self.globalConfigFile = [NSString stringWithFormat:@"%@/retroarch.cfg", self.configDirectory];
|
self.globalConfigFile = [NSString stringWithFormat:@"%@/retroarch.cfg", self.configDirectory];
|
||||||
self.coreDirectory = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"Contents/Resources/modules"];
|
self.coreDirectory = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"Contents/Resources/modules"];
|
||||||
|
|
||||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
self.window.acceptsMouseMovedEvents = YES;
|
||||||
window.acceptsMouseMovedEvents = YES;
|
|
||||||
|
|
||||||
RAGameView.get.frame = [window.contentView bounds];
|
RAGameView.get.frame = [self.window.contentView bounds];
|
||||||
[window.contentView setAutoresizesSubviews:YES];
|
[self.window.contentView setAutoresizesSubviews:YES];
|
||||||
[window.contentView addSubview:RAGameView.get];
|
[self.window.contentView addSubview:RAGameView.get];
|
||||||
[window makeFirstResponder:RAGameView.get];
|
[self.window makeFirstResponder:RAGameView.get];
|
||||||
|
|
||||||
|
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:@"Settings"] autorelease];
|
||||||
|
|
||||||
// Create core select list
|
// Create core select list
|
||||||
NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1];
|
NSComboBox* cb = (NSComboBox*)[self.coreSelectSheet.contentView viewWithTag:1];
|
||||||
|
|
||||||
apple_core_info_set_core_path(self.coreDirectory.UTF8String);
|
apple_core_info_set_core_path(self.coreDirectory.UTF8String);
|
||||||
apple_core_info_set_config_path(self.configDirectory.UTF8String);
|
apple_core_info_set_config_path(self.configDirectory.UTF8String);
|
||||||
@ -154,9 +180,9 @@ static const void* const associated_core_key = &associated_core_key;
|
|||||||
|
|
||||||
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
|
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
|
||||||
{
|
{
|
||||||
if (filenames.count == 1 && filenames[0])
|
if (filenames.count == 1 && [filenames objectAtIndex:0])
|
||||||
{
|
{
|
||||||
_file = filenames[0];
|
self.file = [filenames objectAtIndex:0];
|
||||||
|
|
||||||
if (!_loaded)
|
if (!_loaded)
|
||||||
_wantReload = true;
|
_wantReload = true;
|
||||||
@ -175,48 +201,48 @@ static const void* const associated_core_key = &associated_core_key;
|
|||||||
- (void)openDocument:(id)sender
|
- (void)openDocument:(id)sender
|
||||||
{
|
{
|
||||||
NSOpenPanel* panel = [NSOpenPanel openPanel];
|
NSOpenPanel* panel = [NSOpenPanel openPanel];
|
||||||
[panel beginSheetModalForWindow:window completionHandler:^(NSInteger result)
|
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
||||||
{
|
{
|
||||||
[NSApplication.sharedApplication stopModal];
|
[NSApplication.sharedApplication stopModal];
|
||||||
|
|
||||||
if (result == NSOKButton && panel.URL)
|
if (result == NSOKButton && panel.URL)
|
||||||
{
|
{
|
||||||
_file = panel.URL.path;
|
self.file = panel.URL.path;
|
||||||
[self performSelector:@selector(chooseCore) withObject:nil afterDelay:.5f];
|
[self performSelector:@selector(chooseCore) withObject:nil afterDelay:.5f];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
[NSApplication.sharedApplication runModalForWindow:panel];
|
[NSApplication.sharedApplication runModalForWindow:panel];
|
||||||
}
|
}
|
||||||
|
|
||||||
// This utility function will queue the _core and _file instance values for running.
|
// This utility function will queue the self.core and self.file instance values for running.
|
||||||
// If the emulator thread is already running it will tell it to quit.
|
// If the emulator thread is already running it will tell it to quit.
|
||||||
- (void)runCore
|
- (void)runCore
|
||||||
{
|
{
|
||||||
_wantReload = apple_is_running;
|
_wantReload = apple_is_running;
|
||||||
|
|
||||||
if (!apple_is_running)
|
if (!apple_is_running)
|
||||||
apple_run_core(_core, _file.UTF8String);
|
apple_run_core(self.core, self.file.UTF8String);
|
||||||
else
|
else
|
||||||
apple_frontend_post_event(apple_event_basic_command, (void*)QUIT);
|
apple_frontend_post_event(apple_event_basic_command, (void*)QUIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)chooseCore
|
- (void)chooseCore
|
||||||
{
|
{
|
||||||
[NSApplication.sharedApplication beginSheet:_coreSelectSheet modalForWindow:window modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
[NSApplication.sharedApplication beginSheet:self.coreSelectSheet modalForWindow:self.window modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
||||||
[NSApplication.sharedApplication runModalForWindow:_coreSelectSheet];
|
[NSApplication.sharedApplication runModalForWindow:self.coreSelectSheet];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)coreWasChosen:(id)sender
|
- (IBAction)coreWasChosen:(id)sender
|
||||||
{
|
{
|
||||||
[NSApplication.sharedApplication stopModal];
|
[NSApplication.sharedApplication stopModal];
|
||||||
[NSApplication.sharedApplication endSheet:_coreSelectSheet returnCode:0];
|
[NSApplication.sharedApplication endSheet:self.coreSelectSheet returnCode:0];
|
||||||
[_coreSelectSheet orderOut:self];
|
[self.coreSelectSheet orderOut:self];
|
||||||
|
|
||||||
if (_isTerminating)
|
if (_isTerminating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSComboBox* cb = (NSComboBox*)[_coreSelectSheet.contentView viewWithTag:1];
|
NSComboBox* cb = (NSComboBox*)[self.coreSelectSheet.contentView viewWithTag:1];
|
||||||
_core = objc_getAssociatedObject(cb.objectValueOfSelectedItem, associated_core_key);
|
self.core = objc_getAssociatedObject(cb.objectValueOfSelectedItem, associated_core_key);
|
||||||
|
|
||||||
[self runCore];
|
[self runCore];
|
||||||
}
|
}
|
||||||
@ -234,7 +260,7 @@ static const void* const associated_core_key = &associated_core_key;
|
|||||||
[NSApplication.sharedApplication terminate:nil];
|
[NSApplication.sharedApplication terminate:nil];
|
||||||
|
|
||||||
if (_wantReload)
|
if (_wantReload)
|
||||||
apple_run_core(_core, _file.UTF8String);
|
apple_run_core(self.core, self.file.UTF8String);
|
||||||
else if(apple_use_tv_mode)
|
else if(apple_use_tv_mode)
|
||||||
apple_run_core(nil, 0);
|
apple_run_core(nil, 0);
|
||||||
else
|
else
|
||||||
@ -251,8 +277,7 @@ static const void* const associated_core_key = &associated_core_key;
|
|||||||
|
|
||||||
- (IBAction)showPreferences:(id)sender
|
- (IBAction)showPreferences:(id)sender
|
||||||
{
|
{
|
||||||
NSWindowController* wc = [[NSWindowController alloc] initWithWindowNibName:@"Settings"];
|
[NSApp runModalForWindow:self.settingsWindow.window];
|
||||||
[NSApp runModalForWindow:wc.window];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)basicEvent:(id)sender
|
- (IBAction)basicEvent:(id)sender
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "input/input_common.h"
|
#include "input/input_common.h"
|
||||||
|
|
||||||
static const void* associated_name_tag = (void*)&associated_name_tag;
|
static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||||
|
|
||||||
@interface RAInputBinder : NSWindow
|
@interface RAInputBinder : NSWindow
|
||||||
@property (nonatomic, retain) NSTimer* timer;
|
@property (nonatomic, retain) NSTimer* timer;
|
||||||
@ -29,14 +29,14 @@ static const void* associated_name_tag = (void*)&associated_name_tag;
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation RAInputBinder
|
@implementation RAInputBinder
|
||||||
|
@synthesize timer = _timer;
|
||||||
|
@synthesize setting = _setting;
|
||||||
|
|
||||||
#if 0
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[_timer release];
|
[_timer release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
- (void)runForSetting:(const rarch_setting_t*)setting onWindow:(NSWindow*)window
|
- (void)runForSetting:(const rarch_setting_t*)setting onWindow:(NSWindow*)window
|
||||||
{
|
{
|
||||||
@ -95,8 +95,14 @@ static const void* associated_name_tag = (void*)&associated_name_tag;
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation RASettingsDelegate
|
@implementation RASettingsDelegate
|
||||||
|
@synthesize binderWindow = _binderWindow;
|
||||||
|
@synthesize booleanCell = _booleanCell;
|
||||||
|
@synthesize binderCell = _binderCell;
|
||||||
|
@synthesize table = _table;
|
||||||
|
@synthesize outline = _outline;
|
||||||
|
@synthesize settings = _settings;
|
||||||
|
@synthesize currentGroup = _currentGroup;
|
||||||
|
|
||||||
#if 0
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[_binderWindow release];
|
[_binderWindow release];
|
||||||
@ -109,7 +115,6 @@ static const void* associated_name_tag = (void*)&associated_name_tag;
|
|||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
@ -136,7 +141,8 @@ static const void* associated_name_tag = (void*)&associated_name_tag;
|
|||||||
|
|
||||||
case ST_END_GROUP:
|
case ST_END_GROUP:
|
||||||
{
|
{
|
||||||
[self.settings addObject:thisGroup];
|
if (thisGroup)
|
||||||
|
[self.settings addObject:thisGroup];
|
||||||
thisGroup = nil;
|
thisGroup = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -150,7 +156,8 @@ static const void* associated_name_tag = (void*)&associated_name_tag;
|
|||||||
|
|
||||||
case ST_END_SUB_GROUP:
|
case ST_END_SUB_GROUP:
|
||||||
{
|
{
|
||||||
[thisGroup addObject:thisSubGroup];
|
if (thisSubGroup)
|
||||||
|
[thisGroup addObject:thisSubGroup];
|
||||||
thisSubGroup = nil;
|
thisSubGroup = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -183,12 +190,12 @@ static const void* associated_name_tag = (void*)&associated_name_tag;
|
|||||||
|
|
||||||
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||||
{
|
{
|
||||||
return objc_getAssociatedObject(self.settings[row], associated_name_tag);
|
return objc_getAssociatedObject([self.settings objectAtIndex:row], associated_name_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
self.currentGroup = self.settings[self.table.selectedRow];
|
self.currentGroup = [self.settings objectAtIndex:self.table.selectedRow];
|
||||||
[self.outline reloadData];
|
[self.outline reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +207,7 @@ static const void* associated_name_tag = (void*)&associated_name_tag;
|
|||||||
|
|
||||||
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
|
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
|
||||||
{
|
{
|
||||||
return (item == nil) ? self.currentGroup[index] : [item objectAtIndex:index];
|
return (item == nil) ? [self.currentGroup objectAtIndex:index] : [item objectAtIndex:index];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
|
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
|
||||||
|
@ -270,10 +270,11 @@
|
|||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
||||||
CLANG_CXX_LIBRARY = "compiler-default";
|
CLANG_CXX_LIBRARY = "compiler-default";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
@ -316,7 +317,7 @@
|
|||||||
"-DHAVE_NETPLAY",
|
"-DHAVE_NETPLAY",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = "";
|
SDKROOT = macosx;
|
||||||
WRAPPER_EXTENSION = app;
|
WRAPPER_EXTENSION = app;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@ -327,10 +328,11 @@
|
|||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
||||||
CLANG_CXX_LIBRARY = "compiler-default";
|
CLANG_CXX_LIBRARY = "compiler-default";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
@ -369,7 +371,7 @@
|
|||||||
"-DHAVE_NETPLAY",
|
"-DHAVE_NETPLAY",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = "";
|
SDKROOT = macosx;
|
||||||
WRAPPER_EXTENSION = app;
|
WRAPPER_EXTENSION = app;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
@ -312,32 +312,30 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||||||
|
|
||||||
static RAScreen* get_chosen_screen()
|
static RAScreen* get_chosen_screen()
|
||||||
{
|
{
|
||||||
#ifdef MAC_OS_X_VERSION_10_7
|
#ifdef OSX
|
||||||
@autoreleasepool {
|
|
||||||
if (g_settings.video.monitor_index >= RAScreen.screens.count)
|
|
||||||
{
|
|
||||||
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
|
||||||
return RAScreen.mainScreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSArray *screens = [RAScreen screens];
|
|
||||||
RAScreen *s = (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index];
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
#else
|
||||||
|
@autoreleasepool {
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_settings.video.monitor_index >= RAScreen.screens.count)
|
if (g_settings.video.monitor_index >= RAScreen.screens.count)
|
||||||
{
|
{
|
||||||
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
||||||
|
#ifdef OSX
|
||||||
[pool drain];
|
[pool drain];
|
||||||
|
#endif
|
||||||
return RAScreen.mainScreen;
|
return RAScreen.mainScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray *screens = [RAScreen screens];
|
NSArray *screens = [RAScreen screens];
|
||||||
RAScreen *s = (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index];
|
RAScreen *s = (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index];
|
||||||
|
#ifdef OSX
|
||||||
[pool drain];
|
[pool drain];
|
||||||
|
[pool release];
|
||||||
|
#endif
|
||||||
return s;
|
return s;
|
||||||
|
#ifdef IOS
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,20 +388,23 @@ bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor
|
|||||||
|
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
[g_context clearDrawable];
|
[g_context clearDrawable];
|
||||||
g_context = nil;
|
[g_context release], g_context = nil;
|
||||||
g_format = nil;
|
[g_format release], g_format = nil;
|
||||||
|
|
||||||
NSOpenGLPixelFormatAttribute attributes [] = {
|
NSOpenGLPixelFormatAttribute attributes [] = {
|
||||||
NSOpenGLPFADoubleBuffer, // double buffered
|
NSOpenGLPFADoubleBuffer, // double buffered
|
||||||
NSOpenGLPFADepthSize,
|
NSOpenGLPFADepthSize,
|
||||||
(NSOpenGLPixelFormatAttribute)16, // 16 bit depth buffer
|
(NSOpenGLPixelFormatAttribute)16, // 16 bit depth buffer
|
||||||
#ifdef MAC_OS_X_VERSION_10_7
|
#ifdef MAC_OS_X_VERSION_10_7
|
||||||
(major || minor) ? NSOpenGLPFAOpenGLProfile : 0,
|
(major || minor) ? NSOpenGLPFAOpenGLProfile : 0,
|
||||||
(major << 12) | (minor << 8),
|
(major << 12) | (minor << 8),
|
||||||
#endif
|
#endif
|
||||||
(NSOpenGLPixelFormatAttribute)nil
|
(NSOpenGLPixelFormatAttribute)nil
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[g_format release];
|
||||||
|
[g_context release];
|
||||||
|
|
||||||
g_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
g_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
g_context = [[NSOpenGLContext alloc] initWithFormat:g_format shareContext:nil];
|
g_context = [[NSOpenGLContext alloc] initWithFormat:g_format shareContext:nil];
|
||||||
g_context.view = g_view;
|
g_context.view = g_view;
|
||||||
|
@ -51,7 +51,10 @@ void apple_run_core(NSString* core, const char* file)
|
|||||||
|
|
||||||
[apple_platform loadingCore:core withFile:file];
|
[apple_platform loadingCore:core withFile:file];
|
||||||
|
|
||||||
apple_core = core;
|
#ifdef OSX
|
||||||
|
[apple_core release];
|
||||||
|
#endif
|
||||||
|
apple_core = [core copy];
|
||||||
apple_is_running = true;
|
apple_is_running = true;
|
||||||
|
|
||||||
static char config_path[PATH_MAX];
|
static char config_path[PATH_MAX];
|
||||||
@ -97,7 +100,7 @@ void apple_rarch_exited(void* result)
|
|||||||
apple_display_alert(@"Failed to load content.", 0);
|
apple_display_alert(@"Failed to load content.", 0);
|
||||||
|
|
||||||
NSString* used_core = apple_core;
|
NSString* used_core = apple_core;
|
||||||
apple_core = 0;
|
apple_core = 0;
|
||||||
|
|
||||||
if (apple_is_running)
|
if (apple_is_running)
|
||||||
{
|
{
|
||||||
@ -105,6 +108,10 @@ void apple_rarch_exited(void* result)
|
|||||||
[apple_platform unloadingCore:used_core];
|
[apple_platform unloadingCore:used_core];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OSX
|
||||||
|
[used_core release];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (apple_use_tv_mode)
|
if (apple_use_tv_mode)
|
||||||
apple_run_core(nil, 0);
|
apple_run_core(nil, 0);
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,12 @@ void apple_display_alert(NSString* message, NSString* title)
|
|||||||
otherButtonTitles:nil];
|
otherButtonTitles:nil];
|
||||||
[alert show];
|
[alert show];
|
||||||
#else
|
#else
|
||||||
NSAlert* alert = [NSAlert new];
|
NSAlert* alert = [[NSAlert new] autorelease];
|
||||||
|
|
||||||
alert.messageText = title ? title : @"RetroArch";
|
alert.messageText = title ? title : @"RetroArch";
|
||||||
alert.informativeText = message;
|
alert.informativeText = message;
|
||||||
alert.alertStyle = NSInformationalAlertStyle;
|
alert.alertStyle = NSInformationalAlertStyle;
|
||||||
[alert beginSheetModalForWindow:RetroArch_OSX.get->window
|
[alert beginSheetModalForWindow:RetroArch_OSX.get.window
|
||||||
modalDelegate:apple_platform
|
modalDelegate:apple_platform
|
||||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||||
contextInfo:nil];
|
contextInfo:nil];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user