mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
(Apple) Style nits
This commit is contained in:
parent
453ced002b
commit
9d00e3af1b
@ -32,9 +32,12 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
|
||||
- (void)sendEvent:(NSEvent *)event
|
||||
{
|
||||
int i;
|
||||
NSEventType event_type;
|
||||
|
||||
[super sendEvent:event];
|
||||
|
||||
NSEventType event_type = event.type;
|
||||
event_type = event.type;
|
||||
|
||||
if (event_type == NSKeyDown || event_type == NSKeyUp)
|
||||
{
|
||||
@ -46,7 +49,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
|
||||
{
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, [ch characterAtIndex:0], event.modifierFlags);
|
||||
|
||||
for (unsigned i = 1; i < ch.length; i ++)
|
||||
for (i = 1; i < ch.length; i ++)
|
||||
apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], event.modifierFlags);
|
||||
}
|
||||
}
|
||||
@ -260,7 +263,7 @@ static char** waiting_argv;
|
||||
if (!apple_is_running)
|
||||
apple_run_core(self.core, self.file.UTF8String);
|
||||
else
|
||||
apple_event_basic_command(QUIT);
|
||||
g_extern.system.shutdown = true;
|
||||
}
|
||||
|
||||
- (void)chooseCore
|
||||
|
@ -78,23 +78,26 @@ static void apple_gamecontroller_poll(GCController* controller)
|
||||
|
||||
void apple_gamecontroller_poll_all(void)
|
||||
{
|
||||
NSArray *controllers;
|
||||
int i;
|
||||
#ifdef IOS
|
||||
if (IOS_IS_VERSION_6_OR_LOWER())
|
||||
return;
|
||||
#endif
|
||||
NSArray* controllers = (NSArray*)GCController.controllers;
|
||||
controllers = (NSArray*)GCController.controllers;
|
||||
|
||||
for (int i = 0; i < controllers.count; i ++)
|
||||
for (i = 0; i < controllers.count; i ++)
|
||||
apple_gamecontroller_poll([controllers objectAtIndex:i]);
|
||||
}
|
||||
|
||||
void apple_gamecontroller_connect(GCController* controller)
|
||||
{
|
||||
int32_t slot;
|
||||
#ifdef IOS
|
||||
if (IOS_IS_VERSION_6_OR_LOWER())
|
||||
return;
|
||||
#endif
|
||||
int32_t slot = apple_joypad_connect_gcapi();
|
||||
slot = apple_joypad_connect_gcapi();
|
||||
controller.playerIndex = (slot >= 0 && slot < MAX_PLAYERS) ? slot : GCControllerPlayerIndexUnset;
|
||||
|
||||
/*
|
||||
|
@ -19,9 +19,6 @@
|
||||
#import "RetroArch_Apple.h"
|
||||
#include "rarch_wrapper.h"
|
||||
#include "../../frontend/frontend.h"
|
||||
|
||||
#include "../../input/apple_input.h"
|
||||
|
||||
#include "../../file.h"
|
||||
|
||||
id<RetroArch_Platform> apple_platform;
|
||||
@ -52,6 +49,12 @@ void apple_rarch_exited(void)
|
||||
|
||||
void apple_run_core(NSString* core, const char* file)
|
||||
{
|
||||
static char core_path[PATH_MAX], file_path[PATH_MAX], config_path[PATH_MAX];
|
||||
char **argv;
|
||||
int argc;
|
||||
|
||||
(void)config_path;
|
||||
|
||||
if (apple_is_running)
|
||||
return;
|
||||
|
||||
@ -60,9 +63,6 @@ void apple_run_core(NSString* core, const char* file)
|
||||
apple_core = core;
|
||||
apple_is_running = true;
|
||||
|
||||
static char core_path[PATH_MAX];
|
||||
static char file_path[PATH_MAX];
|
||||
|
||||
if (file && core)
|
||||
{
|
||||
strlcpy(core_path, apple_core.UTF8String, sizeof(core_path));
|
||||
@ -70,8 +70,6 @@ void apple_run_core(NSString* core, const char* file)
|
||||
}
|
||||
|
||||
#ifdef IOS
|
||||
static char config_path[PATH_MAX];
|
||||
|
||||
if (core_info_has_custom_config(apple_core.UTF8String))
|
||||
core_info_get_custom_config(apple_core.UTF8String, config_path, sizeof(config_path));
|
||||
else
|
||||
@ -80,15 +78,14 @@ void apple_run_core(NSString* core, const char* file)
|
||||
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 };
|
||||
|
||||
int argc = (file && core) ? 6 : 4;
|
||||
char** argv = (char**)((file && core) ? argv_game : argv_menu);
|
||||
argc = (file && core) ? 6 : 4;
|
||||
#else
|
||||
static const char* const argv_game[] = { "retroarch", "-L", core_path, file_path, 0 };
|
||||
static const char* const argv_menu[] = { "retroarch", "--menu", 0 };
|
||||
|
||||
int argc = (file && core) ? 4 : 2;
|
||||
char** argv = (char**)((file && core) ? argv_game : argv_menu);
|
||||
argc = (file && core) ? 4 : 2;
|
||||
#endif
|
||||
argv = (char**)((file && core) ? argv_game : argv_menu);
|
||||
|
||||
if (apple_rarch_load_content(argc, argv))
|
||||
{
|
||||
|
@ -90,14 +90,15 @@ NSString *apple_get_core_display_name(NSString *core_id)
|
||||
|
||||
- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
|
||||
{
|
||||
int i;
|
||||
bool hasDot = false;
|
||||
|
||||
if (partialString.length)
|
||||
for (int i = 0; i < partialString.length; i ++)
|
||||
for (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 == '.')
|
||||
hasDot = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user