diff --git a/ios/RetroArch/PauseView.xib b/ios/RetroArch/PauseView.xib index 070ab1125c..238b0695a3 100644 --- a/ios/RetroArch/PauseView.xib +++ b/ios/RetroArch/PauseView.xib @@ -42,7 +42,7 @@ 292 {{160, 237}, {120, 44}} - + _NS:9 NO IBIPadFramework @@ -77,7 +77,6 @@ 292 {{20, 20}, {260, 44}} - _NS:9 NO @@ -100,7 +99,6 @@ 292 {{20, 237}, {120, 44}} - _NS:9 NO @@ -123,7 +121,6 @@ 292 {{20, 186}, {120, 44}} - _NS:9 NO @@ -146,7 +143,6 @@ 292 {{160, 186}, {120, 44}} - _NS:9 NO @@ -169,7 +165,6 @@ 292 {{20, 135}, {260, 44}} - _NS:9 NO @@ -243,7 +238,6 @@ 292 {{20, 71}, {260, 44}} - _NS:9 NO @@ -251,7 +245,7 @@ 0 0 1 - Connect WiiMotes + Settings 1 @@ -264,7 +258,6 @@ {{0, 20}, {300, 300}} - 3 @@ -343,12 +336,12 @@ - conntectWiimotes: + showSettings 7 - 147 + 148 @@ -944,72 +937,9 @@ - 147 - - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - RetroArch_iOS - UIResponder - - id - id - id - id - id - id - id - id - - - - chooseState: - id - - - closeGamePressed: - id - - - closePauseMenu: - id - - - conntectWiimotes: - id - - - loadState: - id - - - resetGame: - id - - - saveState: - id - - - showPauseMenu: - id - - - - IBProjectSource - ./Classes/RetroArch_iOS.h - - - + 148 + 0 IBIPadFramework YES diff --git a/ios/RetroArch/RAModuleInfoList.m b/ios/RetroArch/RAModuleInfoList.m index c555f4b77f..3419b8f5e7 100644 --- a/ios/RetroArch/RAModuleInfoList.m +++ b/ios/RetroArch/RAModuleInfoList.m @@ -19,6 +19,7 @@ RAModuleInfo* new = [RAModuleInfo new]; new.path = thePath; + new.configPath = [NSString stringWithFormat:@"%@/%@.cfg", [RetroArch_iOS get].system_directory, [[thePath lastPathComponent] stringByDeletingPathExtension]]; new.data = theData; return new; } diff --git a/ios/RetroArch/RAModuleList.m b/ios/RetroArch/RAModuleList.m index 30e633af88..63d265934a 100644 --- a/ios/RetroArch/RAModuleList.m +++ b/ios/RetroArch/RAModuleList.m @@ -59,7 +59,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { RAModuleInfo* info = (RAModuleInfo*)[_modules objectAtIndex:indexPath.row]; - [RetroArch_iOS get].module_path = info.path; + [RetroArch_iOS get].moduleInfo = info; [[RetroArch_iOS get] pushViewController:[RADirectoryList directoryListOrGridWithPath:nil] isGame:NO]; } diff --git a/ios/RetroArch/RetroArch-Prefix.pch b/ios/RetroArch/RetroArch-Prefix.pch index a3670b9763..ca2c72fb32 100644 --- a/ios/RetroArch/RetroArch-Prefix.pch +++ b/ios/RetroArch/RetroArch-Prefix.pch @@ -26,6 +26,6 @@ #ifdef __OBJC__ #import #import - #import "RetroArch_iOS.h" #import "views.h" + #import "RetroArch_iOS.h" #endif diff --git a/ios/RetroArch/RetroArch_iOS.h b/ios/RetroArch/RetroArch_iOS.h index c81b2abf7c..233cb78500 100644 --- a/ios/RetroArch/RetroArch_iOS.h +++ b/ios/RetroArch/RetroArch_iOS.h @@ -25,11 +25,9 @@ - (void)pushViewController:(UIViewController*)theView isGame:(BOOL)game; - (UIViewController*)popViewController; -- (NSString*)configFilePath; +@property (strong, nonatomic) RAModuleInfo* moduleInfo; @property (strong, nonatomic) NSString* system_directory; - -@property (strong, nonatomic) NSString* module_path; @property (strong, nonatomic) UIImage* file_icon; @property (strong, nonatomic) UIImage* folder_icon; @property (strong, nonatomic) UIBarButtonItem* settings_button; diff --git a/ios/RetroArch/RetroArch_iOS.m b/ios/RetroArch/RetroArch_iOS.m index 39b087b972..5730a38ef7 100644 --- a/ios/RetroArch/RetroArch_iOS.m +++ b/ios/RetroArch/RetroArch_iOS.m @@ -17,11 +17,6 @@ #include "rarch_wrapper.h" #include "general.h" -#ifdef WIIMOTE -#include "BTStack/wiimote.h" -#import "BTStack/WiiMoteHelper.h" -#endif - #define ALMOST_INVISIBLE .021f @interface RANavigator : UINavigationController @@ -94,14 +89,6 @@ return (RetroArch_iOS*)[[UIApplication sharedApplication] delegate]; } -- (NSString*)configFilePath -{ - if (self.module_path) - return [NSString stringWithFormat:@"%@/%@.cfg", self.system_directory, [[self.module_path lastPathComponent] stringByDeletingPathExtension]]; - - return nil; -} - - (void)applicationDidFinishLaunching:(UIApplication *)application { // TODO: Relocate this! @@ -213,8 +200,8 @@ [RASettingsList refreshConfigFile]; const char* const sd = [[RetroArch_iOS get].system_directory UTF8String]; - const char* const cf =[[RetroArch_iOS get].configFilePath UTF8String]; - const char* const libretro = [[RetroArch_iOS get].module_path UTF8String]; + const char* const cf =[[RetroArch_iOS get].moduleInfo.configPath UTF8String]; + const char* const libretro = [[RetroArch_iOS get].moduleInfo.path UTF8String]; struct rarch_main_wrap main_wrapper = {[path UTF8String], sd, sd, cf, libretro}; if (rarch_main_init_wrap(&main_wrapper) == 0) @@ -339,7 +326,7 @@ - (IBAction)closePauseMenu:(id)sender { if (_isPaused) - [UIView animateWithDuration:0.2 + [UIView animateWithDuration:0.2 animations:^ { _pauseView.alpha = 0.0f; @@ -364,13 +351,6 @@ [self pushViewController:[RASettingsList new] isGame:NO]; } -- (IBAction)conntectWiimotes:(id)sender -{ -#ifdef WIIMOTE - [WiiMoteHelper startwiimote:_navigator]; -#endif -} - @end diff --git a/ios/RetroArch/settings/RASettingsList.m b/ios/RetroArch/settings/RASettingsList.m index bd3588c331..8b93ad7164 100644 --- a/ios/RetroArch/settings/RASettingsList.m +++ b/ios/RetroArch/settings/RASettingsList.m @@ -16,6 +16,11 @@ #import #import "settings.h" +#ifdef WIIMOTE +#include "BTStack/wiimote.h" +#import "BTStack/WiiMoteHelper.h" +#endif + @implementation RASettingData @end @@ -83,9 +88,14 @@ static RASettingData* subpath_setting(RAConfig* config, NSString* name, NSString } @implementation RASettingsList ++ (void)refreshConfigFile +{ + [[[RASettingsList alloc] init] writeToDisk]; +} + - (id)init { - RAConfig* config = [[RAConfig alloc] initWithPath:[RetroArch_iOS get].configFilePath]; + RAConfig* config = [[RAConfig alloc] initWithPath:[RetroArch_iOS get].moduleInfo.configPath]; NSString* overlay_path = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/overlays/"]; NSString* shader_path = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/shaders/"]; @@ -163,19 +173,69 @@ static RASettingData* subpath_setting(RAConfig* config, NSString* name, NSString [self writeToDisk]; } -+ (void)refreshConfigFile -{ - [[[RASettingsList alloc] init] writeToDisk]; -} - - (void)writeToDisk { - RAConfig* config = [[RAConfig alloc] initWithPath:[RetroArch_iOS get].configFilePath]; + RAConfig* config = [[RAConfig alloc] initWithPath:[RetroArch_iOS get].moduleInfo.configPath]; [config putStringNamed:@"system_directory" value:[RetroArch_iOS get].system_directory]; [self writeSettings:nil toConfig:config]; - [config writeToFile:[RetroArch_iOS get].configFilePath]; + [config writeToFile:[RetroArch_iOS get].moduleInfo.configPath]; +} + +// Override tableView methods to add General section at top. +- (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (indexPath.section == 0) + { + if (indexPath.row == 0) + [[RetroArch_iOS get] pushViewController:[[RAModuleInfoList alloc] initWithModuleInfo:[RetroArch_iOS get].moduleInfo] isGame:NO]; +#ifdef WIIMOTE + else if(indexPath.row == 1) + [WiiMoteHelper startwiimote:_navigator]; +#endif + } + else + [super tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section - 1]]; +} + +- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (indexPath.section == 0) + { + UITableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:@"general"]; + cell = cell ? cell : [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"general"]; + + cell.textLabel.text = (indexPath.row == 0) ? @"Module Info" : @"Connect WiiMotes"; + return cell; + } + else + return [super tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section - 1]]; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView +{ + return [super numberOfSectionsInTableView:tableView] + 1; +} + +- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section +{ + if (section == 0) +#ifdef WIIMOTE + return 2; +#else + return 1; +#endif + + return [super tableView:tableView numberOfRowsInSection:section - 1] ; +} + +- (NSString*)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section +{ + if (section == 0) + return @"General"; + + return [super tableView:tableView titleForHeaderInSection:section - 1]; } @end diff --git a/ios/RetroArch/views.h b/ios/RetroArch/views.h index 3b6db9cbec..119213864f 100644 --- a/ios/RetroArch/views.h +++ b/ios/RetroArch/views.h @@ -23,6 +23,7 @@ @interface RAModuleInfo : NSObject @property (strong) NSString* path; +@property (strong) NSString* configPath; @property (strong) RAConfig* data; + (RAModuleInfo*)moduleWithPath:(NSString*)thePath data:(RAConfig*)theData;