diff options
author | Jordi Vilalta Prat | 2008-01-27 19:47:41 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2008-01-27 19:47:41 +0000 |
commit | 66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985 (patch) | |
tree | e27aadabecd8dd910884280e6559ff9c94c3d73c /backends/platform/iphone | |
parent | 278857698dc7b1623096fe1ad12511dc4c886c7e (diff) | |
download | scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.gz scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.bz2 scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.zip |
Removed trailing spaces.
svn-id: r30664
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r-- | backends/platform/iphone/iphone_common.h | 2 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_main.m | 14 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.m | 72 | ||||
-rw-r--r-- | backends/platform/iphone/module.mk | 2 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.cpp | 118 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.h | 6 |
6 files changed, 107 insertions, 107 deletions
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h index 6a5250a018..3c0d57aeb4 100644 --- a/backends/platform/iphone/iphone_common.h +++ b/backends/platform/iphone/iphone_common.h @@ -57,7 +57,7 @@ extern "C" { // On the C++ side void iphone_main(int argc, char *argv[]); - + // On the ObjC side void iPhone_updateScreen(); void iPhone_updateScreenRect(int x1, int y1, int x2, int y2); diff --git a/backends/platform/iphone/iphone_main.m b/backends/platform/iphone/iphone_main.m index b338bd719a..f7f5667bb5 100644 --- a/backends/platform/iphone/iphone_main.m +++ b/backends/platform/iphone/iphone_main.m @@ -47,9 +47,9 @@ int main(int argc, char** argv) { gArgv = argv; [[NSAutoreleasePool alloc] init]; - + return UIApplicationMain(argc, argv, [iPhoneMain class]); -} +} @implementation iPhoneMain @@ -62,7 +62,7 @@ int main(int argc, char** argv) { - (void) mainLoop: (id)param { [[NSAutoreleasePool alloc] init]; - + iphone_main(gArgc, gArgv); [UIApp terminate]; } @@ -78,13 +78,13 @@ int main(int argc, char** argv) { _window = [[UIWindow alloc] initWithContentRect: [UIHardware fullScreenApplicationContentRect]]; [_window retain]; - + _view = [[iPhoneView alloc] initWithFrame: [UIHardware fullScreenApplicationContentRect]]; [_window setContentView: _view]; - + [_window orderFront: self]; - [_window makeKey: self]; - + [_window makeKey: self]; + [NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil]; } diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index 0bc07c10ac..d3a0b00bbe 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -69,7 +69,7 @@ void iPhone_initSurface(int width, int height, bool landscape) { _width = width; _height = height; _landscape = landscape; - + [sharedInstance performSelectorOnMainThread:@selector(initSurface) withObject:nil waitUntilDone: YES]; } @@ -78,14 +78,14 @@ bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) { if (event == nil) { return false; } - + id type = [event objectForKey:@"type"]; - + if (type == nil) { printf("fetchEvent says: No type!\n"); - return false; + return false; } - + *outEvent = [type intValue]; *outX = [[event objectForKey:@"x"] floatValue]; *outY = [[event objectForKey:@"y"] floatValue]; @@ -97,10 +97,10 @@ bool getLocalMouseCoords(CGPoint *point) { point->y < _screenRect.origin.y || point->y >= _screenRect.origin.y + _screenRect.size.height) { return false; } - + point->x = (point->x - _screenRect.origin.x) / _screenRect.size.width; point->y = (point->y - _screenRect.origin.y) / _screenRect.size.height; - + return true; } @@ -122,9 +122,9 @@ bool getLocalMouseCoords(CGPoint *point) { -(void) dealloc { [super dealloc]; - + if (_keyboardView != nil) { - [_keyboardView dealloc]; + [_keyboardView dealloc]; } } @@ -136,7 +136,7 @@ bool getLocalMouseCoords(CGPoint *point) { // if (lastTick == 0) { // lastTick = time(0); // } - // + // // frames++; // if (time(0) > lastTick) { // lastTick = time(0); @@ -148,7 +148,7 @@ 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]; + [sharedInstance setNeedsDisplayInRect: cgRect]; } - (void)initSurface { @@ -157,7 +157,7 @@ bool getLocalMouseCoords(CGPoint *point) { int pitch = _width * 2; int allocSize = 2 * _width * _height; char *pixelFormat = "565L"; - + NSDictionary* dict = [[NSDictionary alloc] initWithObjectsAndKeys: kCFBooleanTrue, kCoreSurfaceBufferGlobal, @"PurpleGFXMem", kCoreSurfaceBufferMemoryRegion, @@ -179,7 +179,7 @@ bool getLocalMouseCoords(CGPoint *point) { CoreSurfaceBufferLock(_screenSurface, 3); LKLayer* screenLayer = [[LKLayer layer] retain]; - + if (_keyboardView != nil) { [_keyboardView removeFromSuperview]; [[_keyboardView inputView] removeFromSuperview]; @@ -202,8 +202,8 @@ bool getLocalMouseCoords(CGPoint *point) { //printf("Rect: %i, %i, %i, %i\n", _widthOffset, _heightOffset, rectWidth, rectHeight); _screenRect = CGRectMake(_widthOffset, _heightOffset, rectWidth, rectHeight); - [screenLayer setFrame: _screenRect]; - } else { + [screenLayer setFrame: _screenRect]; + } else { float ratio = (float)_height / (float)_width; _screenRect = CGRectMake(0, 0, _fullWidth, _fullWidth * ratio); [screenLayer setFrame: _screenRect]; @@ -211,9 +211,9 @@ bool getLocalMouseCoords(CGPoint *point) { CGRect keyFrame = CGRectMake(0.0f, _screenRect.size.height, _fullWidth, _fullHeight - _screenRect.size.height); if (_keyboardView == nil) { _keyboardView = [[SoftKeyboard alloc] initWithFrame:keyFrame]; - [_keyboardView setInputDelegate:self]; + [_keyboardView setInputDelegate:self]; } - + [self addSubview:[_keyboardView inputView]]; [self addSubview: _keyboardView]; [[_keyboardView inputView] becomeFirstResponder]; @@ -221,14 +221,14 @@ bool getLocalMouseCoords(CGPoint *point) { [screenLayer setContents: _screenSurface]; [screenLayer setOpaque: YES]; - + if (_screenLayer != nil) { [[sharedInstance _layer] replaceSublayer: _screenLayer with: screenLayer]; } else { [[sharedInstance _layer] addSublayer: screenLayer]; } _screenLayer = screenLayer; - + CoreSurfaceBufferUnlock(_screenSurface); [dict release]; } @@ -253,21 +253,21 @@ bool getLocalMouseCoords(CGPoint *point) { if (event == nil) { return nil; } - + [_events removeObjectAtIndex: 0]; [self unlock]; - + return event; } - (void)addEvent:(NSDictionary*)event { [self lock]; - + if(_events == nil) _events = [[NSMutableArray alloc] init]; - + [_events addObject: event]; - + [self unlock]; } @@ -284,7 +284,7 @@ bool getLocalMouseCoords(CGPoint *point) { - (void)mouseDown:(GSEvent*)event { struct CGPoint point = GSEventGetLocationInWindow(event); - + if (!getLocalMouseCoords(&point)) return; @@ -300,10 +300,10 @@ bool getLocalMouseCoords(CGPoint *point) { - (void)mouseUp:(GSEvent*)event { struct CGPoint point = GSEventGetLocationInWindow(event); - + if (!getLocalMouseCoords(&point)) return; - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseUp], @"type", @@ -317,10 +317,10 @@ bool getLocalMouseCoords(CGPoint *point) { - (void)mouseDragged:(GSEvent*)event { //printf("mouseDragged()\n"); struct CGPoint point = GSEventGetLocationInWindow(event); - + if (!getLocalMouseCoords(&point)) return; - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseDragged], @"type", @@ -334,10 +334,10 @@ 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", @@ -362,10 +362,10 @@ bool getLocalMouseCoords(CGPoint *point) { { //printf("mouseMoved()\n"); struct CGPoint point = GSEventGetLocationInWindow(event); - + if (!getLocalMouseCoords(&point)) return; - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseSecondToggled], @"type", @@ -393,7 +393,7 @@ bool getLocalMouseCoords(CGPoint *point) { - (int)swipe:(UIViewSwipeDirection)num withEvent:(GSEvent*)event { //printf("swipe: %i\n", num); - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputSwipe], @"type", @@ -416,7 +416,7 @@ bool getLocalMouseCoords(CGPoint *point) { [NSNumber numberWithFloat:0], @"y", nil ] - ]; + ]; } - (void)applicationResume { @@ -427,7 +427,7 @@ bool getLocalMouseCoords(CGPoint *point) { [NSNumber numberWithFloat:0], @"y", nil ] - ]; + ]; } @end diff --git a/backends/platform/iphone/module.mk b/backends/platform/iphone/module.mk index 311a0490c5..a3c9a012fe 100644 --- a/backends/platform/iphone/module.mk +++ b/backends/platform/iphone/module.mk @@ -9,6 +9,6 @@ MODULE_OBJS := \ MODULE_DIRS += \ backends/platform/iphone/ - + # We don't use the rules.mk here on purpose OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index 4dc5948aaf..2ca629d0e2 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -63,7 +63,7 @@ OSystem_IPHONE::OSystem_IPHONE() : _needEventRestPeriod(false), _mouseClickAndDragEnabled(false), _gestureStartX(-1), _gestureStartY(-1), _fullScreenIsDirty(false), _mouseDirty(false), _timeSuspended(0) -{ +{ _queuedInputEvent.type = (Common::EventType)0; _lastDrawnMouseRect = Common::Rect(0, 0, 0, 0); } @@ -95,7 +95,7 @@ void OSystem_IPHONE::initBackend() { setTimerCallback(&OSystem_IPHONE::timerHandler, 10); OSystem::initBackend(); -} +} bool OSystem_IPHONE::hasFeature(Feature f) { return false; @@ -136,7 +136,7 @@ void OSystem_IPHONE::initSize(uint width, uint height) { _screenHeight = height; free(_offscreen); - + _offscreen = (byte *)malloc(width * height); bzero(_offscreen, width * height); @@ -145,12 +145,12 @@ void OSystem_IPHONE::initSize(uint width, uint height) { int fullSize = _screenWidth * _screenHeight * sizeof(OverlayColor); _overlayBuffer = (OverlayColor *)malloc(fullSize); clearOverlay(); - + free(_fullscreen); _fullscreen = (uint16 *)malloc(fullSize); bzero(_fullscreen, fullSize); - + if (_screenOrientation != kScreenOrientationPortrait) iPhone_initSurface(height, width, true); else @@ -177,7 +177,7 @@ void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) { _palette[i] = RGBToColor(b[0], b[1], b[2]); b += 4; } - + dirtyFullScreen(); } @@ -210,12 +210,12 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, if (w <= 0 || h <= 0) return; - + if (!_fullScreenIsDirty) { _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h)); } - - + + byte *dst = _offscreen + y * _screenWidth + x; if (_screenWidth == pitch && pitch == w) memcpy(dst, buf, h * w); @@ -233,7 +233,7 @@ void OSystem_IPHONE::addDirtyRect(int16 x, int16 y, int16 w, int16 h) { return; } - clipRectToScreen(x, y, w, h); + clipRectToScreen(x, y, w, h); _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h)); } @@ -257,7 +257,7 @@ void OSystem_IPHONE::clipRectToScreen(int16 &x, int16 &y, int16 &w, int16 &h) { if (w < 0) { w = 0; } - + if (h < 0) { h = 0; } @@ -268,7 +268,7 @@ void OSystem_IPHONE::updateScreen() { if (_dirtyRects.size() == 0 && !_mouseDirty) return; - + internUpdateScreen(); _fullScreenIsDirty = false; @@ -320,7 +320,7 @@ void OSystem_IPHONE::internUpdateScreen() { uint16 *dst = &_fullscreen[dirtyRect.left * _screenHeight + (_screenHeight - dirtyRect.bottom)]; blitLandscapeScreenRect16bpp(dst, src, w, h, -_screenWidth, -_screenHeight); break; - } + } case kScreenOrientationFlippedLandscape: { uint16 *src = (uint16 *)&_overlayBuffer[dirtyRect.top * _screenWidth + dirtyRect.left]; uint16 *dst = &_fullscreen[(_screenWidth - dirtyRect.left - 1) * _screenHeight + dirtyRect.top]; @@ -354,9 +354,9 @@ void OSystem_IPHONE::internUpdateScreen() { blitLandscapeScreenRect8bpp(dst, src, w, h, _palette, _screenWidth, _screenHeight); break; } - } + } } - + //draw mouse on top if (_mouseVisible && (dirtyRect.intersects(mouseRect))) { int srcX = 0; @@ -364,12 +364,12 @@ void OSystem_IPHONE::internUpdateScreen() { int left = _mouseX - _mouseHotspotX; if (left < 0) { srcX -= left; - left = 0; + left = 0; } int top = _mouseY - _mouseHotspotY; if (top < 0) { srcY -= top; - top = 0; + top = 0; } //int right = left + _mouseWidth; @@ -380,7 +380,7 @@ void OSystem_IPHONE::internUpdateScreen() { int displayWidth = _mouseWidth; if (_mouseWidth + left > _screenWidth) displayWidth = _screenWidth - left; - + int displayHeight = _mouseHeight; if (_mouseHeight + top > _screenHeight) displayHeight = _screenHeight - top; @@ -463,7 +463,7 @@ void OSystem_IPHONE::internUpdateScreen() { fs += _screenHeight; } break; - } + } case kScreenOrientationFlippedLandscape: { int height = h * 2; int offset = ((_screenWidth - dirtyRect.left - 1) * _screenHeight + dirtyRect.top); @@ -475,17 +475,17 @@ void OSystem_IPHONE::internUpdateScreen() { fs -= _screenHeight; } break; - } + } } } - + //iPhone_updateScreenRect(dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom ); } } Graphics::Surface *OSystem_IPHONE::lockScreen() { //printf("lockScreen()\n"); - + _framebuffer.pixels = _offscreen; _framebuffer.w = _screenWidth; _framebuffer.h = _screenHeight; @@ -560,9 +560,9 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x return; if (!_fullScreenIsDirty) { - _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h)); + _dirtyRects.push_back(Common::Rect(x, y, x + w, y + h)); } - + OverlayColor *dst = _overlayBuffer + (y * _screenWidth + x); if (_screenWidth == pitch && pitch == w) memcpy(dst, buf, h * w * sizeof(OverlayColor)); @@ -593,14 +593,14 @@ bool OSystem_IPHONE::showMouse(bool visible) { void OSystem_IPHONE::warpMouse(int x, int y) { //printf("warpMouse()\n"); - + _mouseX = x; _mouseY = y; _mouseDirty = true; } void OSystem_IPHONE::dirtyMouseCursor() { - addDirtyRect(_mouseX - _mouseHotspotX, _mouseY - _mouseHotspotY, _mouseX + _mouseWidth - _mouseHotspotX, _mouseY + _mouseHeight - _mouseHotspotY); + addDirtyRect(_mouseX - _mouseHotspotX, _mouseY - _mouseHotspotY, _mouseX + _mouseWidth - _mouseHotspotX, _mouseY + _mouseHeight - _mouseHotspotY); } void OSystem_IPHONE::dirtyFullScreen() { @@ -618,7 +618,7 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot free(_mouseBuf); _mouseBuf = NULL; } - + if (_mouseBuf == NULL) _mouseBuf = (byte *)malloc(w * h); @@ -629,7 +629,7 @@ void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspot _mouseHotspotY = hotspotY; _mouseKeyColour = keycolor; - + memcpy(_mouseBuf, buf, w * h); _mouseDirty = true; @@ -639,12 +639,12 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { //printf("pollEvent()\n"); long curTime = getMillis(); - + if (_timerCallback && (curTime >= _timerCallbackNext)) { _timerCallback(_timerCallbackTimer); _timerCallbackNext = curTime + _timerCallbackTimer; } - + if (_needEventRestPeriod) { // Workaround: Some engines can't handle mouse-down and mouse-up events // appearing right after each other, without a call returning no input in between. @@ -667,7 +667,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { switch (_screenOrientation) { case kScreenOrientationPortrait: x = (int)(xUnit * _screenWidth); - y = (int)(yUnit * _screenHeight); + y = (int)(yUnit * _screenHeight); break; case kScreenOrientationLandscape: x = (int)(yUnit * _screenWidth); @@ -676,13 +676,13 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { case kScreenOrientationFlippedLandscape: x = (int)((1.0 - yUnit) * _screenWidth); y = (int)(xUnit * _screenHeight); - break; + break; } switch ((InputEvent)eventType) { case kInputMouseDown: //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; @@ -697,7 +697,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { event.mouse.x = _mouseX; event.mouse.y = _mouseY; return true; - } else { + } else { _lastMouseDown = curTime; } return false; @@ -739,7 +739,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { if (lengthSq > 15000) { // Long enough gesture to react upon. _gestureStartX = -1; _gestureStartY = -1; - + float vecLength = sqrt(lengthSq); float vecXNorm = vecX / vecLength; float vecYNorm = vecY / vecLength; @@ -770,8 +770,8 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { // Swipe right // _secondaryTapped = !_secondaryTapped; // _gestureStartX = x; - // _gestureStartY = y; - // + // _gestureStartY = y; + // // GUI::TimedMessageDialog dialog("Forcing toggle of pressed state.", 1500); // dialog.runModal(); return false; @@ -800,7 +800,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { event.type = Common::EVENT_LBUTTONUP; event.mouse.x = _mouseX; event.mouse.y = _mouseY; - + _queuedInputEvent.type = Common::EVENT_RBUTTONDOWN; _queuedInputEvent.mouse.x = _mouseX; _queuedInputEvent.mouse.y = _mouseY; @@ -812,11 +812,11 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { if (curTime - _lastSecondaryTap < 250 && !_overlayVisible) { 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; - _needEventRestPeriod = true; + event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE; + _needEventRestPeriod = true; _lastSecondaryTap = 0; } else if (!_mouseClickAndDragEnabled) { event.type = Common::EVENT_RBUTTONDOWN; @@ -833,8 +833,8 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { event.type = Common::EVENT_RBUTTONUP; event.mouse.x = _mouseX; event.mouse.y = _mouseY; - } - } + } + } break; case kInputOrientationChanged: //printf("Orientation: %i", (int)xUnit); @@ -864,7 +864,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { dirtyFullScreen(); updateScreen(); - } + } break; case kInputApplicationSuspended: @@ -930,9 +930,9 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { event.kbd.flags = _queuedInputEvent.kbd.flags = 0; event.kbd.keycode = _queuedInputEvent.kbd.keycode = (Common::KeyCode)keyPressed; event.kbd.ascii = _queuedInputEvent.kbd.ascii = ascii; - _needEventRestPeriod = true; + _needEventRestPeriod = true; break; - + case kInputSwipe: { Common::KeyCode keycode = Common::KEYCODE_INVALID; switch (_screenOrientation) { @@ -989,7 +989,7 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { default: return false; } - break; + break; } event.kbd.keycode = _queuedInputEvent.kbd.keycode = keycode; @@ -997,10 +997,10 @@ bool OSystem_IPHONE::pollEvent(Common::Event &event) { event.type = Common::EVENT_KEYDOWN; _queuedInputEvent.type = Common::EVENT_KEYUP; event.kbd.flags = _queuedInputEvent.kbd.flags = 0; - _needEventRestPeriod = true; + _needEventRestPeriod = true; break; } - + default: break; } @@ -1022,7 +1022,7 @@ void OSystem_IPHONE::suspendLoop() { if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) if ((InputEvent)eventType == kInputApplicationResumed) done = true; - usleep(100000); + usleep(100000); } AudioQueueStart(s_AudioQueue.queue, NULL); @@ -1047,14 +1047,14 @@ OSystem::MutexRef OSystem_IPHONE::createMutex(void) { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - + pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); if (pthread_mutex_init(mutex, &attr) != 0) { printf("pthread_mutex_init() failed!\n"); free(mutex); return NULL; } - + return (MutexRef)mutex; } @@ -1074,7 +1074,7 @@ void OSystem_IPHONE::deleteMutex(MutexRef mutex) { if (pthread_mutex_destroy((pthread_mutex_t *) mutex) != 0) { printf("pthread_mutex_destroy() failed!\n"); } else { - free(mutex); + free(mutex); } } @@ -1117,7 +1117,7 @@ bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) { } AQBufferCallback(&s_AudioQueue, s_AudioQueue.queue, s_AudioQueue.buffers[i]); - } + } AudioQueueSetParameter(s_AudioQueue.queue, kAudioQueueParam_Volume, 1.0); if (AudioQueueStart(s_AudioQueue.queue, NULL)) { @@ -1137,8 +1137,8 @@ int OSystem_IPHONE::getOutputSampleRate() const { } void OSystem_IPHONE::setTimerCallback(TimerProc callback, int interval) { - //printf("setTimerCallback()\n"); - + //printf("setTimerCallback()\n"); + if (callback != NULL) { _timerCallbackTimer = interval; _timerCallbackNext = getMillis() + interval; @@ -1173,7 +1173,7 @@ OSystem *OSystem_IPHONE_create() { } void iphone_main(int argc, char *argv[]) { - + // 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"); @@ -1183,11 +1183,11 @@ void iphone_main(int argc, char *argv[]) { *stdout = *newfp; *stderr = *newfp; setbuf(stdout, NULL); - setbuf(stderr, NULL); + setbuf(stderr, NULL); //extern int gDebugLevel; //gDebugLevel = 10; - } + } } g_system = OSystem_IPHONE_create(); diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h index 2d0bea310d..eeb8504680 100644 --- a/backends/platform/iphone/osys_iphone.h +++ b/backends/platform/iphone/osys_iphone.h @@ -34,7 +34,7 @@ typedef void (*SoundProc)(void *param, byte *buf, int len); typedef int (*TimerProc)(int interval); - + typedef struct AQCallbackStruct { AudioQueueRef queue; uint32 frameCount; @@ -49,7 +49,7 @@ protected: static AQCallbackStruct s_AudioQueue; static SoundProc s_soundCallback; static void *s_soundParam; - + Common::SaveFileManager *_savefile; Audio::Mixer *_mixer; Common::TimerManager *_timer; @@ -153,7 +153,7 @@ public: virtual Common::SaveFileManager *getSavefileManager(); virtual Audio::Mixer *getMixer(); virtual Common::TimerManager *getTimerManager(); - + protected: inline void addDirtyRect(int16 x1, int16 y1, int16 w, int16 h); void internUpdateScreen(); |