mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 06:18:34 +00:00
(Apple) apple_display_alert - turn two NSString *params into const char*
This commit is contained in:
parent
b765ac5634
commit
7306a124d6
@ -169,7 +169,7 @@ static char** waiting_argv;
|
||||
if (cb.numberOfItems)
|
||||
[cb selectItemAtIndex:0];
|
||||
else
|
||||
apple_display_alert(BOXSTRING("No libretro cores were found.\nSelect \"Go->Cores Directory\" from the menu and place libretro dylib files there."), BOXSTRING("RetroArch"));
|
||||
apple_display_alert("No libretro cores were found.\nSelect \"Go->Cores Directory\" from the menu and place libretro dylib files there.", "RetroArch");
|
||||
|
||||
if (waiting_argc)
|
||||
{
|
||||
@ -221,7 +221,7 @@ static char** waiting_argv;
|
||||
}
|
||||
else
|
||||
{
|
||||
apple_display_alert(BOXSTRING("Cannot open multiple files"), BOXSTRING("RetroArch"));
|
||||
apple_display_alert("Cannot open multiple files", "RetroArch");
|
||||
[sender replyToOpenOrPrint:NSApplicationDelegateReplyFailure];
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ extern void apple_start_iteration();
|
||||
extern void apple_stop_iteration();
|
||||
|
||||
// utility.m
|
||||
extern void apple_display_alert(NSString* message, NSString* title);
|
||||
extern void apple_display_alert(const char *message, const char *title);
|
||||
extern NSString *objc_get_value_from_config(config_file_t* config, NSString* name, NSString* defaultValue);
|
||||
extern NSString *apple_get_core_id(const core_info_t *core);
|
||||
extern NSString *apple_get_core_display_name(NSString *core_id);
|
||||
|
@ -95,9 +95,9 @@ void apple_run_core(NSString* core, const char* file)
|
||||
char basedir[256];
|
||||
fill_pathname_basedir(basedir, file ? file : "", sizeof(basedir));
|
||||
if (file && access(basedir, R_OK | W_OK | X_OK))
|
||||
apple_display_alert(BOXSTRING("The directory containing the selected file must have write premissions. This will prevent zipped content from loading, and will cause some cores to not function."), 0);
|
||||
apple_display_alert("The directory containing the selected file must have write premissions. This will prevent zipped content from loading, and will cause some cores to not function.", "Warning");
|
||||
else
|
||||
apple_display_alert(BOXSTRING("Failed to load content."), 0);
|
||||
apple_display_alert("Failed to load content.", "Error");
|
||||
|
||||
apple_rarch_exited();
|
||||
}
|
||||
|
@ -21,11 +21,11 @@
|
||||
#include "../../general.h"
|
||||
#include "../../file.h"
|
||||
|
||||
void apple_display_alert(NSString* message, NSString* title)
|
||||
void apple_display_alert(const char *message, const char *title)
|
||||
{
|
||||
#ifdef IOS
|
||||
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title ? title : BOXSTRING("RetroArch")
|
||||
message:message
|
||||
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title ? BOXSTRING(title) : BOXSTRING("RetroArch")
|
||||
message:BOXSTRING(message)
|
||||
delegate:nil
|
||||
cancelButtonTitle:BOXSTRING("OK")
|
||||
otherButtonTitles:nil];
|
||||
@ -33,8 +33,8 @@ void apple_display_alert(NSString* message, NSString* title)
|
||||
#else
|
||||
NSAlert* alert = [[NSAlert new] autorelease];
|
||||
|
||||
[alert setMessageText:title ? title : BOXSTRING("RetroArch")];
|
||||
[alert setInformativeText:message];
|
||||
[alert setMessageText:(*title) ? BOXSTRING(title) : BOXSTRING("RetroArch")];
|
||||
[alert setInformativeText:BOXSTRING(message)];
|
||||
[alert setAlertStyle:NSInformationalAlertStyle];
|
||||
[alert beginSheetModalForWindow:[RetroArch_OSX get].window
|
||||
modalDelegate:apple_platform
|
||||
|
@ -34,7 +34,9 @@ static bool zlib_extract_callback(const char *name,
|
||||
|
||||
if (cmode != 0 && cmode != 8)
|
||||
{
|
||||
apple_display_alert([NSString stringWithFormat:@"Could not unzip %s (unknown mode %d)", name, cmode], @"Action Failed");
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "Could not unzip %s (unknown mode %d)", name, cmode);
|
||||
apple_display_alert(msg, "Action Failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -65,13 +67,13 @@ static bool zlib_extract_callback(const char *name,
|
||||
static void unzip_file(const char* path, const char* output_directory)
|
||||
{
|
||||
if (!path_file_exists(path))
|
||||
apple_display_alert(@"Could not locate zip file.", @"Action Failed");
|
||||
apple_display_alert("Could not locate zip file.", "Action Failed");
|
||||
else if (path_is_directory(output_directory))
|
||||
apple_display_alert(@"Output directory for zip must not already exist.", @"Action Failed");
|
||||
apple_display_alert("Output directory for zip must not already exist.", "Action Failed");
|
||||
else if (!path_mkdir(output_directory))
|
||||
apple_display_alert(@"Could not create output directory to extract zip.", @"Action Failed");
|
||||
apple_display_alert("Could not create output directory to extract zip.", "Action Failed");
|
||||
else if (!zlib_parse_file(path, zlib_extract_callback, (void*)output_directory))
|
||||
apple_display_alert(@"Could not process zip file.", @"Action Failed");
|
||||
apple_display_alert("Could not process zip file.", "Action Failed");
|
||||
}
|
||||
|
||||
enum file_action { FA_DELETE = 10000, FA_CREATE, FA_MOVE, FA_UNZIP };
|
||||
@ -92,7 +94,7 @@ static void file_action(enum file_action action, NSString* source, NSString* tar
|
||||
}
|
||||
|
||||
if (!result && error)
|
||||
apple_display_alert(error.localizedDescription, @"Action failed");
|
||||
apple_display_alert(error.localizedDescription.UTF8String, "Action failed");
|
||||
}
|
||||
|
||||
@implementation RADirectoryItem
|
||||
@ -369,7 +371,7 @@ static void file_action(enum file_action action, NSString* source, NSString* tar
|
||||
[alertView show];
|
||||
}
|
||||
else if (![action isEqualToString:@"Cancel"])// Zip
|
||||
apple_display_alert(@"Action not supported.", @"Action Failed");
|
||||
apple_display_alert("Action not supported.", "Action Failed");
|
||||
}
|
||||
|
||||
// Called by various alert views created in this class, the alertView.tag value is the action to take.
|
||||
|
@ -238,13 +238,21 @@ static void handle_touch_event(NSArray* touches)
|
||||
const char *path = [self.documentsDirectory UTF8String];
|
||||
path_mkdir(path);
|
||||
if (access(path, 0755) != 0)
|
||||
apple_display_alert([NSString stringWithFormat:@"Failed to create or access base directory: %@", self.documentsDirectory], 0);
|
||||
{
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "Failed to create or access base directory: %s", self.documentsDirectory.UTF8String);
|
||||
apple_display_alert(msg, "Error");
|
||||
}
|
||||
else
|
||||
{
|
||||
path = [self.systemDirectory UTF8String];
|
||||
path_mkdir(path);
|
||||
if (access(path, 0755) != 0)
|
||||
apple_display_alert([NSString stringWithFormat:@"Failed to create or access system directory: %@", self.systemDirectory], 0);
|
||||
{
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg), "Failed to create or access system directory: %s", self.systemDirectory.UTF8String);
|
||||
apple_display_alert(msg, "Error");
|
||||
}
|
||||
else
|
||||
[self pushViewController:[RAMainMenu new] animated:YES];
|
||||
}
|
||||
@ -256,7 +264,7 @@ static void handle_touch_event(NSArray* touches)
|
||||
const core_info_list_t* core_list = (const core_info_list_t*)core_info_list_get();
|
||||
|
||||
if (!core_list || core_list->count == 0)
|
||||
apple_display_alert(@"No libretro cores were found. You will not be able to run any content.", 0);
|
||||
apple_display_alert("No libretro cores were found. You will not be able to run any content.", "Warning");
|
||||
|
||||
apple_gamecontroller_init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user