[Scummvm-git-logs] scummvm master -> 32013e98091fbed8e5cf68875049fd7367f54fcf

criezy noreply at scummvm.org
Wed May 31 19:14:57 UTC 2023


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0eca37a262 BACKENDS: Remove old iPhone backend
7af069b110 CONFIGURE: Rename iphone host_os to iphoneos
32013e9809 PORTS: Rename iphone target to scummvm-static-ios


Commit: 0eca37a26254d1646f4c2e9417f4de268875ad36
    https://github.com/scummvm/scummvm/commit/0eca37a26254d1646f4c2e9417f4de268875ad36
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-05-31T19:31:19+01:00

Commit Message:
BACKENDS: Remove old iPhone backend

This backend was no longer maintained and have had no release
and no daily builds for several years.

Changed paths:
  R backends/platform/iphone/iphone_common.h
  R backends/platform/iphone/iphone_keyboard.h
  R backends/platform/iphone/iphone_keyboard.mm
  R backends/platform/iphone/iphone_main.mm
  R backends/platform/iphone/iphone_video.h
  R backends/platform/iphone/iphone_video.mm
  R backends/platform/iphone/module.mk
  R backends/platform/iphone/osys_events.cpp
  R backends/platform/iphone/osys_main.cpp
  R backends/platform/iphone/osys_main.h
  R backends/platform/iphone/osys_sound.cpp
  R backends/platform/iphone/osys_video.mm
  R dists/iphone/Default.png
  R dists/iphone/Info.plist
  R dists/iphone/Info.plist.in
  R dists/iphone/icon-72.png
  R dists/iphone/icon.png
  R dists/iphone/icon4.png
    .gitignore
    configure
    devtools/create_project/xcode/create_project.xcodeproj/project.pbxproj
    devtools/update-version.pl
    po/POTFILES
    ports.mk


diff --git a/.gitignore b/.gitignore
index 151b5e3b359..1dadcfd7e5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -101,12 +101,10 @@ lib*.a
 #Ignore XCode user data and build files
 xcuserdata
 project.xcworkspace
-/dists/iphone/build
-/dists/iphone/scummvm.xcodeproj
-/dists/iphone/create_project
 /dists/macosx/build
 /dists/macosx/scummvm.xcodeproj
 /dists/macosx/create_project
+/dists/ios7/create_project
 /devtools/create_project/xcode/build
 
 /dists/msvc/[Dd]ebug*/
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
deleted file mode 100644
index 8442ae7e091..00000000000
--- a/backends/platform/iphone/iphone_common.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BACKENDS_PLATFORM_IPHONE_IPHONE_COMMON_H
-#define BACKENDS_PLATFORM_IPHONE_IPHONE_COMMON_H
-
-#include "graphics/surface.h"
-
-enum InputEvent {
-	kInputMouseDown,
-	kInputMouseUp,
-	kInputMouseDragged,
-	kInputMouseSecondDragged,
-	kInputMouseSecondDown,
-	kInputMouseSecondUp,
-	kInputOrientationChanged,
-	kInputKeyPressed,
-	kInputApplicationSuspended,
-	kInputApplicationResumed,
-	kInputSwipe
-};
-
-enum ScreenOrientation {
-	kScreenOrientationPortrait,
-	kScreenOrientationLandscape,
-	kScreenOrientationFlippedLandscape
-};
-
-enum UIViewSwipeDirection {
-	kUIViewSwipeUp = 1,
-	kUIViewSwipeDown = 2,
-	kUIViewSwipeLeft = 4,
-	kUIViewSwipeRight = 8
-};
-
-struct VideoContext {
-	VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
-	                 overlayInGUI(false), overlayWidth(), overlayHeight(), mouseX(), mouseY(),
-	                 mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
-	                 mouseIsVisible(), filtering(false),
-	                 shakeXOffset(), shakeYOffset() {
-	}
-
-	// Game screen state
-	bool asprectRatioCorrection;
-	uint screenWidth, screenHeight;
-	Graphics::Surface screenTexture;
-
-	// Overlay state
-	bool overlayVisible;
-	bool overlayInGUI;
-	uint overlayWidth, overlayHeight;
-	Graphics::Surface overlayTexture;
-
-	// Mouse cursor state
-	uint mouseX, mouseY;
-	int mouseHotspotX, mouseHotspotY;
-	uint mouseWidth, mouseHeight;
-	bool mouseIsVisible;
-	Graphics::Surface mouseTexture;
-
-	// Misc state
-	bool filtering;
-	int shakeXOffset;
-	int shakeYOffset;
-};
-
-struct InternalEvent {
-	InternalEvent() : type(), value1(), value2() {}
-	InternalEvent(InputEvent t, int v1, int v2) : type(t), value1(v1), value2(v2) {}
-
-	InputEvent type;
-	int value1, value2;
-};
-
-// On the ObjC side
-void iPhone_updateScreen();
-bool iPhone_fetchEvent(InternalEvent *event);
-const char *iPhone_getDocumentsDir();
-bool iPhone_isHighResDevice();
-
-uint getSizeNextPOT(uint size);
-
-#endif
diff --git a/backends/platform/iphone/iphone_keyboard.h b/backends/platform/iphone/iphone_keyboard.h
deleted file mode 100644
index 70866af0b3f..00000000000
--- a/backends/platform/iphone/iphone_keyboard.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BACKENDS_PLATFORM_IPHONE_IPHONE_KEYBOARD_H
-#define BACKENDS_PLATFORM_IPHONE_IPHONE_KEYBOARD_H
-
-#include <UIKit/UIKit.h>
-#include <UIKit/UITextView.h>
-
- at interface SoftKeyboard : UIView {
-	id inputDelegate;
-	UITextView *inputView;
-}
-
-- (id)initWithFrame:(CGRect)frame;
-- (UITextView *)inputView;
-- (void)setInputDelegate:(id)delegate;
-- (void)handleKeyPress:(unichar)c;
-
- at end
-
-#endif
diff --git a/backends/platform/iphone/iphone_keyboard.mm b/backends/platform/iphone/iphone_keyboard.mm
deleted file mode 100644
index af1a8dfc99e..00000000000
--- a/backends/platform/iphone/iphone_keyboard.mm
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "backends/platform/iphone/iphone_keyboard.h"
-
- at interface UITextInputTraits
-- (void)setAutocorrectionType:(int)type;
-- (void)setAutocapitalizationType:(int)type;
-- (void)setEnablesReturnKeyAutomatically:(BOOL)val;
- at end
-
- at interface TextInputHandler : UITextView {
-	SoftKeyboard *softKeyboard;
-}
-
-- (id)initWithKeyboard:(SoftKeyboard *)keyboard;
-
- at end
-
-
- at implementation TextInputHandler
-
-- (id)initWithKeyboard:(SoftKeyboard *)keyboard {
-	self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)];
-	softKeyboard = keyboard;
-
-	[[self textInputTraits] setAutocorrectionType:(UITextAutocorrectionType)1];
-	[[self textInputTraits] setAutocapitalizationType:(UITextAutocapitalizationType)0];
-	[[self textInputTraits] setEnablesReturnKeyAutomatically:NO];
-
-	return self;
-}
-
-- (void) keyboardInputShouldDelete:(id)input {
-	[softKeyboard handleKeyPress:0x08];
-}
-
-- (BOOL)webView:(id)fp8 shouldInsertText:(id)character
-                       replacingDOMRange:(id)fp16
-                             givenAction:(int)fp20 {
-
-	if ([character length] != 1) {
-		[NSException raise:@"Unsupported" format:@"Unhandled multi-char insert!"];
-		return NO;
-	}
-
-	[softKeyboard handleKeyPress:[character characterAtIndex:0]];
-
-	return NO;
-}
-
- at end
-
-
- at implementation SoftKeyboard
-
-- (id)initWithFrame:(CGRect)frame {
-	self = [super initWithFrame:frame];
-	inputDelegate = nil;
-	inputView = [[TextInputHandler alloc] initWithKeyboard:self];
-	return self;
-}
-
-- (UITextView *)inputView {
-	return inputView;
-}
-
-- (void)setInputDelegate:(id)delegate {
-	inputDelegate = delegate;
-}
-
-- (void)handleKeyPress:(unichar)c {
-	[inputDelegate handleKeyPress:c];
-}
-
- at end
diff --git a/backends/platform/iphone/iphone_main.mm b/backends/platform/iphone/iphone_main.mm
deleted file mode 100644
index 7c7d2916328..00000000000
--- a/backends/platform/iphone/iphone_main.mm
+++ /dev/null
@@ -1,139 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include <UIKit/UIKit.h>
-#include <Foundation/NSThread.h>
-
-#include "backends/platform/iphone/iphone_video.h"
-
-void iphone_main(int argc, char *argv[]);
-
- at interface iPhoneMain : UIApplication {
-	UIWindow *_window;
-	iPhoneView *_view;
-}
-
-- (void)mainLoop:(id)param;
-- (iPhoneView *)getView;
-- (UIWindow *)getWindow;
-- (void)didRotate:(NSNotification *)notification;
- at end
-
-static int g_argc;
-static char **g_argv;
-
-int main(int argc, char **argv) {
-	g_argc = argc;
-	g_argv = argv;
-
-	NSAutoreleasePool *autoreleasePool = [
-		[NSAutoreleasePool alloc] init
-	];
-
-	int returnCode = UIApplicationMain(argc, argv, @"iPhoneMain", @"iPhoneMain");
-	[autoreleasePool release];
-	return returnCode;
-}
-
- at implementation iPhoneMain
-
--(id) init {
-	[super init];
-	_window = nil;
-	_view = nil;
-	return self;
-}
-
-- (void)mainLoop:(id)param {
-	[[NSAutoreleasePool alloc] init];
-
-	iphone_main(g_argc, g_argv);
-	exit(0);
-}
-
-- (iPhoneView *)getView {
-	return _view;
-}
-
-- (void)applicationDidFinishLaunching:(UIApplication *)application {
-	CGRect  rect = [[UIScreen mainScreen] bounds];
-
-	// hide the status bar
-	[application setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
-	[application setStatusBarHidden:YES animated:YES];
-
-	_window = [[UIWindow alloc] initWithFrame:rect];
-	[_window retain];
-
-	_view = [[iPhoneView alloc] initWithFrame:rect];
-	_view.multipleTouchEnabled = YES;
-
-	[_window setContentView:_view];
-
-  	[_window addSubview:_view];
-	[_window makeKeyAndVisible];
-
-	[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
-	[[NSNotificationCenter defaultCenter] addObserver:self
-	                                         selector:@selector(didRotate:)
-	                                             name:@"UIDeviceOrientationDidChangeNotification"
-	                                           object:nil];
-
-	[NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil];
-}
-
-- (void)applicationDidResume {
-}
-
-- (void)applicationWillSuspend {
-}
-
-- (void)applicationWillTerminate {
-}
-
-- (void)applicationSuspend:(struct __GSEvent *)event {
-	//[self setApplicationBadge:NSLocalizedString(@"ON", nil)];
-	[_view applicationSuspend];
-}
-
-- (void)applicationResume:(struct __GSEvent *)event {
-	[_view applicationResume];
-
-	// Workaround, need to "hide" and unhide the statusbar to properly remove it,
-	// since the Springboard has put it back without apparently flagging our application.
-	[self setStatusBarHidden:YES animated:YES];
-	[self setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
-	[self setStatusBarHidden:YES animated:YES];
-}
-
-- (void)didRotate:(NSNotification *)notification {
-	UIDeviceOrientation screenOrientation = [[UIDevice currentDevice] orientation];
-	[_view deviceOrientationChanged:screenOrientation];
-}
-
-- (UIWindow*) getWindow {
-	return _window;
-}
-
- at end
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
deleted file mode 100644
index fc5a67e8091..00000000000
--- a/backends/platform/iphone/iphone_video.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BACKENDS_PLATFORM_IPHONE_IPHONE_VIDEO_H
-#define BACKENDS_PLATFORM_IPHONE_IPHONE_VIDEO_H
-
-#include <UIKit/UIKit.h>
-#include <Foundation/Foundation.h>
-#include <QuartzCore/QuartzCore.h>
-
-#include <OpenGLES/EAGL.h>
-#include <OpenGLES/ES1/gl.h>
-#include <OpenGLES/ES1/glext.h>
-
-#include "backends/platform/iphone/iphone_keyboard.h"
-#include "backends/platform/iphone/iphone_common.h"
-
-#include "common/list.h"
-
- at interface iPhoneView : UIView {
-	VideoContext _videoContext;
-
-	Common::List<InternalEvent> _events;
-	NSLock *_eventLock;
-	SoftKeyboard *_keyboardView;
-
-	EAGLContext *_context;
-	GLuint _viewRenderbuffer;
-	GLuint _viewFramebuffer;
-	GLuint _screenTexture;
-	GLuint _overlayTexture;
-	GLuint _mouseCursorTexture;
-
-	UIDeviceOrientation _orientation;
-
-	GLint _renderBufferWidth;
-	GLint _renderBufferHeight;
-
-	GLfloat _gameScreenVertCoords[4 * 2];
-	GLfloat _gameScreenTexCoords[4 * 2];
-	CGRect _gameScreenRect;
-
-	GLfloat _overlayVertCoords[4 * 2];
-	GLfloat _overlayTexCoords[4 * 2];
-	CGRect _overlayRect;
-
-	GLfloat _mouseVertCoords[4 * 2];
-	GLfloat _mouseTexCoords[4 * 2];
-	GLint _mouseHotspotX, _mouseHotspotY;
-	GLint _mouseWidth, _mouseHeight;
-	GLfloat _mouseScaleX, _mouseScaleY;
-
-	int _scaledShakeXOffset;
-	int _scaledShakeYOffset;
-	CGFloat _contentScaleFactor;
-
-	UITouch *_firstTouch;
-	UITouch *_secondTouch;
-}
-
-- (id)initWithFrame:(struct CGRect)frame;
-
-- (VideoContext *)getVideoContext;
-
-- (void)drawRect:(CGRect)frame;
-
-- (void)createScreenTexture;
-- (void)initSurface;
-- (void)setViewTransformation;
-
-- (void)setGraphicsMode;
-
-- (void)updateSurface;
-- (void)updateMainSurface;
-- (void)updateOverlaySurface;
-- (void)updateMouseSurface;
-- (void)clearColorBuffer;
-
-- (void)notifyMouseMove;
-- (void)updateMouseCursorScaling;
-- (void)updateMouseCursor;
-
-- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation;
-
-- (void)disableIdleTimer;
-- (void)enableIdleTimer;
-
-- (void)applicationSuspend;
-
-- (void)applicationResume;
-
-- (bool)fetchEvent:(InternalEvent *)event;
-
- at end
-
-extern iPhoneView *g_iPhoneViewInstance;
-
-#endif
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
deleted file mode 100644
index a1f5795c012..00000000000
--- a/backends/platform/iphone/iphone_video.mm
+++ /dev/null
@@ -1,784 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "backends/platform/iphone/iphone_video.h"
-
-iPhoneView *g_iPhoneViewInstance = nil;
-static int g_fullWidth;
-static int g_fullHeight;
-
-static int g_needsScreenUpdate = 0;
-
-#if 0
-static long g_lastTick = 0;
-static int g_frames = 0;
-#endif
-
-#define printOpenGLError() printOglError(__FILE__, __LINE__)
-
-int printOglError(const char *file, int line) {
-	int retCode = 0;
-
-	// returns 1 if an OpenGL error occurred, 0 otherwise.
-	GLenum glErr = glGetError();
-	while (glErr != GL_NO_ERROR) {
-		fprintf(stderr, "glError: %u (%s: %d)\n", glErr, file, line);
-		retCode = 1;
-		glErr = glGetError();
-	}
-	return retCode;
-}
-
-bool iPhone_isHighResDevice() {
-	return g_fullHeight > 480;
-}
-
-void iPhone_updateScreen() {
-	//printf("Mouse: (%i, %i)\n", mouseX, mouseY);
-	if (!g_needsScreenUpdate) {
-		g_needsScreenUpdate = 1;
-		[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateSurface) withObject:nil waitUntilDone: NO];
-	}
-}
-
-bool iPhone_fetchEvent(InternalEvent *event) {
-	return [g_iPhoneViewInstance fetchEvent:event];
-}
-
-uint getSizeNextPOT(uint size) {
-	if ((size & (size - 1)) || !size) {
-		int log = 0;
-
-		while (size >>= 1)
-			++log;
-
-		size = (2 << log);
-	}
-
-	return size;
-}
-
-const char *iPhone_getDocumentsDir() {
-	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-	NSString *documentsDirectory = [paths objectAtIndex:0];
-	return [documentsDirectory UTF8String];
-}
-
- at implementation iPhoneView
-
-+ (Class)layerClass {
-	return [CAEAGLLayer class];
-}
-
-- (VideoContext *)getVideoContext {
-	return &_videoContext;
-}
-
-- (void)createContext {
-	CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
-
-	eaglLayer.opaque = YES;
-	eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
-	                                [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat, nil];
-
-	_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
-
-	// In case creating the OpenGL ES context failed, we will error out here.
-	if (_context == nil) {
-		fprintf(stderr, "Could not create OpenGL ES context\n");
-		exit(-1);
-	}
-
-	if ([EAGLContext setCurrentContext:_context]) {
-		glGenFramebuffersOES(1, &_viewFramebuffer); printOpenGLError();
-		glGenRenderbuffersOES(1, &_viewRenderbuffer); printOpenGLError();
-
-		glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer); printOpenGLError();
-		glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
-		[_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
-
-		glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
-
-		// Retrieve the render buffer size. This *should* match the frame size,
-		// i.e. g_fullWidth and g_fullHeight.
-		glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_renderBufferWidth); printOpenGLError();
-		glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_renderBufferHeight); printOpenGLError();
-
-		if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
-			NSLog(@"Failed to make complete framebuffer object %x.", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
-			return;
-		}
-
-		_videoContext.overlayHeight = _renderBufferWidth;
-		_videoContext.overlayWidth = _renderBufferHeight;
-		uint overlayTextureWidth = getSizeNextPOT(_videoContext.overlayHeight);
-		uint overlayTextureHeight = getSizeNextPOT(_videoContext.overlayWidth);
-
-		// Since the overlay size won't change the whole run, we can
-		// precalculate the texture coordinates for the overlay texture here
-		// and just use it later on.
-		_overlayTexCoords[2] = _overlayTexCoords[6] = _videoContext.overlayWidth / (GLfloat)overlayTextureWidth;
-		_overlayTexCoords[5] = _overlayTexCoords[7] = _videoContext.overlayHeight / (GLfloat)overlayTextureHeight;
-
-		_videoContext.overlayTexture.create(overlayTextureWidth, overlayTextureHeight, Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
-
-		glViewport(0, 0, _renderBufferWidth, _renderBufferHeight); printOpenGLError();
-		glClearColor(0.0f, 0.0f, 0.0f, 1.0f); printOpenGLError();
-
-		glEnable(GL_BLEND);
-		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-		glEnable(GL_TEXTURE_2D); printOpenGLError();
-		glEnableClientState(GL_TEXTURE_COORD_ARRAY); printOpenGLError();
-		glEnableClientState(GL_VERTEX_ARRAY); printOpenGLError();
-	}
-}
-
-- (id)initWithFrame:(struct CGRect)frame {
-	self = [super initWithFrame: frame];
-
-	_contentScaleFactor = 1;
-	if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
-		if ([self respondsToSelector:@selector(setContentScaleFactor:)]) {
-			// Horrible and crazy method to get the proper return value of
-			// scale when the SDK used for building does not know anything
-			// about the selector scale...
-			NSMethodSignature *scaleSignature = [UIScreen instanceMethodSignatureForSelector:@selector(scale)];
-			NSInvocation *scaleInvocation = [NSInvocation invocationWithMethodSignature:scaleSignature];
-			[scaleInvocation setTarget:[UIScreen mainScreen]];
-			[scaleInvocation setSelector:@selector(scale)];
-			[scaleInvocation invoke];
-
-			NSInteger returnLength = [[scaleInvocation methodSignature] methodReturnLength];
-			if (returnLength == sizeof(CGFloat)) {
-				[scaleInvocation getReturnValue:&_contentScaleFactor];
-				[self setContentScaleFactor:_contentScaleFactor];
-			}
-		}
-	}
-
-	g_fullWidth = (int)frame.size.width;
-	g_fullHeight = (int)frame.size.height;
-
-	g_iPhoneViewInstance = self;
-
-	_keyboardView = nil;
-	_screenTexture = 0;
-	_overlayTexture = 0;
-	_mouseCursorTexture = 0;
-
-	_scaledShakeXOffset = 0;
-	_scaledShakeYOffset = 0;
-
-	_firstTouch = NULL;
-	_secondTouch = NULL;
-
-	_eventLock = [[NSLock alloc] init];
-
-	_gameScreenVertCoords[0] = _gameScreenVertCoords[1] =
-	    _gameScreenVertCoords[2] = _gameScreenVertCoords[3] =
-	    _gameScreenVertCoords[4] = _gameScreenVertCoords[5] =
-	    _gameScreenVertCoords[6] = _gameScreenVertCoords[7] = 0;
-
-	_gameScreenTexCoords[0] = _gameScreenTexCoords[1] =
-	    _gameScreenTexCoords[2] = _gameScreenTexCoords[3] =
-	    _gameScreenTexCoords[4] = _gameScreenTexCoords[5] =
-	    _gameScreenTexCoords[6] = _gameScreenTexCoords[7] = 0;
-
-	_overlayVertCoords[0] = _overlayVertCoords[1] =
-	    _overlayVertCoords[2] = _overlayVertCoords[3] =
-	    _overlayVertCoords[4] = _overlayVertCoords[5] =
-	    _overlayVertCoords[6] = _overlayVertCoords[7] = 0;
-
-	_overlayTexCoords[0] = _overlayTexCoords[1] =
-	    _overlayTexCoords[2] = _overlayTexCoords[3] =
-	    _overlayTexCoords[4] = _overlayTexCoords[5] =
-	    _overlayTexCoords[6] = _overlayTexCoords[7] = 0;
-
-	_mouseVertCoords[0] = _mouseVertCoords[1] =
-	    _mouseVertCoords[2] = _mouseVertCoords[3] =
-	    _mouseVertCoords[4] = _mouseVertCoords[5] =
-	    _mouseVertCoords[6] = _mouseVertCoords[7] = 0;
-
-	_mouseTexCoords[0] = _mouseTexCoords[1] =
-	    _mouseTexCoords[2] = _mouseTexCoords[3] =
-	    _mouseTexCoords[4] = _mouseTexCoords[5] =
-	    _mouseTexCoords[6] = _mouseTexCoords[7] = 0;
-
-	// Initialize the OpenGL ES context
-	[self createContext];
-
-	return self;
-}
-
-- (void)dealloc {
-	if (_keyboardView != nil) {
-		[_keyboardView dealloc];
-	}
-
-	_videoContext.screenTexture.free();
-	_videoContext.overlayTexture.free();
-	_videoContext.mouseTexture.free();
-
-	[_eventLock dealloc];
-	[super dealloc];
-}
-
-- (void)drawRect:(CGRect)frame {
-#if 0
-	if (g_lastTick == 0) {
-		g_lastTick = time(0);
-	}
-
-	g_frames++;
-	if (time(0) > g_lastTick) {
-		g_lastTick = time(0);
-		printf("FPS: %i\n", g_frames);
-		g_frames = 0;
-	}
-#endif
-}
-
-- (void)setFilterModeForTexture:(GLuint)tex {
-	if (!tex)
-		return;
-
-	glBindTexture(GL_TEXTURE_2D, tex); printOpenGLError();
-
-	GLint filter = _videoContext.filtering ? GL_LINEAR : GL_NEAREST;
-
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); printOpenGLError();
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); printOpenGLError();
-	// We use GL_CLAMP_TO_EDGE here to avoid artifacts when linear filtering
-	// is used. If we would not use this for example the cursor in Loom would
-	// have a line/border artifact on the right side of the covered rect.
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); printOpenGLError();
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); printOpenGLError();
-}
-
-- (void)setGraphicsMode {
-	[self setFilterModeForTexture:_screenTexture];
-	[self setFilterModeForTexture:_overlayTexture];
-	[self setFilterModeForTexture:_mouseCursorTexture];
-}
-
-- (void)updateSurface {
-	if (!g_needsScreenUpdate) {
-		return;
-	}
-	g_needsScreenUpdate = 0;
-
-	glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
-
-	[self updateMainSurface];
-
-	if (_videoContext.overlayVisible)
-		[self updateOverlaySurface];
-
-	if (_videoContext.mouseIsVisible)
-		[self updateMouseSurface];
-
-	glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
-	[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
-
-}
-
-- (void)notifyMouseMove {
-	const GLint mouseX = (GLint)(_videoContext.mouseX * _mouseScaleX) - _mouseHotspotX;
-	const GLint mouseY = (GLint)(_videoContext.mouseY * _mouseScaleY) - _mouseHotspotY;
-
-	_mouseVertCoords[0] = _mouseVertCoords[4] = mouseX;
-	_mouseVertCoords[1] = _mouseVertCoords[3] = mouseY;
-	_mouseVertCoords[2] = _mouseVertCoords[6] = mouseX + _mouseWidth;
-	_mouseVertCoords[5] = _mouseVertCoords[7] = mouseY + _mouseHeight;
-}
-
-- (void)updateMouseCursorScaling {
-	CGRect *rect;
-	int maxWidth, maxHeight;
-
-	if (!_videoContext.overlayInGUI) {
-		rect = &_gameScreenRect;
-		maxWidth = _videoContext.screenWidth;
-		maxHeight = _videoContext.screenHeight;
-	} else {
-		rect = &_overlayRect;
-		maxWidth = _videoContext.overlayWidth;
-		maxHeight = _videoContext.overlayHeight;
-	}
-
-	if (!maxWidth || !maxHeight) {
-		printf("WARNING: updateMouseCursorScaling called when screen was not ready (%d)!\n", _videoContext.overlayInGUI);
-		return;
-	}
-
-	_mouseScaleX = CGRectGetWidth(*rect) / (GLfloat)maxWidth;
-	_mouseScaleY = CGRectGetHeight(*rect) / (GLfloat)maxHeight;
-
-	_mouseWidth = (GLint)(_videoContext.mouseWidth * _mouseScaleX);
-	_mouseHeight = (GLint)(_videoContext.mouseHeight * _mouseScaleY);
-
-	_mouseHotspotX = (GLint)(_videoContext.mouseHotspotX * _mouseScaleX);
-	_mouseHotspotY = (GLint)(_videoContext.mouseHotspotY * _mouseScaleY);
-
-	// We subtract the screen offset to the hotspot here to simplify the
-	// screen offset handling in the mouse code. Note the subtraction here
-	// makes sure that the offset actually gets added to the mouse position,
-	// since the hotspot offset is substracted from the position.
-	_mouseHotspotX -= (GLint)CGRectGetMinX(*rect);
-	_mouseHotspotY -= (GLint)CGRectGetMinY(*rect);
-
-	// FIXME: For now we also adapt the mouse position here. In reality we
-	// would be better off to also adjust the event position when switching
-	// from overlay to game screen or vica versa.
-	[self notifyMouseMove];
-}
-
-- (void)updateMouseCursor {
-	if (_mouseCursorTexture == 0) {
-		glGenTextures(1, &_mouseCursorTexture); printOpenGLError();
-		[self setFilterModeForTexture:_mouseCursorTexture];
-	}
-
-	[self updateMouseCursorScaling];
-
-	_mouseTexCoords[2] = _mouseTexCoords[6] = _videoContext.mouseWidth / (GLfloat)_videoContext.mouseTexture.w;
-	_mouseTexCoords[5] = _mouseTexCoords[7] = _videoContext.mouseHeight / (GLfloat)_videoContext.mouseTexture.h;
-
-	glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.mouseTexture.w, _videoContext.mouseTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.mouseTexture.getPixels()); printOpenGLError();
-}
-
-- (void)updateMainSurface {
-	glVertexPointer(2, GL_FLOAT, 0, _gameScreenVertCoords); printOpenGLError();
-	glTexCoordPointer(2, GL_FLOAT, 0, _gameScreenTexCoords); printOpenGLError();
-
-	glBindTexture(GL_TEXTURE_2D, _screenTexture); printOpenGLError();
-
-	// Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases
-	// due to the iPhone internals having to convert the whole texture back from its internal format when used.
-	// In the future we could use several tiled textures instead.
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.getPixels()); printOpenGLError();
-	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
-}
-
-- (void)updateOverlaySurface {
-	glVertexPointer(2, GL_FLOAT, 0, _overlayVertCoords); printOpenGLError();
-	glTexCoordPointer(2, GL_FLOAT, 0, _overlayTexCoords); printOpenGLError();
-
-	glBindTexture(GL_TEXTURE_2D, _overlayTexture); printOpenGLError();
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _videoContext.overlayTexture.w, _videoContext.overlayTexture.h, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, _videoContext.overlayTexture.getPixels()); printOpenGLError();
-	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
-}
-
-- (void)updateMouseSurface {
-	glVertexPointer(2, GL_FLOAT, 0, _mouseVertCoords); printOpenGLError();
-	glTexCoordPointer(2, GL_FLOAT, 0, _mouseTexCoords); printOpenGLError();
-
-	glBindTexture(GL_TEXTURE_2D, _mouseCursorTexture); printOpenGLError();
-	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError();
-}
-
-- (void)setUpOrientation:(UIDeviceOrientation)orientation width:(int *)width height:(int *)height {
-	_orientation = orientation;
-
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-
-	// We always force the origin (0,0) to be in the upper left corner.
-	switch (_orientation) {
-	case UIDeviceOrientationLandscapeRight:
-		glRotatef( 90, 0, 0, 1); printOpenGLError();
-		glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
-
-		*width = _renderBufferHeight;
-		*height = _renderBufferWidth;
-		break;
-
-	case UIDeviceOrientationLandscapeLeft:
-		glRotatef(-90, 0, 0, 1); printOpenGLError();
-		glOrthof(0, _renderBufferHeight, _renderBufferWidth, 0, 0, 1); printOpenGLError();
-
-		*width = _renderBufferHeight;
-		*height = _renderBufferWidth;
-		break;
-
-	case UIDeviceOrientationPortrait:
-	default:
-		// We must force the portrait orientation here, since we might not know
-		// the real orientation.
-		_orientation = UIDeviceOrientationPortrait;
-
-		glOrthof(0, _renderBufferWidth, _renderBufferHeight, 0, 0, 1); printOpenGLError();
-
-		*width = _renderBufferWidth;
-		*height = _renderBufferHeight;
-		break;
-	}
-}
-
-- (void)createScreenTexture {
-	const uint screenTexWidth = getSizeNextPOT(_videoContext.screenWidth);
-	const uint screenTexHeight = getSizeNextPOT(_videoContext.screenHeight);
-
-	_gameScreenTexCoords[2] = _gameScreenTexCoords[6] = _videoContext.screenWidth / (GLfloat)screenTexWidth;
-	_gameScreenTexCoords[5] = _gameScreenTexCoords[7] = _videoContext.screenHeight / (GLfloat)screenTexHeight;
-
-	_videoContext.screenTexture.create(screenTexWidth, screenTexHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
-}
-
-- (void)initSurface {
-	int screenWidth, screenHeight;
-	[self setUpOrientation:[[UIDevice currentDevice] orientation] width:&screenWidth height:&screenHeight];
-
-	if (_screenTexture > 0) {
-		glDeleteTextures(1, &_screenTexture); printOpenGLError();
-	}
-
-	glGenTextures(1, &_screenTexture); printOpenGLError();
-	[self setFilterModeForTexture:_screenTexture];
-
-	if (_overlayTexture > 0) {
-		glDeleteTextures(1, &_overlayTexture); printOpenGLError();
-	}
-
-	glGenTextures(1, &_overlayTexture); printOpenGLError();
-	[self setFilterModeForTexture:_overlayTexture];
-
-	glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
-
-	[self clearColorBuffer];
-
-	if (_keyboardView != nil) {
-		[_keyboardView removeFromSuperview];
-		[[_keyboardView inputView] removeFromSuperview];
-	}
-
-	GLfloat adjustedWidth = _videoContext.screenWidth;
-	GLfloat adjustedHeight = _videoContext.screenHeight;
-	if (_videoContext.asprectRatioCorrection) {
-		if (_videoContext.screenWidth == 320 && _videoContext.screenHeight == 200)
-			adjustedHeight = 240;
-		else if (_videoContext.screenWidth == 640 && _videoContext.screenHeight == 400)
-			adjustedHeight = 480;
-	}
-
-	float overlayPortraitRatio;
-
-	if (_orientation == UIDeviceOrientationLandscapeLeft || _orientation ==  UIDeviceOrientationLandscapeRight) {
-		GLfloat gameScreenRatio = adjustedWidth / adjustedHeight;
-		GLfloat screenRatio = (GLfloat)screenWidth / (GLfloat)screenHeight;
-
-		// These are the width/height according to the portrait layout!
-		int rectWidth, rectHeight;
-		int xOffset, yOffset;
-
-		if (gameScreenRatio < screenRatio) {
-			// When the game screen ratio is less than the screen ratio
-			// we need to scale the width, since the game screen was higher
-			// compared to the width than our output screen is.
-			rectWidth = (int)(screenHeight * gameScreenRatio);
-			rectHeight = screenHeight;
-			xOffset = (screenWidth - rectWidth) / 2;
-			yOffset = 0;
-		} else {
-			// When the game screen ratio is bigger than the screen ratio
-			// we need to scale the height, since the game screen was wider
-			// compared to the height than our output screen is.
-			rectWidth = screenWidth;
-			rectHeight = (int)(screenWidth / gameScreenRatio);
-			xOffset = 0;
-			yOffset = (screenHeight - rectHeight) / 2;
-		}
-
-		//printf("Rect: %i, %i, %i, %i\n", xOffset, yOffset, rectWidth, rectHeight);
-		_gameScreenRect = CGRectMake(xOffset, yOffset, rectWidth, rectHeight);
-		overlayPortraitRatio = 1.0f;
-	} else {
-		GLfloat ratio = adjustedHeight / adjustedWidth;
-		int height = (int)(screenWidth * ratio);
-		//printf("Making rect (%u, %u)\n", screenWidth, height);
-		_gameScreenRect = CGRectMake(0, 0, screenWidth, height);
-
-		CGRect keyFrame = CGRectMake(0.0f, 0.0f, 0.0f, 0.0f);
-		if (_keyboardView == nil) {
-			_keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame];
-			[_keyboardView setInputDelegate:self];
-		}
-
-		[self addSubview:[_keyboardView inputView]];
-		[self addSubview: _keyboardView];
-		[[_keyboardView inputView] becomeFirstResponder];
-		overlayPortraitRatio = (_videoContext.overlayHeight * ratio) / _videoContext.overlayWidth;
-	}
-
-	_overlayRect = CGRectMake(0, 0, screenWidth, screenHeight * overlayPortraitRatio);
-
-	_gameScreenVertCoords[0] = _gameScreenVertCoords[4] = CGRectGetMinX(_gameScreenRect);
-	_gameScreenVertCoords[1] = _gameScreenVertCoords[3] = CGRectGetMinY(_gameScreenRect);
-	_gameScreenVertCoords[2] = _gameScreenVertCoords[6] = CGRectGetMaxX(_gameScreenRect);
-	_gameScreenVertCoords[5] = _gameScreenVertCoords[7] = CGRectGetMaxY(_gameScreenRect);
-
-	_overlayVertCoords[2] = _overlayVertCoords[6] = CGRectGetMaxX(_overlayRect);
-	_overlayVertCoords[5] = _overlayVertCoords[7] = CGRectGetMaxY(_overlayRect);
-
-	[self setViewTransformation];
-	[self updateMouseCursorScaling];
-}
-
-- (void)setViewTransformation {
-	// Set the modelview matrix. This matrix will be used for the shake offset
-	// support.
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();
-
-	// Scale the shake offset according to the overlay size. We need this to
-	// adjust the overlay mouse click coordinates when an offset is set.
-	_scaledShakeXOffset = (int)(_videoContext.shakeXOffset / (GLfloat)_videoContext.screenWidth * CGRectGetWidth(_overlayRect));
-	_scaledShakeYOffset = (int)(_videoContext.shakeYOffset / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect));
-
-	// Apply the shaking to the output screen.
-	glTranslatef(_scaledShakeXOffset, -_scaledShakeYOffset, 0);
-}
-
-- (void)clearColorBuffer {
-	// The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
-	int clearCount = 5;
-	while (clearCount-- > 0) {
-		glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
-		[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
-	}
-}
-
-- (void)addEvent:(InternalEvent)event {
-	[_eventLock lock];
-	_events.push_back(event);
-	[_eventLock unlock];
-}
-
-- (bool)fetchEvent:(InternalEvent *)event {
-	[_eventLock lock];
-	if (_events.empty()) {
-		[_eventLock unlock];
-		return false;
-	}
-
-	*event = *_events.begin();
-	_events.pop_front();
-	[_eventLock unlock];
-	return true;
-}
-
-/**
- * Converts portrait mode coordinates into rotated mode coordinates.
- */
-- (bool)convertToRotatedCoords:(CGPoint)point result:(CGPoint *)result {
-	switch (_orientation) {
-	case UIDeviceOrientationLandscapeLeft:
-		result->x = point.y;
-		result->y = _renderBufferWidth - point.x;
-		return true;
-
-	case UIDeviceOrientationLandscapeRight:
-		result->x = _renderBufferHeight - point.y;
-		result->y = point.x;
-		return true;
-
-	case UIDeviceOrientationPortrait:
-		result->x = point.x;
-		result->y = point.y;
-		return true;
-
-	default:
-		return false;
-	}
-}
-
-- (bool)getMouseCoords:(CGPoint)point eventX:(int *)x eventY:(int *)y {
-	// We scale the input according to our scale factor to get actual screen
-	// cooridnates.
-	point.x *= _contentScaleFactor;
-	point.y *= _contentScaleFactor;
-
-	if (![self convertToRotatedCoords:point result:&point])
-		return false;
-
-	CGRect *area;
-	int width, height, offsetX, offsetY;
-	if (_videoContext.overlayInGUI) {
-		area = &_overlayRect;
-		width = _videoContext.overlayWidth;
-		height = _videoContext.overlayHeight;
-		offsetX = _scaledShakeXOffset;
-		offsetY = _scaledShakeYOffset;
-	} else {
-		area = &_gameScreenRect;
-		width = _videoContext.screenWidth;
-		height = _videoContext.screenHeight;
-		offsetX = _videoContext.shakeXOffset;
-		offsetY = _videoContext.shakeYOffset;
-	}
-
-	point.x = (point.x - CGRectGetMinX(*area)) / CGRectGetWidth(*area);
-	point.y = (point.y - CGRectGetMinY(*area)) / CGRectGetHeight(*area);
-
-	*x = (int)(point.x * width + offsetX);
-	// offsetY describes the translation of the screen in the upward direction,
-	// thus we need to add it here.
-	*y = (int)(point.y * height + offsetY);
-
-	// Clip coordinates
-	if (*x < 0 || *x > width || *y < 0 || *y > height)
-		return false;
-
-	return true;
-}
-
-- (void)deviceOrientationChanged:(UIDeviceOrientation)orientation {
-	switch (orientation) {
-	case UIDeviceOrientationLandscapeLeft:
-	case UIDeviceOrientationLandscapeRight:
-	case UIDeviceOrientationPortrait:
-		_orientation = orientation;
-		break;
-
-	default:
-		return;
-	}
-
-	[self addEvent:InternalEvent(kInputOrientationChanged, orientation, 0)];
-}
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
-	NSSet *allTouches = [event allTouches];
-	int x, y;
-
-	switch ([allTouches count]) {
-	case 1: {
-		UITouch *touch = [touches anyObject];
-		CGPoint point = [touch locationInView:self];
-		if (![self getMouseCoords:point eventX:&x eventY:&y])
-			return;
-
-		_firstTouch = touch;
-		[self addEvent:InternalEvent(kInputMouseDown, x, y)];
-		break;
-		}
-
-	case 2: {
-		UITouch *touch = [touches anyObject];
-		CGPoint point = [touch locationInView:self];
-		if (![self getMouseCoords:point eventX:&x eventY:&y])
-			return;
-
-		_secondTouch = touch;
-		[self addEvent:InternalEvent(kInputMouseSecondDown, x, y)];
-		break;
-		}
-	}
-}
-
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
-	//NSSet *allTouches = [event allTouches];
-	int x, y;
-
-	for (UITouch *touch in touches) {
-		if (touch == _firstTouch) {
-			CGPoint point = [touch locationInView:self];
-			if (![self getMouseCoords:point eventX:&x eventY:&y])
-				return;
-
-			[self addEvent:InternalEvent(kInputMouseDragged, x, y)];
-		} else if (touch == _secondTouch) {
-			CGPoint point = [touch locationInView:self];
-			if (![self getMouseCoords:point eventX:&x eventY:&y])
-				return;
-
-			[self addEvent:InternalEvent(kInputMouseSecondDragged, x, y)];
-		}
-	}
-}
-
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
-	NSSet *allTouches = [event allTouches];
-	int x, y;
-
-	switch ([allTouches count]) {
-	case 1: {
-		UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
-		CGPoint point = [touch locationInView:self];
-		if (![self getMouseCoords:point eventX:&x eventY:&y])
-			return;
-
-		[self addEvent:InternalEvent(kInputMouseUp, x, y)];
-		break;
-		}
-
-	case 2: {
-		UITouch *touch = [[allTouches allObjects] objectAtIndex:1];
-		CGPoint point = [touch locationInView:self];
-		if (![self getMouseCoords:point eventX:&x eventY:&y])
-			return;
-
-		[self addEvent:InternalEvent(kInputMouseSecondUp, x, y)];
-		break;
-		}
-	}
-}
-
-- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
-}
-
-- (void)handleKeyPress:(unichar)c {
-	[self addEvent:InternalEvent(kInputKeyPressed, c, 0)];
-}
-
-- (BOOL)canHandleSwipes {
-	return TRUE;
-}
-
-- (int)swipe:(int)num withEvent:(struct __GSEvent *)event {
-	//printf("swipe: %i\n", num);
-
-	[self addEvent:InternalEvent(kInputSwipe, num, 0)];
-	return 0;
-}
-
-- (void)disableIdleTimer {
-	[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
-}
-
-- (void)enableIdleTimer {
-	[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
-}
-
-- (void)applicationSuspend {
-	[self addEvent:InternalEvent(kInputApplicationSuspended, 0, 0)];
-}
-
-- (void)applicationResume {
-	[self addEvent:InternalEvent(kInputApplicationResumed, 0, 0)];
-}
-
- at end
diff --git a/backends/platform/iphone/module.mk b/backends/platform/iphone/module.mk
deleted file mode 100644
index ea5115782f0..00000000000
--- a/backends/platform/iphone/module.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-MODULE := backends/platform/iphone
-
-MODULE_OBJS := \
-	osys_main.o \
-	osys_events.o \
-	osys_sound.o \
-	osys_video.o \
-	iphone_main.o \
-	iphone_video.o \
-	iphone_keyboard.o
-
-# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
-MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
-OBJS := $(MODULE_OBJS) $(OBJS)
-MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp
deleted file mode 100644
index 98a47c7cc82..00000000000
--- a/backends/platform/iphone/osys_events.cpp
+++ /dev/null
@@ -1,488 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "gui/message.h"
-#include "common/translation.h"
-
-#include "backends/platform/iphone/osys_main.h"
-
-static const int kQueuedInputEventDelay = 50;
-
-bool OSystem_IPHONE::pollEvent(Common::Event &event) {
-	//printf("pollEvent()\n");
-
-	long curTime = getMillis();
-
-	if (_timerCallback && (curTime >= _timerCallbackNext)) {
-		_timerCallback(_timerCallbackTimer);
-		_timerCallbackNext = curTime + _timerCallbackTimer;
-	}
-
-	if (_queuedInputEvent.type != Common::EVENT_INVALID && curTime >= _queuedEventTime) {
-		event = _queuedInputEvent;
-		_queuedInputEvent.type = Common::EVENT_INVALID;
-		return true;
-	}
-
-	InternalEvent internalEvent;
-
-	if (iPhone_fetchEvent(&internalEvent)) {
-		switch (internalEvent.type) {
-		case kInputMouseDown:
-			if (!handleEvent_mouseDown(event, internalEvent.value1, internalEvent.value2))
-				return false;
-			break;
-
-		case kInputMouseUp:
-			if (!handleEvent_mouseUp(event, internalEvent.value1, internalEvent.value2))
-				return false;
-			break;
-
-		case kInputMouseDragged:
-			if (!handleEvent_mouseDragged(event, internalEvent.value1, internalEvent.value2))
-				return false;
-			break;
-		case kInputMouseSecondDragged:
-			if (!handleEvent_mouseSecondDragged(event, internalEvent.value1, internalEvent.value2))
-				return false;
-			break;
-		case kInputMouseSecondDown:
-			_secondaryTapped = true;
-			if (!handleEvent_secondMouseDown(event, internalEvent.value1, internalEvent.value2))
-				return false;
-			break;
-		case kInputMouseSecondUp:
-			_secondaryTapped = false;
-			if (!handleEvent_secondMouseUp(event, internalEvent.value1, internalEvent.value2))
-				return false;
-			break;
-		case kInputOrientationChanged:
-			handleEvent_orientationChanged(internalEvent.value1);
-			return false;
-			break;
-
-		case kInputApplicationSuspended:
-			suspendLoop();
-			return false;
-			break;
-
-		case kInputKeyPressed:
-			handleEvent_keyPressed(event, internalEvent.value1);
-			break;
-
-		case kInputSwipe:
-			if (!handleEvent_swipe(event, internalEvent.value1))
-				return false;
-			break;
-
-		default:
-			break;
-		}
-
-		return true;
-	}
-	return false;
-}
-
-bool OSystem_IPHONE::handleEvent_mouseDown(Common::Event &event, int x, int y) {
-	//printf("Mouse down at (%u, %u)\n", x, y);
-
-	// Workaround: kInputMouseSecondToggled isn't always sent when the
-	// secondary finger is lifted. Need to make sure we get out of that mode.
-	_secondaryTapped = false;
-
-	if (_touchpadModeEnabled) {
-		_lastPadX = x;
-		_lastPadY = y;
-	} else
-		warpMouse(x, y);
-
-	if (_mouseClickAndDragEnabled) {
-		event.type = Common::EVENT_LBUTTONDOWN;
-		event.mouse.x = _videoContext->mouseX;
-		event.mouse.y = _videoContext->mouseY;
-		return true;
-	} else {
-		_lastMouseDown = getMillis();
-	}
-	return false;
-}
-
-bool OSystem_IPHONE::handleEvent_mouseUp(Common::Event &event, int x, int y) {
-	//printf("Mouse up at (%u, %u)\n", x, y);
-
-	if (_secondaryTapped) {
-		_secondaryTapped = false;
-		if (!handleEvent_secondMouseUp(event, x, y))
-			return false;
-	} else if (_mouseClickAndDragEnabled) {
-		event.type = Common::EVENT_LBUTTONUP;
-		event.mouse.x = _videoContext->mouseX;
-		event.mouse.y = _videoContext->mouseY;
-	} else {
-		if (getMillis() - _lastMouseDown < 250) {
-			event.type = Common::EVENT_LBUTTONDOWN;
-			event.mouse.x = _videoContext->mouseX;
-			event.mouse.y = _videoContext->mouseY;
-
-			_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
-			_queuedInputEvent.mouse.x = _videoContext->mouseX;
-			_queuedInputEvent.mouse.y = _videoContext->mouseY;
-			_lastMouseTap = getMillis();
-			_queuedEventTime = _lastMouseTap + kQueuedInputEventDelay;
-		} else
-			return false;
-	}
-
-	return true;
-}
-
-bool OSystem_IPHONE::handleEvent_secondMouseDown(Common::Event &event, int x, int y) {
-	_lastSecondaryDown = getMillis();
-	_gestureStartX = x;
-	_gestureStartY = y;
-
-	if (_mouseClickAndDragEnabled) {
-		event.type = Common::EVENT_LBUTTONUP;
-		event.mouse.x = _videoContext->mouseX;
-		event.mouse.y = _videoContext->mouseY;
-
-		_queuedInputEvent.type = Common::EVENT_RBUTTONDOWN;
-		_queuedInputEvent.mouse.x = _videoContext->mouseX;
-		_queuedInputEvent.mouse.y = _videoContext->mouseY;
-	} else
-		return false;
-
-	return true;
-}
-
-bool OSystem_IPHONE::handleEvent_secondMouseUp(Common::Event &event, int x, int y) {
-	int curTime = getMillis();
-
-	if (curTime - _lastSecondaryDown < 400) {
-		//printf("Right tap!\n");
-		if (curTime - _lastSecondaryTap < 400 && !_videoContext->overlayInGUI) {
-			//printf("Right escape!\n");
-			event.type = Common::EVENT_KEYDOWN;
-			_queuedInputEvent.type = Common::EVENT_KEYUP;
-
-			event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
-			event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE;
-			event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE;
-			_queuedEventTime = curTime + kQueuedInputEventDelay;
-			_lastSecondaryTap = 0;
-		} else if (!_mouseClickAndDragEnabled) {
-			//printf("Rightclick!\n");
-			event.type = Common::EVENT_RBUTTONDOWN;
-			event.mouse.x = _videoContext->mouseX;
-			event.mouse.y = _videoContext->mouseY;
-			_queuedInputEvent.type = Common::EVENT_RBUTTONUP;
-			_queuedInputEvent.mouse.x = _videoContext->mouseX;
-			_queuedInputEvent.mouse.y = _videoContext->mouseY;
-			_lastSecondaryTap = curTime;
-			_queuedEventTime = curTime + kQueuedInputEventDelay;
-		} else {
-			//printf("Right nothing!\n");
-			return false;
-		}
-	}
-	if (_mouseClickAndDragEnabled) {
-		event.type = Common::EVENT_RBUTTONUP;
-		event.mouse.x = _videoContext->mouseX;
-		event.mouse.y = _videoContext->mouseY;
-	}
-
-	return true;
-}
-
-bool OSystem_IPHONE::handleEvent_mouseDragged(Common::Event &event, int x, int y) {
-	if (_lastDragPosX == x && _lastDragPosY == y)
-		return false;
-
-	_lastDragPosX = x;
-	_lastDragPosY = y;
-
-	//printf("Mouse dragged at (%u, %u)\n", x, y);
-	int mouseNewPosX;
-	int mouseNewPosY;
-	if (_touchpadModeEnabled) {
-		int deltaX = _lastPadX - x;
-		int deltaY = _lastPadY - y;
-		_lastPadX = x;
-		_lastPadY = y;
-
-		mouseNewPosX = (int)(_videoContext->mouseX - deltaX / 0.5f);
-		mouseNewPosY = (int)(_videoContext->mouseY - deltaY / 0.5f);
-
-		int widthCap = _videoContext->overlayInGUI ? _videoContext->overlayWidth : _videoContext->screenWidth;
-		int heightCap = _videoContext->overlayInGUI ? _videoContext->overlayHeight : _videoContext->screenHeight;
-
-		if (mouseNewPosX < 0)
-			mouseNewPosX = 0;
-		else if (mouseNewPosX > widthCap)
-			mouseNewPosX = widthCap;
-
-		if (mouseNewPosY < 0)
-			mouseNewPosY = 0;
-		else if (mouseNewPosY > heightCap)
-			mouseNewPosY = heightCap;
-
-	} else {
-		mouseNewPosX = x;
-		mouseNewPosY = y;
-	}
-
-	event.type = Common::EVENT_MOUSEMOVE;
-	event.mouse.x = mouseNewPosX;
-	event.mouse.y = mouseNewPosY;
-	warpMouse(mouseNewPosX, mouseNewPosY);
-
-	return true;
-}
-
-bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, int y) {
-	if (_gestureStartX == -1 || _gestureStartY == -1) {
-		return false;
-	}
-
-	static const int kNeededLength = 100;
-	static const int kMaxDeviation = 20;
-
-	int vecX = (x - _gestureStartX);
-	int vecY = (y - _gestureStartY);
-
-	int absX = abs(vecX);
-	int absY = abs(vecY);
-
-	//printf("(%d, %d)\n", vecX, vecY);
-
-	if (absX >= kNeededLength || absY >= kNeededLength) { // Long enough gesture to react upon.
-		_gestureStartX = -1;
-		_gestureStartY = -1;
-
-		if (absX < kMaxDeviation && vecY >= kNeededLength) {
-			// Swipe down
-			event.type = Common::EVENT_MAINMENU;
-			_queuedInputEvent.type = Common::EVENT_INVALID;
-
-			_queuedEventTime = getMillis() + kQueuedInputEventDelay;
-			return true;
-		}
-
-		if (absX < kMaxDeviation && -vecY >= kNeededLength) {
-			// Swipe up
-			_mouseClickAndDragEnabled = !_mouseClickAndDragEnabled;
-			Common::U32String dialogMsg;
-			if (_mouseClickAndDragEnabled) {
-				_touchpadModeEnabled = false;
-				dialogMsg = _("Mouse-click-and-drag mode enabled.");
-			} else
-				dialogMsg = _("Mouse-click-and-drag mode disabled.");
-			GUI::TimedMessageDialog dialog(dialogMsg, 1500);
-			dialog.runModal();
-			return false;
-		}
-
-		if (absY < kMaxDeviation && vecX >= kNeededLength) {
-			// Swipe right
-			_touchpadModeEnabled = !_touchpadModeEnabled;
-			Common::U32String dialogMsg;
-			if (_touchpadModeEnabled)
-				dialogMsg = _("Touchpad mode enabled.");
-			else
-				dialogMsg = _("Touchpad mode disabled.");
-			GUI::TimedMessageDialog dialog(dialogMsg, 1500);
-			dialog.runModal();
-			return false;
-
-		}
-
-		if (absY < kMaxDeviation && -vecX >= kNeededLength) {
-			// Swipe left
-			return false;
-		}
-	}
-
-	return false;
-}
-
-void  OSystem_IPHONE::handleEvent_orientationChanged(int orientation) {
-	//printf("Orientation: %i\n", orientation);
-
-	ScreenOrientation newOrientation;
-	switch (orientation) {
-	case 1:
-		newOrientation = kScreenOrientationPortrait;
-		break;
-	case 3:
-		newOrientation = kScreenOrientationLandscape;
-		break;
-	case 4:
-		newOrientation = kScreenOrientationFlippedLandscape;
-		break;
-	default:
-		return;
-	}
-
-
-	if (_screenOrientation != newOrientation) {
-		_screenOrientation = newOrientation;
-		updateOutputSurface();
-
-		dirtyFullScreen();
-		if (_videoContext->overlayVisible)
-			dirtyFullOverlayScreen();
-		updateScreen();
-	}
-}
-
-void  OSystem_IPHONE::handleEvent_keyPressed(Common::Event &event, int keyPressed) {
-	int ascii = keyPressed;
-	//printf("key: %i\n", keyPressed);
-
-	// We remap some of the iPhone keyboard keys.
-	// The first ten here are the row of symbols below the numeric keys.
-	switch (keyPressed) {
-	case 45:
-		keyPressed = Common::KEYCODE_F1;
-		ascii = Common::ASCII_F1;
-		break;
-	case 47:
-		keyPressed = Common::KEYCODE_F2;
-		ascii = Common::ASCII_F2;
-		break;
-	case 58:
-		keyPressed = Common::KEYCODE_F3;
-		ascii = Common::ASCII_F3;
-		break;
-	case 59:
-		keyPressed = Common::KEYCODE_F4;
-		ascii = Common::ASCII_F4;
-		break;
-	case 40:
-		keyPressed = Common::KEYCODE_F5;
-		ascii = Common::ASCII_F5;
-		break;
-	case 41:
-		keyPressed = Common::KEYCODE_F6;
-		ascii = Common::ASCII_F6;
-		break;
-	case 36:
-		keyPressed = Common::KEYCODE_F7;
-		ascii = Common::ASCII_F7;
-		break;
-	case 38:
-		keyPressed = Common::KEYCODE_F8;
-		ascii = Common::ASCII_F8;
-		break;
-	case 64:
-		keyPressed = Common::KEYCODE_F9;
-		ascii = Common::ASCII_F9;
-		break;
-	case 34:
-		keyPressed = Common::KEYCODE_F10;
-		ascii = Common::ASCII_F10;
-		break;
-	case 10:
-		keyPressed = Common::KEYCODE_RETURN;
-		ascii = Common::ASCII_RETURN;
-		break;
-	}
-	event.type = Common::EVENT_KEYDOWN;
-	_queuedInputEvent.type = Common::EVENT_KEYUP;
-
-	event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
-	event.kbd.keycode = _queuedInputEvent.kbd.keycode = (Common::KeyCode)keyPressed;
-	event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii;
-	_queuedEventTime = getMillis() + kQueuedInputEventDelay;
-}
-
-bool OSystem_IPHONE::handleEvent_swipe(Common::Event &event, int direction) {
-	Common::KeyCode keycode = Common::KEYCODE_INVALID;
-	switch (_screenOrientation) {
-	case kScreenOrientationPortrait:
-		switch ((UIViewSwipeDirection)direction) {
-		case kUIViewSwipeUp:
-			keycode = Common::KEYCODE_UP;
-			break;
-		case kUIViewSwipeDown:
-			keycode = Common::KEYCODE_DOWN;
-			break;
-		case kUIViewSwipeLeft:
-			keycode = Common::KEYCODE_LEFT;
-			break;
-		case kUIViewSwipeRight:
-			keycode = Common::KEYCODE_RIGHT;
-			break;
-		default:
-			return false;
-		}
-		break;
-	case kScreenOrientationLandscape:
-		switch ((UIViewSwipeDirection)direction) {
-		case kUIViewSwipeUp:
-			keycode = Common::KEYCODE_LEFT;
-			break;
-		case kUIViewSwipeDown:
-			keycode = Common::KEYCODE_RIGHT;
-			break;
-		case kUIViewSwipeLeft:
-			keycode = Common::KEYCODE_DOWN;
-			break;
-		case kUIViewSwipeRight:
-			keycode = Common::KEYCODE_UP;
-			break;
-		default:
-			return false;
-		}
-		break;
-	case kScreenOrientationFlippedLandscape:
-		switch ((UIViewSwipeDirection)direction) {
-		case kUIViewSwipeUp:
-			keycode = Common::KEYCODE_RIGHT;
-			break;
-		case kUIViewSwipeDown:
-			keycode = Common::KEYCODE_LEFT;
-			break;
-		case kUIViewSwipeLeft:
-			keycode = Common::KEYCODE_UP;
-			break;
-		case kUIViewSwipeRight:
-			keycode = Common::KEYCODE_DOWN;
-			break;
-		default:
-			return false;
-		}
-		break;
-	}
-
-	event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode;
-	event.kbd.ascii = _queuedInputEvent.kbd.ascii = 0;
-	event.type = Common::EVENT_KEYDOWN;
-	_queuedInputEvent.type = Common::EVENT_KEYUP;
-	event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
-	_queuedEventTime = getMillis() + kQueuedInputEventDelay;
-
-	return true;
-}
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
deleted file mode 100644
index 326281338f5..00000000000
--- a/backends/platform/iphone/osys_main.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include <unistd.h>
-
-#include <sys/time.h>
-
-#include "common/scummsys.h"
-#include "common/util.h"
-#include "common/rect.h"
-#include "common/file.h"
-#include "common/fs.h"
-
-#include "base/main.h"
-
-#include "backends/saves/default/default-saves.h"
-#include "backends/timer/default/default-timer.h"
-#include "backends/mutex/pthread/pthread-mutex.h"
-#include "audio/mixer.h"
-#include "audio/mixer_intern.h"
-
-#include "backends/platform/iphone/osys_main.h"
-
-
-AQCallbackStruct OSystem_IPHONE::s_AudioQueue;
-SoundProc OSystem_IPHONE::s_soundCallback = NULL;
-void *OSystem_IPHONE::s_soundParam = NULL;
-
-OSystem_IPHONE::OSystem_IPHONE() :
-	_mixer(NULL), _lastMouseTap(0), _queuedEventTime(0),
-	_mouseNeedTextureUpdate(false), _secondaryTapped(false), _lastSecondaryTap(0),
-	_screenOrientation(kScreenOrientationFlippedLandscape), _mouseClickAndDragEnabled(false),
-	_gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _fullScreenOverlayIsDirty(false),
-	_mouseDirty(false), _timeSuspended(0), _lastDragPosX(-1), _lastDragPosY(-1), _screenChangeCount(0),
-	_mouseCursorPaletteEnabled(false), _gfxTransactionError(kTransactionSuccess) {
-	_queuedInputEvent.type = Common::EVENT_INVALID;
-	_touchpadModeEnabled = !iPhone_isHighResDevice();
-	_fsFactory = new POSIXFilesystemFactory();
-	initVideoContext();
-
-	memset(_gamePalette, 0, sizeof(_gamePalette));
-	memset(_gamePaletteRGBA5551, 0, sizeof(_gamePaletteRGBA5551));
-	memset(_mouseCursorPalette, 0, sizeof(_mouseCursorPalette));
-}
-
-OSystem_IPHONE::~OSystem_IPHONE() {
-	AudioQueueDispose(s_AudioQueue.queue, true);
-
-	delete _mixer;
-	// Prevent accidental freeing of the screen texture here. This needs to be
-	// checked since we might use the screen texture as framebuffer in the case
-	// of hi-color games for example. Otherwise this can lead to a double free.
-	if (_framebuffer.getPixels() != _videoContext->screenTexture.getPixels())
-		_framebuffer.free();
-	_mouseBuffer.free();
-}
-
-int OSystem_IPHONE::timerHandler(int t) {
-	DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager();
-	tm->handler();
-	return t;
-}
-
-void OSystem_IPHONE::initBackend() {
-#ifdef IPHONE_SANDBOXED
-	_savefileManager = new DefaultSaveFileManager(iPhone_getDocumentsDir());
-#else
-	_savefileManager = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH);
-#endif
-
-	_timerManager = new DefaultTimerManager();
-
-	gettimeofday(&_startTime, NULL);
-
-	setupMixer();
-
-	setTimerCallback(&OSystem_IPHONE::timerHandler, 10);
-
-	EventsBaseBackend::initBackend();
-}
-
-bool OSystem_IPHONE::hasFeature(Feature f) {
-	switch (f) {
-	case kFeatureCursorPalette:
-	case kFeatureFilteringMode:
-	case kFeatureNoQuit:
-		return true;
-
-	default:
-		return false;
-	}
-}
-
-void OSystem_IPHONE::setFeatureState(Feature f, bool enable) {
-	switch (f) {
-	case kFeatureCursorPalette:
-		if (_mouseCursorPaletteEnabled != enable) {
-			_mouseNeedTextureUpdate = true;
-			_mouseDirty = true;
-			_mouseCursorPaletteEnabled = enable;
-		}
-		break;
-	case kFeatureFilteringMode:
-		_videoContext->filtering = enable;
-		break;
-	case kFeatureAspectRatioCorrection:
-		_videoContext->asprectRatioCorrection = enable;
-		break;
-
-	default:
-		break;
-	}
-}
-
-bool OSystem_IPHONE::getFeatureState(Feature f) {
-	switch (f) {
-	case kFeatureCursorPalette:
-		return _mouseCursorPaletteEnabled;
-	case kFeatureFilteringMode:
-		return _videoContext->filtering;
-	case kFeatureAspectRatioCorrection:
-		return _videoContext->asprectRatioCorrection;
-
-	default:
-		return false;
-	}
-}
-
-void OSystem_IPHONE::suspendLoop() {
-	bool done = false;
-	uint32 startTime = getMillis();
-
-	stopSoundsystem();
-
-	InternalEvent event;
-	while (!done) {
-		if (iPhone_fetchEvent(&event))
-			if (event.type == kInputApplicationResumed)
-				done = true;
-		usleep(100000);
-	}
-
-	startSoundsystem();
-
-	_timeSuspended += getMillis() - startTime;
-}
-
-uint32 OSystem_IPHONE::getMillis(bool skipRecord) {
-	//printf("getMillis()\n");
-
-	struct timeval currentTime;
-	gettimeofday(&currentTime, NULL);
-	return (uint32)(((currentTime.tv_sec - _startTime.tv_sec) * 1000) +
-	                ((currentTime.tv_usec - _startTime.tv_usec) / 1000)) - _timeSuspended;
-}
-
-void OSystem_IPHONE::delayMillis(uint msecs) {
-	//printf("delayMillis(%d)\n", msecs);
-	usleep(msecs * 1000);
-}
-
-
-void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) {
-	//printf("setTimerCallback()\n");
-
-	if (callback != NULL) {
-		_timerCallbackTimer = interval;
-		_timerCallbackNext = getMillis() + interval;
-		_timerCallback = callback;
-	} else
-		_timerCallback = NULL;
-}
-
-Common::MutexInternal *OSystem_IPHONE::createMutex() {
-	return createPthreadMutexInternal();
-}
-
-void OSystem_IPHONE::quit() {
-}
-
-void OSystem_IPHONE::getTimeAndDate(TimeDate &td, bool skipRecord) const {
-	time_t curTime = time(0);
-	struct tm t = *localtime(&curTime);
-	td.tm_sec = t.tm_sec;
-	td.tm_min = t.tm_min;
-	td.tm_hour = t.tm_hour;
-	td.tm_mday = t.tm_mday;
-	td.tm_mon = t.tm_mon;
-	td.tm_year = t.tm_year;
-	td.tm_wday = t.tm_wday;
-}
-
-Audio::Mixer *OSystem_IPHONE::getMixer() {
-	assert(_mixer);
-	return _mixer;
-}
-
-OSystem *OSystem_IPHONE_create() {
-	return new OSystem_IPHONE();
-}
-
-Common::String OSystem_IPHONE::getDefaultConfigFileName() {
-#ifdef IPHONE_SANDBOXED
-	Common::String path = iPhone_getDocumentsDir();
-	path += "/Preferences";
-	return path;
-#else
-	return SCUMMVM_PREFS_PATH;
-#endif
-}
-
-void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
-	// Get URL of the Resource directory of the .app bundle
-	CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
-	if (fileUrl) {
-		// Try to convert the URL to an absolute path
-		UInt8 buf[MAXPATHLEN];
-		if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
-			// Success: Add it to the search path
-			Common::String bundlePath((const char *)buf);
-			s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority);
-		}
-		CFRelease(fileUrl);
-	}
-}
-
-void OSystem_IPHONE::logMessage(LogMessageType::Type type, const char *message) {
-	FILE *output = 0;
-
-	if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
-		output = stdout;
-	else
-		output = stderr;
-
-	fputs(message, output);
-	fflush(output);
-}
-
-void iphone_main(int argc, char *argv[]) {
-
-	//OSystem_IPHONE::migrateApp();
-
-	FILE *newfp = fopen("/var/mobile/.scummvm.log", "a");
-	if (newfp != NULL) {
-		fclose(stdout);
-		fclose(stderr);
-		*stdout = *newfp;
-		*stderr = *newfp;
-		setbuf(stdout, NULL);
-		setbuf(stderr, NULL);
-
-		//extern int gDebugLevel;
-		//gDebugLevel = 10;
-	}
-
-#ifdef IPHONE_SANDBOXED
-	chdir(iPhone_getDocumentsDir());
-#else
-	system("mkdir " SCUMMVM_ROOT_PATH);
-	system("mkdir " SCUMMVM_SAVE_PATH);
-
-	chdir("/var/mobile/");
-#endif
-
-	g_system = OSystem_IPHONE_create();
-	assert(g_system);
-
-	// Invoke the actual ScummVM main entry point:
-	scummvm_main(argc, argv);
-	g_system->quit();       // TODO: Consider removing / replacing this!
-}
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
deleted file mode 100644
index 2dbd537ba56..00000000000
--- a/backends/platform/iphone/osys_main.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BACKENDS_PLATFORM_IPHONE_OSYS_MAIN_H
-#define BACKENDS_PLATFORM_IPHONE_OSYS_MAIN_H
-
-#include "graphics/surface.h"
-#include "backends/platform/iphone/iphone_common.h"
-#include "backends/modular-backend.h"
-#include "common/events.h"
-#include "audio/mixer_intern.h"
-#include "backends/fs/posix/posix-fs-factory.h"
-#include "graphics/palette.h"
-
-#include <AudioToolbox/AudioQueue.h>
-
-#define AUDIO_BUFFERS 3
-#define WAVE_BUFFER_SIZE 2048
-#define AUDIO_SAMPLE_RATE 44100
-
-#define SCUMMVM_ROOT_PATH "/var/mobile/Library/ScummVM"
-#define SCUMMVM_SAVE_PATH SCUMMVM_ROOT_PATH "/Savegames"
-#define SCUMMVM_PREFS_PATH SCUMMVM_ROOT_PATH "/Preferences"
-
-typedef void (*SoundProc)(void *param, byte *buf, int len);
-typedef int (*TimerProc)(int interval);
-
-struct AQCallbackStruct {
-	AudioQueueRef queue;
-	uint32 frameCount;
-	AudioQueueBufferRef buffers[AUDIO_BUFFERS];
-	AudioStreamBasicDescription dataFormat;
-};
-
-class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
-protected:
-	static AQCallbackStruct s_AudioQueue;
-	static SoundProc s_soundCallback;
-	static void *s_soundParam;
-
-	Audio::MixerImpl *_mixer;
-
-	VideoContext *_videoContext;
-
-	Graphics::Surface _framebuffer;
-
-	// For signaling that screen format set up might have failed.
-	TransactionError _gfxTransactionError;
-
-	// For use with the game texture
-	uint16  _gamePalette[256];
-	// For use with the mouse texture
-	uint16  _gamePaletteRGBA5551[256];
-
-	struct timeval _startTime;
-	uint32 _timeSuspended;
-
-	bool _mouseCursorPaletteEnabled;
-	uint16 _mouseCursorPalette[256];
-	Graphics::Surface _mouseBuffer;
-	uint16 _mouseKeyColor;
-	bool _mouseDirty;
-	bool _mouseNeedTextureUpdate;
-
-	long _lastMouseDown;
-	long _lastMouseTap;
-	long _queuedEventTime;
-	Common::Event _queuedInputEvent;
-	bool _secondaryTapped;
-	long _lastSecondaryDown;
-	long _lastSecondaryTap;
-	int _gestureStartX, _gestureStartY;
-	bool _mouseClickAndDragEnabled;
-	bool _touchpadModeEnabled;
-	int _lastPadX;
-	int _lastPadY;
-	int _lastDragPosX;
-	int _lastDragPosY;
-
-	int _timerCallbackNext;
-	int _timerCallbackTimer;
-	TimerProc _timerCallback;
-
-	Common::Array<Common::Rect> _dirtyRects;
-	Common::Array<Common::Rect> _dirtyOverlayRects;
-	ScreenOrientation _screenOrientation;
-	bool _fullScreenIsDirty;
-	bool _fullScreenOverlayIsDirty;
-	int _screenChangeCount;
-
-public:
-
-	OSystem_IPHONE();
-	virtual ~OSystem_IPHONE();
-
-	virtual void initBackend();
-
-	virtual void engineInit();
-	virtual void engineDone();
-
-	virtual bool hasFeature(Feature f);
-	virtual void setFeatureState(Feature f, bool enable);
-	virtual bool getFeatureState(Feature f);
-	virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format);
-
-	virtual void beginGFXTransaction();
-	virtual TransactionError endGFXTransaction();
-
-	virtual int16 getHeight();
-	virtual int16 getWidth();
-
-#ifdef USE_RGB_COLOR
-	virtual Graphics::PixelFormat getScreenFormat() const { return _framebuffer.format; }
-	virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
-#endif
-
-	virtual PaletteManager *getPaletteManager() { return this; }
-protected:
-	// PaletteManager API
-	virtual void setPalette(const byte *colors, uint start, uint num);
-	virtual void grabPalette(byte *colors, uint start, uint num) const;
-
-public:
-	virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
-	virtual void updateScreen();
-	virtual Graphics::Surface *lockScreen();
-	virtual void unlockScreen();
-	virtual void setShakePos(int shakeXOffset, int shakeYOffset);
-
-	virtual void showOverlay(bool inGUI);
-	virtual void hideOverlay();
-	virtual bool isOverlayVisible() const { return _videoContext->overlayVisible; }
-	virtual void clearOverlay();
-	virtual void grabOverlay(Graphics::Surface &surface);
-	virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
-	virtual int16 getOverlayHeight();
-	virtual int16 getOverlayWidth();
-	virtual Graphics::PixelFormat getOverlayFormat() const;
-
-	virtual bool showMouse(bool visible);
-
-	virtual void warpMouse(int x, int y);
-	virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL, const byte *mask = NULL);
-	virtual void setCursorPalette(const byte *colors, uint start, uint num);
-
-	virtual bool pollEvent(Common::Event &event);
-	virtual uint32 getMillis(bool skipRecord = false);
-	virtual void delayMillis(uint msecs);
-	virtual Common::MutexInternal *createMutex();
-
-	static void mixCallback(void *sys, byte *samples, int len);
-	virtual void setupMixer(void);
-	virtual void setTimerCallback(TimerProc callback, int interval);
-	virtual int getScreenChangeID() const { return _screenChangeCount; }
-	virtual void quit();
-
-	virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
-	virtual void getTimeAndDate(TimeDate &td, bool skipRecord = false) const;
-
-	virtual Audio::Mixer *getMixer();
-
-	void startSoundsystem();
-	void stopSoundsystem();
-
-	virtual Common::String getDefaultConfigFileName();
-
-	virtual void logMessage(LogMessageType::Type type, const char *message);
-
-	virtual Common::String getDefaultLogFileName() { return Common::String("/var/mobile/.scummvm.log"); }
-
-protected:
-	void initVideoContext();
-	void updateOutputSurface();
-
-	void internUpdateScreen();
-	void dirtyFullScreen();
-	void dirtyFullOverlayScreen();
-	void suspendLoop();
-	void drawDirtyRect(const Common::Rect &dirtyRect);
-	void updateMouseTexture();
-	static void AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB);
-	static int timerHandler(int t);
-
-	bool handleEvent_swipe(Common::Event &event, int direction);
-	void handleEvent_keyPressed(Common::Event &event, int keyPressed);
-	void handleEvent_orientationChanged(int orientation);
-
-	bool handleEvent_mouseDown(Common::Event &event, int x, int y);
-	bool handleEvent_mouseUp(Common::Event &event, int x, int y);
-
-	bool handleEvent_secondMouseDown(Common::Event &event, int x, int y);
-	bool handleEvent_secondMouseUp(Common::Event &event, int x, int y);
-
-	bool handleEvent_mouseDragged(Common::Event &event, int x, int y);
-	bool handleEvent_mouseSecondDragged(Common::Event &event, int x, int y);
-};
-
-#endif
diff --git a/backends/platform/iphone/osys_sound.cpp b/backends/platform/iphone/osys_sound.cpp
deleted file mode 100644
index bc71f3b760d..00000000000
--- a/backends/platform/iphone/osys_sound.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "backends/platform/iphone/osys_main.h"
-
-void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB) {
-	//printf("AQBufferCallback()\n");
-	if (s_AudioQueue.frameCount > 0 && s_soundCallback != NULL) {
-		outQB->mAudioDataByteSize = 4 * s_AudioQueue.frameCount;
-		s_soundCallback(s_soundParam, (byte *)outQB->mAudioData, outQB->mAudioDataByteSize);
-		AudioQueueEnqueueBuffer(inQ, outQB, 0, NULL);
-	} else {
-		AudioQueueStop(s_AudioQueue.queue, false);
-	}
-}
-
-void OSystem_IPHONE::mixCallback(void *sys, byte *samples, int len) {
-	OSystem_IPHONE *this_ = (OSystem_IPHONE *)sys;
-	assert(this_);
-
-	if (this_->_mixer) {
-		this_->_mixer->mixCallback(samples, len);
-	}
-}
-
-void OSystem_IPHONE::setupMixer() {
-	_mixer = new Audio::MixerImpl(AUDIO_SAMPLE_RATE, true, WAVE_BUFFER_SIZE);
-
-	s_soundCallback = mixCallback;
-	s_soundParam = this;
-
-	startSoundsystem();
-}
-
-void OSystem_IPHONE::startSoundsystem() {
-	s_AudioQueue.dataFormat.mSampleRate = AUDIO_SAMPLE_RATE;
-	s_AudioQueue.dataFormat.mFormatID = kAudioFormatLinearPCM;
-	s_AudioQueue.dataFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
-	s_AudioQueue.dataFormat.mBytesPerPacket = 4;
-	s_AudioQueue.dataFormat.mFramesPerPacket = 1;
-	s_AudioQueue.dataFormat.mBytesPerFrame = 4;
-	s_AudioQueue.dataFormat.mChannelsPerFrame = 2;
-	s_AudioQueue.dataFormat.mBitsPerChannel = 16;
-	s_AudioQueue.frameCount = WAVE_BUFFER_SIZE;
-
-	if (AudioQueueNewOutput(&s_AudioQueue.dataFormat, AQBufferCallback, &s_AudioQueue, 0, kCFRunLoopCommonModes, 0, &s_AudioQueue.queue)) {
-		printf("Couldn't set the AudioQueue callback!\n");
-		_mixer->setReady(false);
-		return;
-	}
-
-	uint32 bufferBytes = s_AudioQueue.frameCount * s_AudioQueue.dataFormat.mBytesPerFrame;
-
-	for (int i = 0; i < AUDIO_BUFFERS; i++) {
-		if (AudioQueueAllocateBuffer(s_AudioQueue.queue, bufferBytes, &s_AudioQueue.buffers[i])) {
-			printf("Error allocating AudioQueue buffer!\n");
-			_mixer->setReady(false);
-			return;
-		}
-
-		AQBufferCallback(&s_AudioQueue, s_AudioQueue.queue, s_AudioQueue.buffers[i]);
-	}
-
-	AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0);
-	if (AudioQueueStart(s_AudioQueue.queue, NULL)) {
-		printf("Error starting the AudioQueue!\n");
-		_mixer->setReady(false);
-		return;
-	}
-
-	_mixer->setReady(true);
-}
-
-void OSystem_IPHONE::stopSoundsystem() {
-	AudioQueueStop(s_AudioQueue.queue, true);
-
-	for (int i = 0; i < AUDIO_BUFFERS; i++) {
-		AudioQueueFreeBuffer(s_AudioQueue.queue, s_AudioQueue.buffers[i]);
-	}
-
-	AudioQueueDispose(s_AudioQueue.queue, true);
-	_mixer->setReady(false);
-}
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
deleted file mode 100644
index 5bb567fc511..00000000000
--- a/backends/platform/iphone/osys_video.mm
+++ /dev/null
@@ -1,495 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "backends/platform/iphone/osys_main.h"
-#include "backends/platform/iphone/iphone_video.h"
-
-#include "graphics/blit.h"
-
-void OSystem_IPHONE::engineInit() {
-	EventsBaseBackend::engineInit();
-	// Prevent the device going to sleep during game play (and in particular cut scenes)
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(disableIdleTimer) withObject:nil waitUntilDone: NO];
-}
-
-void OSystem_IPHONE::engineDone() {
-	EventsBaseBackend::engineDone();
-	// Allow the device going to sleep if idle while in the Launcher
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(enableIdleTimer) withObject:nil waitUntilDone: NO];
-}
-
-void OSystem_IPHONE::initVideoContext() {
-	_videoContext = [g_iPhoneViewInstance getVideoContext];
-}
-
-#ifdef USE_RGB_COLOR
-Common::List<Graphics::PixelFormat> OSystem_IPHONE::getSupportedFormats() const {
-	Common::List<Graphics::PixelFormat> list;
-	// RGB565
-	list.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
-	// CLUT8
-	list.push_back(Graphics::PixelFormat::createFormatCLUT8());
-	return list;
-}
-#endif
-
-void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
-	//printf("initSize(%u, %u, %p)\n", width, height, (const void *)format);
-
-	_videoContext->screenWidth = width;
-	_videoContext->screenHeight = height;
-	_videoContext->shakeXOffset = 0;
-	_videoContext->shakeYOffset = 0;
-
-	// In case we use the screen texture as frame buffer we reset the pixels
-	// pointer here to avoid freeing the screen texture.
-	if (_framebuffer.getPixels() == _videoContext->screenTexture.getPixels())
-		_framebuffer.setPixels(0);
-
-	// Create the screen texture right here. We need to do this here, since
-	// when a game requests hi-color mode, we actually set the framebuffer
-	// to the texture buffer to avoid an additional copy step.
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(createScreenTexture) withObject:nil waitUntilDone: YES];
-
-	// In case the client code tries to set up a non supported mode, we will
-	// fall back to CLUT8 and set the transaction error accordingly.
-	if (format && format->bytesPerPixel != 1 && *format != _videoContext->screenTexture.format) {
-		format = 0;
-		_gfxTransactionError = kTransactionFormatNotSupported;
-	}
-
-	if (!format || format->bytesPerPixel == 1) {
-		_framebuffer.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-	} else {
-#if 0
-		printf("bytesPerPixel: %u RGBAlosses: %u,%u,%u,%u RGBAshifts: %u,%u,%u,%u\n", format->bytesPerPixel,
-		       format->rLoss, format->gLoss, format->bLoss, format->aLoss,
-		       format->rShift, format->gShift, format->bShift, format->aShift);
-#endif
-		// We directly draw on the screen texture in hi-color mode. Thus
-		// we copy over its settings here and just replace the width and
-		// height to avoid any problems.
-		_framebuffer = _videoContext->screenTexture;
-		_framebuffer.w = width;
-		_framebuffer.h = height;
-	}
-
-	_fullScreenIsDirty = false;
-	dirtyFullScreen();
-	_mouseCursorPaletteEnabled = false;
-}
-
-void OSystem_IPHONE::beginGFXTransaction() {
-	_gfxTransactionError = kTransactionSuccess;
-}
-
-OSystem::TransactionError OSystem_IPHONE::endGFXTransaction() {
-	_screenChangeCount++;
-	updateOutputSurface();
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(setGraphicsMode) withObject:nil waitUntilDone: YES];
-
-	return _gfxTransactionError;
-}
-
-void OSystem_IPHONE::updateOutputSurface() {
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(initSurface) withObject:nil waitUntilDone: YES];
-}
-
-int16 OSystem_IPHONE::getHeight() {
-	return _videoContext->screenHeight;
-}
-
-int16 OSystem_IPHONE::getWidth() {
-	return _videoContext->screenWidth;
-}
-
-void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) {
-	//printf("setPalette(%p, %u, %u)\n", colors, start, num);
-	assert(start + num <= 256);
-	const byte *b = colors;
-
-	for (uint i = start; i < start + num; ++i) {
-		_gamePalette[i] = _videoContext->screenTexture.format.RGBToColor(b[0], b[1], b[2]);
-		_gamePaletteRGBA5551[i] = _videoContext->mouseTexture.format.RGBToColor(b[0], b[1], b[2]);
-		b += 3;
-	}
-
-	dirtyFullScreen();
-
-	// Automatically update the mouse texture when the palette changes while the
-	// cursor palette is disabled.
-	if (!_mouseCursorPaletteEnabled && _mouseBuffer.format.bytesPerPixel == 1)
-		_mouseDirty = _mouseNeedTextureUpdate = true;
-}
-
-void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) const {
-	//printf("grabPalette(%p, %u, %u)\n", colors, start, num);
-	assert(start + num <= 256);
-	byte *b = colors;
-
-	for (uint i = start; i < start + num; ++i) {
-		_videoContext->screenTexture.format.colorToRGB(_gamePalette[i], b[0], b[1], b[2]);
-		b += 3;
-	}
-}
-
-void OSystem_IPHONE::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
-	//printf("copyRectToScreen(%p, %d, %i, %i, %i, %i)\n", buf, pitch, x, y, w, h);
-	//Clip the coordinates
-	const byte *src = (const byte *)buf;
-	if (x < 0) {
-		w += x;
-		src -= x;
-		x = 0;
-	}
-
-	if (y < 0) {
-		h += y;
-		src -= y * pitch;
-		y = 0;
-	}
-
-	if (w > (int)_framebuffer.w - x) {
-		w = _framebuffer.w - x;
-	}
-
-	if (h > (int)_framebuffer.h - y) {
-		h = _framebuffer.h - y;
-	}
-
-	if (w <= 0 || h <= 0)
-		return;
-
-	if (!_fullScreenIsDirty) {
-		_dirtyRects.push_back(Common::Rect(x, y, x + w, y + h));
-	}
-
-	byte *dst = (byte *)_framebuffer.getBasePtr(x, y);
-	if (_framebuffer.pitch == pitch && _framebuffer.w == w) {
-		memcpy(dst, src, h * pitch);
-	} else {
-		do {
-			memcpy(dst, src, w * _framebuffer.format.bytesPerPixel);
-			src += pitch;
-			dst += _framebuffer.pitch;
-		} while (--h);
-	}
-}
-
-void OSystem_IPHONE::updateScreen() {
-	if (_dirtyRects.size() == 0 && _dirtyOverlayRects.size() == 0 && !_mouseDirty)
-		return;
-
-	//printf("updateScreen(): %i dirty rects.\n", _dirtyRects.size());
-
-	internUpdateScreen();
-	_mouseDirty = false;
-	_fullScreenIsDirty = false;
-	_fullScreenOverlayIsDirty = false;
-
-	iPhone_updateScreen();
-}
-
-void OSystem_IPHONE::internUpdateScreen() {
-	if (_mouseNeedTextureUpdate) {
-		updateMouseTexture();
-		_mouseNeedTextureUpdate = false;
-	}
-
-	while (_dirtyRects.size()) {
-		Common::Rect dirtyRect = _dirtyRects.remove_at(_dirtyRects.size() - 1);
-
-		//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
-		drawDirtyRect(dirtyRect);
-		// TODO: Implement dirty rect code
-		//updateHardwareSurfaceForRect(dirtyRect);
-	}
-
-	if (_videoContext->overlayVisible) {
-		// TODO: Implement dirty rect code
-		_dirtyOverlayRects.clear();
-		/*while (_dirtyOverlayRects.size()) {
-			Common::Rect dirtyRect = _dirtyOverlayRects.remove_at(_dirtyOverlayRects.size() - 1);
-
-			//printf("Drawing: (%i, %i) -> (%i, %i)\n", dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
-			drawDirtyOverlayRect(dirtyRect);
-		}*/
-	}
-}
-
-void OSystem_IPHONE::drawDirtyRect(const Common::Rect &dirtyRect) {
-	// We only need to do a color look up for CLUT8
-	if (_framebuffer.format.bytesPerPixel != 1)
-		return;
-
-	int h = dirtyRect.bottom - dirtyRect.top;
-	int w = dirtyRect.right - dirtyRect.left;
-
-	const byte *src = (const byte *)_framebuffer.getBasePtr(dirtyRect.left, dirtyRect.top);
-	byte *dstRaw = (byte *)_videoContext->screenTexture.getBasePtr(dirtyRect.left, dirtyRect.top);
-
-	// When we use CLUT8 do a color look up
-	for (int y = h; y > 0; y--) {
-		uint16 *dst = (uint16 *)dstRaw;
-		for (int x = w; x > 0; x--)
-			*dst++ = _gamePalette[*src++];
-
-		dstRaw += _videoContext->screenTexture.pitch;
-		src += _framebuffer.pitch - w;
-	}
-}
-
-Graphics::Surface *OSystem_IPHONE::lockScreen() {
-	//printf("lockScreen()\n");
-	return &_framebuffer;
-}
-
-void OSystem_IPHONE::unlockScreen() {
-	//printf("unlockScreen()\n");
-	dirtyFullScreen();
-}
-
-void OSystem_IPHONE::setShakePos(int shakeXOffset, int shakeYOffset) {
-	//printf("setShakePos(%i, %i)\n", shakeXOffset, shakeYOffset);
-	_videoContext->shakeXOffset = shakeXOffset;
-	_videoContext->shakeYOffset = shakeYOffset;
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(setViewTransformation) withObject:nil waitUntilDone: YES];
-	// HACK: We use this to force a redraw.
-	_mouseDirty = true;
-}
-
-void OSystem_IPHONE::showOverlay(bool inGUI) {
-	//printf("showOverlay()\n");
-	_videoContext->overlayVisible = true;
-	_videoContext->overlayInGUI = inGUI;
-	dirtyFullOverlayScreen();
-	updateScreen();
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursorScaling) withObject:nil waitUntilDone: YES];
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
-}
-
-void OSystem_IPHONE::hideOverlay() {
-	//printf("hideOverlay()\n");
-	_videoContext->overlayVisible = false;
-	_videoContext->overlayInGUI = false;
-	_dirtyOverlayRects.clear();
-	dirtyFullScreen();
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursorScaling) withObject:nil waitUntilDone: YES];
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
-}
-
-void OSystem_IPHONE::clearOverlay() {
-	//printf("clearOverlay()\n");
-	memset(_videoContext->overlayTexture.getPixels(), 0, _videoContext->overlayTexture.h * _videoContext->overlayTexture.pitch);
-	dirtyFullOverlayScreen();
-}
-
-void OSystem_IPHONE::grabOverlay(Graphics::Surface &surface) {
-	//printf("grabOverlay()\n");
-	assert(surface.w >= _videoContext->overlayWidth);
-	assert(surface.h >= _videoContext->overlayHeight);
-	assert(surface.format.bytesPerPixel == sizeof(uint16));
-
-	const byte *src = (const byte *)_videoContext->overlayTexture.getPixels();
-	byte *dst = (byte *)surface.getPixels();
-	Graphics::copyBlit(dst, src, surface.pitch,  _videoContext->overlayTexture.pitch,
-		_videoContext->overlayWidth, _videoContext->overlayHeight, sizeof(uint16));
-}
-
-void OSystem_IPHONE::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
-	//printf("copyRectToOverlay(%p, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", (const void *)buf, pitch, x, y, w, h);
-	const byte *src = (const byte *)buf;
-
-	//Clip the coordinates
-	if (x < 0) {
-		w += x;
-		src -= x * sizeof(uint16);
-		x = 0;
-	}
-
-	if (y < 0) {
-		h += y;
-		src -= y * pitch;
-		y = 0;
-	}
-
-	if (w > (int)_videoContext->overlayWidth - x)
-		w = _videoContext->overlayWidth - x;
-
-	if (h > (int)_videoContext->overlayHeight - y)
-		h = _videoContext->overlayHeight - y;
-
-	if (w <= 0 || h <= 0)
-		return;
-
-	if (!_fullScreenOverlayIsDirty) {
-		_dirtyOverlayRects.push_back(Common::Rect(x, y, x + w, y + h));
-	}
-
-	byte *dst = (byte *)_videoContext->overlayTexture.getBasePtr(x, y);
-	do {
-		memcpy(dst, src, w * sizeof(uint16));
-		src += pitch;
-		dst += _videoContext->overlayTexture.pitch;
-	} while (--h);
-}
-
-int16 OSystem_IPHONE::getOverlayHeight() {
-	return _videoContext->overlayHeight;
-}
-
-int16 OSystem_IPHONE::getOverlayWidth() {
-	return _videoContext->overlayWidth;
-}
-
-Graphics::PixelFormat OSystem_IPHONE::getOverlayFormat() const {
-	return _videoContext->overlayTexture.format;
-}
-
-bool OSystem_IPHONE::showMouse(bool visible) {
-	//printf("showMouse(%d)\n", visible);
-	bool last = _videoContext->mouseIsVisible;
-	_videoContext->mouseIsVisible = visible;
-	_mouseDirty = true;
-
-	return last;
-}
-
-void OSystem_IPHONE::warpMouse(int x, int y) {
-	//printf("warpMouse(%d, %d)\n", x, y);
-	_videoContext->mouseX = x;
-	_videoContext->mouseY = y;
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(notifyMouseMove) withObject:nil waitUntilDone: YES];
-	_mouseDirty = true;
-}
-
-void OSystem_IPHONE::dirtyFullScreen() {
-	if (!_fullScreenIsDirty) {
-		_dirtyRects.clear();
-		_dirtyRects.push_back(Common::Rect(0, 0, _videoContext->screenWidth, _videoContext->screenHeight));
-		_fullScreenIsDirty = true;
-	}
-}
-
-void OSystem_IPHONE::dirtyFullOverlayScreen() {
-	if (!_fullScreenOverlayIsDirty) {
-		_dirtyOverlayRects.clear();
-		_dirtyOverlayRects.push_back(Common::Rect(0, 0, _videoContext->overlayWidth, _videoContext->overlayHeight));
-		_fullScreenOverlayIsDirty = true;
-	}
-}
-
-void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format, const byte *mask) {
-	//printf("setMouseCursor(%p, %u, %u, %i, %i, %u, %d, %p)\n", (const void *)buf, w, h, hotspotX, hotspotY, keycolor, dontScale, (const void *)format);
-
-	const Graphics::PixelFormat pixelFormat = format ? *format : Graphics::PixelFormat::createFormatCLUT8();
-#if 0
-	printf("bytesPerPixel: %u RGBAlosses: %u,%u,%u,%u RGBAshifts: %u,%u,%u,%u\n", pixelFormat.bytesPerPixel,
-	       pixelFormat.rLoss, pixelFormat.gLoss, pixelFormat.bLoss, pixelFormat.aLoss,
-	       pixelFormat.rShift, pixelFormat.gShift, pixelFormat.bShift, pixelFormat.aShift);
-#endif
-	assert(pixelFormat.bytesPerPixel == 1 || pixelFormat.bytesPerPixel == 2);
-
-	if (_mouseBuffer.w != w || _mouseBuffer.h != h || _mouseBuffer.format != pixelFormat || !_mouseBuffer.getPixels())
-		_mouseBuffer.create(w, h, pixelFormat);
-
-	_videoContext->mouseWidth = w;
-	_videoContext->mouseHeight = h;
-
-	_videoContext->mouseHotspotX = hotspotX;
-	_videoContext->mouseHotspotY = hotspotY;
-
-	_mouseKeyColor = keycolor;
-
-	memcpy(_mouseBuffer.getPixels(), buf, h * _mouseBuffer.pitch);
-
-	_mouseDirty = true;
-	_mouseNeedTextureUpdate = true;
-}
-
-void OSystem_IPHONE::setCursorPalette(const byte *colors, uint start, uint num) {
-	//printf("setCursorPalette(%p, %u, %u)\n", (const void *)colors, start, num);
-	assert(start + num <= 256);
-
-	for (uint i = start; i < start + num; ++i, colors += 3)
-		_mouseCursorPalette[i] = _videoContext->mouseTexture.format.RGBToColor(colors[0], colors[1], colors[2]);
-
-	// FIXME: This is just stupid, our client code seems to assume that this
-	// automatically enables the cursor palette.
-	_mouseCursorPaletteEnabled = true;
-
-	if (_mouseCursorPaletteEnabled)
-		_mouseDirty = _mouseNeedTextureUpdate = true;
-}
-
-void OSystem_IPHONE::updateMouseTexture() {
-	uint texWidth = getSizeNextPOT(_videoContext->mouseWidth);
-	uint texHeight = getSizeNextPOT(_videoContext->mouseHeight);
-
-	Graphics::Surface &mouseTexture = _videoContext->mouseTexture;
-	if (mouseTexture.w != texWidth || mouseTexture.h != texHeight)
-		mouseTexture.create(texWidth, texHeight, Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
-
-	if (_mouseBuffer.format.bytesPerPixel == 1) {
-		const uint16 *palette;
-		if (_mouseCursorPaletteEnabled)
-			palette = _mouseCursorPalette;
-		else
-			palette = _gamePaletteRGBA5551;
-
-		uint16 *mouseBuf = (uint16 *)mouseTexture.getPixels();
-		for (uint x = 0; x < _videoContext->mouseWidth; ++x) {
-			for (uint y = 0; y < _videoContext->mouseHeight; ++y) {
-				const byte color = *(const byte *)_mouseBuffer.getBasePtr(x, y);
-				if (color != _mouseKeyColor)
-					mouseBuf[y * texWidth + x] = palette[color] | 0x1;
-				else
-					mouseBuf[y * texWidth + x] = 0x0;
-			}
-		}
-	} else {
-		if (crossBlit((byte *)mouseTexture.getPixels(), (const byte *)_mouseBuffer.getPixels(), mouseTexture.pitch,
-			          _mouseBuffer.pitch, _mouseBuffer.w, _mouseBuffer.h, mouseTexture.format, _mouseBuffer.format)) {
-			// Apply color keying since the original cursor had no alpha channel.
-			const uint16 *src = (const uint16 *)_mouseBuffer.getPixels();
-			uint8 *dstRaw = (uint8 *)mouseTexture.getPixels();
-
-			for (uint y = 0; y < _mouseBuffer.h; ++y, dstRaw += mouseTexture.pitch) {
-				uint16 *dst = (uint16 *)dstRaw;
-				for (uint x = 0; x < _mouseBuffer.w; ++x, ++dst) {
-					if (*src++ == _mouseKeyColor)
-						*dst &= ~1;
-					else
-						*dst |= 1;
-				}
-			}
-		} else {
-			// TODO: Log this!
-			// Make the cursor all transparent... we really need a better fallback ;-).
-			memset(mouseTexture.getPixels(), 0, mouseTexture.h * mouseTexture.pitch);
-		}
-	}
-
-	[g_iPhoneViewInstance performSelectorOnMainThread:@selector(updateMouseCursor) withObject:nil waitUntilDone: YES];
-}
diff --git a/configure b/configure
index d9f760360b4..e349d4905a4 100755
--- a/configure
+++ b/configure
@@ -844,8 +844,8 @@ Usage: $0 [OPTIONS]...
 Configuration:
   -h, --help              display this help and exit
   --backend=BACKEND       backend to build (3ds, atari, android, dc, dingux, ds, gcw0,
-                          gph, iphone, ios7, ios7-arm64, maemo, n64, null, opendingux,
-                          openpandora, psp, psp2, samsungtv, sdl, switch, wii) [sdl]
+                          gph, ios7, maemo, n64, null, opendingux, openpandora,
+                          psp, psp2, samsungtv, sdl, switch, wii) [sdl]
 
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -885,7 +885,6 @@ Special configuration feature:
                                            gcw0 for GCW Zero
                                            gp2x for GP2X
                                            gp2xwiz for GP2X Wiz
-                                           iphone for Apple iPhone (iOS <= 6)
                                            ios7 for Apple iPhone / iPad (iOS >= 7)
                                            ios7-arm64 for Apple iPhone / iPad (iOS >= 7, 64-bit)
                                            kos32 for Kolibri OS
@@ -1690,11 +1689,6 @@ i586-mingw32msvc)
 	_host_os=mingw32msvc
 	_host_cpu=i586
 	;;
-iphone)
-	_host_os=iphone
-	_host_cpu=arm
-	_host_alias=arm-apple-darwin9
-	;;
 ios7)
 	_host_os=iphone
 	_host_cpu=arm
@@ -3611,17 +3605,6 @@ if test -n "$_host"; then
 			_timidity=no
 			_port_mk="backends/platform/gph/gp2xwiz-bundle.mk"
 			;;
-		iphone)
-			add_line_to_config_mk 'IPHONE = 1'
-			append_var DEFINES "-DIPHONE"
-			append_var ASFLAGS "-arch armv6"
-			_backend="iphone"
-			_build_scalers=no
-			_build_aspect=no
-			_mt32emu=no
-			_seq_midi=no
-			_timidity=no
-			;;
 		ios7*)
 			add_line_to_config_mk 'IPHONE = 1'
 			append_var DEFINES "-DIPHONE -DIPHONE_IOS7"
@@ -4012,11 +3995,6 @@ case $_backend in
 		_sdlconfig=sdl-config
 		_sdl=auto
 		;;
-	iphone)
-		append_var LIBS "-lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES"
-		append_var LIBS "-framework QuartzCore -framework CoreFoundation -framework Foundation"
-		append_var LIBS "-framework AudioToolbox -framework CoreAudio"
-		;;
 	ios7)
 		append_var LIBS "-lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES"
 		append_var LIBS "-framework QuartzCore -framework CoreFoundation -framework Foundation"
@@ -4474,7 +4452,7 @@ fi
 # Enable 16bit support only for backends which support it
 #
 case $_backend in
-	3ds | android | dingux | dc | ds | gph | iphone | ios7 | kolibrios | maemo | null | opendingux | miyoomini | miyoo | openpandora | psp | psp2 | samsungtv | sdl | switch | wii)
+	3ds | android | dingux | dc | ds | gph | ios7 | kolibrios | maemo | null | opendingux | miyoomini | miyoo | openpandora | psp | psp2 | samsungtv | sdl | switch | wii)
 		if test "$_16bit" = auto ; then
 			_16bit=yes
 		else
diff --git a/devtools/create_project/xcode/create_project.xcodeproj/project.pbxproj b/devtools/create_project/xcode/create_project.xcodeproj/project.pbxproj
index 654a232e580..7bc90e2a935 100644
--- a/devtools/create_project/xcode/create_project.xcodeproj/project.pbxproj
+++ b/devtools/create_project/xcode/create_project.xcodeproj/project.pbxproj
@@ -21,7 +21,7 @@
 		F9A66C251396D36100CEE494 /* CopyFiles */ = {
 			isa = PBXCopyFilesBuildPhase;
 			buildActionMask = 12;
-			dstPath = ../../../../../dists/iphone;
+			dstPath = ../../../../../dists/ios7;
 			dstSubfolderSpec = 16;
 			files = (
 				F9A66C91139704A400CEE494 /* create_project in CopyFiles */,
diff --git a/devtools/update-version.pl b/devtools/update-version.pl
index 0a4c9e9ff1c..ad4cef9c066 100755
--- a/devtools/update-version.pl
+++ b/devtools/update-version.pl
@@ -37,7 +37,6 @@ my @subs_files = qw(
 	dists/slackware/scummvm.SlackBuild
 	dists/macosx/Info.plist
 	dists/macosx/dockplugin/Info.plist
-	dists/iphone/Info.plist
 	dists/ios7/Info.plist
 	dists/tvos/Info.plist
 	dists/irix/scummvm.spec
diff --git a/dists/iphone/Default.png b/dists/iphone/Default.png
deleted file mode 100644
index 0e13a65e7a6..00000000000
Binary files a/dists/iphone/Default.png and /dev/null differ
diff --git a/dists/iphone/Info.plist b/dists/iphone/Info.plist
deleted file mode 100644
index 217df8121d0..00000000000
--- a/dists/iphone/Info.plist
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>en</string>
-	<key>CFBundleExecutable</key>
-	<string>ScummVM</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.scummvm.scummvm</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>ScummVM</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>2.8.0git</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>2.8.0git</string>
-	<key>CFBundleIconFile</key>
-	<string>icon.png</string>
-	<key>CFBundleIconFiles</key>
-	<array>
-		<string>icon.png</string>
-		<string>icon-72.png</string>
-		<string>icon4.png</string>
-	</array>
-	<key>UIPrerenderedIcon</key>
-	<true/>
-	<key>UIDeviceFamily</key>
-	<array>
-		<integer>1</integer>
-		<integer>2</integer>
-	</array>
-	<key>UISupportedInterfaceOrientations</key>
-	<array>
-		<string>UIInterfaceOrientationPortrait</string>
-		<string>UIInterfaceOrientationLandscapeLeft</string>
-		<string>UIInterfaceOrientationLandscapeRight</string>
-	</array>
-</dict>
-</plist>
diff --git a/dists/iphone/Info.plist.in b/dists/iphone/Info.plist.in
deleted file mode 100644
index 2bcdd15a03e..00000000000
--- a/dists/iphone/Info.plist.in
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>en</string>
-	<key>CFBundleExecutable</key>
-	<string>ScummVM</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.scummvm.scummvm</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>ScummVM</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>@VERSION@</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>@VERSION@</string>
-	<key>CFBundleIconFile</key>
-	<string>icon.png</string>
-	<key>CFBundleIconFiles</key>
-	<array>
-		<string>icon.png</string>
-		<string>icon-72.png</string>
-		<string>icon4.png</string>
-	</array>
-	<key>UIPrerenderedIcon</key>
-	<true/>
-	<key>UIDeviceFamily</key>
-	<array>
-		<integer>1</integer>
-		<integer>2</integer>
-	</array>
-	<key>UISupportedInterfaceOrientations</key>
-	<array>
-		<string>UIInterfaceOrientationPortrait</string>
-		<string>UIInterfaceOrientationLandscapeLeft</string>
-		<string>UIInterfaceOrientationLandscapeRight</string>
-	</array>
-</dict>
-</plist>
diff --git a/dists/iphone/icon-72.png b/dists/iphone/icon-72.png
deleted file mode 100644
index d27d083f97d..00000000000
Binary files a/dists/iphone/icon-72.png and /dev/null differ
diff --git a/dists/iphone/icon.png b/dists/iphone/icon.png
deleted file mode 100644
index c244840052a..00000000000
Binary files a/dists/iphone/icon.png and /dev/null differ
diff --git a/dists/iphone/icon4.png b/dists/iphone/icon4.png
deleted file mode 100644
index d414fbc214f..00000000000
Binary files a/dists/iphone/icon4.png and /dev/null differ
diff --git a/po/POTFILES b/po/POTFILES
index a98405d9a58..7b9e9ee5b8a 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -102,7 +102,6 @@ backends/platform/ds/osystem_ds.cpp
 backends/platform/ios7/ios7_options.mm
 backends/platform/ios7/ios7_osys_events.cpp
 backends/platform/ios7/ios7_osys_main.cpp
-backends/platform/iphone/osys_events.cpp
 backends/platform/maemo/maemo.cpp
 backends/platform/sdl/macosx/appmenu_osx.mm
 backends/platform/sdl/macosx/macosx.cpp
diff --git a/ports.mk b/ports.mk
index 0ee485410ed..163644e34f6 100644
--- a/ports.mk
+++ b/ports.mk
@@ -199,33 +199,6 @@ else
 bundle: scummvm-static plugins bundle-pack
 endif
 
-iphonebundle: iphone
-	mkdir -p $(bundle_name)
-	cp $(srcdir)/dists/iphone/Info.plist $(bundle_name)/
-	sed -i'' -e 's/$$(PRODUCT_BUNDLE_IDENTIFIER)/org.scummvm.scummvm/' $(bundle_name)/Info.plist
-	sed -i'' -e 's/$$(EXECUTABLE_NAME)/ScummVM/' $(bundle_name)/Info.plist
-	cp $(DIST_FILES_DOCS) $(bundle_name)/
-	cp $(DIST_FILES_THEMES) $(bundle_name)/
-ifdef DIST_FILES_NETWORKING
-	cp $(DIST_FILES_NETWORKING) $(bundle_name)/
-endif
-ifdef DIST_FILES_ENGINEDATA
-	cp $(DIST_FILES_ENGINEDATA) $(bundle_name)/
-endif
-ifdef DIST_FILES_VKEYBD
-	cp $(DIST_FILES_VKEYBD) $(bundle_name)/
-endif
-ifneq ($(DIST_FILES_SHADERS),)
-	cp $(DIST_FILES_SHADERS) $(bundle_name)/
-endif
-	$(STRIP) scummvm
-	chmod 755 scummvm
-	cp scummvm $(bundle_name)/ScummVM
-	cp $(srcdir)/dists/iphone/icon.png $(bundle_name)/
-	cp $(srcdir)/dists/iphone/icon-72.png $(bundle_name)/
-	cp $(srcdir)/dists/iphone/Default.png $(bundle_name)/
-	codesign -s - --deep --force $(bundle_name)
-
 ios7bundle: iphone
 	mkdir -p $(bundle_name)
 	awk 'BEGIN {s=0}\
@@ -485,13 +458,11 @@ OSX_STATIC_LIBS += -liconv \
                 $(STATICLIBPATH)/lib/libglib-2.0.a \
                 $(STATICLIBPATH)/lib/libintl.a
 
-ifneq ($(BACKEND), iphone)
 ifneq ($(BACKEND), ios7)
 OSX_STATIC_LIBS += -lreadline -framework AudioUnit
 endif
 endif
 endif
-endif
 
 ifdef USE_MAD
 OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libmad.a
@@ -563,7 +534,7 @@ scummvm-static: $(DETECT_OBJS) $(OBJS)
 		$(OSX_STATIC_LIBS) \
 		$(OSX_ZLIB)
 
-# Special target to create a static linked binary for the iPhone (legacy, and iOS 7+)
+# Special target to create a static linked binary for the iOS and tvOS devices (ios7 backend)
 iphone: $(DETECT_OBJS) $(OBJS)
 	+$(LD) $(LDFLAGS) -o scummvm $(DETECT_OBJS) $(OBJS) \
 		$(OSX_STATIC_LIBS) \


Commit: 7af069b1106de1199d1c2a6fad5d27247f6b7b7e
    https://github.com/scummvm/scummvm/commit/7af069b1106de1199d1c2a6fad5d27247f6b7b7e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-05-31T19:33:48+01:00

Commit Message:
CONFIGURE: Rename iphone host_os to iphoneos

Changed paths:
    configure


diff --git a/configure b/configure
index e349d4905a4..652b78ed15f 100755
--- a/configure
+++ b/configure
@@ -1690,12 +1690,12 @@ i586-mingw32msvc)
 	_host_cpu=i586
 	;;
 ios7)
-	_host_os=iphone
+	_host_os=iphoneos
 	_host_cpu=arm
 	_host_alias=arm-apple-darwin11
 	;;
 ios7-arm64)
-	_host_os=iphone
+	_host_os=iphoneos
 	# Remains of configure not knowing about arm64
 	_host_cpu=aarch64
 	_host_alias=arm64-apple-darwin11
@@ -1812,7 +1812,7 @@ switch)
 	docdir='${prefix}/doc'
 	;;
 tvos)
-	_host_os=iphone
+	_host_os=iphoneos
 	# Remains of configure not knowing about arm64
 	_host_cpu=aarch64
 	_host_alias=arm64-apple-darwin11
@@ -4528,7 +4528,7 @@ case $_host_os in
 	amigaos* | dreamcast | ds | gamecube | kolibrios | mingw* | morphos | n64 | ps3 | psp2 | psp | riscos | wii)
 		_posix=no
 		;;
-	3ds | android | beos* | bsd* | cygwin* | darwin* | dragonfly* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | ios7 | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | serenity* | solaris* | sunos* | switch | uclinux*)
+	3ds | android | beos* | bsd* | cygwin* | darwin* | dragonfly* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphoneos | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | serenity* | solaris* | sunos* | switch | uclinux*)
 		_posix=yes
 		;;
 	os2-emx*)
@@ -5814,7 +5814,7 @@ case $_host_os in
 		FLUIDSYNTH_STATIC_LIBS="$FLUIDSYNTH_LIBS -framework Foundation -framework CoreServices -framework CoreMIDI -framework CoreAudio -framework AudioToolbox -lglib-2.0 -lintl -liconv -lreadline"
 	;;
 
-	iphone)
+	iphoneos)
 		FLUIDSYNTH_STATIC_LIBS="$FLUIDSYNTH_LIBS -framework Foundation -framework CoreMIDI -lglib-2.0 -lintl -liconv"
 	;;
 


Commit: 32013e98091fbed8e5cf68875049fd7367f54fcf
    https://github.com/scummvm/scummvm/commit/32013e98091fbed8e5cf68875049fd7367f54fcf
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-05-31T20:04:29+01:00

Commit Message:
PORTS: Rename iphone target to scummvm-static-ios

Changed paths:
    ports.mk


diff --git a/ports.mk b/ports.mk
index 163644e34f6..4d6deece1fb 100644
--- a/ports.mk
+++ b/ports.mk
@@ -199,7 +199,7 @@ else
 bundle: scummvm-static plugins bundle-pack
 endif
 
-ios7bundle: iphone
+ios7bundle: scummvm-static-ios
 	mkdir -p $(bundle_name)
 	awk 'BEGIN {s=0}\
 		/<key>CFBundleIcons<\/key>/ {\
@@ -320,7 +320,7 @@ endif
 	cp $(srcdir)/dists/ios7/Images.xcassets/LaunchImage.launchimage/ScummVM-splash-750x1334.png $(bundle_name)/LaunchImage-800-667h at 2x.png
 	codesign -s - --deep --force $(bundle_name)
 
-tvosbundle: iphone
+tvosbundle: scummvm-static-ios
 	mkdir -p $(bundle_name)
 	awk 'BEGIN {s=0}\
 		/<key>CFBundleIcons<\/key>/ {\
@@ -535,7 +535,7 @@ scummvm-static: $(DETECT_OBJS) $(OBJS)
 		$(OSX_ZLIB)
 
 # Special target to create a static linked binary for the iOS and tvOS devices (ios7 backend)
-iphone: $(DETECT_OBJS) $(OBJS)
+scummvm-static-ios: $(DETECT_OBJS) $(OBJS)
 	+$(LD) $(LDFLAGS) -o scummvm $(DETECT_OBJS) $(OBJS) \
 		$(OSX_STATIC_LIBS) \
 		-framework UIKit -framework CoreGraphics -framework OpenGLES -framework GameController \




More information about the Scummvm-git-logs mailing list