diff --git a/CMakeLists.txt b/CMakeLists.txt index e0d117728b..b1e38b10a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1292,6 +1292,7 @@ elseif(IOS AND NOT LIBRETRO) ios/DisplayManager.mm ios/Controls.h ios/Controls.mm + ios/ViewControllerCommon.h ios/ViewController.mm ios/ViewController.h ios/iOSCoreAudio.mm diff --git a/ios/ViewController.h b/ios/ViewController.h index 1e1678685d..fcacaff1ac 100644 --- a/ios/ViewController.h +++ b/ios/ViewController.h @@ -7,15 +7,7 @@ #import "CameraHelper.h" #import "LocationHelper.h" -@protocol PPSSPPViewController -@optional -- (void)hideKeyboard; -- (void)showKeyboard; -- (void)shareText:(NSString *)text; -- (void)shutdown; -- (void)bindDefaultFBO; -- (UIView *)getView; -@end +#include "ViewControllerCommon.h" @interface PPSSPPViewControllerGL : GLKViewController < iCadeEventDelegate, LocationHandlerDelegate, CameraFrameDelegate, @@ -27,5 +19,3 @@ extern id sharedViewController; void setCameraSize(int width, int height); void startVideo(); void stopVideo(); -void startLocation(); -void stopLocation(); diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 169cc32de9..224ee01fe6 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -95,13 +95,13 @@ id sharedViewController; // TODO: Reach these through sharedViewController static CameraHelper *cameraHelper; -static LocationHelper *locationHelper; @interface PPSSPPViewControllerGL () { ICadeTracker g_iCadeTracker; TouchTracker g_touchTracker; GraphicsContext *graphicsContext; + LocationHelper *locationHelper; } @property (nonatomic, strong) EAGLContext* context; @@ -394,19 +394,19 @@ void stopVideo() { [cameraHelper stopVideo]; } --(void) PushCameraImageIOS:(long long)len buffer:(unsigned char*)data { +- (void)PushCameraImageIOS:(long long)len buffer:(unsigned char*)data { Camera::pushCameraImage(len, data); } -void startLocation() { +- (void)startLocation { [locationHelper startLocationUpdates]; } -void stopLocation() { +- (void)stopLocation { [locationHelper stopLocationUpdates]; } --(void) SetGpsDataIOS:(CLLocation *)newLocation { +- (void)SetGpsDataIOS:(CLLocation *)newLocation { GPS::setGpsData((long long)newLocation.timestamp.timeIntervalSince1970, newLocation.horizontalAccuracy/5.0, newLocation.coordinate.latitude, newLocation.coordinate.longitude, diff --git a/ios/ViewControllerCommon.h b/ios/ViewControllerCommon.h new file mode 100644 index 0000000000..bdcd0ee255 --- /dev/null +++ b/ios/ViewControllerCommon.h @@ -0,0 +1,17 @@ +#pragma once + +#import + +@protocol PPSSPPViewController +@optional + +- (void)hideKeyboard; +- (void)showKeyboard; +- (void)shareText:(NSString *)text; +- (void)shutdown; +- (void)bindDefaultFBO; +- (UIView *)getView; +- (void)startLocation; +- (void)stopLocation; + +@end diff --git a/ios/main.mm b/ios/main.mm index 0466c67000..94a0028668 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -437,9 +437,9 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string return true; case SystemRequestType::GPS_COMMAND: if (param1 == "open") { - startLocation(); + [sharedViewController startLocation]; } else if (param1 == "close") { - stopLocation(); + [sharedViewController stopLocation]; } return true; case SystemRequestType::SHARE_TEXT: