Start spliting ios port into dual OS X and iOS ports

This commit is contained in:
meancoot 2013-07-06 18:24:25 -04:00
parent 7c74542c58
commit a852da4e88
77 changed files with 243 additions and 161 deletions

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -13,8 +13,9 @@
96297A0F16C5AEA100E6DCE0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 96297A0E16C5AEA100E6DCE0 /* main.m */; }; 96297A0F16C5AEA100E6DCE0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 96297A0E16C5AEA100E6DCE0 /* main.m */; };
96297A2716C82FF100E6DCE0 /* overlays in Resources */ = {isa = PBXBuildFile; fileRef = 96297A2616C82FF100E6DCE0 /* overlays */; }; 96297A2716C82FF100E6DCE0 /* overlays in Resources */ = {isa = PBXBuildFile; fileRef = 96297A2616C82FF100E6DCE0 /* overlays */; };
96337E82176AC6E5004685F3 /* utility.m in Sources */ = {isa = PBXBuildFile; fileRef = 96337E81176AC6E5004685F3 /* utility.m */; }; 96337E82176AC6E5004685F3 /* utility.m in Sources */ = {isa = PBXBuildFile; fileRef = 96337E81176AC6E5004685F3 /* utility.m */; };
96337E84176AD5D9004685F3 /* browser.m in Sources */ = {isa = PBXBuildFile; fileRef = 96337E83176AD5D9004685F3 /* browser.m */; }; 96355CCE1788C90B0010DBFA /* browser.m in Sources */ = {isa = PBXBuildFile; fileRef = 96355CCA1788C90B0010DBFA /* browser.m */; };
96337E86176AD6B6004685F3 /* settings.m in Sources */ = {isa = PBXBuildFile; fileRef = 96337E85176AD6B6004685F3 /* settings.m */; }; 96355CCF1788C90B0010DBFA /* RALogView.m in Sources */ = {isa = PBXBuildFile; fileRef = 96355CCB1788C90B0010DBFA /* RALogView.m */; };
96355CD01788C90B0010DBFA /* settings.m in Sources */ = {isa = PBXBuildFile; fileRef = 96355CCC1788C90B0010DBFA /* settings.m */; };
96366C5516C9AC3300D64A22 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96366C5416C9AC3300D64A22 /* CoreAudio.framework */; }; 96366C5516C9AC3300D64A22 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96366C5416C9AC3300D64A22 /* CoreAudio.framework */; };
96366C5916C9ACF500D64A22 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96366C5816C9ACF500D64A22 /* AudioToolbox.framework */; }; 96366C5916C9ACF500D64A22 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96366C5816C9ACF500D64A22 /* AudioToolbox.framework */; };
963F5AC816CC523B009BBD19 /* RAGameView.m in Sources */ = {isa = PBXBuildFile; fileRef = 963F5AC516CC523B009BBD19 /* RAGameView.m */; }; 963F5AC816CC523B009BBD19 /* RAGameView.m in Sources */ = {isa = PBXBuildFile; fileRef = 963F5AC516CC523B009BBD19 /* RAGameView.m */; };
@ -33,7 +34,6 @@
96AFAE3016C1D4EA009DE44C /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96AFAE2F16C1D4EA009DE44C /* GLKit.framework */; }; 96AFAE3016C1D4EA009DE44C /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96AFAE2F16C1D4EA009DE44C /* GLKit.framework */; };
96AFAE3216C1D4EA009DE44C /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96AFAE3116C1D4EA009DE44C /* OpenGLES.framework */; }; 96AFAE3216C1D4EA009DE44C /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96AFAE3116C1D4EA009DE44C /* OpenGLES.framework */; };
96AFAE3816C1D4EA009DE44C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96AFAE3616C1D4EA009DE44C /* InfoPlist.strings */; }; 96AFAE3816C1D4EA009DE44C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96AFAE3616C1D4EA009DE44C /* InfoPlist.strings */; };
96F9C28316FFA55F002455B3 /* RALogView.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F9C28216FFA55F002455B3 /* RALogView.m */; };
D48581DE16F823F9004BEB17 /* griffin.c in Sources */ = {isa = PBXBuildFile; fileRef = D48581DD16F823F9004BEB17 /* griffin.c */; }; D48581DE16F823F9004BEB17 /* griffin.c in Sources */ = {isa = PBXBuildFile; fileRef = D48581DD16F823F9004BEB17 /* griffin.c */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -43,13 +43,15 @@
9614C71F16DDC018000B36EF /* RetroArch copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "RetroArch copy-Info.plist"; path = "/Users/jason/Documents/Projects/ios/RetroArch/ios/RetroArch copy-Info.plist"; sourceTree = "<absolute>"; }; 9614C71F16DDC018000B36EF /* RetroArch copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "RetroArch copy-Info.plist"; path = "/Users/jason/Documents/Projects/ios/RetroArch/ios/RetroArch copy-Info.plist"; sourceTree = "<absolute>"; };
962979F416C43B9500E6DCE0 /* ic_dir.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_dir.png; path = "../../android/phoenix/res/drawable-xhdpi/ic_dir.png"; sourceTree = "<group>"; }; 962979F416C43B9500E6DCE0 /* ic_dir.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_dir.png; path = "../../android/phoenix/res/drawable-xhdpi/ic_dir.png"; sourceTree = "<group>"; };
962979F516C43B9500E6DCE0 /* ic_file.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_file.png; path = "../../android/phoenix/res/drawable-xhdpi/ic_file.png"; sourceTree = "<group>"; }; 962979F516C43B9500E6DCE0 /* ic_file.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ic_file.png; path = "../../android/phoenix/res/drawable-xhdpi/ic_file.png"; sourceTree = "<group>"; };
96297A0A16C5AD8D00E6DCE0 /* RetroArch_iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RetroArch_iOS.h; sourceTree = "<group>"; };
96297A0D16C5ADDA00E6DCE0 /* views.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = views.h; sourceTree = "<group>"; };
96297A0E16C5AEA100E6DCE0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 96297A0E16C5AEA100E6DCE0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
96297A2616C82FF100E6DCE0 /* overlays */ = {isa = PBXFileReference; lastKnownFileType = folder; name = overlays; path = ../../media/overlays; sourceTree = "<group>"; }; 96297A2616C82FF100E6DCE0 /* overlays */ = {isa = PBXFileReference; lastKnownFileType = folder; name = overlays; path = ../../media/overlays; sourceTree = "<group>"; };
96337E81176AC6E5004685F3 /* utility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = utility.m; sourceTree = "<group>"; }; 96337E81176AC6E5004685F3 /* utility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = utility.m; sourceTree = "<group>"; };
96337E83176AD5D9004685F3 /* browser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = browser.m; sourceTree = "<group>"; }; 96355CC81788C8FC0010DBFA /* RAGameView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAGameView.h; sourceTree = "<group>"; };
96337E85176AD6B6004685F3 /* settings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = settings.m; sourceTree = "<group>"; }; 96355CCA1788C90B0010DBFA /* browser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = browser.m; sourceTree = "<group>"; };
96355CCB1788C90B0010DBFA /* RALogView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RALogView.m; sourceTree = "<group>"; };
96355CCC1788C90B0010DBFA /* settings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = settings.m; sourceTree = "<group>"; };
96355CCD1788C90B0010DBFA /* views.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = views.h; sourceTree = "<group>"; };
96355CD11788CF190010DBFA /* RetroArch_Apple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RetroArch_Apple.h; sourceTree = "<group>"; };
96366C5416C9AC3300D64A22 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 96366C5416C9AC3300D64A22 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
96366C5816C9ACF500D64A22 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 96366C5816C9ACF500D64A22 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
963F5AC516CC523B009BBD19 /* RAGameView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAGameView.m; sourceTree = "<group>"; }; 963F5AC516CC523B009BBD19 /* RAGameView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAGameView.m; sourceTree = "<group>"; };
@ -76,7 +78,6 @@
96AFAF4516C1E00A009DE44C /* bitmap.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = bitmap.bin; sourceTree = "<group>"; }; 96AFAF4516C1E00A009DE44C /* bitmap.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = bitmap.bin; sourceTree = "<group>"; };
96AFAF4616C1E00A009DE44C /* bitmap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = bitmap.bmp; sourceTree = "<group>"; }; 96AFAF4616C1E00A009DE44C /* bitmap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = bitmap.bmp; sourceTree = "<group>"; };
96C19C2616D455BE00FE8D5A /* rarch_wrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rarch_wrapper.h; sourceTree = "<group>"; }; 96C19C2616D455BE00FE8D5A /* rarch_wrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rarch_wrapper.h; sourceTree = "<group>"; };
96F9C28216FFA55F002455B3 /* RALogView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RALogView.m; sourceTree = "<group>"; };
D48581DD16F823F9004BEB17 /* griffin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = griffin.c; path = ../griffin/griffin.c; sourceTree = "<group>"; }; D48581DD16F823F9004BEB17 /* griffin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = griffin.c; path = ../griffin/griffin.c; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -98,6 +99,17 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
96355CC91788C90B0010DBFA /* iOS */ = {
isa = PBXGroup;
children = (
96355CCA1788C90B0010DBFA /* browser.m */,
96355CCB1788C90B0010DBFA /* RALogView.m */,
96355CCC1788C90B0010DBFA /* settings.m */,
96355CCD1788C90B0010DBFA /* views.h */,
);
path = iOS;
sourceTree = "<group>";
};
966B9CB716E41E7A005B61E1 /* Assets */ = { 966B9CB716E41E7A005B61E1 /* Assets */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -154,17 +166,15 @@
96AFAE3316C1D4EA009DE44C /* RetroArch */ = { 96AFAE3316C1D4EA009DE44C /* RetroArch */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96337E83176AD5D9004685F3 /* browser.m */, 96355CC91788C90B0010DBFA /* iOS */,
96297A0E16C5AEA100E6DCE0 /* main.m */, 96297A0E16C5AEA100E6DCE0 /* main.m */,
963F5AC516CC523B009BBD19 /* RAGameView.m */, 963F5AC516CC523B009BBD19 /* RAGameView.m */,
96F9C28216FFA55F002455B3 /* RALogView.m */, 96355CC81788C8FC0010DBFA /* RAGameView.h */,
9605EA9A170288EA001D47B0 /* RAModuleInfo.m */, 9605EA9A170288EA001D47B0 /* RAModuleInfo.m */,
9605EA99170288EA001D47B0 /* RAModuleInfo.h */, 9605EA99170288EA001D47B0 /* RAModuleInfo.h */,
96C19C2616D455BE00FE8D5A /* rarch_wrapper.h */, 96C19C2616D455BE00FE8D5A /* rarch_wrapper.h */,
96297A0A16C5AD8D00E6DCE0 /* RetroArch_iOS.h */, 96355CD11788CF190010DBFA /* RetroArch_Apple.h */,
96337E85176AD6B6004685F3 /* settings.m */,
96337E81176AC6E5004685F3 /* utility.m */, 96337E81176AC6E5004685F3 /* utility.m */,
96297A0D16C5ADDA00E6DCE0 /* views.h */,
); );
path = RetroArch; path = RetroArch;
sourceTree = "<group>"; sourceTree = "<group>";
@ -304,11 +314,11 @@
96297A0F16C5AEA100E6DCE0 /* main.m in Sources */, 96297A0F16C5AEA100E6DCE0 /* main.m in Sources */,
963F5AC816CC523B009BBD19 /* RAGameView.m in Sources */, 963F5AC816CC523B009BBD19 /* RAGameView.m in Sources */,
D48581DE16F823F9004BEB17 /* griffin.c in Sources */, D48581DE16F823F9004BEB17 /* griffin.c in Sources */,
96F9C28316FFA55F002455B3 /* RALogView.m in Sources */,
9605EA9B170288EA001D47B0 /* RAModuleInfo.m in Sources */, 9605EA9B170288EA001D47B0 /* RAModuleInfo.m in Sources */,
96337E82176AC6E5004685F3 /* utility.m in Sources */, 96337E82176AC6E5004685F3 /* utility.m in Sources */,
96337E84176AD5D9004685F3 /* browser.m in Sources */, 96355CCE1788C90B0010DBFA /* browser.m in Sources */,
96337E86176AD6B6004685F3 /* settings.m in Sources */, 96355CCF1788C90B0010DBFA /* RALogView.m in Sources */,
96355CD01788C90B0010DBFA /* settings.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#import "RetroArch_iOS.h" #import "RetroArch_Apple.h"
#import "views.h" #import "views.h"
#include "rarch_wrapper.h" #include "rarch_wrapper.h"
#include "input/ios_input.h" #include "input/ios_input.h"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#import "RetroArch_iOS.h" #import "RetroArch_Apple.h"
#import "RAModuleInfo.h" #import "RAModuleInfo.h"
#import "views.h" #import "views.h"
@ -156,7 +156,7 @@ static NSString* build_string_pair(NSString* stringA, NSString* stringB)
if (indexPath.section == _firmwareSectionIndex) if (indexPath.section == _firmwareSectionIndex)
{ {
NSString* item = (NSString*)[self itemForIndexPath:indexPath]; NSString* item = (NSString*)[self itemForIndexPath:indexPath];
ios_display_alert(objc_getAssociatedObject(item, "OTHER"), item); apple_display_alert(objc_getAssociatedObject(item, "OTHER"), item);
} }
} }

View File

@ -19,11 +19,22 @@
#import "RAModuleInfo.h" #import "RAModuleInfo.h"
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate> void apple_run_core(RAModuleInfo* core, const char* file);
@protocol RetroArch_Platform
- (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file;
- (void)unloadingCore:(RAModuleInfo*)core;
@end
#ifdef IOS
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate, RetroArch_Platform>
+ (RetroArch_iOS*)get; + (RetroArch_iOS*)get;
- (void)runGame:(NSString*)path withModule:(RAModuleInfo*)module; - (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file;
- (void)unloadingCore:(RAModuleInfo*)core;
- (void)refreshConfig; - (void)refreshConfig;
- (void)refreshSystemConfig; - (void)refreshSystemConfig;
@ -33,8 +44,10 @@
@end @end
#endif
// utility.m // utility.m
extern void ios_display_alert(NSString* message, NSString* title); extern void apple_display_alert(NSString* message, NSString* title);
extern void objc_clear_config_hack(); extern void objc_clear_config_hack();
extern bool path_make_and_check_directory(const char* path, mode_t mode, int amode); extern bool path_make_and_check_directory(const char* path, mode_t mode, int amode);
extern NSString* objc_get_value_from_config(config_file_t* config, NSString* name, NSString* defaultValue); extern NSString* objc_get_value_from_config(config_file_t* config, NSString* name, NSString* defaultValue);

View File

@ -16,7 +16,7 @@
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
#import "RetroArch_iOS.h" #import "../RetroArch_Apple.h"
#import "views.h" #import "views.h"
#include "conf/config_file.h" #include "conf/config_file.h"
@ -115,7 +115,7 @@
} }
} }
else else
ios_display_alert([NSString stringWithFormat:@"Browsed path is not a directory: %@", _path], 0); apple_display_alert([NSString stringWithFormat:@"Browsed path is not a directory: %@", _path], 0);
[self.tableView reloadData]; [self.tableView reloadData];
} }
@ -129,8 +129,8 @@
else else
{ {
if (access(_path.UTF8String, R_OK | W_OK | X_OK)) if (access(_path.UTF8String, R_OK | W_OK | X_OK))
ios_display_alert(@"The directory containing the selected file has limited permissions. This may " 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 games from loading, and will cause some cores to not function.", 0);
[[RetroArch_iOS get] pushViewController:[[RAModuleList alloc] initWithGame:path.path] animated:YES]; [[RetroArch_iOS get] pushViewController:[[RAModuleList alloc] initWithGame:path.path] animated:YES];
} }
@ -190,7 +190,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
[RetroArch_iOS.get runGame:_game withModule:(RAModuleInfo*)[self itemForIndexPath:indexPath]]; apple_run_core((RAModuleInfo*)[self itemForIndexPath:indexPath], _game.UTF8String);
} }
- (void)infoButtonTapped:(id)sender - (void)infoButtonTapped:(id)sender
@ -199,7 +199,7 @@
if (info && info.data) if (info && info.data)
[RetroArch_iOS.get pushViewController:[[RAModuleInfoList alloc] initWithModuleInfo:info] animated:YES]; [RetroArch_iOS.get pushViewController:[[RAModuleInfoList alloc] initWithModuleInfo:info] animated:YES];
else else
ios_display_alert(@"No information available.", 0); apple_display_alert(@"No information available.", 0);
} }
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

View File

@ -13,13 +13,13 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#import "RetroArch_iOS.h" #import "../RetroArch_Apple.h"
#import "views.h" #import "views.h"
#include "input/ios_input.h" #include "../input/ios_input.h"
#include "input/keycode.h" #include "../input/keycode.h"
#include "input/BTStack/btdynamic.h" #include "../input/BTStack/btdynamic.h"
#include "input/BTStack/btpad.h" #include "../input/BTStack/btpad.h"
enum SettingTypes enum SettingTypes
{ {

View File

@ -16,7 +16,7 @@
#include <pthread.h> #include <pthread.h>
#include <string.h> #include <string.h>
#import "RetroArch_iOS.h" #import "RetroArch_Apple.h"
#import "views.h" #import "views.h"
#include "rarch_wrapper.h" #include "rarch_wrapper.h"
@ -30,7 +30,124 @@
//#define HAVE_DEBUG_FILELOG //#define HAVE_DEBUG_FILELOG
static bool use_tv_mode; static bool use_tv_mode;
static RetroArch_iOS* apple_platform;
// From frontend/frontend_ios.c
extern void* rarch_main_apple(void* args);
extern void apple_frontend_post_event(void (*fn)(void*), void* userdata);
// These are based on the tag property of the button used to trigger the event
enum basic_event_t { RESET = 1, LOAD_STATE = 2, SAVE_STATE = 3, QUIT = 4 };
static void event_basic_command(void* userdata)
{
switch ((enum basic_event_t)userdata)
{
case RESET: rarch_game_reset(); return;
case LOAD_STATE: rarch_load_state(); return;
case SAVE_STATE: rarch_save_state(); return;
case QUIT: g_extern.system.shutdown = true; return;
}
}
static void event_set_state_slot(void* userdata)
{
g_extern.state_slot = (uint32_t)userdata;
}
static void event_show_rgui(void* userdata)
{
const bool in_menu = g_extern.lifecycle_mode_state & (1 << MODE_MENU);
g_extern.lifecycle_mode_state &= ~(1ULL << (in_menu ? MODE_MENU : MODE_GAME));
g_extern.lifecycle_mode_state |= (1ULL << (in_menu ? MODE_GAME : MODE_MENU));
}
static void event_reload_config(void* userdata)
{
objc_clear_config_hack();
uninit_drivers();
config_load();
init_drivers();
}
#pragma mark EMULATION
static pthread_t apple_retro_thread;
static bool apple_is_paused;
static bool apple_is_running;
static RAModuleInfo* apple_core;
void apple_run_core(RAModuleInfo* core, const char* file)
{
if (!apple_is_running)
{
[apple_platform loadingCore:core withFile:file];
apple_core = core;
apple_is_running = true;
struct rarch_main_wrap* load_data = malloc(sizeof(struct rarch_main_wrap));
memset(load_data, 0, sizeof(struct rarch_main_wrap));
#ifdef IOS
// load_data->sram_path = strdup(self.systemDirectory.UTF8String);
// load_data->state_path = strdup(self.systemDirectory.UTF8String);
#endif
if (file && core)
{
load_data->libretro_path = strdup(apple_core.path.UTF8String);
load_data->rom_path = strdup(file);
#ifdef IOS
load_data->config_path = strdup(apple_core.configPath.UTF8String);
#endif
}
#ifdef IOS
else
load_data->config_path = strdup(RAModuleInfo.globalConfigPath.UTF8String);
#endif
if (pthread_create(&apple_retro_thread, 0, rarch_main_apple, load_data))
{
apple_rarch_exited((void*)1);
return;
}
pthread_detach(apple_retro_thread);
// [self refreshSystemConfig];
}
}
void apple_rarch_exited(void* result)
{
if (result)
apple_display_alert(@"Failed to load game.", 0);
if (apple_is_running)
{
[apple_platform unloadingCore:apple_core];
apple_is_running = false;
//
// [self popToViewController:[RAGameView get] animated:NO];
// [self popViewControllerAnimated:NO];
// btpad_set_inquiry_state(true);
}
apple_core = nil;
if (use_tv_mode)
apple_run_core(nil, 0);
}
//
// IOS
//
#pragma mark IOS
#ifdef IOS
// Input helpers: This is kept here because it needs objective-c // Input helpers: This is kept here because it needs objective-c
static void handle_touch_event(NSArray* touches) static void handle_touch_event(NSArray* touches)
{ {
@ -79,8 +196,6 @@ static void handle_touch_event(NSArray* touches)
} }
} }
@end
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@autoreleasepool { @autoreleasepool {
@ -95,54 +210,13 @@ int main(int argc, char *argv[])
} }
} }
// From frontend/frontend_ios.c @end
extern void* rarch_main_apple(void* args);
extern void apple_frontend_post_event(void (*fn)(void*), void* userdata);
// These are based on the tag property of the button used to trigger the event
enum basic_event_t { RESET = 1, LOAD_STATE = 2, SAVE_STATE = 3, QUIT = 4 };
static void event_basic_command(void* userdata)
{
switch ((enum basic_event_t)userdata)
{
case RESET: rarch_game_reset(); return;
case LOAD_STATE: rarch_load_state(); return;
case SAVE_STATE: rarch_save_state(); return;
case QUIT: g_extern.system.shutdown = true; return;
}
}
static void event_set_state_slot(void* userdata)
{
g_extern.state_slot = (uint32_t)userdata;
}
static void event_show_rgui(void* userdata)
{
const bool in_menu = g_extern.lifecycle_mode_state & (1 << MODE_MENU);
g_extern.lifecycle_mode_state &= ~(1ULL << (in_menu ? MODE_MENU : MODE_GAME));
g_extern.lifecycle_mode_state |= (1ULL << (in_menu ? MODE_GAME : MODE_MENU));
}
static void event_reload_config(void* userdata)
{
objc_clear_config_hack();
uninit_drivers();
config_load();
init_drivers();
}
@implementation RetroArch_iOS @implementation RetroArch_iOS
{ {
UIWindow* _window; UIWindow* _window;
pthread_t _retroThread;
bool _isGameTop; bool _isGameTop;
bool _isPaused;
bool _isRunning;
uint32_t _settingMenusInBackStack; uint32_t _settingMenusInBackStack;
uint32_t _enabledOrientations; uint32_t _enabledOrientations;
@ -157,6 +231,7 @@ static void event_reload_config(void* userdata)
// UIApplicationDelegate // UIApplicationDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application - (void)applicationDidFinishLaunching:(UIApplication *)application
{ {
apple_platform = self;
self.delegate = self; self.delegate = self;
// Setup window // Setup window
@ -170,21 +245,21 @@ static void event_reload_config(void* userdata)
self.systemConfigPath = [self.systemDirectory stringByAppendingPathComponent:@"frontend.cfg"]; self.systemConfigPath = [self.systemDirectory stringByAppendingPathComponent:@"frontend.cfg"];
if (!path_make_and_check_directory(self.documentsDirectory.UTF8String, 0755, R_OK | W_OK | X_OK)) if (!path_make_and_check_directory(self.documentsDirectory.UTF8String, 0755, R_OK | W_OK | X_OK))
ios_display_alert([NSString stringWithFormat:@"Failed to create or access base directory: %@", self.documentsDirectory], 0); apple_display_alert([NSString stringWithFormat:@"Failed to create or access base directory: %@", self.documentsDirectory], 0);
else if (!path_make_and_check_directory(self.systemDirectory.UTF8String, 0755, R_OK | W_OK | X_OK)) else if (!path_make_and_check_directory(self.systemDirectory.UTF8String, 0755, R_OK | W_OK | X_OK))
ios_display_alert([NSString stringWithFormat:@"Failed to create or access system directory: %@", self.systemDirectory], 0); apple_display_alert([NSString stringWithFormat:@"Failed to create or access system directory: %@", self.systemDirectory], 0);
else else
{ {
[self pushViewController:[RADirectoryList directoryListAtBrowseRoot] animated:YES]; [self pushViewController:[RADirectoryList directoryListAtBrowseRoot] animated:YES];
[self refreshSystemConfig]; [self refreshSystemConfig];
if (use_tv_mode) if (use_tv_mode)
[self runGame:nil withModule:nil]; apple_run_core(nil, 0);
} }
// Warn if there are no cores present // Warn if there are no cores present
if ([RAModuleInfo getModules].count == 0) if ([RAModuleInfo getModules].count == 0)
ios_display_alert(@"No libretro cores were found. You will not be able to play any games.", 0); apple_display_alert(@"No libretro cores were found. You will not be able to play any games.", 0);
} }
- (void)applicationWillEnterForeground:(UIApplication *)application - (void)applicationWillEnterForeground:(UIApplication *)application
@ -253,71 +328,28 @@ static void event_reload_config(void* userdata)
} }
#pragma mark EMULATION #pragma mark RetroArch_Platform
- (void)runGame:(NSString*)path withModule:(RAModuleInfo*)module - (void)loadingCore:(RAModuleInfo*)core withFile:(const char*)file
{ {
if (!_isRunning) [self pushViewController:RAGameView.get animated:NO];
{ [RASettingsList refreshModuleConfig:core];
[self pushViewController:RAGameView.get animated:NO];
_module = module; btpad_set_inquiry_state(false);
[RASettingsList refreshModuleConfig:_module];
_isRunning = true; [self refreshSystemConfig];
btpad_set_inquiry_state(false);
struct rarch_main_wrap* load_data = malloc(sizeof(struct rarch_main_wrap));
memset(load_data, 0, sizeof(struct rarch_main_wrap));
load_data->sram_path = strdup(self.systemDirectory.UTF8String);
load_data->state_path = strdup(self.systemDirectory.UTF8String);
if (path && module)
{
load_data->libretro_path = strdup(_module.path.UTF8String);
load_data->rom_path = strdup(path.UTF8String);
load_data->config_path = strdup(_module.configPath.UTF8String);
}
else
load_data->config_path = strdup(RAModuleInfo.globalConfigPath.UTF8String);
if (pthread_create(&_retroThread, 0, rarch_main_apple, load_data))
{
[self rarchExited:NO];
return;
}
pthread_detach(_retroThread);
[self refreshSystemConfig];
}
} }
- (void)rarchExited:(BOOL)successful - (void)unloadingCore:(RAModuleInfo*)core
{ {
if (!successful) [self popToViewController:[RAGameView get] animated:NO];
ios_display_alert(@"Failed to load game.", 0); [self popViewControllerAnimated:NO];
if (_isRunning)
{
_isRunning = false;
// btpad_set_inquiry_state(true);
[self popToViewController:[RAGameView get] animated:NO];
[self popViewControllerAnimated:NO];
btpad_set_inquiry_state(true);
}
if (use_tv_mode)
[self runGame:nil withModule:nil];
_module = nil;
} }
- (void)refreshConfig - (void)refreshConfig
{ {
if (_isRunning) if (apple_is_running)
apple_frontend_post_event(&event_reload_config, 0); apple_frontend_post_event(&event_reload_config, 0);
else else
objc_clear_config_hack(); objc_clear_config_hack();
@ -376,9 +408,9 @@ static void event_reload_config(void* userdata)
- (IBAction)showPauseMenu:(id)sender - (IBAction)showPauseMenu:(id)sender
{ {
if (_isRunning && !_isPaused && _isGameTop) if (apple_is_running && !apple_is_paused && _isGameTop)
{ {
_isPaused = true; apple_is_paused = true;
[[RAGameView get] openPauseMenu]; [[RAGameView get] openPauseMenu];
btpad_set_inquiry_state(true); btpad_set_inquiry_state(true);
@ -387,7 +419,7 @@ static void event_reload_config(void* userdata)
- (IBAction)basicEvent:(id)sender - (IBAction)basicEvent:(id)sender
{ {
if (_isRunning) if (apple_is_running)
apple_frontend_post_event(&event_basic_command, ((UIView*)sender).tag); apple_frontend_post_event(&event_basic_command, ((UIView*)sender).tag);
[self closePauseMenu:sender]; [self closePauseMenu:sender];
@ -395,13 +427,13 @@ static void event_reload_config(void* userdata)
- (IBAction)chooseState:(id)sender - (IBAction)chooseState:(id)sender
{ {
if (_isRunning) if (apple_is_running)
apple_frontend_post_event(event_set_state_slot, (void*)((UISegmentedControl*)sender).selectedSegmentIndex); apple_frontend_post_event(event_set_state_slot, (void*)((UISegmentedControl*)sender).selectedSegmentIndex);
} }
- (IBAction)showRGUI:(id)sender - (IBAction)showRGUI:(id)sender
{ {
if (_isRunning) if (apple_is_running)
apple_frontend_post_event(event_show_rgui, 0); apple_frontend_post_event(event_show_rgui, 0);
[self closePauseMenu:sender]; [self closePauseMenu:sender];
@ -410,7 +442,7 @@ static void event_reload_config(void* userdata)
- (IBAction)closePauseMenu:(id)sender - (IBAction)closePauseMenu:(id)sender
{ {
[[RAGameView get] closePauseMenu]; [[RAGameView get] closePauseMenu];
_isPaused = false; apple_is_paused = false;
btpad_set_inquiry_state(false); btpad_set_inquiry_state(false);
} }
@ -427,12 +459,27 @@ static void event_reload_config(void* userdata)
@end @end
void apple_rarch_exited(void* result)
#endif
//
// OSX
//
#pragma mark OSX
#ifdef OSX
@implementation AppDelegate
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{ {
[[RetroArch_iOS get] rarchExited:result ? NO : YES]; return YES;
} }
char* ios_get_rarch_system_directory() @end
int main(int argc, char *argv[])
{ {
return strdup([RetroArch_iOS.get.systemDirectory UTF8String]); return NSApplicationMain(argc, (const char **) argv);
} }
#endif

View File

@ -15,21 +15,23 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "RetroArch_Apple.h"
#include "general.h" #include "general.h"
#include "file.h" #include "file.h"
#import "views.h" #import "views.h"
#ifdef IOS void apple_display_alert(NSString* message, NSString* title)
void ios_display_alert(NSString* message, NSString* title)
{ {
#ifdef IOS
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title ? title : @"RetroArch" UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title ? title : @"RetroArch"
message:message message:message
delegate:nil delegate:nil
cancelButtonTitle:@"OK" cancelButtonTitle:@"OK"
otherButtonTitles:nil]; otherButtonTitles:nil];
[alert show]; [alert show];
}
#endif #endif
}
// Little nudge to prevent stale values when reloading the confg file // Little nudge to prevent stale values when reloading the confg file
void objc_clear_config_hack() void objc_clear_config_hack()
@ -61,6 +63,12 @@ bool path_make_and_check_directory(const char* path, mode_t mode, int amode)
} }
#ifdef IOS #ifdef IOS
char* ios_get_rarch_system_directory()
{
return strdup([RetroArch_iOS.get.systemDirectory UTF8String]);
}
// Simple class to reduce code duplication for fixed table views // Simple class to reduce code duplication for fixed table views
@implementation RATableViewController @implementation RATableViewController
@ -92,4 +100,5 @@ bool path_make_and_check_directory(const char* path, mode_t mode, int amode)
} }
@end @end
#endif
#endif

View File

@ -21,8 +21,8 @@
#include "../conf/config_file.h" #include "../conf/config_file.h"
#include "../file.h" #include "../file.h"
#ifdef IOS #ifdef __APPLE__
#include "../ios/RetroArch/rarch_wrapper.h" #include "../apple/RetroArch/rarch_wrapper.h"
#endif #endif
#ifdef HAVE_RGUI #ifdef HAVE_RGUI
@ -93,10 +93,13 @@ void* rarch_main_apple(void* args)
} }
#ifdef HAVE_RGUI #ifdef HAVE_RGUI
#ifdef IOS
char* system_directory = ios_get_rarch_system_directory(); char* system_directory = ios_get_rarch_system_directory();
strlcpy(g_extern.savestate_dir, system_directory, sizeof(g_extern.savestate_dir)); strlcpy(g_extern.savestate_dir, system_directory, sizeof(g_extern.savestate_dir));
strlcpy(g_extern.savefile_dir, system_directory, sizeof(g_extern.savefile_dir)); strlcpy(g_extern.savefile_dir, system_directory, sizeof(g_extern.savefile_dir));
free(system_directory); free(system_directory);
#endif
menu_init(); menu_init();
g_extern.lifecycle_mode_state |= 1ULL << MODE_GAME; g_extern.lifecycle_mode_state |= 1ULL << MODE_GAME;

View File

@ -25,7 +25,7 @@
#include "../shader_glsl.h" #include "../shader_glsl.h"
#endif #endif
#include "../../ios/RetroArch/rarch_wrapper.h" #include "../../apple/RetroArch/rarch_wrapper.h"
static bool gfx_ctx_bind_api(enum gfx_ctx_api api) static bool gfx_ctx_bind_api(enum gfx_ctx_api api)
{ {

View File

@ -255,14 +255,14 @@ INPUT
#include "../android/native/jni/input_autodetect.c" #include "../android/native/jni/input_autodetect.c"
#include "../android/native/jni/input_android.c" #include "../android/native/jni/input_android.c"
#elif defined(IOS) #elif defined(IOS)
#include "../ios/RetroArch/input/ios_input.c" #include "../apple/RetroArch/input/ios_input.c"
#include "../ios/RetroArch/input/ios_joypad.c" #include "../apple/RetroArch/input/ios_joypad.c"
#include "../ios/RetroArch/input/BTStack/btdynamic.c" #include "../apple/RetroArch/input/BTStack/btdynamic.c"
#include "../ios/RetroArch/input/BTStack/wiimote.c" #include "../apple/RetroArch/input/BTStack/wiimote.c"
#include "../ios/RetroArch/input/BTStack/btpad.c" #include "../apple/RetroArch/input/BTStack/btpad.c"
#include "../ios/RetroArch/input/BTStack/btpad_ps3.c" #include "../apple/RetroArch/input/BTStack/btpad_ps3.c"
#include "../ios/RetroArch/input/BTStack/btpad_wii.c" #include "../apple/RetroArch/input/BTStack/btpad_wii.c"
#include "../ios/RetroArch/input/BTStack/btpad_queue.c" #include "../apple/RetroArch/input/BTStack/btpad_queue.c"
#elif defined(__BLACKBERRY_QNX__) #elif defined(__BLACKBERRY_QNX__)
#include "../blackberry-qnx/qnx_input.c" #include "../blackberry-qnx/qnx_input.c"
#endif #endif