(iOS) Move some cdoe from platform.m over to C
This commit is contained in:
parent
8759e43542
commit
3ec9581c68
|
@ -43,7 +43,7 @@ void apple_run_core(NSString* core, const char* file)
|
|||
fill_pathname_basedir(basedir, file, sizeof(basedir));
|
||||
if (file && access(basedir, R_OK | W_OK | X_OK))
|
||||
apple_display_alert(@"The directory containing the selected file has limited permissions. This may "
|
||||
"prevent zipped games from loading, and will cause some cores to not function.", 0);
|
||||
"prevent zipped content from loading, and will cause some cores to not function.", 0);
|
||||
#endif
|
||||
|
||||
[apple_platform loadingCore:core withFile:file];
|
||||
|
@ -91,7 +91,7 @@ void apple_run_core(NSString* core, const char* file)
|
|||
void apple_rarch_exited(void* result)
|
||||
{
|
||||
if (result)
|
||||
apple_display_alert(@"Failed to load game.", 0);
|
||||
apple_display_alert(@"Failed to load content.", 0);
|
||||
|
||||
NSString* used_core = apple_core;
|
||||
apple_core = 0;
|
||||
|
|
|
@ -368,7 +368,7 @@
|
|||
detail:^{ return weakSelf.core ? apple_get_core_display_name(weakSelf.core) : @"Auto Detect"; }],
|
||||
[RAMenuItemBasic itemWithDescription:@"Load Content" action:^{ [weakSelf loadGame]; }],
|
||||
[RAMenuItemBasic itemWithDescription:@"Load Content (History)" action:^{ [weakSelf loadHistory]; }],
|
||||
[RAMenuItemBasic itemWithDescription:@"Frontend Settings" action:^{ [[RetroArch_iOS get] showSystemSettings]; }]
|
||||
[RAMenuItemBasic itemWithDescription:@"Settings" action:^{ [[RetroArch_iOS get] showSystemSettings]; }]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../frontend/platform/platform_ios.h"
|
||||
#import "RetroArch_Apple.h"
|
||||
#include "rarch_wrapper.h"
|
||||
|
||||
|
@ -30,57 +31,6 @@
|
|||
|
||||
#include "file.h"
|
||||
|
||||
static struct
|
||||
{
|
||||
bool portrait;
|
||||
bool portrait_upside_down;
|
||||
bool landscape_left;
|
||||
bool landscape_right;
|
||||
|
||||
bool logging_enabled;
|
||||
|
||||
char bluetooth_mode[64];
|
||||
|
||||
struct
|
||||
{
|
||||
int stdout;
|
||||
int stderr;
|
||||
|
||||
FILE* file;
|
||||
} logging;
|
||||
} apple_frontend_settings;
|
||||
|
||||
const rarch_setting_t* apple_get_frontend_settings()
|
||||
{
|
||||
static rarch_setting_t settings[16];
|
||||
|
||||
settings[0] = setting_data_group_setting(ST_GROUP, "Frontend Settings");
|
||||
settings[1] = setting_data_group_setting(ST_SUB_GROUP, "Frontend");
|
||||
settings[2] = setting_data_bool_setting("ios_use_file_log", "Enable File Logging",
|
||||
&apple_frontend_settings.logging_enabled, false);
|
||||
settings[3] = setting_data_bool_setting("ios_tv_mode", "TV Mode", &apple_use_tv_mode, false);
|
||||
settings[4] = setting_data_group_setting(ST_END_SUB_GROUP, 0);
|
||||
|
||||
settings[5] = setting_data_group_setting(ST_SUB_GROUP, "Bluetooth");
|
||||
settings[6] = setting_data_string_setting("ios_btmode", "Mode", apple_frontend_settings.bluetooth_mode,
|
||||
sizeof(apple_frontend_settings.bluetooth_mode), "keyboard");
|
||||
settings[7] = setting_data_group_setting(ST_END_SUB_GROUP, 0);
|
||||
|
||||
settings[8] = setting_data_group_setting(ST_SUB_GROUP, "Orientations");
|
||||
settings[9] = setting_data_bool_setting("ios_allow_portrait", "Portrait",
|
||||
&apple_frontend_settings.portrait, true);
|
||||
settings[10] = setting_data_bool_setting("ios_allow_portrait_upside_down", "Portrait Upside Down",
|
||||
&apple_frontend_settings.portrait_upside_down, true);
|
||||
settings[11] = setting_data_bool_setting("ios_allow_landscape_left", "Landscape Left",
|
||||
&apple_frontend_settings.landscape_left, true);
|
||||
settings[12] = setting_data_bool_setting("ios_allow_landscape_right", "Landscape Right",
|
||||
&apple_frontend_settings.landscape_right, true);
|
||||
settings[13] = setting_data_group_setting(ST_END_SUB_GROUP, 0);
|
||||
settings[14] = setting_data_group_setting(ST_END_GROUP, 0);
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
//#define HAVE_DEBUG_FILELOG
|
||||
bool is_ios_7()
|
||||
{
|
||||
|
@ -104,29 +54,6 @@ void ios_set_bluetooth_mode(NSString* mode)
|
|||
#endif
|
||||
}
|
||||
|
||||
void ios_set_logging_state(bool on)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
if (on && !apple_frontend_settings.logging.file)
|
||||
{
|
||||
apple_frontend_settings.logging.file = fopen([RetroArch_iOS get].logPath.UTF8String, "a");
|
||||
apple_frontend_settings.logging.stdout = dup(1);
|
||||
apple_frontend_settings.logging.stderr = dup(2);
|
||||
dup2(fileno(apple_frontend_settings.logging.file), 1);
|
||||
dup2(fileno(apple_frontend_settings.logging.file), 2);
|
||||
}
|
||||
else if (!on && apple_frontend_settings.logging.file)
|
||||
{
|
||||
dup2(apple_frontend_settings.logging.stdout, 1);
|
||||
dup2(apple_frontend_settings.logging.stderr, 2);
|
||||
|
||||
fclose(apple_frontend_settings.logging.file);
|
||||
apple_frontend_settings.logging.file = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Input helpers: This is kept here because it needs objective-c
|
||||
static void handle_touch_event(NSArray* touches)
|
||||
{
|
||||
|
@ -368,9 +295,7 @@ static void handle_touch_event(NSArray* touches)
|
|||
|
||||
// Set bluetooth mode
|
||||
ios_set_bluetooth_mode(@(apple_frontend_settings.bluetooth_mode));
|
||||
ios_set_logging_state(apple_frontend_settings.logging_enabled);
|
||||
|
||||
|
||||
ios_set_logging_state([RetroArch_iOS get].logPath.UTF8String, apple_frontend_settings.logging_enabled);
|
||||
}
|
||||
|
||||
#pragma mark PAUSE MENU
|
||||
|
@ -397,4 +322,3 @@ int main(int argc, char *argv[])
|
|||
return UIApplicationMain(argc, argv, NSStringFromClass([RApplication class]), NSStringFromClass([RetroArch_iOS class]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
#include <pthread.h>
|
||||
#include "../../apple/common/rarch_wrapper.h"
|
||||
#include "../../apple/common/apple_export.h"
|
||||
#include "../../apple/common/setting_data.h"
|
||||
|
||||
#include "../frontend_context.h"
|
||||
#include "platform_ios.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../../boolean.h"
|
||||
|
@ -178,6 +180,62 @@ void *rarch_main_spring(void* args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef IOS
|
||||
const void* apple_get_frontend_settings(void)
|
||||
{
|
||||
static rarch_setting_t settings[16];
|
||||
|
||||
settings[0] = setting_data_group_setting(ST_GROUP, "Frontend Settings");
|
||||
settings[1] = setting_data_group_setting(ST_SUB_GROUP, "Frontend");
|
||||
settings[2] = setting_data_bool_setting("ios_use_file_log", "Enable File Logging",
|
||||
&apple_frontend_settings.logging_enabled, false);
|
||||
settings[3] = setting_data_bool_setting("ios_tv_mode", "TV Mode", &apple_use_tv_mode, false);
|
||||
settings[4] = setting_data_group_setting(ST_END_SUB_GROUP, 0);
|
||||
|
||||
settings[5] = setting_data_group_setting(ST_SUB_GROUP, "Bluetooth");
|
||||
settings[6] = setting_data_string_setting("ios_btmode", "Mode", apple_frontend_settings.bluetooth_mode,
|
||||
sizeof(apple_frontend_settings.bluetooth_mode), "keyboard");
|
||||
settings[7] = setting_data_group_setting(ST_END_SUB_GROUP, 0);
|
||||
|
||||
settings[8] = setting_data_group_setting(ST_SUB_GROUP, "Orientations");
|
||||
settings[9] = setting_data_bool_setting("ios_allow_portrait", "Portrait",
|
||||
&apple_frontend_settings.portrait, true);
|
||||
settings[10] = setting_data_bool_setting("ios_allow_portrait_upside_down", "Portrait Upside Down",
|
||||
&apple_frontend_settings.portrait_upside_down, true);
|
||||
settings[11] = setting_data_bool_setting("ios_allow_landscape_left", "Landscape Left",
|
||||
&apple_frontend_settings.landscape_left, true);
|
||||
settings[12] = setting_data_bool_setting("ios_allow_landscape_right", "Landscape Right",
|
||||
&apple_frontend_settings.landscape_right, true);
|
||||
settings[13] = setting_data_group_setting(ST_END_SUB_GROUP, 0);
|
||||
settings[14] = setting_data_group_setting(ST_END_GROUP, 0);
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
void ios_set_logging_state(const char *log_path, bool on)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
if (on && !apple_frontend_settings.logging.file)
|
||||
{
|
||||
apple_frontend_settings.logging.file = fopen(log_path, "a");
|
||||
apple_frontend_settings.logging.stdout = dup(1);
|
||||
apple_frontend_settings.logging.stderr = dup(2);
|
||||
dup2(fileno(apple_frontend_settings.logging.file), 1);
|
||||
dup2(fileno(apple_frontend_settings.logging.file), 2);
|
||||
}
|
||||
else if (!on && apple_frontend_settings.logging.file)
|
||||
{
|
||||
dup2(apple_frontend_settings.logging.stdout, 1);
|
||||
dup2(apple_frontend_settings.logging.stderr, 2);
|
||||
|
||||
fclose(apple_frontend_settings.logging.file);
|
||||
apple_frontend_settings.logging.file = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const frontend_ctx_driver_t frontend_ctx_apple = {
|
||||
NULL, /* environment_get */
|
||||
NULL, /* init */
|
||||
|
|
Loading…
Reference in New Issue