Centralized key handling in EmulatorView

This commit is contained in:
TwistedUmbrella 2015-08-31 23:47:58 -04:00
parent e6fe7df468
commit 656a230d06
9 changed files with 212 additions and 159 deletions

View File

@ -10,4 +10,9 @@
@interface EmulatorView : GLKView @interface EmulatorView : GLKView
- (void)handleKeyDown:(UIButton*)button;
- (void)handleKeyUp:(UIButton*)button;
@property (nonatomic, strong) UIViewController *controllerView;
@end @end

View File

@ -7,9 +7,37 @@
// //
#import "EmulatorView.h" #import "EmulatorView.h"
#import "PadViewController.h"
#include "types.h" #include "types.h"
extern u16 kcode[4];
extern u32 vks[4];
extern s8 joyx[4],joyy[4];
extern u8 rt[4],lt[4];
#define DC_BTN_C (1)
#define DC_BTN_B (1<<1)
#define DC_BTN_A (1<<2)
#define DC_BTN_START (1<<3)
#define DC_DPAD_UP (1<<4)
#define DC_DPAD_DOWN (1<<5)
#define DC_DPAD_LEFT (1<<6)
#define DC_DPAD_RIGHT (1<<7)
#define DC_BTN_Z (1<<8)
#define DC_BTN_Y (1<<9)
#define DC_BTN_X (1<<10)
#define DC_BTN_D (1<<11)
#define DC_DPAD2_UP (1<<12)
#define DC_DPAD2_DOWN (1<<13)
#define DC_DPAD2_LEFT (1<<14)
#define DC_DPAD2_RIGHT (1<<15)
#define DC_AXIS_LT (0X10000)
#define DC_AXIS_RT (0X10001)
#define DC_AXIS_X (0X20000)
#define DC_AXIS_Y (0X20001)
@implementation EmulatorView @implementation EmulatorView
/* /*
@ -20,4 +48,85 @@
} }
*/ */
- (void)setControlInput:(PadViewController *)input
{
self.controllerView = input;
}
- (void)handleKeyDown:(UIButton*)button
{
PadViewController * controller = (PadViewController *)self.controllerView;
if (button == controller.img_dpad_l) {
kcode[0] &= ~(DC_DPAD_LEFT);
}
if (button == controller.img_dpad_r) {
kcode[0] &= ~(DC_DPAD_RIGHT);
}
if (button == controller.img_dpad_u) {
kcode[0] &= ~(DC_DPAD_UP);
}
if (button == controller.img_dpad_d) {
kcode[0] &= ~(DC_DPAD_DOWN);
}
if (button == controller.img_abxy_a) {
kcode[0] &= ~(DC_BTN_A);
}
if (button == controller.img_abxy_b) {
kcode[0] &= ~(DC_BTN_B);
}
if (button == controller.img_abxy_x) {
kcode[0] &= ~(DC_BTN_X);
}
if (button == controller.img_abxy_y) {
kcode[0] &= ~(DC_BTN_Y);
}
if (button == controller.img_lt) {
kcode[0] &= ~(DC_AXIS_LT);
}
if (button == controller.img_rt) {
kcode[0] &= ~(DC_AXIS_RT);
}
if (button == controller.img_start) {
kcode[0] &= ~(DC_BTN_START);
}
}
- (void)handleKeyUp:(UIButton*)button
{
PadViewController * controller = (PadViewController *)self.controllerView;
if (button == controller.img_dpad_l) {
kcode[0] |= ~(DC_DPAD_LEFT);
}
if (button == controller.img_dpad_r) {
kcode[0] |= ~(DC_DPAD_RIGHT);
}
if (button == controller.img_dpad_u) {
kcode[0] |= ~(DC_DPAD_UP);
}
if (button == controller.img_dpad_d) {
kcode[0] |= ~(DC_DPAD_DOWN);
}
if (button == controller.img_abxy_a) {
kcode[0] |= (DC_BTN_A);
}
if (button == controller.img_abxy_b) {
kcode[0] |= (DC_BTN_B);
}
if (button == controller.img_abxy_x) {
kcode[0] |= (DC_BTN_X);
}
if (button == controller.img_abxy_y) {
kcode[0] |= (DC_BTN_Y);
}
if (button == controller.img_lt) {
kcode[0] |= (DC_AXIS_LT);
}
if (button == controller.img_rt) {
kcode[0] |= (DC_AXIS_RT);
}
if (button == controller.img_start) {
kcode[0] |= (DC_BTN_START);
}
}
@end @end

View File

@ -11,17 +11,17 @@
#import <GameController/GameController.h> #import <GameController/GameController.h>
#import "iCadeReaderView.h" #import "iCadeReaderView.h"
#import "PadViewController.h" #import "PadViewController.h"
#import "EmulatorView.h"
@interface ViewController : GLKViewController <iCadeEventDelegate> @interface EmulatorViewController : GLKViewController <iCadeEventDelegate>
@property NSString* diskImage; @property NSString* diskImage;
@property (nonatomic) iCadeReaderView* iCadeReader; @property (nonatomic) iCadeReaderView* iCadeReader;
@property (nonatomic) GCController *gController __attribute__((weak_import)); @property (nonatomic) GCController *gController __attribute__((weak_import));
@property (nonatomic, strong) id connectObserver; @property (nonatomic, strong) id connectObserver;
@property (nonatomic, strong) id disconnectObserver; @property (nonatomic, strong) id disconnectObserver;
@property (nonatomic, strong) EmulatorView *emuView;
@property (nonatomic, strong) PadViewController *controllerView; @property (nonatomic, strong) PadViewController *controllerView;
- (void)handleKeycode:(UIButton*)button;
@end @end

View File

@ -16,34 +16,7 @@
#include "hw/maple/maple_devs.h" #include "hw/maple/maple_devs.h"
#include "hw/maple/maple_if.h" #include "hw/maple/maple_if.h"
extern u16 kcode[4]; @interface EmulatorViewController () {
extern u32 vks[4];
extern s8 joyx[4],joyy[4];
extern u8 rt[4],lt[4];
#define DC_BTN_C (1)
#define DC_BTN_B (1<<1)
#define DC_BTN_A (1<<2)
#define DC_BTN_START (1<<3)
#define DC_DPAD_UP (1<<4)
#define DC_DPAD_DOWN (1<<5)
#define DC_DPAD_LEFT (1<<6)
#define DC_DPAD_RIGHT (1<<7)
#define DC_BTN_Z (1<<8)
#define DC_BTN_Y (1<<9)
#define DC_BTN_X (1<<10)
#define DC_BTN_D (1<<11)
#define DC_DPAD2_UP (1<<12)
#define DC_DPAD2_DOWN (1<<13)
#define DC_DPAD2_LEFT (1<<14)
#define DC_DPAD2_RIGHT (1<<15)
#define DC_AXIS_LT (0X10000)
#define DC_AXIS_RT (0X10001)
#define DC_AXIS_X (0X20000)
#define DC_AXIS_Y (0X20001)
@interface ViewController () {
} }
@property (strong, nonatomic) EAGLContext *context; @property (strong, nonatomic) EAGLContext *context;
@ -62,7 +35,7 @@ bool gles_init();
extern "C" int reicast_main(int argc, char* argv[]); extern "C" int reicast_main(int argc, char* argv[]);
@implementation ViewController @implementation EmulatorViewController
-(void)emuThread -(void)emuThread
{ {
@ -97,9 +70,11 @@ extern "C" int reicast_main(int argc, char* argv[]);
NSLog(@"Failed to create ES context"); NSLog(@"Failed to create ES context");
} }
GLKView *view = (GLKView *)self.view; self.emuView = (EmulatorView *)self.view;
view.context = self.context; self.emuView.context = self.context;
view.drawableDepthFormat = GLKViewDrawableDepthFormat24; self.emuView.drawableDepthFormat = GLKViewDrawableDepthFormat24;
[self.controllerView setControlOutput:self.emuView];
self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
if ([[GCController controllers] count] == 1) { if ([[GCController controllers] count] == 1) {
@ -179,65 +154,6 @@ extern "C" int reicast_main(int argc, char* argv[]);
} }
- (void)handleKeycode:(UIButton*)button
{
if (button == self.controllerView.img_dpad_l) {
kcode[0] &= ~(DC_DPAD_LEFT);
} else {
kcode[0] |= ~(DC_DPAD_LEFT);
}
if (button == self.controllerView.img_dpad_r) {
kcode[0] &= ~(DC_DPAD_RIGHT);
} else {
kcode[0] |= ~(DC_DPAD_RIGHT);
}
if (button == self.controllerView.img_dpad_u) {
kcode[0] &= ~(DC_DPAD_UP);
} else {
kcode[0] |= ~(DC_DPAD_UP);
}
if (button == self.controllerView.img_dpad_d) {
kcode[0] &= ~(DC_DPAD_DOWN);
} else {
kcode[0] |= ~(DC_DPAD_DOWN);
}
if (button == self.controllerView.img_abxy_a) {
kcode[0] &= ~(DC_BTN_A);
} else {
kcode[0] |= (DC_BTN_A);
}
if (button == self.controllerView.img_abxy_b) {
kcode[0] &= ~(DC_BTN_B);
} else {
kcode[0] |= (DC_BTN_B);
}
if (button == self.controllerView.img_abxy_x) {
kcode[0] &= ~(DC_BTN_X);
} else {
kcode[0] |= (DC_BTN_X);
}
if (button == self.controllerView.img_abxy_y) {
kcode[0] &= ~(DC_BTN_Y);
} else {
kcode[0] |= (DC_BTN_Y);
}
if (button == self.controllerView.img_lt) {
kcode[0] &= ~(DC_AXIS_LT);
} else {
kcode[0] |= (DC_AXIS_LT);
}
if (button == self.controllerView.img_rt) {
kcode[0] &= ~(DC_AXIS_RT);
} else {
kcode[0] |= (DC_AXIS_RT);
}
if (button == self.controllerView.img_start) {
kcode[0] &= ~(DC_BTN_START);
} else {
kcode[0] |= (DC_BTN_START);
}
}
- (void)toggleHardwareController:(BOOL)useHardware { - (void)toggleHardwareController:(BOOL)useHardware {
if (useHardware) { if (useHardware) {
// [self.controllerView hideController]; // [self.controllerView hideController];
@ -245,52 +161,52 @@ extern "C" int reicast_main(int argc, char* argv[]);
if (self.gController.gamepad) { if (self.gController.gamepad) {
[self.gController.gamepad.buttonA setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.gamepad.buttonA setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_A); [self.emuView handleKeyDown:self.controllerView.img_abxy_a];
} else { } else {
kcode[0] |= (DC_BTN_A); [self.emuView handleKeyUp:self.controllerView.img_abxy_a];
} }
}]; }];
[self.gController.gamepad.buttonB setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.gamepad.buttonB setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_B); [self.emuView handleKeyDown:self.controllerView.img_abxy_b];
} else { } else {
kcode[0] |= (DC_BTN_B); [self.emuView handleKeyUp:self.controllerView.img_abxy_b];
} }
}]; }];
[self.gController.gamepad.buttonX setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.gamepad.buttonX setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_X); [self.emuView handleKeyDown:self.controllerView.img_abxy_x];
} else { } else {
kcode[0] |= (DC_BTN_X); [self.emuView handleKeyUp:self.controllerView.img_abxy_x];
} }
}]; }];
[self.gController.gamepad.buttonY setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.gamepad.buttonY setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_Y); [self.emuView handleKeyDown:self.controllerView.img_abxy_y];
} else { } else {
kcode[0] |= (DC_BTN_Y); [self.emuView handleKeyUp:self.controllerView.img_abxy_y];
} }
}]; }];
[self.gController.gamepad.dpad setValueChangedHandler:^(GCControllerDirectionPad *dpad, float xValue, float yValue){ [self.gController.gamepad.dpad setValueChangedHandler:^(GCControllerDirectionPad *dpad, float xValue, float yValue){
if (xValue >= 0.1) { if (xValue >= 0.1) {
kcode[0] &= ~(DC_DPAD_RIGHT); [self.emuView handleKeyDown:self.controllerView.img_dpad_r];
} else { } else {
kcode[0] |= ~(DC_DPAD_RIGHT); [self.emuView handleKeyUp:self.controllerView.img_dpad_r];
} }
if (xValue <= -0.1) { if (xValue <= -0.1) {
kcode[0] &= ~(DC_DPAD_LEFT); [self.emuView handleKeyDown:self.controllerView.img_dpad_l];
} else { } else {
kcode[0] |= ~(DC_DPAD_LEFT); [self.emuView handleKeyUp:self.controllerView.img_dpad_l];
} }
if (yValue >= 0.1) { if (yValue >= 0.1) {
kcode[0] &= ~(DC_DPAD_UP); [self.emuView handleKeyDown:self.controllerView.img_dpad_u];
} else { } else {
kcode[0] |= ~(DC_DPAD_UP); [self.emuView handleKeyUp:self.controllerView.img_dpad_u];
} }
if (yValue <= -0.1) { if (yValue <= -0.1) {
kcode[0] &= ~(DC_DPAD_DOWN); [self.emuView handleKeyDown:self.controllerView.img_dpad_d];
} else { } else {
kcode[0] |= ~(DC_DPAD_DOWN); [self.emuView handleKeyUp:self.controllerView.img_dpad_d];
} }
}]; }];
//Add controller pause handler here //Add controller pause handler here
@ -298,52 +214,52 @@ extern "C" int reicast_main(int argc, char* argv[]);
if (self.gController.extendedGamepad) { if (self.gController.extendedGamepad) {
[self.gController.extendedGamepad.buttonA setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.extendedGamepad.buttonA setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_A); [self.emuView handleKeyDown:self.controllerView.img_abxy_a];
} else { } else {
kcode[0] |= (DC_BTN_A); [self.emuView handleKeyUp:self.controllerView.img_abxy_a];
} }
}]; }];
[self.gController.extendedGamepad.buttonB setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.extendedGamepad.buttonB setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_B); [self.emuView handleKeyDown:self.controllerView.img_abxy_b];
} else { } else {
kcode[0] |= (DC_BTN_B); [self.emuView handleKeyUp:self.controllerView.img_abxy_b];
} }
}]; }];
[self.gController.extendedGamepad.buttonX setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.extendedGamepad.buttonX setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_X); [self.emuView handleKeyDown:self.controllerView.img_abxy_x];
} else { } else {
kcode[0] |= (DC_BTN_X); [self.emuView handleKeyUp:self.controllerView.img_abxy_x];
} }
}]; }];
[self.gController.extendedGamepad.buttonY setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) { [self.gController.extendedGamepad.buttonY setValueChangedHandler:^(GCControllerButtonInput *button, float value, BOOL pressed) {
if (pressed && value >= 0.1) { if (pressed && value >= 0.1) {
kcode[0] &= ~(DC_BTN_Y); [self.emuView handleKeyDown:self.controllerView.img_abxy_y];
} else { } else {
kcode[0] |= (DC_BTN_Y); [self.emuView handleKeyUp:self.controllerView.img_abxy_y];
} }
}]; }];
[self.gController.extendedGamepad.dpad setValueChangedHandler:^(GCControllerDirectionPad *dpad, float xValue, float yValue){ [self.gController.extendedGamepad.dpad setValueChangedHandler:^(GCControllerDirectionPad *dpad, float xValue, float yValue){
if (xValue >= 0.1) { if (xValue >= 0.1) {
kcode[0] &= ~(DC_DPAD_RIGHT); [self.emuView handleKeyDown:self.controllerView.img_dpad_r];
} else { } else {
kcode[0] |= ~(DC_DPAD_RIGHT); [self.emuView handleKeyUp:self.controllerView.img_dpad_r];
} }
if (xValue <= -0.1) { if (xValue <= -0.1) {
kcode[0] &= ~(DC_DPAD_LEFT); [self.emuView handleKeyDown:self.controllerView.img_dpad_l];
} else { } else {
kcode[0] |= ~(DC_DPAD_LEFT); [self.emuView handleKeyUp:self.controllerView.img_dpad_l];
} }
if (yValue >= 0.1) { if (yValue >= 0.1) {
kcode[0] &= ~(DC_DPAD_UP); [self.emuView handleKeyDown:self.controllerView.img_dpad_u];
} else { } else {
kcode[0] |= ~(DC_DPAD_UP); [self.emuView handleKeyUp:self.controllerView.img_dpad_u];
} }
if (yValue <= -0.1) { if (yValue <= -0.1) {
kcode[0] &= ~(DC_DPAD_DOWN); [self.emuView handleKeyDown:self.controllerView.img_dpad_d];
} else { } else {
kcode[0] |= ~(DC_DPAD_DOWN); [self.emuView handleKeyUp:self.controllerView.img_dpad_d];
} }
}]; }];
[self.gController.extendedGamepad.leftThumbstick.xAxis setValueChangedHandler:^(GCControllerAxisInput *axis, float value){ [self.gController.extendedGamepad.leftThumbstick.xAxis setValueChangedHandler:^(GCControllerAxisInput *axis, float value){

View File

@ -70,11 +70,11 @@
</objects> </objects>
<point key="canvasLocation" x="-692" y="-692"/> <point key="canvasLocation" x="-692" y="-692"/>
</scene> </scene>
<!--View Controller--> <!--Emulator View Controller-->
<scene sceneID="h6I-2s-MCy"> <scene sceneID="h6I-2s-MCy">
<objects> <objects>
<viewController storyboardIdentifier="emulatorView" wantsFullScreenLayout="YES" id="WRM-pR-XCP" customClass="ViewController" sceneMemberID="viewController"> <viewController storyboardIdentifier="emulatorView" wantsFullScreenLayout="YES" id="WRM-pR-XCP" customClass="EmulatorViewController" sceneMemberID="viewController">
<view key="view" userInteractionEnabled="NO" contentMode="scaleToFill" id="JQE-db-ZiC" customClass="EmulatorView"> <view key="view" multipleTouchEnabled="YES" contentMode="scaleToFill" id="JQE-db-ZiC" customClass="EmulatorView">
<rect key="frame" x="0.0" y="0.0" width="568" height="320"/> <rect key="frame" x="0.0" y="0.0" width="568" height="320"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>

View File

@ -24,8 +24,11 @@
@property (nonatomic, strong) IBOutlet UIButton* img_rt; @property (nonatomic, strong) IBOutlet UIButton* img_rt;
@property (nonatomic, strong) IBOutlet UIButton* img_start; @property (nonatomic, strong) IBOutlet UIButton* img_start;
@property (nonatomic, strong) EmulatorView *handler;
- (void) showController:(UIView *)parentView; - (void) showController:(UIView *)parentView;
- (void) hideController; - (void) hideController;
- (BOOL) isControllerVisible; - (BOOL) isControllerVisible;
- (void) setControlOutput:(EmulatorView *)output;
@end @end

View File

@ -7,7 +7,7 @@
// //
#import "PadViewController.h" #import "PadViewController.h"
#import "EmulatorViewController.h" #import "EmulatorView.h"
@interface PadViewController () @interface PadViewController ()
@ -17,7 +17,6 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view from its nib.
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
@ -30,7 +29,8 @@
[parentView addSubview:self.view]; [parentView addSubview:self.view];
} }
- (void)hideController { - (void)hideController
{
[self.view removeFromSuperview]; [self.view removeFromSuperview];
} }
@ -41,10 +41,19 @@
return NO; return NO;
} }
- (IBAction)keycode:(id)sender - (void)setControlOutput:(EmulatorView *)output
{ {
ViewController *emulatorView = [[ViewController alloc] init]; self.handler = output;
[emulatorView handleKeycode:(UIButton*)sender]; }
- (IBAction)keycodeDown:(id)sender
{
[self.handler handleKeyDown:(UIButton*)sender];
}
- (IBAction)keycodeUp:(id)sender
{
[self.handler handleKeyUp:(UIButton*)sender];
} }
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

View File

@ -21,7 +21,7 @@
</connections> </connections>
</placeholder> </placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="3M7-1s-N5r"> <view multipleTouchEnabled="YES" contentMode="scaleToFill" id="3M7-1s-N5r">
<rect key="frame" x="0.0" y="0.0" width="568" height="320"/> <rect key="frame" x="0.0" y="0.0" width="568" height="320"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
@ -29,28 +29,30 @@
<rect key="frame" x="0.0" y="0.0" width="80" height="40"/> <rect key="frame" x="0.0" y="0.0" width="80" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="8Gl-Iv-u8L" userLabel="LT-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="8Gl-Iv-u8L" userLabel="LT-Button">
<rect key="frame" x="0.0" y="0.0" width="80" height="40"/> <rect key="frame" x="0.0" y="0.0" width="80" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="a2O-ps-Xkb"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="34L-sO-g81"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="iDv-U3-6OX"/>
</connections> </connections>
</button> </button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="RTrigger.png" id="Cjn-zx-eSs"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="RTrigger.png" id="Cjn-zx-eSs">
<rect key="frame" x="488" y="0.0" width="80" height="40"/> <rect key="frame" x="488" y="0.0" width="80" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="V8J-vG-dlF" userLabel="RT-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="V8J-vG-dlF" userLabel="RT-Button">
<rect key="frame" x="488" y="0.0" width="80" height="40"/> <rect key="frame" x="488" y="0.0" width="80" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="mjN-y6-pnM"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="vPf-qF-m13"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="hQh-8f-5jG"/>
</connections> </connections>
</button> </button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="JoystickButton.png" id="ivh-8r-bw3" userLabel="JoystickThumbpad.png"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="JoystickButton.png" id="ivh-8r-bw3" userLabel="JoystickThumbpad.png">
@ -65,102 +67,111 @@
<rect key="frame" x="0.0" y="44" width="140" height="140"/> <rect key="frame" x="0.0" y="44" width="140" height="140"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="rp6-Nd-1qa" userLabel="L-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="rp6-Nd-1qa" userLabel="L-Button">
<rect key="frame" x="0.0" y="94" width="46" height="40"/> <rect key="frame" x="0.0" y="94" width="46" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="rxe-GW-d3m"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="3Yw-AP-xVf"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="5gI-j0-ANf"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="CVH-hw-R8F" userLabel="R-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="CVH-hw-R8F" userLabel="R-Button">
<rect key="frame" x="94" y="94" width="46" height="40"/> <rect key="frame" x="94" y="94" width="46" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="qEi-9T-5Iv"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="2Dv-zb-f8V"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="woi-3Y-IfD"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="WMD-Fv-ibu" userLabel="U-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="WMD-Fv-ibu" userLabel="U-Button">
<rect key="frame" x="50" y="44" width="40" height="40"/> <rect key="frame" x="50" y="44" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="ui8-hf-7zE"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="kT6-yy-ZtY"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="R0R-dl-GAG"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="s7g-nq-lRU" userLabel="D-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="s7g-nq-lRU" userLabel="D-Button">
<rect key="frame" x="50" y="144" width="40" height="40"/> <rect key="frame" x="50" y="144" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="5o3-Va-rA2"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="Wck-mk-4Py"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="Qox-hz-p3A"/>
</connections> </connections>
</button> </button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ABXYPad.png" id="xbP-E4-fCE"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ABXYPad.png" id="xbP-E4-fCE">
<rect key="frame" x="408" y="159" width="160" height="161"/> <rect key="frame" x="408" y="159" width="160" height="161"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="iwO-7q-c8H" userLabel="X-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="iwO-7q-c8H" userLabel="X-Button">
<rect key="frame" x="408" y="210" width="60" height="60"/> <rect key="frame" x="408" y="210" width="60" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="oaf-qS-PRe"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="IBH-TK-vfV"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="dhr-NT-lcF"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="7LB-OY-vh3" userLabel="B-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="7LB-OY-vh3" userLabel="B-Button">
<rect key="frame" x="508" y="210" width="60" height="60"/> <rect key="frame" x="508" y="210" width="60" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="NSp-5e-auj"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="dhg-58-L8C"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="zqg-KK-Wxb"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="hGZ-v7-VA5" userLabel="Y-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="hGZ-v7-VA5" userLabel="Y-Button">
<rect key="frame" x="458" y="159" width="60" height="60"/> <rect key="frame" x="458" y="159" width="60" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="NOd-Vt-P6x"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="tyb-H4-TqJ"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="oai-Xb-scl"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="iKO-3z-Ias" userLabel="A-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="iKO-3z-Ias" userLabel="A-Button">
<rect key="frame" x="458" y="260" width="60" height="60"/> <rect key="frame" x="458" y="260" width="60" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="SIh-0L-Dn0"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="Ysa-m4-KnN"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="MTf-ND-WNy"/>
</connections> </connections>
</button> </button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Start.png" id="9K0-cV-7zu"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Start.png" id="9K0-cV-7zu">
<rect key="frame" x="244" y="272" width="80" height="40"/> <rect key="frame" x="244" y="272" width="80" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="VtI-tC-PSX" userLabel="S-Button"> <button opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="VtI-tC-PSX" userLabel="S-Button">
<rect key="frame" x="257" y="272" width="54" height="40"/> <rect key="frame" x="257" y="272" width="54" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal"> <state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
<connections> <connections>
<action selector="keycode:" destination="-2" eventType="touchUpInside" id="H7E-wo-Hc9"/> <action selector="keycodeDown:" destination="-1" eventType="touchDown" id="kwd-jB-5Wn"/>
<action selector="keycodeUp:" destination="-1" eventType="touchUpInside" id="gHx-tA-QlF"/>
</connections> </connections>
</button> </button>
</subviews> </subviews>

View File

@ -100,7 +100,7 @@
NSIndexPath* indexPath = self.tableView.indexPathForSelectedRow; NSIndexPath* indexPath = self.tableView.indexPathForSelectedRow;
NSString* filePath = [self.diskImages objectAtIndex: indexPath.row]; NSString* filePath = [self.diskImages objectAtIndex: indexPath.row];
NSString* diskPath = [[self documents].path stringByAppendingPathComponent: filePath]; NSString* diskPath = [[self documents].path stringByAppendingPathComponent: filePath];
ViewController* emulatorView = segue.destinationViewController; EmulatorViewController* emulatorView = segue.destinationViewController;
emulatorView.diskImage = diskPath; emulatorView.diskImage = diskPath;
} }
} }