ios: Add a system directory '/var/mobile/Library/RetroArch'
All save games are store there. It is also searched for a retroarch.cfg file. If you want to run in the simulator you will need to create and give yourself access to this directory manually.
This commit is contained in:
parent
0e29ad3af2
commit
b4814a96f2
|
@ -15,5 +15,9 @@
|
|||
@property (strong, nonatomic) NSString *module_path;
|
||||
@property (strong, nonatomic) UINavigationController *navigator;
|
||||
@property (strong, nonatomic) NSString *nib_name;
|
||||
@property (strong, nonatomic) UIImage* file_icon;
|
||||
@property (strong, nonatomic) UIImage* folder_icon;
|
||||
|
||||
@property const char* system_directory;
|
||||
|
||||
@end
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// Copyright (c) 2013 RetroArch. All rights reserved.
|
||||
//
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define MAX_TOUCH 16
|
||||
extern struct
|
||||
{
|
||||
|
@ -25,8 +27,16 @@ extern uint32_t ios_current_touch_count ;
|
|||
|
||||
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
// TODO: Relocate this!
|
||||
self.system_directory = "/var/mobile/Library/RetroArch/";
|
||||
mkdir(self.system_directory, 0755);
|
||||
|
||||
bool is_iphone = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone;
|
||||
self.nib_name = is_iphone ? @"ViewController_iPhone" : @"ViewController_iPad";
|
||||
|
||||
self.file_icon = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ic_file" ofType:@"png"]];
|
||||
self.folder_icon = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ic_dir" ofType:@"png"]];
|
||||
|
||||
|
||||
self.navigator = [[UINavigationController alloc] initWithNibName:self.nib_name bundle:nil];
|
||||
[self.navigator pushViewController: [[module_list alloc] initWithNibName:self.nib_name bundle:nil] animated:YES];
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
|
||||
UITableView* table;
|
||||
struct dirent_list* files;
|
||||
|
||||
UIImage* file_icon;
|
||||
UIImage* folder_icon;
|
||||
};
|
||||
|
||||
- (id)load_path:(const char*)directory
|
||||
|
@ -43,9 +40,6 @@
|
|||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
file_icon = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ic_file" ofType:@"png"]];
|
||||
folder_icon = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"ic_dir" ofType:@"png"]];
|
||||
|
||||
table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 640, 480) style:UITableViewStylePlain];
|
||||
table.dataSource = self;
|
||||
table.delegate = self;
|
||||
|
@ -102,7 +96,7 @@
|
|||
{
|
||||
cell.textLabel.text = [[NSString string] initWithUTF8String:item->d_name];
|
||||
cell.accessoryType = (item->d_type) ? UITableViewCellAccessoryDisclosureIndicator : UITableViewCellAccessoryNone;
|
||||
cell.imageView.image = (item->d_type) ? folder_icon : file_icon;
|
||||
cell.imageView.image = (item->d_type) ? [RetroArch_iOS get].folder_icon : [RetroArch_iOS get].file_icon;
|
||||
[cell.imageView sizeToFit];
|
||||
}
|
||||
|
||||
|
|
|
@ -26,15 +26,16 @@ void ios_load_game(const char* file_name)
|
|||
{
|
||||
if(!ra_initialized && file_name)
|
||||
{
|
||||
const char* const sd = [RetroArch_iOS get].system_directory;
|
||||
const char* libretro = [[RetroArch_iOS get].module_path UTF8String];
|
||||
const char* overlay = [[[NSBundle mainBundle] pathForResource:@"overlay" ofType:@"cfg"] UTF8String];
|
||||
|
||||
printf("%s\n", overlay);
|
||||
|
||||
strcpy(g_settings.input.overlay, overlay ? overlay : "");
|
||||
char config_path[PATH_MAX];
|
||||
snprintf(config_path, PATH_MAX, "%s/retroarch.cfg", sd);
|
||||
config_path[PATH_MAX - 1] = 0;
|
||||
bool have_config = 0 == access(config_path, R_OK);
|
||||
|
||||
const char* argv[] = {"retroarch", "-L", libretro, file_name, 0};
|
||||
if (rarch_main_init(6, (char**)argv) == 0)
|
||||
struct rarch_main_wrap main_wrapper = {file_name, sd, sd, have_config ? config_path : 0, libretro};
|
||||
if (rarch_main_init_wrap(&main_wrapper) == 0)
|
||||
{
|
||||
rarch_init_msg_queue();
|
||||
ra_initialized = TRUE;
|
||||
|
|
Loading…
Reference in New Issue