mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-01 12:11:03 +00:00
apple: Fix some warnings
This commit is contained in:
parent
056bc62d23
commit
44b26b5ef2
@ -32,28 +32,25 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
|||||||
|
|
||||||
- (void)sendEvent:(NSEvent *)event
|
- (void)sendEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
NSEventType event_type;
|
|
||||||
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
|
|
||||||
|
|
||||||
[super sendEvent:event];
|
[super sendEvent:event];
|
||||||
|
|
||||||
event_type = event.type;
|
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
|
||||||
|
NSEventType event_type = event.type;
|
||||||
|
|
||||||
switch ((NSInteger)event_type)
|
switch ((NSInteger)event_type)
|
||||||
{
|
{
|
||||||
case NSKeyDown:
|
case NSKeyDown:
|
||||||
case NSKeyUp:
|
case NSKeyUp:
|
||||||
{
|
{
|
||||||
NSString* ch = (NSString*)event.characters;
|
NSString* ch = (NSString*)event.characters;
|
||||||
|
|
||||||
if (!ch || ch.length == 0)
|
if (!ch || ch.length == 0)
|
||||||
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, 0, 0);
|
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, 0, 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, [ch characterAtIndex:0], event.modifierFlags);
|
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, [ch characterAtIndex:0], event.modifierFlags);
|
||||||
|
|
||||||
for (i = 1; i < ch.length; i ++)
|
for (NSUInteger i = 1; i < ch.length; i ++)
|
||||||
apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], event.modifierFlags);
|
apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], event.modifierFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +61,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
|||||||
uint32_t new_flags = event.modifierFlags;
|
uint32_t new_flags = event.modifierFlags;
|
||||||
bool down = (new_flags & old_flags) == old_flags;
|
bool down = (new_flags & old_flags) == old_flags;
|
||||||
old_flags = new_flags;
|
old_flags = new_flags;
|
||||||
|
|
||||||
apple_input_keyboard_event(down, event.keyCode, 0, event.modifierFlags);
|
apple_input_keyboard_event(down, event.keyCode, 0, event.modifierFlags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -77,7 +74,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
|||||||
// Relative
|
// Relative
|
||||||
apple->mouse_delta[0] += event.deltaX;
|
apple->mouse_delta[0] += event.deltaX;
|
||||||
apple->mouse_delta[1] += event.deltaY;
|
apple->mouse_delta[1] += event.deltaY;
|
||||||
|
|
||||||
// Absolute
|
// Absolute
|
||||||
pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil];
|
pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||||
apple->touches[0].screen_x = pos.x;
|
apple->touches[0].screen_x = pos.x;
|
||||||
@ -133,14 +130,9 @@ static char** waiting_argv;
|
|||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
NSComboBox* cb;
|
|
||||||
const core_info_list_t* core_list;
|
|
||||||
int i;
|
|
||||||
const char *paths;
|
|
||||||
|
|
||||||
apple_platform = self;
|
apple_platform = self;
|
||||||
|
|
||||||
paths = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject] UTF8String];
|
const char* paths = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject] UTF8String];
|
||||||
fill_pathname_join(g_defaults.core_dir, NSBundle.mainBundle.bundlePath.UTF8String, "Contents/Resources/modules", sizeof(g_defaults.core_dir));
|
fill_pathname_join(g_defaults.core_dir, NSBundle.mainBundle.bundlePath.UTF8String, "Contents/Resources/modules", sizeof(g_defaults.core_dir));
|
||||||
|
|
||||||
fill_pathname_join(g_defaults.menu_config_dir, paths, "RetroArch", sizeof(g_defaults.menu_config_dir));
|
fill_pathname_join(g_defaults.menu_config_dir, paths, "RetroArch", sizeof(g_defaults.menu_config_dir));
|
||||||
@ -152,22 +144,22 @@ static char** waiting_argv;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
[self.window setAcceptsMouseMovedEvents: YES];
|
[self.window setAcceptsMouseMovedEvents: YES];
|
||||||
|
|
||||||
[[RAGameView get] setFrame: [[self.window contentView] bounds]];
|
[[RAGameView get] setFrame: [[self.window contentView] bounds]];
|
||||||
[[self.window contentView] setAutoresizesSubviews:YES];
|
[[self.window contentView] setAutoresizesSubviews:YES];
|
||||||
[[self.window contentView] addSubview:[RAGameView get]];
|
[[self.window contentView] addSubview:[RAGameView get]];
|
||||||
[self.window makeFirstResponder:[RAGameView get]];
|
[self.window makeFirstResponder:[RAGameView get]];
|
||||||
|
|
||||||
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:BOXSTRING("Settings")] autorelease];
|
self.settingsWindow = [[[NSWindowController alloc] initWithWindowNibName:BOXSTRING("Settings")] autorelease];
|
||||||
|
|
||||||
// Warn if there are no cores present
|
// Warn if there are no cores present
|
||||||
core_info_set_core_path();
|
core_info_set_core_path();
|
||||||
core_list = (const core_info_list_t*)core_info_list_get();
|
const core_info_list_t* core_list = (const core_info_list_t*)core_info_list_get();
|
||||||
|
|
||||||
// Create core select list
|
// Create core select list
|
||||||
cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
|
NSComboBox* cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
|
||||||
|
|
||||||
for (i = 0; core_list && i < core_list->count; i ++)
|
for (size_t i = 0; core_list && i < core_list->count; i ++)
|
||||||
{
|
{
|
||||||
NSString* desc = (NSString*)BOXSTRING(core_list->list[i].display_name);
|
NSString* desc = (NSString*)BOXSTRING(core_list->list[i].display_name);
|
||||||
#if defined(MAC_OS_X_VERSION_10_6)
|
#if defined(MAC_OS_X_VERSION_10_6)
|
||||||
@ -176,7 +168,7 @@ static char** waiting_argv;
|
|||||||
#endif
|
#endif
|
||||||
[cb addItemWithObjectValue:desc];
|
[cb addItemWithObjectValue:desc];
|
||||||
}
|
}
|
||||||
|
|
||||||
apple_run_core(waiting_argc, waiting_argv, nil, 0);
|
apple_run_core(waiting_argc, waiting_argv, nil, 0);
|
||||||
|
|
||||||
waiting_argc = 0;
|
waiting_argc = 0;
|
||||||
|
@ -60,17 +60,17 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
|
|||||||
- (void)checkBind:(NSTimer*)send
|
- (void)checkBind:(NSTimer*)send
|
||||||
{
|
{
|
||||||
int32_t value = 0;
|
int32_t value = 0;
|
||||||
int32_t index = _setting->index ? _setting->index - 1 : 0;
|
int32_t index = self.setting->index ? self.setting->index - 1 : 0;
|
||||||
|
|
||||||
if ((value = apple_input_find_any_key()))
|
if ((value = apple_input_find_any_key()))
|
||||||
BINDFOR(*_setting).key = input_translate_keysym_to_rk(value);
|
BINDFOR(*[self setting]).key = input_translate_keysym_to_rk(value);
|
||||||
else if ((value = apple_input_find_any_button(index)) >= 0)
|
else if ((value = apple_input_find_any_button(index)) >= 0)
|
||||||
BINDFOR(*_setting).joykey = value;
|
BINDFOR(*[self setting]).joykey = value;
|
||||||
else if ((value = apple_input_find_any_axis(index)))
|
else if ((value = apple_input_find_any_axis(index)))
|
||||||
BINDFOR(*_setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
|
BINDFOR(*[self setting]).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[self goAway:self];
|
[self goAway:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,14 +64,13 @@ void apple_display_alert(const char *message, const char *title)
|
|||||||
|
|
||||||
- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
|
- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
|
||||||
{
|
{
|
||||||
NSUInteger i;
|
|
||||||
bool hasDot = false;
|
bool hasDot = false;
|
||||||
|
|
||||||
if (partialString.length)
|
if (partialString.length)
|
||||||
for (i = 0; i < partialString.length; i ++)
|
for (NSUInteger i = 0; i < partialString.length; i ++)
|
||||||
{
|
{
|
||||||
unichar ch = [partialString characterAtIndex: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;
|
continue;
|
||||||
else if (self.allowsFloats && !hasDot && ch == '.')
|
else if (self.allowsFloats && !hasDot && ch == '.')
|
||||||
|
Loading…
Reference in New Issue
Block a user