mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
(OSX) Reduce usage of obj-c dot notation to explicit properties.
This commit is contained in:
parent
b86a2c92e6
commit
4c526585f5
@ -35,37 +35,39 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
{
|
||||
[super sendEvent:event];
|
||||
|
||||
if (event.type == NSKeyDown || event.type == NSKeyUp)
|
||||
apple_input_handle_key_event(event.keyCode, event.type == GSEVENT_TYPE_KEYDOWN);
|
||||
else if (event.type == NSFlagsChanged)
|
||||
NSEventType event_type = [event type];
|
||||
|
||||
if (event_type == NSKeyDown || event_type == NSKeyUp)
|
||||
apple_input_handle_key_event([event keyCode], event_type == GSEVENT_TYPE_KEYDOWN);
|
||||
else if (event_type == NSFlagsChanged)
|
||||
{
|
||||
static uint32_t old_flags = 0;
|
||||
uint32_t new_flags = event.modifierFlags;
|
||||
uint32_t new_flags = [event modifierFlags];
|
||||
bool down = (new_flags & old_flags) == old_flags;
|
||||
old_flags = new_flags;
|
||||
|
||||
apple_input_handle_key_event(event.keyCode, down);
|
||||
apple_input_handle_key_event([event keyCode], down);
|
||||
}
|
||||
else if (event.type == NSMouseMoved || event.type == NSLeftMouseDragged ||
|
||||
event.type == NSRightMouseDragged || event.type == NSOtherMouseDragged)
|
||||
else if (event_type == NSMouseMoved || event_type == NSLeftMouseDragged ||
|
||||
event_type == NSRightMouseDragged || event_type == NSOtherMouseDragged)
|
||||
{
|
||||
// Relative
|
||||
g_current_input_data.mouse_delta[0] += event.deltaX;
|
||||
g_current_input_data.mouse_delta[1] += event.deltaY;
|
||||
g_current_input_data.mouse_delta[0] += [event deltaX];
|
||||
g_current_input_data.mouse_delta[1] += [event deltaY];
|
||||
|
||||
// Absolute
|
||||
NSPoint pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||
g_current_input_data.touches[0].screen_x = pos.x;
|
||||
g_current_input_data.touches[0].screen_y = pos.y;
|
||||
}
|
||||
else if (event.type == NSLeftMouseDown || event.type == NSRightMouseDown || event.type == NSOtherMouseDown)
|
||||
else if (event_type == NSLeftMouseDown || event_type == NSRightMouseDown || event_type == NSOtherMouseDown)
|
||||
{
|
||||
g_current_input_data.mouse_buttons |= 1 << event.buttonNumber;
|
||||
g_current_input_data.mouse_buttons |= 1 << [event buttonNumber];
|
||||
g_current_input_data.touch_count = 1;
|
||||
}
|
||||
else if (event.type == NSLeftMouseUp || event.type == NSRightMouseUp || event.type == NSOtherMouseUp)
|
||||
else if (event_type == NSLeftMouseUp || event_type == NSRightMouseUp || event_type == NSOtherMouseUp)
|
||||
{
|
||||
g_current_input_data.mouse_buttons &= ~(1 << event.buttonNumber);
|
||||
g_current_input_data.mouse_buttons &= ~(1 << [event buttonNumber]);
|
||||
g_current_input_data.touch_count = 0;
|
||||
}
|
||||
}
|
||||
@ -116,22 +118,22 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
|
||||
self.configDirectory = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"RetroArch"];
|
||||
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"];
|
||||
|
||||
self.window.acceptsMouseMovedEvents = YES;
|
||||
[self.window setAcceptsMouseMovedEvents: YES];
|
||||
|
||||
RAGameView.get.frame = [self.window.contentView bounds];
|
||||
[self.window.contentView setAutoresizesSubviews:YES];
|
||||
[self.window.contentView addSubview:RAGameView.get];
|
||||
[self.window makeFirstResponder:RAGameView.get];
|
||||
[[RAGameView get] setFrame: [[self.window contentView] bounds]];
|
||||
[[self.window contentView] setAutoresizesSubviews:YES];
|
||||
[[self.window contentView] addSubview:RAGameView.get];
|
||||
[self.window makeFirstResponder:[RAGameView get]];
|
||||
|
||||
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:@"Settings"] autorelease];
|
||||
|
||||
// Create core select list
|
||||
NSComboBox* cb = (NSComboBox*)[self.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_config_path(self.configDirectory.UTF8String);
|
||||
apple_core_info_set_core_path([self.coreDirectory UTF8String]);
|
||||
apple_core_info_set_config_path([self.configDirectory UTF8String]);
|
||||
const core_info_list_t* cores = apple_core_info_list_get();
|
||||
for (int i = 0; cores && i != cores->count; i ++)
|
||||
{
|
||||
@ -140,7 +142,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
[cb addItemWithObjectValue:desc];
|
||||
}
|
||||
|
||||
if (cb.numberOfItems)
|
||||
if ([cb numberOfItems])
|
||||
[cb selectItemAtIndex:0];
|
||||
else
|
||||
apple_display_alert(@"No libretro cores were found.\nSelect \"Go->Cores Directory\" from the menu and place libretro dylib files there.", @"RetroArch");
|
||||
@ -175,7 +177,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
|
||||
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
|
||||
{
|
||||
if (filenames.count == 1 && [filenames objectAtIndex:0])
|
||||
if ([filenames count] == 1 && [filenames objectAtIndex:0])
|
||||
{
|
||||
self.file = [filenames objectAtIndex:0];
|
||||
|
||||
@ -198,15 +200,15 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
NSOpenPanel* panel = [NSOpenPanel openPanel];
|
||||
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
|
||||
{
|
||||
[NSApplication.sharedApplication stopModal];
|
||||
[[NSApplication sharedApplication] stopModal];
|
||||
|
||||
if (result == NSOKButton && panel.URL)
|
||||
if (result == NSOKButton && [panel URL])
|
||||
{
|
||||
self.file = panel.URL.path;
|
||||
self.file = [[panel URL] path];
|
||||
[self performSelector:@selector(chooseCore) withObject:nil afterDelay:.5f];
|
||||
}
|
||||
}];
|
||||
[NSApplication.sharedApplication runModalForWindow:panel];
|
||||
[[NSApplication sharedApplication] runModalForWindow:panel];
|
||||
}
|
||||
|
||||
// This utility function will queue the self.core and self.file instance values for running.
|
||||
@ -216,28 +218,28 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
_wantReload = apple_is_running;
|
||||
|
||||
if (!apple_is_running)
|
||||
apple_run_core(self.core, self.file.UTF8String);
|
||||
apple_run_core(self.core, [self.file UTF8String]);
|
||||
else
|
||||
apple_frontend_post_event(apple_event_basic_command, (void*)QUIT);
|
||||
}
|
||||
|
||||
- (void)chooseCore
|
||||
{
|
||||
[NSApplication.sharedApplication beginSheet:self.coreSelectSheet modalForWindow:self.window modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
||||
[NSApplication.sharedApplication runModalForWindow:self.coreSelectSheet];
|
||||
[[NSApplication sharedApplication] beginSheet:self.coreSelectSheet modalForWindow:self.window modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
||||
[[NSApplication sharedApplication] runModalForWindow:self.coreSelectSheet];
|
||||
}
|
||||
|
||||
- (IBAction)coreWasChosen:(id)sender
|
||||
{
|
||||
[NSApplication.sharedApplication stopModal];
|
||||
[NSApplication.sharedApplication endSheet:self.coreSelectSheet returnCode:0];
|
||||
[[NSApplication sharedApplication] stopModal];
|
||||
[[NSApplication sharedApplication] endSheet:self.coreSelectSheet returnCode:0];
|
||||
[self.coreSelectSheet orderOut:self];
|
||||
|
||||
if (_isTerminating)
|
||||
return;
|
||||
|
||||
NSComboBox* cb = (NSComboBox*)[self.coreSelectSheet.contentView viewWithTag:1];
|
||||
self.core = objc_getAssociatedObject(cb.objectValueOfSelectedItem, associated_core_key);
|
||||
NSComboBox* cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
|
||||
self.core = objc_getAssociatedObject([cb objectValueOfSelectedItem], associated_core_key);
|
||||
|
||||
[self runCore];
|
||||
}
|
||||
@ -246,20 +248,20 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
- (void)loadingCore:(const NSString*)core withFile:(const char*)file
|
||||
{
|
||||
if (file)
|
||||
[NSDocumentController.sharedDocumentController noteNewRecentDocumentURL:[NSURL fileURLWithPath:BOXSTRING(file)]];
|
||||
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:BOXSTRING(file)]];
|
||||
}
|
||||
|
||||
- (void)unloadingCore:(const NSString*)core
|
||||
{
|
||||
if (_isTerminating)
|
||||
[NSApplication.sharedApplication terminate:nil];
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
|
||||
if (_wantReload)
|
||||
apple_run_core(self.core, self.file.UTF8String);
|
||||
apple_run_core(self.core, [self.file UTF8String]);
|
||||
else if(apple_use_tv_mode)
|
||||
apple_run_core(nil, 0);
|
||||
else
|
||||
[NSApplication.sharedApplication terminate:nil];
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
|
||||
_wantReload = false;
|
||||
}
|
||||
@ -272,18 +274,18 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
|
||||
- (IBAction)showPreferences:(id)sender
|
||||
{
|
||||
[NSApp runModalForWindow:self.settingsWindow.window];
|
||||
[NSApp runModalForWindow:[self.settingsWindow window]];
|
||||
}
|
||||
|
||||
- (IBAction)basicEvent:(id)sender
|
||||
{
|
||||
if (apple_is_running)
|
||||
apple_frontend_post_event(&apple_event_basic_command, (void*)((NSMenuItem*)sender).tag);
|
||||
apple_frontend_post_event(&apple_event_basic_command, (void*)[sender tag]);
|
||||
}
|
||||
|
||||
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
[NSApplication.sharedApplication stopModal];
|
||||
[[NSApplication sharedApplication] stopModal];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -187,12 +187,12 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
}
|
||||
}
|
||||
|
||||
setting_data_load_config_path(setting_data_get_list(), apple_platform.globalConfigFile.UTF8String);
|
||||
setting_data_load_config_path(setting_data_get_list(), [apple_platform.globalConfigFile UTF8String]);
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)notification
|
||||
{
|
||||
setting_data_save_config_path(setting_data_get_list(), apple_platform.globalConfigFile.UTF8String);
|
||||
setting_data_save_config_path(setting_data_get_list(), [apple_platform.globalConfigFile UTF8String]);
|
||||
|
||||
apple_exit_stasis(true);
|
||||
|
||||
@ -202,7 +202,7 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
#pragma mark Section Table
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView*)view
|
||||
{
|
||||
return self.settings.count;
|
||||
return [self.settings count];
|
||||
}
|
||||
|
||||
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||
@ -212,14 +212,14 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
|
||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
self.currentGroup = [self.settings objectAtIndex:self.table.selectedRow];
|
||||
self.currentGroup = [self.settings objectAtIndex:[self.table selectedRow]];
|
||||
[self.outline reloadData];
|
||||
}
|
||||
|
||||
#pragma mark Setting Outline
|
||||
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
|
||||
{
|
||||
return (item == nil) ? self.currentGroup.count : [item count];
|
||||
return (item == nil) ? [self.currentGroup count] : [item count];
|
||||
}
|
||||
|
||||
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
|
||||
@ -244,7 +244,7 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
|
||||
if ([item isKindOfClass:[NSArray class]])
|
||||
{
|
||||
if ([tableColumn.identifier isEqualToString:@"left"])
|
||||
if ([[tableColumn identifier] isEqualToString:@"left"])
|
||||
return objc_getAssociatedObject(item, associated_name_tag);
|
||||
else
|
||||
return @"";
|
||||
@ -255,7 +255,7 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
char buffer[PATH_MAX];
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"left"])
|
||||
if ([[tableColumn identifier] isEqualToString:@"left"])
|
||||
return BOXSTRING(setting->short_description);
|
||||
else
|
||||
{
|
||||
@ -274,10 +274,10 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
return nil;
|
||||
|
||||
if ([item isKindOfClass:[NSArray class]])
|
||||
return tableColumn.dataCell;
|
||||
return [tableColumn dataCell];
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"left"])
|
||||
return tableColumn.dataCell;
|
||||
if ([[tableColumn identifier] isEqualToString:@"left"])
|
||||
return [tableColumn dataCell];
|
||||
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
@ -286,15 +286,15 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
{
|
||||
case ST_BOOL: return self.booleanCell;
|
||||
case ST_BIND: return self.binderCell;
|
||||
default: return tableColumn.dataCell;
|
||||
default: return [tableColumn dataCell];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)outlineViewClicked:(id)sender
|
||||
{
|
||||
if (self.outline.clickedColumn == 1)
|
||||
if ([self.outline clickedColumn] == 1)
|
||||
{
|
||||
id item = [self.outline itemAtRow:self.outline.clickedRow];
|
||||
id item = [self.outline itemAtRow:[self.outline clickedRow]];
|
||||
|
||||
if ([item isKindOfClass:[NSNumber class]])
|
||||
{
|
||||
@ -304,7 +304,7 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
switch (setting->type)
|
||||
{
|
||||
case ST_BOOL: *setting->value.boolean = !*setting->value.boolean; return;
|
||||
case ST_BIND: [self.binderWindow runForSetting:setting onWindow:self.outline.window]; return;
|
||||
case ST_BIND: [self.binderWindow runForSetting:setting onWindow:[self.outline window]]; return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
@ -313,18 +313,18 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
||||
|
||||
- (void)controlTextDidEndEditing:(NSNotification*)notification
|
||||
{
|
||||
if (notification.object == self.outline)
|
||||
if ([notification object] == self.outline)
|
||||
{
|
||||
NSText* editor = [[notification userInfo] objectForKey:@"NSFieldEditor"];
|
||||
|
||||
id item = [self.outline itemAtRow:self.outline.selectedRow];
|
||||
id item = [self.outline itemAtRow:[self.outline selectedRow]];
|
||||
|
||||
if ([item isKindOfClass:[NSNumber class]])
|
||||
{
|
||||
const rarch_setting_t* setting_data = setting_data_get_list();
|
||||
const rarch_setting_t* setting = &setting_data[[item intValue]];
|
||||
|
||||
setting_data_set_with_string_representation(setting, editor.string.UTF8String);
|
||||
setting_data_set_with_string_representation(setting, [editor.string UTF8String]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <AVFoundation/AVCaptureInput.h>
|
||||
#include <AVFoundation/AVMediaFormat.h>
|
||||
#include <CoreVideo/CVOpenGLESTextureCache.h>
|
||||
#define APP_HAS_FOCUS ([UIApplication sharedApplication].applicationState == UIApplicationStateActive)
|
||||
#define APP_HAS_FOCUS ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
|
||||
|
||||
#define GLContextClass EAGLContext
|
||||
#define GLAPIType GFX_CTX_OPENGL_ES_API
|
||||
@ -37,8 +37,8 @@
|
||||
|
||||
@interface EAGLContext (OSXCompat) @end
|
||||
@implementation EAGLContext (OSXCompat)
|
||||
+ (void)clearCurrentContext { EAGLContext.currentContext = nil; }
|
||||
- (void)makeCurrentContext { EAGLContext.currentContext = self; }
|
||||
+ (void)clearCurrentContext { [EAGLContext setCurrentContext:nil]; }
|
||||
- (void)makeCurrentContext { [EAGLContext setCurrentContext:self]; }
|
||||
@end
|
||||
|
||||
#elif defined(OSX)
|
||||
@ -55,7 +55,7 @@
|
||||
@implementation NSScreen (IOSCompat)
|
||||
- (CGRect)bounds
|
||||
{
|
||||
CGRect cgrect = NSRectToCGRect(self.frame);
|
||||
CGRect cgrect = NSRectToCGRect([self frame]);
|
||||
return CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect));
|
||||
}
|
||||
- (float) scale { return 1.0f; }
|
||||
@ -109,7 +109,7 @@ static bool g_is_syncing = true;
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
||||
[self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ static RAScreen* get_chosen_screen()
|
||||
#ifdef OSX
|
||||
[pool drain];
|
||||
#endif
|
||||
return RAScreen.mainScreen;
|
||||
return [RAScreen mainScreen];
|
||||
}
|
||||
|
||||
NSArray *screens = [RAScreen screens];
|
||||
@ -406,7 +406,7 @@ bool apple_gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor
|
||||
|
||||
g_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||
g_context = [[NSOpenGLContext alloc] initWithFormat:g_format shareContext:nil];
|
||||
g_context.view = g_view;
|
||||
[g_context setView:g_view];
|
||||
#else
|
||||
g_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
g_view.context = g_context;
|
||||
@ -446,13 +446,13 @@ bool apple_gfx_ctx_set_video_mode(unsigned width, unsigned height, bool fullscre
|
||||
else if (!fullscreen && g_has_went_fullscreen)
|
||||
{
|
||||
[g_view exitFullScreenModeWithOptions:nil];
|
||||
[g_view.window makeFirstResponder:g_view];
|
||||
[[g_view window] makeFirstResponder:g_view];
|
||||
[NSCursor unhide];
|
||||
}
|
||||
|
||||
g_has_went_fullscreen = fullscreen;
|
||||
if (!g_has_went_fullscreen)
|
||||
[g_view.window setContentSize:NSMakeSize(width, height)];
|
||||
[[g_view window] setContentSize:NSMakeSize(width, height)];
|
||||
});
|
||||
#endif
|
||||
|
||||
@ -469,18 +469,18 @@ void apple_gfx_ctx_get_video_size(unsigned* width, unsigned* height)
|
||||
if (g_initialized)
|
||||
{
|
||||
#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_7)
|
||||
CGRect cgrect = NSRectToCGRect(g_view.frame);
|
||||
CGRect cgrect = NSRectToCGRect([g_view frame]);
|
||||
size = CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect));
|
||||
#else
|
||||
size = g_view.bounds;
|
||||
size = [g_view bounds];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
size = screen.bounds;
|
||||
size = [screen bounds];
|
||||
|
||||
|
||||
*width = CGRectGetWidth(size) * screen.scale;
|
||||
*height = CGRectGetHeight(size) * screen.scale;
|
||||
*width = CGRectGetWidth(size) * [screen scale];
|
||||
*height = CGRectGetHeight(size) * [screen scale];
|
||||
}
|
||||
|
||||
void apple_gfx_ctx_update_window_title(void)
|
||||
@ -498,7 +498,7 @@ void apple_gfx_ctx_update_window_title(void)
|
||||
// If it poses a problem it should be changed to dispatch_sync.
|
||||
dispatch_async(dispatch_get_main_queue(),
|
||||
^{
|
||||
g_view.window.title = [NSString stringWithCString:text encoding:NSUTF8StringEncoding];
|
||||
[[g_view window] setTitle:[NSString stringWithCString:text encoding:NSUTF8StringEncoding]];
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
@ -63,17 +63,17 @@ void apple_run_core(NSString* core, const char* file)
|
||||
|
||||
if (!apple_argv)
|
||||
{
|
||||
if (apple_core_info_has_custom_config(apple_core.UTF8String))
|
||||
apple_core_info_get_custom_config(apple_core.UTF8String, config_path, sizeof(config_path));
|
||||
if (apple_core_info_has_custom_config([apple_core UTF8String]))
|
||||
apple_core_info_get_custom_config([apple_core UTF8String], config_path, sizeof(config_path));
|
||||
else
|
||||
strlcpy(config_path, apple_platform.globalConfigFile.UTF8String, sizeof(config_path));
|
||||
strlcpy(config_path, [apple_platform.globalConfigFile UTF8String], sizeof(config_path));
|
||||
|
||||
static const char* const argv_game[] = { "retroarch", "-c", config_path, "-L", core_path, file_path, 0 };
|
||||
static const char* const argv_menu[] = { "retroarch", "-c", config_path, "--menu", 0 };
|
||||
|
||||
if (file && core)
|
||||
{
|
||||
strlcpy(core_path, apple_core.UTF8String, sizeof(core_path));
|
||||
strlcpy(core_path, [apple_core UTF8String], sizeof(core_path));
|
||||
strlcpy(file_path, file, sizeof(file_path));
|
||||
}
|
||||
|
||||
|
@ -33,14 +33,14 @@ void apple_display_alert(NSString* message, NSString* title)
|
||||
#else
|
||||
NSAlert* alert = [[NSAlert new] autorelease];
|
||||
|
||||
alert.messageText = title ? title : @"RetroArch";
|
||||
alert.informativeText = message;
|
||||
alert.alertStyle = NSInformationalAlertStyle;
|
||||
[alert beginSheetModalForWindow:RetroArch_OSX.get.window
|
||||
[alert setMessageText:title ? title : @"RetroArch"];
|
||||
[alert setInformativeText:message];
|
||||
[alert setAlertStyle:NSInformationalAlertStyle];
|
||||
[alert beginSheetModalForWindow:[RetroArch_OSX get].window
|
||||
modalDelegate:apple_platform
|
||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:nil];
|
||||
[[NSApplication sharedApplication] runModalForWindow:alert.window];
|
||||
[[NSApplication sharedApplication] runModalForWindow:[alert window]];
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ NSString *apple_get_core_id(const core_info_t *core)
|
||||
|
||||
NSString *apple_get_core_display_name(NSString *core_id)
|
||||
{
|
||||
const core_info_t *core = apple_core_info_list_get_by_id(core_id.UTF8String);
|
||||
const core_info_t *core = apple_core_info_list_get_by_id([core_id UTF8String]);
|
||||
return core ? BOXSTRING(core->display_name) : core_id;
|
||||
}
|
||||
|
||||
@ -75,29 +75,29 @@ NSString *apple_get_core_display_name(NSString *core_id)
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
self.allowsFloats = (setting->type == ST_FLOAT);
|
||||
[self setAllowsFloats:(setting->type == ST_FLOAT)];
|
||||
|
||||
if (setting->min != setting->max)
|
||||
{
|
||||
self.minimum = BOXFLOAT(setting->min);
|
||||
self.maximum = BOXFLOAT(setting->max);
|
||||
[self setMinimum:BOXFLOAT(setting->min)];
|
||||
[self setMaximum:BOXFLOAT(setting->max)];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (setting->type == ST_INT)
|
||||
{
|
||||
self.minimum = BOXINT(INT_MIN);
|
||||
self.maximum = BOXINT(INT_MAX);
|
||||
[self setMinimum:BOXINT(INT_MIN)];
|
||||
[self setMaximum:BOXINT(INT_MAX)];
|
||||
}
|
||||
else if (setting->type == ST_UINT)
|
||||
{
|
||||
self.minimum = BOXUINT(0);
|
||||
self.maximum = BOXUINT(UINT_MAX);
|
||||
[self setMinimum:BOXUINT(0)];
|
||||
[self setMaximum:BOXUINT(UINT_MAX)];
|
||||
}
|
||||
else if (setting->type == ST_FLOAT)
|
||||
{
|
||||
self.minimum = BOXFLOAT(FLT_MIN);
|
||||
self.maximum = BOXFLOAT(FLT_MAX);
|
||||
[self setMinimum:BOXFLOAT(FLT_MIN)];
|
||||
[self setMaximum:BOXFLOAT(FLT_MAX)];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,14 +109,14 @@ NSString *apple_get_core_display_name(NSString *core_id)
|
||||
{
|
||||
bool hasDot = false;
|
||||
|
||||
if (partialString.length)
|
||||
for (int i = 0; i != partialString.length; i ++)
|
||||
if ([partialString length])
|
||||
for (int i = 0; i != [partialString length]; i ++)
|
||||
{
|
||||
unichar ch = [partialString characterAtIndex:i];
|
||||
|
||||
if (i == 0 && (!self.minimum || self.minimum.intValue < 0) && ch == '-')
|
||||
if (i == 0 && (![self minimum] || [[self minimum] intValue] < 0) && ch == '-')
|
||||
continue;
|
||||
else if (self.allowsFloats && !hasDot && ch == '.')
|
||||
else if ([self allowsFloats] && !hasDot && ch == '.')
|
||||
hasDot = true;
|
||||
else if (!isdigit(ch))
|
||||
return NO;
|
||||
@ -128,7 +128,7 @@ NSString *apple_get_core_display_name(NSString *core_id)
|
||||
#ifdef IOS
|
||||
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
|
||||
{
|
||||
NSString* text = [textField.text stringByReplacingCharactersInRange:range withString:string];
|
||||
NSString* text = [[textField text] stringByReplacingCharactersInRange:range withString:string];
|
||||
return [self isPartialStringValid:text newEditingString:nil errorDescription:nil];
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user