(Apple) Refactor away apple_get_core_id
This commit is contained in:
parent
1754acb500
commit
f64b772ceb
|
@ -156,10 +156,12 @@ static char** waiting_argv;
|
||||||
|
|
||||||
for (i = 0; core_list && i < core_list->count; i ++)
|
for (i = 0; core_list && i < core_list->count; i ++)
|
||||||
{
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
NSString* desc = (NSString*)BOXSTRING(core_list->list[i].display_name);
|
NSString* desc = (NSString*)BOXSTRING(core_list->list[i].display_name);
|
||||||
|
NSString *__core = BOXSTRING(core_info_get_id(&core_list->list[i], buf, sizeof(buf)));
|
||||||
#if defined(MAC_OS_X_VERSION_10_6)
|
#if defined(MAC_OS_X_VERSION_10_6)
|
||||||
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
|
||||||
objc_setAssociatedObject(desc, associated_core_key, apple_get_core_id(&core_list->list[i]), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
objc_setAssociatedObject(desc, associated_core_key, __core, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
#endif
|
#endif
|
||||||
[cb addItemWithObjectValue:desc];
|
[cb addItemWithObjectValue:desc];
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ extern void apple_stop_iteration();
|
||||||
|
|
||||||
// utility.m
|
// utility.m
|
||||||
extern void apple_display_alert(const char *message, const char *title);
|
extern void apple_display_alert(const char *message, const char *title);
|
||||||
extern NSString *apple_get_core_id(const core_info_t *core);
|
|
||||||
|
|
||||||
@interface RANumberFormatter : NSNumberFormatter
|
@interface RANumberFormatter : NSNumberFormatter
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
|
|
|
@ -44,13 +44,6 @@ void apple_display_alert(const char *message, const char *title)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a core ID as an NSString
|
|
||||||
NSString *apple_get_core_id(const core_info_t *core)
|
|
||||||
{
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
return BOXSTRING(core_info_get_id(core, buf, sizeof(buf)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Number formatter class for setting strings
|
// Number formatter class for setting strings
|
||||||
@implementation RANumberFormatter
|
@implementation RANumberFormatter
|
||||||
- (id)initWithSetting:(const rarch_setting_t*)setting
|
- (id)initWithSetting:(const rarch_setting_t*)setting
|
||||||
|
|
|
@ -883,7 +883,8 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||||
|
|
||||||
for (i = 0; i < core_list->count; i ++)
|
for (i = 0; i < core_list->count; i ++)
|
||||||
{
|
{
|
||||||
NSString* core_id = (NSString*)apple_get_core_id(&core_list->list[i]);
|
char buf[PATH_MAX];
|
||||||
|
NSString* core_id = BOXSTRING(core_info_get_id(&core_list->list[i], buf, sizeof(buf)));
|
||||||
|
|
||||||
if (core_info_has_custom_config(core_id.UTF8String))
|
if (core_info_has_custom_config(core_id.UTF8String))
|
||||||
{
|
{
|
||||||
|
@ -1091,13 +1092,16 @@ static bool copy_config(const char *src_path, const char *dst_path)
|
||||||
{
|
{
|
||||||
if (_path)
|
if (_path)
|
||||||
{
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
const core_info_t* core_support = NULL;
|
const core_info_t* core_support = NULL;
|
||||||
size_t core_count = 0;
|
size_t core_count = 0;
|
||||||
|
NSString *__core;
|
||||||
|
|
||||||
core_info_list_get_supported_cores(core_list, _path.UTF8String, &core_support, &core_count);
|
core_info_list_get_supported_cores(core_list, _path.UTF8String, &core_support, &core_count);
|
||||||
|
__core = BOXSTRING(core_info_get_id(&core_support[0], buf, sizeof(buf)));
|
||||||
|
|
||||||
if (core_count == 1 && _action)
|
if (core_count == 1 && _action)
|
||||||
[self runAction:apple_get_core_id(&core_support[0])];
|
[self runAction:__core];
|
||||||
else if (core_count > 1)
|
else if (core_count > 1)
|
||||||
[self load:(uint32_t)core_count coresFromList:core_support toSection:core_section];
|
[self load:(uint32_t)core_count coresFromList:core_support toSection:core_section];
|
||||||
}
|
}
|
||||||
|
@ -1121,9 +1125,10 @@ static bool copy_config(const char *src_path, const char *dst_path)
|
||||||
- (void)load:(uint32_t)count coresFromList:(const core_info_t*)list toSection:(NSMutableArray*)array
|
- (void)load:(uint32_t)count coresFromList:(const core_info_t*)list toSection:(NSMutableArray*)array
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
[array addObject:[[RAMenuItemCoreList alloc] initWithCore:apple_get_core_id(&list[i]) parent:self]];
|
[array addObject:[[RAMenuItemCoreList alloc] initWithCore:BOXSTRING(core_info_get_id(&list[i], buf, sizeof(buf))) parent:self]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue