ios: Move wiimote connection widget into settings menu.
This commit is contained in:
parent
fd52e8c537
commit
b89208f7fb
|
@ -42,7 +42,7 @@
|
|||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{160, 237}, {120, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
|
||||
|
@ -77,7 +77,6 @@
|
|||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 20}, {260, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="1033465661"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
|
@ -100,7 +99,6 @@
|
|||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 237}, {120, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="61755535"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
|
@ -123,7 +121,6 @@
|
|||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 186}, {120, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="58186559"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
|
@ -146,7 +143,6 @@
|
|||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{160, 186}, {120, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="721040644"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
|
@ -169,7 +165,6 @@
|
|||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 135}, {260, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="694263183"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
|
@ -243,7 +238,6 @@
|
|||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 71}, {260, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="562513162"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
|
@ -251,7 +245,7 @@
|
|||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<int key="IBUIButtonType">1</int>
|
||||
<string key="IBUINormalTitle">Connect WiiMotes</string>
|
||||
<string key="IBUINormalTitle">Settings</string>
|
||||
<reference key="IBUIHighlightedTitleColor" ref="428922964"/>
|
||||
<object class="NSColor" key="IBUINormalTitleColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
|
@ -264,7 +258,6 @@
|
|||
</array>
|
||||
<string key="NSFrame">{{0, 20}, {300, 300}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="38801877"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
|
@ -343,12 +336,12 @@
|
|||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">conntectWiimotes:</string>
|
||||
<string key="label">showSettings</string>
|
||||
<reference key="source" ref="1033465661"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">147</int>
|
||||
<int key="connectionID">148</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
|
@ -944,72 +937,9 @@
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">147</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSLayoutConstraint</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/NSLayoutConstraint.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">RetroArch_iOS</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="chooseState:">id</string>
|
||||
<string key="closeGamePressed:">id</string>
|
||||
<string key="closePauseMenu:">id</string>
|
||||
<string key="conntectWiimotes:">id</string>
|
||||
<string key="loadState:">id</string>
|
||||
<string key="resetGame:">id</string>
|
||||
<string key="saveState:">id</string>
|
||||
<string key="showPauseMenu:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="chooseState:">
|
||||
<string key="name">chooseState:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="closeGamePressed:">
|
||||
<string key="name">closeGamePressed:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="closePauseMenu:">
|
||||
<string key="name">closePauseMenu:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="conntectWiimotes:">
|
||||
<string key="name">conntectWiimotes:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="loadState:">
|
||||
<string key="name">loadState:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="resetGame:">
|
||||
<string key="name">resetGame:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="saveState:">
|
||||
<string key="name">saveState:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="showPauseMenu:">
|
||||
<string key="name">showPauseMenu:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/RetroArch_iOS.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<int key="maxID">148</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes"/>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -26,6 +26,6 @@
|
|||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RetroArch_iOS.h"
|
||||
#import "views.h"
|
||||
#import "RetroArch_iOS.h"
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
#import <objc/runtime.h>
|
||||
#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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue