diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index c6ccb15414..0d604113c1 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -600,7 +600,6 @@ static const void* const associated_core_key = &associated_core_key; - (id)init { - const rarch_setting_t* apple_get_frontend_settings(); const rarch_setting_t* frontend_setting_data = apple_get_frontend_settings(); if ((self = [super initWithGroup:frontend_setting_data])) @@ -633,7 +632,6 @@ static const void* const associated_core_key = &associated_core_key; - (void)dealloc { - const rarch_setting_t* apple_get_frontend_settings(); setting_data_save_config_path(apple_get_frontend_settings(), [RetroArch_iOS get].systemConfigPath.UTF8String); [[RetroArch_iOS get] refreshSystemConfig]; } diff --git a/apple/iOS/platform.h b/apple/iOS/platform.h index ac2cacbebd..12f4bfd314 100644 --- a/apple/iOS/platform.h +++ b/apple/iOS/platform.h @@ -20,6 +20,30 @@ #import #include "views.h" +typedef 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_t; +extern apple_frontend_settings_t apple_frontend_settings; + +const void* apple_get_frontend_settings(void); + + @interface RAGameView : UIViewController + (RAGameView*)get; - (void)iOS7SetiCadeMode:(bool)on; diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index f7997d99c9..2d51a1b01a 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -16,7 +16,6 @@ #include #include -#include "../../frontend/platform/platform_ios.h" #import "RetroArch_Apple.h" #include "rarch_wrapper.h" @@ -31,6 +30,8 @@ #include "file.h" +apple_frontend_settings_t apple_frontend_settings; + //#define HAVE_DEBUG_FILELOG bool is_ios_7() { @@ -54,6 +55,64 @@ void ios_set_bluetooth_mode(NSString* mode) #endif } +const void* apple_get_frontend_settings(void) +{ + static rarch_setting_t settings[16]; + + if (settings[0].type == ST_NONE) + { + 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(ST_STRING, "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; + } +} + + // Input helpers: This is kept here because it needs objective-c static void handle_touch_event(NSArray* touches) { diff --git a/frontend/platform/platform_apple.c b/frontend/platform/platform_apple.c index d3b92b692d..fafe120f84 100644 --- a/frontend/platform/platform_apple.c +++ b/frontend/platform/platform_apple.c @@ -21,7 +21,6 @@ #include "../../apple/common/setting_data.h" #include "../frontend_context.h" -#include "platform_ios.h" #include #include "../../boolean.h" @@ -180,62 +179,6 @@ 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(ST_STRING, "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 */ diff --git a/frontend/platform/platform_ios.h b/frontend/platform/platform_ios.h deleted file mode 100644 index f0b89ace0c..0000000000 --- a/frontend/platform/platform_ios.h +++ /dev/null @@ -1,48 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2013 - Jason Fetters - * Copyright (C) 2011-2013 - Daniel De Matteis - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef _RARCH_PLATFORM_IOS_H -#define _RARCH_PLATFORM_IOS_H - -#include -#include - -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 void* apple_get_frontend_settings(void); -void ios_set_logging_state(const char *log_path, bool on); - -extern bool apple_use_tv_mode; - -#endif