diff options
Diffstat (limited to 'backends')
| -rw-r--r-- | backends/fs/windows/windows-fs.cpp | 2 | ||||
| -rw-r--r-- | backends/platform/iphone/blit_arm.s | 156 | ||||
| -rw-r--r-- | backends/platform/iphone/iphone_keyboard.h | 6 | ||||
| -rw-r--r-- | backends/platform/iphone/iphone_keyboard.m | 16 | ||||
| -rw-r--r-- | backends/platform/iphone/iphone_main.m | 18 | ||||
| -rw-r--r-- | backends/platform/iphone/iphone_video.h | 5 | ||||
| -rw-r--r-- | backends/platform/iphone/iphone_video.m | 99 | ||||
| -rw-r--r-- | backends/platform/iphone/osys_iphone.cpp | 94 | ||||
| -rw-r--r-- | backends/platform/iphone/osys_iphone.h | 10 | ||||
| -rw-r--r-- | backends/platform/sdl/sdl.cpp | 4 | ||||
| -rw-r--r-- | backends/platform/symbian/BuildPackageUpload_LocalSettings.pl | 2 | ||||
| -rw-r--r-- | backends/platform/symbian/src/SymbianOS.cpp | 16 | ||||
| -rw-r--r-- | backends/plugins/win32/win32-provider.cpp | 13 | 
13 files changed, 236 insertions, 205 deletions
diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index cbb93e8cd6..ac2f521e21 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -245,7 +245,7 @@ WindowsFilesystemNode::WindowsFilesystemNode(const String &p, const bool current  		_isDirectory = ((fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0);  		_isValid = true;  		// Add a trailing slash, if necessary. -		if (_path.lastChar() != '\\') { +		if (_isDirectory && _path.lastChar() != '\\') {  			_path += '\\';  		}  	} diff --git a/backends/platform/iphone/blit_arm.s b/backends/platform/iphone/blit_arm.s index ae31fdcce4..417f3741cf 100644 --- a/backends/platform/iphone/blit_arm.s +++ b/backends/platform/iphone/blit_arm.s @@ -36,47 +36,47 @@ _blitLandscapeScreenRect16bpp:  	@ r3 = h  	@ <> = _screenWidth  	@ <> = _screenHeight -	MOV	r12,r13 -	STMFD	r13!,{r4-r11,r14} -	LDMFD	r12,{r12,r14}		@ r12 = _screenWidth +	mov		r12,r13 +	stmfd	r13!,{r4-r11,r14} +	ldmfd	r12,{r12,r14}		@ r12 = _screenWidth  					@ r14 = _screenHeight -	ADD	r14,r14,r3		@ r14 = _screenHeight + h -	MVN	r11,#0 -	MLA	r11,r3,r12,r11		@ r11= _screenWidth*h-1 -	ADD	r12,r12,r12 +	add	r14,r14,r3		@ r14 = _screenHeight + h +	mvn	r11,#0 +	mla	r11,r3,r12,r11		@ r11= _screenWidth*h-1 +	add	r12,r12,r12  xloop: -	SUBS	r4,r3,#5		@ r4 = y = h -	BLE	thin +	subs	r4,r3,#5		@ r4 = y = h +	ble		thin  yloop: -	LDRH	r5, [r1],r12		@ r5 = *src    src += _screenWidth -	LDRH	r6, [r1],r12		@ r6 = *src    src += _screenWidth -	LDRH	r7, [r1],r12		@ r7 = *src    src += _screenWidth -	LDRH	r8, [r1],r12		@ r8 = *src    src += _screenWidth -	LDRH	r9, [r1],r12		@ r9 = *src    src += _screenWidth -	LDRH	r10,[r1],r12		@ r10= *src    src += _screenWidth -	SUBS	r4,r4,#6 -	STRH	r5, [r0],#2		@ *dst++ = r5 -	STRH	r6, [r0],#2		@ *dst++ = r6 -	STRH	r7, [r0],#2		@ *dst++ = r7 -	STRH	r8, [r0],#2		@ *dst++ = r8 -	STRH	r9, [r0],#2		@ *dst++ = r9 -	STRH	r10,[r0],#2		@ *dst++ = r10 -	BGT	yloop +	ldrh	r5, [r1],r12		@ r5 = *src    src += _screenWidth +	ldrh	r6, [r1],r12		@ r6 = *src    src += _screenWidth +	ldrh	r7, [r1],r12		@ r7 = *src    src += _screenWidth +	ldrh	r8, [r1],r12		@ r8 = *src    src += _screenWidth +	ldrh	r9, [r1],r12		@ r9 = *src    src += _screenWidth +	ldrh	r10,[r1],r12		@ r10= *src    src += _screenWidth +	subs	r4,r4,#6 +	strh	r5, [r0],#2		@ *dst++ = r5 +	strh	r6, [r0],#2		@ *dst++ = r6 +	strh	r7, [r0],#2		@ *dst++ = r7 +	strh	r8, [r0],#2		@ *dst++ = r8 +	strh	r9, [r0],#2		@ *dst++ = r9 +	strh	r10,[r0],#2		@ *dst++ = r10 +	bgt		yloop  thin: -	ADDS	r4,r4,#5 -	BEQ	lineend +	adds	r4,r4,#5 +	beq		lineend  thin_loop: -	LDRH	r5,[r1],r12		@ r5 = *src    src += _screenWidth -	SUBS	r4,r4,#1 -	STRH	r5,[r0],#2		@ *dst++ = r5 -	BGT	thin_loop +	ldrh	r5,[r1],r12		@ r5 = *src    src += _screenWidth +	subs	r4,r4,#1 +	strh	r5,[r0],#2		@ *dst++ = r5 +	bgt	thin_loop  lineend: -	SUB	r0,r0,r14,LSL #1	@ dst -= _screenHeight + h -	SUB	r1,r1,r11,LSL #1	@ src += 1-_screenWidth*h -	SUBS	r2,r2,#1 -	BGT	xloop +	sub	r0,r0,r14,LSL #1	@ dst -= _screenHeight + h +	sub	r1,r1,r11,LSL #1	@ src += 1-_screenWidth*h +	subs	r2,r2,#1 +	bgt	xloop -	LDMFD	r13!,{r4-r11,PC} +	ldmfd	r13!,{r4-r11,PC}  _blitLandscapeScreenRect8bpp:  	@ r0 = dst @@ -86,55 +86,55 @@ _blitLandscapeScreenRect8bpp:  	@ <> = _palette  	@ <> = _screenWidth  	@ <> = _screenHeight -	MOV	r12,r13 -	STMFD	r13!,{r4-r11,r14} -	LDMFD	r12,{r11,r12,r14}	@ r11 = _palette +	mov		r12,r13 +	stmfd	r13!,{r4-r11,r14} +	ldmfd	r12,{r11,r12,r14}	@ r11 = _palette  					@ r12 = _screenWidth  					@ r14 = _screenHeight -	ADD	r14,r14,r3		@ r14 = _screenHeight + h -	MVN	r6,#0 -	MLA	r6,r3,r12,r6		@ r6 = _screenWidth*h-1 +	add		r14,r14,r3		@ r14 = _screenHeight + h +	mvn		r6,#0 +	mla		r6,r3,r12,r6		@ r6 = _screenWidth*h-1  xloop8: -	MOV	r4,r3			@ r4 = y = h -	SUBS	r4,r3,#4		@ r4 = y = h -	BLE	thin8 +	mov		r4,r3			@ r4 = y = h +	subs	r4,r3,#4		@ r4 = y = h +	ble		thin8  yloop8: -	LDRB	r5, [r1],r12		@ r5 = *src    src += _screenWidth -	LDRB	r7, [r1],r12		@ r7 = *src    src += _screenWidth -	LDRB	r8, [r1],r12		@ r8 = *src    src += _screenWidth -	LDRB	r9, [r1],r12		@ r9 = *src    src += _screenWidth -	LDRB	r10,[r1],r12		@ r10= *src    src += _screenWidth -	ADD	r5, r5, r5 -	ADD	r7, r7, r7 -	ADD	r8, r8, r8 -	ADD	r9, r9, r9 -	ADD	r10,r10,r10 -	LDRH	r5, [r11,r5] -	LDRH	r7, [r11,r7] -	LDRH	r8, [r11,r8] -	LDRH	r9, [r11,r9] -	LDRH	r10,[r11,r10] -	SUBS	r4,r4,#5 -	STRH	r5, [r0],#2		@ *dst++ = r5 -	STRH	r7, [r0],#2		@ *dst++ = r7 -	STRH	r8, [r0],#2		@ *dst++ = r8 -	STRH	r9, [r0],#2		@ *dst++ = r9 -	STRH	r10,[r0],#2		@ *dst++ = r10 -	BGT	yloop8 +	ldrb	r5, [r1],r12		@ r5 = *src    src += _screenWidth +	ldrb	r7, [r1],r12		@ r7 = *src    src += _screenWidth +	ldrb	r8, [r1],r12		@ r8 = *src    src += _screenWidth +	ldrb	r9, [r1],r12		@ r9 = *src    src += _screenWidth +	ldrb	r10,[r1],r12		@ r10= *src    src += _screenWidth +	add	r5, r5, r5 +	add	r7, r7, r7 +	add	r8, r8, r8 +	add	r9, r9, r9 +	add	r10,r10,r10 +	ldrh	r5, [r11,r5] +	ldrh	r7, [r11,r7] +	ldrh	r8, [r11,r8] +	ldrh	r9, [r11,r9] +	ldrh	r10,[r11,r10] +	subs	r4,r4,#5 +	strh	r5, [r0],#2		@ *dst++ = r5 +	strh	r7, [r0],#2		@ *dst++ = r7 +	strh	r8, [r0],#2		@ *dst++ = r8 +	strh	r9, [r0],#2		@ *dst++ = r9 +	strh	r10,[r0],#2		@ *dst++ = r10 +	bgt	yloop8  thin8: -	ADDS	r4,r4,#4 -	BEQ	lineend8 +	adds	r4,r4,#4 +	beq		lineend8  thin_loop8: -	LDRB	r5,[r1],r12		@ r5 = *src    src += _screenWidth -	ADD	r5,r5,r5 -	LDRH	r5,[r11,r5] -	SUBS	r4,r4,#1 -	STRH	r5,[r0],#2		@ *dst++ = r5 -	BGT	thin_loop8 +	ldrb	r5,[r1],r12		@ r5 = *src    src += _screenWidth +	add	r5,r5,r5 +	ldrh	r5,[r11,r5] +	subs	r4,r4,#1 +	strh	r5,[r0],#2		@ *dst++ = r5 +	bgt	thin_loop8  lineend8: -	SUB	r0,r0,r14,LSL #1	@ dst -= _screenHeight + h -	SUB	r1,r1,r6		@ src += 1-_screenWidth*h -	SUBS	r2,r2,#1 -	BGT	xloop8 +	sub	r0,r0,r14,LSL #1	@ dst -= _screenHeight + h +	sub	r1,r1,r6		@ src += 1-_screenWidth*h +	subs	r2,r2,#1 +	bgt	xloop8 -	LDMFD	r13!,{r4-r11,PC} +	ldmfd	r13!,{r4-r11,PC} diff --git a/backends/platform/iphone/iphone_keyboard.h b/backends/platform/iphone/iphone_keyboard.h index 17a3836efd..6d381d561d 100644 --- a/backends/platform/iphone/iphone_keyboard.h +++ b/backends/platform/iphone/iphone_keyboard.h @@ -26,11 +26,7 @@  #import <UIKit/UIKit.h>  #import <UIKit/UITextView.h> -@protocol KeyboardInputProtocol -- (void)handleKeyPress:(unichar)c; -@end - -@interface SoftKeyboard : UIKeyboard<KeyboardInputProtocol> { +@interface SoftKeyboard : UIView {  	id inputDelegate;  	UITextView* inputView;  } diff --git a/backends/platform/iphone/iphone_keyboard.m b/backends/platform/iphone/iphone_keyboard.m index dc2d417746..bd4948e30a 100644 --- a/backends/platform/iphone/iphone_keyboard.m +++ b/backends/platform/iphone/iphone_keyboard.m @@ -25,19 +25,6 @@  #import "iphone_keyboard.h" -// Override settings of the default keyboard implementation -@implementation UIKeyboardImpl (DisableFeatures) - -- (BOOL)autoCapitalizationPreference { -	return false; -} - -- (BOOL)autoCorrectionPreference { -	return false; -} - -@end -  @implementation TextInputHandler  - (id)initWithKeyboard:(SoftKeyboard*)keyboard; { @@ -67,7 +54,8 @@  @implementation SoftKeyboard  - (id)initWithFrame:(CGRect)frame { -	self = [super initWithFrame:frame]; +	//self = [super initWithFrame:frame]; +	self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)];  	inputDelegate = nil;  	inputView = [[TextInputHandler alloc] initWithKeyboard:self];  	return self; diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m index f7f5667bb5..b01e9f3f34 100644 --- a/backends/platform/iphone/iphone_main.m +++ b/backends/platform/iphone/iphone_main.m @@ -46,9 +46,14 @@ int main(int argc, char** argv) {  	gArgc = argc;  	gArgv = argv; -	[[NSAutoreleasePool alloc] init]; - -    return UIApplicationMain(argc, argv, [iPhoneMain class]); +    NSAutoreleasePool *autoreleasePool = [  +        [ NSAutoreleasePool alloc ] init +    ]; + +    UIApplicationUseLegacyEvents(1); +    int returnCode = UIApplicationMain(argc, argv, [iPhoneMain class]); +    [ autoreleasePool release ]; +    return returnCode;  }  @implementation iPhoneMain @@ -74,7 +79,10 @@ int main(int argc, char** argv) {  - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {  	// hide the status bar  	[UIHardware _setStatusBarHeight:0.0f]; -	[self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0]; +	//[self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0]; + +	//[self setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO]; +	[self setStatusBarHidden:YES animated:YES];  	_window = [[UIWindow alloc] initWithContentRect:  [UIHardware fullScreenApplicationContentRect]];  	[_window retain]; @@ -96,7 +104,7 @@ int main(int argc, char** argv) {  - (void)applicationResume:(GSEventRef)event {  	[self removeApplicationBadge];  	[UIHardware _setStatusBarHeight:0.0f]; -	[self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0]; +	[self setStatusBarHidden:YES animated:YES];  	[_view applicationResume];  } diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h index 615b2e5345..6e4b446926 100644 --- a/backends/platform/iphone/iphone_video.h +++ b/backends/platform/iphone/iphone_video.h @@ -27,12 +27,11 @@  #define _IPHONE_VIDEO__H  #import <UIKit/UIKit.h> -#import <UIKit/UIView-Geometry.h>  #import <GraphicsServices/GraphicsServices.h>  #import <Foundation/Foundation.h>  #import <CoreSurface/CoreSurface.h> -#import <LayerKit/LKLayer.h> +#import <QuartzCore/QuartzCore.h>  #import "iphone_keyboard.h"  @interface iPhoneView : UIView @@ -41,7 +40,7 @@  	NSMutableArray* _events;  	NSLock* _lock;  	SoftKeyboard* _keyboardView; -	LKLayer* _screenLayer; +	CALayer* _screenLayer;  	int _fullWidth;  	int _fullHeight; diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 6c6944045e..89f159c1d9 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -31,8 +31,8 @@  #import <GraphicsServices/GraphicsServices.h>  #import <Foundation/Foundation.h>  #import <CoreSurface/CoreSurface.h> -#import <LayerKit/LKLayer.h>  #import <UIKit/UIKeyboardLayoutQWERTY.h> +#import <QuartzCore/QuartzCore.h>  static iPhoneView *sharedInstance = nil;  static int _width = 0; @@ -53,8 +53,8 @@ void iPhone_updateScreen() {  }  void iPhone_updateScreenRect(int x1, int y1, int x2, int y2) { -	NSRect rect = NSMakeRect(x1, y1, x2, y2); -	[sharedInstance performSelectorOnMainThread:@selector(updateScreenRect:) withObject: [NSValue valueWithRect:rect] waitUntilDone: NO]; +	//CGRect rect = CGRectMake(x1, y1, x2, y2); +	//[sharedInstance performSelectorOnMainThread:@selector(updateScreenRect:) withObject: [NSValue valueWithRect:rect] waitUntilDone: NO];  }  void iPhone_lockSurface() { @@ -146,9 +146,9 @@ bool getLocalMouseCoords(CGPoint *point) {  }  - (void)updateScreenRect:(id)rect { -	NSRect nsRect = [rect rectValue]; -	CGRect cgRect = CGRectMake(nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height); -	[sharedInstance setNeedsDisplayInRect: cgRect]; +	// NSRect nsRect = [rect rectValue]; +	// CGRect cgRect = CGRectMake(nsRect.origin.x, nsRect.origin.y, nsRect.size.width, nsRect.size.height); +	// [sharedInstance setNeedsDisplayInRect: cgRect];  }  - (void)initSurface { @@ -178,7 +178,7 @@ bool getLocalMouseCoords(CGPoint *point) {  	//printf("Surface created.\n");  	CoreSurfaceBufferLock(_screenSurface, 3); -	LKLayer* screenLayer = [[LKLayer layer] retain]; +	CALayer* screenLayer = [[CALayer layer] retain];  	if (_keyboardView != nil) {  		[_keyboardView removeFromSuperview]; @@ -213,7 +213,7 @@ bool getLocalMouseCoords(CGPoint *point) {  			_keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame];  			[_keyboardView setInputDelegate:self];  		} - +		  		[self addSubview:[_keyboardView inputView]];  		[self addSubview: _keyboardView];  		[[_keyboardView inputView] becomeFirstResponder]; @@ -283,11 +283,13 @@ bool getLocalMouseCoords(CGPoint *point) {  }  - (void)mouseDown:(GSEvent*)event { -	struct CGPoint point = GSEventGetLocationInWindow(event); - +	//printf("mouseDown()\n"); +	CGRect rect = GSEventGetLocationInWindow(event); +	CGPoint point = CGPointMake(rect.origin.x, rect.origin.y); +	  	if (!getLocalMouseCoords(&point))  		return; - +	  	[self addEvent:  		[[NSDictionary alloc] initWithObjectsAndKeys:  		 [NSNumber numberWithInt:kInputMouseDown], @"type", @@ -298,12 +300,18 @@ bool getLocalMouseCoords(CGPoint *point) {  	];  } +- (void)touchesBegan { +	//printf("touchesBegan()\n");	 +} +	  - (void)mouseUp:(GSEvent*)event { -	struct CGPoint point = GSEventGetLocationInWindow(event); - +	//printf("mouseUp()\n"); +	CGRect rect = GSEventGetLocationInWindow(event); +	CGPoint point = CGPointMake(rect.origin.x, rect.origin.y); +	  	if (!getLocalMouseCoords(&point))  		return; - +	  	[self addEvent:  		[[NSDictionary alloc] initWithObjectsAndKeys:  		 [NSNumber numberWithInt:kInputMouseUp], @"type", @@ -316,11 +324,12 @@ bool getLocalMouseCoords(CGPoint *point) {  - (void)mouseDragged:(GSEvent*)event {  	//printf("mouseDragged()\n"); -	struct CGPoint point = GSEventGetLocationInWindow(event); - +	CGRect rect = GSEventGetLocationInWindow(event); +	CGPoint point = CGPointMake(rect.origin.x, rect.origin.y); +	  	if (!getLocalMouseCoords(&point))  		return; - +	  	[self addEvent:  		[[NSDictionary alloc] initWithObjectsAndKeys:  		 [NSNumber numberWithInt:kInputMouseDragged], @"type", @@ -333,19 +342,21 @@ bool getLocalMouseCoords(CGPoint *point) {  - (void)mouseEntered:(GSEvent*)event {  	//printf("mouseEntered()\n"); -	// struct CGPoint point = GSEventGetLocationInWindow(event); -	// -	// if (!getLocalMouseCoords(&point)) -	//	return; -	// -	// [self addEvent: -	//	[[NSDictionary alloc] initWithObjectsAndKeys: -	//	 [NSNumber numberWithInt:kInputMouseSecondToggled], @"type", -	//	 [NSNumber numberWithFloat:point.x], @"x", -	//	 [NSNumber numberWithFloat:point.y], @"y", -	//	 nil -	//	] -	// ]; +	CGRect rect = GSEventGetLocationInWindow(event); +	CGPoint point = CGPointMake(rect.origin.x, rect.origin.y); + +	 +	if (!getLocalMouseCoords(&point)) +		return; +	 +	[self addEvent: +		[[NSDictionary alloc] initWithObjectsAndKeys: +		 [NSNumber numberWithInt:kInputMouseSecondToggled], @"type", +		 [NSNumber numberWithFloat:point.x], @"x", +		 [NSNumber numberWithFloat:point.y], @"y", +		 nil +		] +	];  }  - (void)mouseExited:(GSEvent*)event { @@ -361,19 +372,19 @@ bool getLocalMouseCoords(CGPoint *point) {  - (void)mouseMoved:(GSEvent*)event  {  	//printf("mouseMoved()\n"); -	struct CGPoint point = GSEventGetLocationInWindow(event); - -	if (!getLocalMouseCoords(&point)) -		return; - -	[self addEvent: -		[[NSDictionary alloc] initWithObjectsAndKeys: -		 [NSNumber numberWithInt:kInputMouseSecondToggled], @"type", -		 [NSNumber numberWithFloat:point.x], @"x", -		 [NSNumber numberWithFloat:point.y], @"y", -		 nil -		] -	]; +	// struct CGPoint point = GSEventGetLocationInWindow(event); +	//  +	// if (!getLocalMouseCoords(&point)) +	// 	return; +	//  +	// [self addEvent: +	// 	[[NSDictionary alloc] initWithObjectsAndKeys: +	// 	 [NSNumber numberWithInt:kInputMouseSecondToggled], @"type", +	// 	 [NSNumber numberWithFloat:point.x], @"x", +	// 	 [NSNumber numberWithFloat:point.y], @"y", +	// 	 nil +	// 	] +	// ];  }  - (void)handleKeyPress:(unichar)c { @@ -391,7 +402,7 @@ bool getLocalMouseCoords(CGPoint *point) {  	return TRUE;  } -- (int)swipe:(UIViewSwipeDirection)num withEvent:(GSEvent*)event { +- (int)swipe:(int)num withEvent:(GSEvent*)event {  	//printf("swipe: %i\n", num);  	[self addEvent: diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index 4cb90d35b9..fdef911d0a 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -25,8 +25,6 @@  #if defined(IPHONE_BACKEND) -#include <CoreGraphics/CGDirectDisplay.h> -#include <CoreSurface/CoreSurface.h>  #include <unistd.h>  #include <pthread.h> @@ -41,10 +39,15 @@  #include "backends/saves/default/default-saves.h"  #include "backends/timer/default/default-timer.h"  #include "sound/mixer.h" +#include "sound/mixer_intern.h"  #include "gui/message.h"  #include "osys_iphone.h"  #include "blit_arm.h" +#include <sys/time.h> + +#include <CoreGraphics/CGDirectDisplay.h> +#include <CoreSurface/CoreSurface.h>  const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = {  	{0, 0, 0} @@ -86,12 +89,12 @@ int OSystem_IPHONE::timerHandler(int t) {  void OSystem_IPHONE::initBackend() {  	_savefile = new DefaultSaveFileManager(); -	_mixer = new Audio::Mixer();  	_timer = new DefaultTimerManager();  	gettimeofday(&_startTime, NULL); -	setSoundCallback(Audio::Mixer::mixCallback, _mixer); +	setupMixer(); +  	setTimerCallback(&OSystem_IPHONE::timerHandler, 10);  	OSystem::initBackend(); @@ -871,7 +874,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {  				suspendLoop();  				break; -			case kInputKeyPressed: +			case kInputKeyPressed: {  				int keyPressed = (int)xUnit;  				int ascii = keyPressed;  				//printf("key: %i\n", keyPressed); @@ -932,6 +935,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) {  				event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii;  				_needEventRestPeriod = true;  				break; +			}  			case kInputSwipe: {  				Common::KeyCode keycode = Common::KEYCODE_INVALID; @@ -1088,10 +1092,21 @@ void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBuf  		AudioQueueStop(s_AudioQueue.queue, false);  } -bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) { +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() {  	//printf("setSoundCallback()\n"); -	s_soundCallback = proc; -	s_soundParam = param; +	_mixer = new Audio::MixerImpl(this); + +	s_soundCallback = mixCallback; +	s_soundParam = this; +  	s_AudioQueue.dataFormat.mSampleRate = AUDIO_SAMPLE_RATE;  	s_AudioQueue.dataFormat.mFormatID = kAudioFormatLinearPCM; @@ -1105,7 +1120,8 @@ bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) {  	if (AudioQueueNewOutput(&s_AudioQueue.dataFormat, AQBufferCallback, &s_AudioQueue, 0, kCFRunLoopCommonModes, 0, &s_AudioQueue.queue)) {  		printf("Couldn't set the AudioQueue callback!\n"); -		return false; +		_mixer->setReady(false); +		return;  	}  	uint32 bufferBytes = s_AudioQueue.frameCount * s_AudioQueue.dataFormat.mBytesPerFrame; @@ -1113,7 +1129,8 @@ bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) {  	for (int i = 0; i < AUDIO_BUFFERS; i++) {  		if (AudioQueueAllocateBuffer(s_AudioQueue.queue, bufferBytes, &s_AudioQueue.buffers[i])) {  			printf("Error allocating AudioQueue buffer!\n"); -			return false; +			_mixer->setReady(false);		 +			return;  		}  		AQBufferCallback(&s_AudioQueue, s_AudioQueue.queue, s_AudioQueue.buffers[i]); @@ -1122,10 +1139,12 @@ bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) {  	AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0);  	if (AudioQueueStart(s_AudioQueue.queue, NULL)) {  		printf("Error starting the AudioQueue!\n"); -		return false; +		_mixer->setReady(false);		 +		return;  	} - -	return true; +	 +	_mixer->setOutputRate(AUDIO_SAMPLE_RATE); +	_mixer->setReady(true);  }  int OSystem_IPHONE::getOutputSampleRate() const { @@ -1146,6 +1165,11 @@ void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) {  void OSystem_IPHONE::quit() {  } +void OSystem_IPHONE::getTimeAndDate(struct tm &t) const { +	time_t curTime = time(0); +	t = *localtime(&curTime); +} +  void OSystem_IPHONE::setWindowCaption(const char *caption) {  } @@ -1169,17 +1193,11 @@ OSystem *OSystem_IPHONE_create() {  }  const char* OSystem_IPHONE::getConfigPath() { -	if (s_is113OrHigher) -		return SCUMMVM_PREFS_PATH; -	else -		return SCUMMVM_OLD_PREFS_PATH; +	return SCUMMVM_PREFS_PATH;  }  const char* OSystem_IPHONE::getSavePath() { -	if (s_is113OrHigher) -		return SCUMMVM_SAVE_PATH; -	else -		return SCUMMVM_OLD_SAVE_PATH; +	return SCUMMVM_SAVE_PATH;  }  void OSystem_IPHONE::migrateApp() { @@ -1193,7 +1211,7 @@ void OSystem_IPHONE::migrateApp() {  		if (!file.exists()) {  			system("mkdir " SCUMMVM_ROOT_PATH);  			system("mkdir " SCUMMVM_SAVE_PATH); - +			  			// Copy over the prefs file  			system("cp " SCUMMVM_OLD_PREFS_PATH " " SCUMMVM_PREFS_PATH); @@ -1207,24 +1225,24 @@ void OSystem_IPHONE::migrateApp() {  void iphone_main(int argc, char *argv[]) { -	OSystem_IPHONE::migrateApp(); - -	// Redirect stdout and stderr if we're launching from the Springboard. -	if (argc == 2 && strcmp(argv[1], "--launchedFromSB") == 0) { -		FILE *newfp = fopen("/tmp/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; -		} +	//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;  	} +	system("mkdir " SCUMMVM_ROOT_PATH); +	system("mkdir " SCUMMVM_SAVE_PATH); +  	g_system = OSystem_IPHONE_create();  	assert(g_system); diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h index a01cad480a..af883a62c9 100644 --- a/backends/platform/iphone/osys_iphone.h +++ b/backends/platform/iphone/osys_iphone.h @@ -29,6 +29,8 @@  #include "iphone_common.h"  #include "common/system.h"  #include "common/events.h" +#include "sound/mixer_intern.h" +#include "backends/fs/posix/posix-fs-factory.h"  #include <AudioToolbox/AudioQueue.h> @@ -62,7 +64,7 @@ protected:  	static bool s_is113OrHigher;  	Common::SaveFileManager *_savefile; -	Audio::Mixer *_mixer; +	Audio::MixerImpl *_mixer;  	Common::TimerManager *_timer;  	Graphics::Surface _framebuffer; @@ -152,12 +154,16 @@ public:  	virtual void unlockMutex(MutexRef mutex);  	virtual void deleteMutex(MutexRef mutex); -	virtual bool setSoundCallback(SoundProc proc, void *param); +	static void mixCallback(void *sys, byte *samples, int len); +	virtual void setupMixer(void);  	virtual int getOutputSampleRate() const;  	virtual void setTimerCallback(TimerProc callback, int interval);  	virtual void quit(); +	FilesystemFactory *getFilesystemFactory() { return &POSIXFilesystemFactory::instance(); } +	virtual void getTimeAndDate(struct tm &t) const; +  	virtual void setWindowCaption(const char *caption);  	virtual Common::SaveFileManager *getSavefileManager(); diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 76ac91c282..d8394b5c9c 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -170,6 +170,10 @@ OSystem_SDL::OSystem_SDL()  	_joystick(0),  	_currentShakePos(0), _newShakePos(0),  	_paletteDirtyStart(0), _paletteDirtyEnd(0), +#ifdef MIXER_DOUBLE_BUFFERING +	_soundMutex(0), _soundCond(0), _soundThread(0), +	_soundThreadIsRunning(false), _soundThreadShouldQuit(false), +#endif  	_savefile(0),  	_mixer(0),  	_timer(0), diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl index 5d85fc03a2..22846f45dd 100644 --- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl +++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl @@ -29,7 +29,7 @@  	);  	# these are normally enabled for each variation -	$DefaultFeatures = qw(zlib tremor); +	$DefaultFeatures = qw(zlib mad tremor);  	#$DefaultFeatures = qw(zlib mad tremor); diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 660b0c69ed..e3a4027d79 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -617,9 +617,13 @@ bool symbian_feof(FILE* handle) {  long int symbian_ftell(FILE* handle) {  	TInt pos = 0; +	TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle)); -	((TSymbianFileEntry*)(handle))->iFileHandle.Seek(ESeekCurrent, pos); - +	entry->iFileHandle.Seek(ESeekCurrent, pos); +	if(entry->iInputPos != KErrNotFound) +		{ +		pos+=(entry->iInputPos - entry->iInputBufferLen); +		}  	return pos;  } @@ -627,6 +631,7 @@ int symbian_fseek(FILE* handle, long int offset, int whence) {  	TSeek seekMode = ESeekStart;  	TInt pos = offset; +	TSymbianFileEntry* entry = ((TSymbianFileEntry*)(handle));  	switch(whence) {  	case SEEK_SET: @@ -634,6 +639,9 @@ int symbian_fseek(FILE* handle, long int offset, int whence) {  		break;  	case SEEK_CUR:  		seekMode = ESeekCurrent; +		if(entry->iInputPos != KErrNotFound) { +			pos+=(entry->iInputPos - entry->iInputBufferLen); +		}  		break;  	case SEEK_END:  		seekMode = ESeekEnd; @@ -641,9 +649,9 @@ int symbian_fseek(FILE* handle, long int offset, int whence) {  	} -	((TSymbianFileEntry*)(handle))->iInputPos = KErrNotFound; +	entry->iInputPos = KErrNotFound; -	return ((TSymbianFileEntry*)(handle))->iFileHandle.Seek(seekMode, pos); +	return entry->iFileHandle.Seek(seekMode, pos);  }  void symbian_clearerr(FILE* /*handle*/) { diff --git a/backends/plugins/win32/win32-provider.cpp b/backends/plugins/win32/win32-provider.cpp index 64636d8096..b8fdd3d802 100644 --- a/backends/plugins/win32/win32-provider.cpp +++ b/backends/plugins/win32/win32-provider.cpp @@ -50,21 +50,14 @@ protected:  	virtual VoidFunc findSymbol(const char *symbol) {  		#ifndef _WIN32_WCE -		void *func = (void *)GetProcAddress((HMODULE)_dlHandle, symbol); +		FARPROC func = GetProcAddress((HMODULE)_dlHandle, symbol);  		#else -		void *func = (void *)GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol)); +		FARPROC func = GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol));  		#endif  		if (!func)  			debug("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str()); -		// FIXME HACK: This is a HACK to circumvent a clash between the ISO C++ -		// standard and POSIX: ISO C++ disallows casting between function pointers -		// and data pointers, but dlsym always returns a void pointer. For details, -		// see e.g. <http://www.trilithium.com/johan/2004/12/problem-with-dlsym/>. -		assert(sizeof(VoidFunc) == sizeof(func)); -		VoidFunc tmp; -		memcpy(&tmp, &func, sizeof(VoidFunc)); -		return tmp; +		return (void (*)())func;  	}  public:  | 
