(iOS) Fix issues with orientation locking.

This commit is contained in:
meancoot 2013-12-20 19:20:01 -05:00
parent 0d94dd03f7
commit 09dc8295d6
3 changed files with 30 additions and 32 deletions

View File

@ -192,6 +192,30 @@ static bool g_is_syncing = true;
];
}
// NOTE: This version only runs on iOS6
- (NSUInteger)supportedInterfaceOrientations
{
return apple_frontend_settings.orientation_flags;
}
// NOTE: This version runs on iOS2-iOS5, but not iOS6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
switch (interfaceOrientation)
{
case UIInterfaceOrientationPortrait:
return (apple_frontend_settings.orientation_flags & UIInterfaceOrientationMaskPortrait);
case UIInterfaceOrientationPortraitUpsideDown:
return (apple_frontend_settings.orientation_flags & UIInterfaceOrientationMaskPortraitUpsideDown);
case UIInterfaceOrientationLandscapeLeft:
return (apple_frontend_settings.orientation_flags & UIInterfaceOrientationMaskLandscapeLeft);
case UIInterfaceOrientationLandscapeRight:
return (apple_frontend_settings.orientation_flags & UIInterfaceOrientationMaskLandscapeRight);
}
return YES;
}
void event_process_camera_frame(void* pixelBufferPtr)
{
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)pixelBufferPtr;

View File

@ -23,7 +23,9 @@
typedef struct
{
char orientations[32];
char orientations[32];
unsigned orientation_flags;
bool logging_enabled;
char bluetooth_mode[64];

View File

@ -175,8 +175,6 @@ static void handle_touch_event(NSArray* touches)
{
UIWindow* _window;
NSString* _path;
uint32_t _enabledOrientations;
}
+ (RetroArch_iOS*)get
@ -265,32 +263,6 @@ static void handle_touch_event(NSArray* touches)
[self refreshSystemConfig];
}
// NOTE: This version only runs on iOS6
- (NSUInteger)supportedInterfaceOrientations
{
return g_extern.is_paused ? _enabledOrientations
: UIInterfaceOrientationMaskAll;
}
// NOTE: This version runs on iOS2-iOS5, but not iOS6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (!g_extern.is_paused)
switch (interfaceOrientation)
{
case UIInterfaceOrientationPortrait:
return (_enabledOrientations & UIInterfaceOrientationMaskPortrait);
case UIInterfaceOrientationPortraitUpsideDown:
return (_enabledOrientations & UIInterfaceOrientationMaskPortraitUpsideDown);
case UIInterfaceOrientationLandscapeLeft:
return (_enabledOrientations & UIInterfaceOrientationMaskLandscapeLeft);
case UIInterfaceOrientationLandscapeRight:
return (_enabledOrientations & UIInterfaceOrientationMaskLandscapeRight);
}
return YES;
}
- (void)showGameView
{
[self popToRootViewControllerAnimated:NO];
@ -329,12 +301,12 @@ static void handle_touch_event(NSArray* touches)
- (void)refreshSystemConfig
{
// Get enabled orientations
_enabledOrientations = UIInterfaceOrientationMaskAll;
apple_frontend_settings.orientation_flags = UIInterfaceOrientationMaskAll;
if (strcmp(apple_frontend_settings.orientations, "landscape") == 0)
_enabledOrientations = UIInterfaceOrientationMaskLandscape;
apple_frontend_settings.orientation_flags = UIInterfaceOrientationMaskLandscape;
else if (strcmp(apple_frontend_settings.orientations, "portrait") == 0)
_enabledOrientations = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
apple_frontend_settings.orientation_flags = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
// Set bluetooth mode
ios_set_bluetooth_mode(BOXSTRING(apple_frontend_settings.bluetooth_mode));