Ticket #8746: scummvm-iphone-20071111.patch
File scummvm-iphone-20071111.patch, 43.1 KB (added by , 16 years ago) |
---|
-
configure
207 207 208 208 if test -n "$_host"; then 209 209 # In cross-compiling mode, we cannot run the result 210 eval "$1 -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp210 eval "$1 $CXXFLAGS -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp 211 211 else 212 212 eval "$1 $CXXFLAGS -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && eval "./tmp_cxx_compiler 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp 213 213 fi … … 732 732 _host_os=mingw32msvc 733 733 _host_cpu=i586 734 734 ;; 735 iphone) 736 _host_os=iphone 737 _host_cpu=arm 738 ;; 735 739 *) 736 740 if test -z "$_host"; then 737 741 guessed_host=`$_srcdir/config.guess` … … 977 981 mint*) 978 982 DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE" 979 983 ;; 984 iphone*) 985 DEFINES="$DEFINES -DUNIX -DIPHONE" 986 LIBS="$LIBS -lobjc -framework UIKit -framework CoreGraphics -framework CoreSurface -framework LayerKit -framework GraphicsServices -framework CoreFoundation -framework Foundation" 987 ;; 980 988 amigaos*) 981 989 # TODO: anything to be added here? 982 990 ;; … … 1064 1072 _ranlib=i586-mingw32msvc-ranlib 1065 1073 LIBS="$LIBS -lmingw32 -lwinmm" 1066 1074 OBJS="$OBJS scummvmico.o" 1067 ;; 1075 ;; 1076 arm-iphone) 1077 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes" 1078 _endian=little 1079 _need_memalign=yes 1080 type_1_byte='char' 1081 type_2_byte='short' 1082 type_4_byte='int' 1083 ;; 1068 1084 *) 1069 1085 echo "Continuing with auto-detected values ... if you have problems, please add your target to configure." 1070 1086 ;; … … 1546 1562 DEFINES="$DEFINES -DX11_BACKEND" 1547 1563 MODULES="$MODULES backends/platform/x11" 1548 1564 ;; 1565 iphone) 1566 DEFINES="$DEFINES -DIPHONE_BACKEND" 1567 MODULES="$MODULES backends/platform/iphone" 1568 ;; 1549 1569 *) 1550 1570 echo "support for $_backend backend not implemented in configure script yet" 1551 1571 exit 1 -
dists/iphone/Info.plist
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 <plist version="1.0"> 4 <dict> 5 <key>CFBundleDevelopmentRegion</key> 6 <string>en</string> 7 <key>CFBundleExecutable</key> 8 <string>ScummVM</string> 9 <key>CFBundleIdentifier</key> 10 <string>com.scummvm.scummvm</string> 11 <key>CFBundleInfoDictionaryVersion</key> 12 <string>6.0</string> 13 <key>CFBundleName</key> 14 <string>ScummVM</string> 15 <key>CFBundlePackageType</key> 16 <string>APPL</string> 17 <key>CFBundleShortVersionString</key> 18 <string>1.0.0</string> 19 <key>CFBundleSignature</key> 20 <string>????</string> 21 <key>CFBundleVersion</key> 22 <string>svn</string> 23 </dict> 24 </plist> -
common/file.cpp
30 30 #include "common/hash-str.h" 31 31 #include <errno.h> 32 32 33 #if def MACOSX33 #if defined(MACOSX) || defined(IPHONE) 34 34 #include "CoreFoundation/CoreFoundation.h" 35 35 #endif 36 36 … … 329 329 _handle = fopenNoCase(filename, "", modeStr); 330 330 331 331 // Last last (really) resort: try looking inside the application bundle on Mac OS X for the lowercase file. 332 #if def MACOSX332 #if defined(MACOSX) || defined(IPHONE) 333 333 if (!_handle) { 334 334 CFStringRef cfFileName = CFStringCreateWithBytes(NULL, (const UInt8 *)filename.c_str(), filename.size(), kCFStringEncodingASCII, false); 335 335 CFURLRef fileUrl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), cfFileName, NULL, NULL); -
common/config-manager.cpp
82 82 83 83 void ConfigManager::loadDefaultConfigFile() { 84 84 char configFile[MAXPATHLEN]; 85 #if defined(UNIX) && !defined(GP2X) // GP2X is Linux based but Home dir can be read only so do not use it and put the config in the executable dir. 85 // GP2X is Linux based but Home dir can be read only so do not use it and put the config in the executable dir. 86 // On the iPhone, the home dir of the user when you launch the app from the Springboard, is /. Which we don't want. 87 #if defined(UNIX) && !defined(GP2X) && !defined(IPHONE) 86 88 const char *home = getenv("HOME"); 87 89 if (home != NULL && strlen(home) < MAXPATHLEN) 88 90 snprintf(configFile, MAXPATHLEN, "%s/%s", home, DEFAULT_CONFIG_FILE); … … 135 137 136 138 #elif defined(PALMOS_MODE) 137 139 strcpy(configFile,"/PALM/Programs/ScummVM/" DEFAULT_CONFIG_FILE); 140 #elif defined(IPHONE) 141 strcpy(configFile,"/var/root/" DEFAULT_CONFIG_FILE); 138 142 #elif defined(__PLAYSTATION2__) 139 143 ((OSystem_PS2*)g_system)->makeConfigPath(configFile); 140 144 #elif defined(__PSP__) -
Makefile.common
109 109 .cpp.o: 110 110 $(MKDIR) $(*D)/$(DEPDIR) 111 111 $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o 112 .m.o: 113 $(MKDIR) $(*D)/$(DEPDIR) 114 $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(OBJCFLAGS) -c $(<) -o $*.o 112 115 endif 113 116 114 117 ifdef HAVE_NASM -
backends/platform/psp/osys_psp.cpp
395 395 } 396 396 397 397 void OSystem_PSP::warpMouse(int x, int y) { 398 //assert(x > 0 && x < _screenWidth);399 //assert(y > 0 && y < _screenHeight);400 398 _mouseX = x; 401 399 _mouseY = y; 402 400 } -
backends/platform/iphone/iphone_common.h
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * $URL$ 22 * $Id$ 23 * 24 */ 25 26 enum InputEvent { 27 kInputMouseDown, 28 kInputMouseUp, 29 kInputMouseDragged, 30 kInputMouseSecondToggled 31 }; 32 33 // We need this to be able to call functions from/in Objective-C. 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 // On the C++ side 39 void iphone_main(int argc, char *argv[]); 40 41 // On the ObjC side 42 void iPhone_updateScreen(); 43 unsigned short* iPhone_getSurface(); 44 void iPhone_lockSurface(); 45 void iPhone_unlockSurface(); 46 void iPhone_initSurface(int width, int height); 47 bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY); 48 49 #ifdef __cplusplus 50 } 51 #endif -
backends/platform/iphone/osys_iphone.cpp
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * $URL$ 22 * $Id$ 23 * 24 */ 25 26 #if defined(IPHONE_BACKEND) 27 28 #include <CoreGraphics/CGDirectDisplay.h> 29 #include <CoreSurface/CoreSurface.h> 30 #include <unistd.h> 31 #include <pthread.h> 32 33 #include "common/system.h" 34 #include "base/main.h" 35 36 #include "common/rect.h" 37 #include "common/events.h" 38 39 #include "backends/saves/default/default-saves.h" 40 #include "backends/timer/default/default-timer.h" 41 #include "sound/mixer.h" 42 43 #include "osys_iphone.h" 44 #include "iphone_common.h" 45 46 const OSystem::GraphicsMode OSystem_IPHONE::s_supportedGraphicsModes[] = { 47 {0, 0, 0} 48 }; 49 50 OSystem_IPHONE::OSystem_IPHONE() : 51 _savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL), 52 _overlayVisible(false), _overlayBuffer(NULL), _fullscreen(NULL), 53 _mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), 54 _secondaryTapped(false), _lastSecondaryTap(0) 55 { 56 57 } 58 59 OSystem_IPHONE::~OSystem_IPHONE() { 60 delete _savefile; 61 delete _mixer; 62 delete _timer; 63 delete _offscreen; 64 delete _fullscreen; 65 } 66 67 void OSystem_IPHONE::initBackend() { 68 _savefile = new DefaultSaveFileManager(); 69 _mixer = new Audio::Mixer(); 70 _timer = new DefaultTimerManager(); 71 72 // Note that both the mixer and the timer manager are useless 73 // this way; they need to be hooked into the system somehow to 74 // be functional. Of course, can't do that in a NULL backend :). 75 76 gettimeofday(&_startTime, NULL); 77 _queuedInputEvent.type = (Common::EventType)0; 78 79 OSystem::initBackend(); 80 } 81 82 bool OSystem_IPHONE::hasFeature(Feature f) { 83 return false; 84 } 85 86 void OSystem_IPHONE::setFeatureState(Feature f, bool enable) { 87 } 88 89 bool OSystem_IPHONE::getFeatureState(Feature f) { 90 return false; 91 } 92 93 const OSystem::GraphicsMode* OSystem_IPHONE::getSupportedGraphicsModes() const { 94 return s_supportedGraphicsModes; 95 } 96 97 98 int OSystem_IPHONE::getDefaultGraphicsMode() const { 99 return -1; 100 } 101 102 bool OSystem_IPHONE::setGraphicsMode(const char *mode) { 103 return true; 104 } 105 106 bool OSystem_IPHONE::setGraphicsMode(int mode) { 107 return true; 108 } 109 110 int OSystem_IPHONE::getGraphicsMode() const { 111 return -1; 112 } 113 114 void OSystem_IPHONE::initSize(uint width, uint height) { 115 //printf("initSize(%i, %i)\n", width, height); 116 117 _screenWidth = width; 118 _screenHeight = height; 119 120 if (_offscreen) 121 free(_offscreen); 122 123 _offscreen = (byte *)malloc(width * height); 124 bzero(_offscreen, width * height); 125 126 if (_overlayBuffer) 127 free(_overlayBuffer); 128 129 int fullSize = _screenWidth * _screenHeight * sizeof(OverlayColor); 130 _overlayBuffer = (OverlayColor *)malloc(fullSize); 131 clearOverlay(); 132 133 if (_fullscreen) { 134 free(_fullscreen); 135 } 136 _fullscreen = (uint16 *)malloc(fullSize); 137 bzero(_fullscreen, fullSize); 138 139 iPhone_initSurface(height, width); 140 141 _mouseVisible = false; 142 } 143 144 int16 OSystem_IPHONE::getHeight() { 145 return _screenHeight; 146 } 147 148 int16 OSystem_IPHONE::getWidth() { 149 return _screenWidth; 150 } 151 152 void OSystem_IPHONE::setPalette(const byte *colors, uint start, uint num) { 153 //printf("setPalette()\n"); 154 const byte *b = colors; 155 156 for (uint i = start; i < num; ++i) { 157 _palette[i] = RGBToColor(b[0], b[1], b[2]); 158 b += 4; 159 } 160 } 161 162 void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) { 163 //printf("grabPalette()\n"); 164 } 165 166 void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { 167 //printf("copyRectToScreen()\n"); 168 //Clip the coordinates 169 if (x < 0) { 170 w += x; 171 buf -= x; 172 x = 0; 173 } 174 175 if (y < 0) { 176 h += y; 177 buf -= y * pitch; 178 y = 0; 179 } 180 181 if (w > _screenWidth - x) { 182 w = _screenWidth - x; 183 } 184 185 if (h > _screenHeight - y) { 186 h = _screenHeight - y; 187 } 188 189 if (w <= 0 || h <= 0) 190 return; 191 192 193 byte *dst = _offscreen + y * _screenWidth + x; 194 if (_screenWidth == pitch && pitch == w) { 195 memcpy(dst, buf, h * w); 196 } else { 197 do { 198 memcpy(dst, buf, w); 199 buf += pitch; 200 dst += _screenWidth; 201 } while (--h); 202 } 203 } 204 205 void OSystem_IPHONE::updateScreen() { 206 //printf("updateScreen()\n"); 207 208 //uint16* screen = iPhone_getSurface(); 209 210 int row; 211 if (_overlayVisible) { 212 for (int x = _screenWidth; x >= 1; x--) { 213 row = (_screenWidth - x) * _screenHeight; 214 for (int y = 0; y < _screenHeight; y++) { 215 _fullscreen[row + y] = _overlayBuffer[y * _screenWidth + x]; 216 } 217 } 218 } else { 219 for (int x = _screenWidth; x >= 1; x--) { 220 row = (_screenWidth - x) * _screenHeight; 221 for (int y = 0; y < _screenHeight; y++) { 222 _fullscreen[row + y] = _palette[_offscreen[y * _screenWidth + x]]; 223 } 224 } 225 } 226 227 //draw mouse on top 228 if (_mouseVisible) { 229 for (uint x = _mouseWidth; x >= 1; x--) { 230 int mx = _mouseX + x; // + _mouseHotspotX; 231 row = (_screenWidth - mx) * _screenHeight; 232 if (mx >= 0 && mx < _screenWidth) { 233 for (uint y = 0; y < _mouseHeight; ++y) { 234 if (_mouseBuf[y * _mouseWidth + x] != _mouseKeyColour) { 235 int my = _mouseY + y; // + _mouseHotspotY; 236 237 if ( my >= 0 && my < _screenHeight) 238 _fullscreen[row + my] = _palette[_mouseBuf[y * _mouseWidth + x]]; 239 } 240 } 241 } 242 } 243 } 244 245 memcpy(iPhone_getSurface(), _fullscreen, (_screenWidth * _screenHeight) * 2); 246 iPhone_updateScreen(); 247 } 248 249 Graphics::Surface *OSystem_IPHONE::lockScreen() { 250 //printf("lockScreen()\n"); 251 252 _framebuffer.pixels = _offscreen; 253 _framebuffer.w = _screenWidth; 254 _framebuffer.h = _screenHeight; 255 _framebuffer.pitch = _screenWidth; 256 _framebuffer.bytesPerPixel = 1; 257 258 return &_framebuffer; 259 } 260 261 void OSystem_IPHONE::unlockScreen() { 262 //printf("unlockScreen()\n"); 263 updateScreen(); 264 } 265 266 void OSystem_IPHONE::setShakePos(int shakeOffset) { 267 } 268 269 void OSystem_IPHONE::showOverlay() { 270 //printf("showOverlay()\n"); 271 _overlayVisible = true; 272 } 273 274 void OSystem_IPHONE::hideOverlay() { 275 //printf("hideOverlay()\n"); 276 _overlayVisible = false; 277 } 278 279 void OSystem_IPHONE::clearOverlay() { 280 //printf("clearOverlay()\n"); 281 bzero(_overlayBuffer, _screenWidth * _screenHeight * sizeof(OverlayColor)); 282 } 283 284 void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) { 285 //printf("grabOverlay()\n"); 286 int h = _screenHeight; 287 OverlayColor *src = _overlayBuffer; 288 289 do { 290 memcpy(buf, src, _screenWidth * sizeof(OverlayColor)); 291 src += _screenWidth; 292 buf += pitch; 293 } while (--h); 294 } 295 296 void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { 297 //printf("copyRectToOverlay(buf, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", pitch, x, y, w, h); 298 299 //Clip the coordinates 300 if (x < 0) { 301 w += x; 302 buf -= x; 303 x = 0; 304 } 305 306 if (y < 0) { 307 h += y; 308 buf -= y * pitch; 309 y = 0; 310 } 311 312 if (w > _screenWidth - x) { 313 w = _screenWidth - x; 314 } 315 316 if (h > _screenHeight - y) { 317 h = _screenHeight - y; 318 } 319 320 if (w <= 0 || h <= 0) 321 return; 322 323 324 OverlayColor *dst = _overlayBuffer + (y * _screenWidth + x); 325 if (_screenWidth == pitch && pitch == w) { 326 memcpy(dst, buf, h * w * sizeof(OverlayColor)); 327 } else { 328 do { 329 memcpy(dst, buf, w * sizeof(OverlayColor)); 330 buf += pitch; 331 dst += _screenWidth; 332 } while (--h); 333 } 334 } 335 336 int16 OSystem_IPHONE::getOverlayHeight() { 337 return _screenHeight; 338 } 339 340 int16 OSystem_IPHONE::getOverlayWidth() { 341 return _screenWidth; 342 } 343 344 OverlayColor OSystem_IPHONE::RGBToColor(uint8 r, uint8 g, uint8 b) 345 { 346 return (r & 0xF8) << 8 | (g & 0xFC) << 3 | (b >> 3); 347 } 348 349 void OSystem_IPHONE::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) 350 { 351 r = ((color & 0xF800) >> 11) << 3; 352 g = ((color & 0x07e0) >> 5) << 2; 353 b = (color & 0x001F) << 3; 354 } 355 356 bool OSystem_IPHONE::showMouse(bool visible) { 357 bool last = _mouseVisible; 358 _mouseVisible = visible; 359 return last; 360 } 361 362 void OSystem_IPHONE::warpMouse(int x, int y) { 363 //printf("warpMouse()\n"); 364 _mouseX = x; 365 _mouseY = y; 366 } 367 368 void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) { 369 //printf("setMouseCursor()\n"); 370 371 if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) { 372 free(_mouseBuf); 373 _mouseBuf = NULL; 374 } 375 376 if (_mouseBuf == NULL) { 377 _mouseBuf = (byte *)malloc(w * h); 378 } 379 380 _mouseWidth = w; 381 _mouseHeight = h; 382 383 _mouseHotspotX = hotspotX; 384 _mouseHotspotY = hotspotY; 385 386 _mouseKeyColour = keycolor; 387 388 memcpy(_mouseBuf, buf, w * h); 389 } 390 391 bool OSystem_IPHONE::pollEvent(Common::Event &event) { 392 //printf("pollEvent()\n"); 393 394 if (_queuedInputEvent.type != (Common::EventType)0) { 395 event = _queuedInputEvent; 396 _queuedInputEvent.type = (Common::EventType)0; 397 return true; 398 } 399 400 int eventType; 401 float xUnit, yUnit; 402 403 if (iPhone_fetchEvent(&eventType, &xUnit, &yUnit)) { 404 int x = (int)((1.0 - yUnit) * _screenWidth); 405 int y = (int)(xUnit * _screenHeight); 406 407 long curTime = getMillis(); 408 409 switch ((InputEvent)eventType) { 410 case kInputMouseDown: 411 //printf("Mouse down at (%u, %u)\n", x, y); 412 _lastMouseDown = curTime; 413 _mouseX = x; 414 _mouseY = y; 415 return false; 416 417 break; 418 case kInputMouseUp: 419 //printf("Mouse up at (%u, %u)\n", x, y); 420 421 if (curTime - _lastMouseDown < 250) { 422 event.type = Common::EVENT_LBUTTONDOWN; 423 event.mouse.x = _mouseX; 424 event.mouse.y = _mouseY; 425 426 _queuedInputEvent.type = Common::EVENT_LBUTTONUP; 427 _queuedInputEvent.mouse.x = _mouseX; 428 _queuedInputEvent.mouse.y = _mouseY; 429 _lastMouseTap = curTime; 430 431 // if (curTime - _lastMouseTap < 250 && !_overlayVisible) { 432 // event.type = Common::EVENT_KEYDOWN; 433 // _queuedInputEvent.type = Common::EVENT_KEYUP; 434 // 435 // event.kbd.flags = _queuedInputEvent.kbd.flags = 0; 436 // event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE; 437 // event.kbd.ascii = _queuedInputEvent.kbd.ascii = 27; 438 // 439 // _lastMouseTap = 0; 440 // } else { 441 // 442 // } 443 } else { 444 return false; 445 } 446 447 break; 448 case kInputMouseDragged: 449 //printf("Mouse dragged at (%u, %u)\n", x, y); 450 if (_secondaryTapped) { 451 int vecX = (x - _gestureStartX); 452 int vecY = (y - _gestureStartY); 453 int lengthSq = vecX * vecX + vecY * vecY; 454 //printf("Lengthsq: %u\n", lengthSq); 455 456 if (lengthSq > 5000) { // Long enough gesture to react upon. 457 _gestureStartX = x; 458 _gestureStartY = y; 459 460 float vecLength = sqrt(lengthSq); 461 float vecXNorm = vecX / vecLength; 462 float vecYNorm = vecY / vecLength; 463 464 //printf("Swipe vector: (%.2f, %.2f)\n", vecXNorm, vecYNorm); 465 466 if (vecXNorm > -0.50 && vecXNorm < 0.50 && vecYNorm > 0.75) { 467 // Swipe down 468 event.type = Common::EVENT_KEYDOWN; 469 _queuedInputEvent.type = Common::EVENT_KEYUP; 470 471 event.kbd.flags = _queuedInputEvent.kbd.flags = 0; 472 event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_F5; 473 event.kbd.ascii = _queuedInputEvent.kbd.ascii = 27; 474 } else if (vecXNorm > -0.50 && vecXNorm < 0.50 && vecYNorm < -0.75) { 475 // Swipe up 476 event.type = Common::EVENT_KEYDOWN; 477 _queuedInputEvent.type = Common::EVENT_KEYUP; 478 479 event.kbd.flags = _queuedInputEvent.kbd.flags = 0; 480 event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_1; 481 event.kbd.ascii = _queuedInputEvent.kbd.ascii = 27; 482 } else if (vecXNorm > 0.75 && vecYNorm > -0.5 && vecYNorm < 0.5) { 483 // Swipe right 484 return false; 485 } else if (vecXNorm < -0.75 && vecYNorm > -0.5 && vecYNorm < 0.5) { 486 // Swipe left 487 return false; 488 } else { 489 return false; 490 } 491 } else { 492 return false; 493 } 494 } else { 495 event.type = Common::EVENT_MOUSEMOVE; 496 event.mouse.x = x; 497 event.mouse.y = y; 498 _mouseX = x; 499 _mouseY = y; 500 } 501 break; 502 case kInputMouseSecondToggled: 503 _secondaryTapped = !_secondaryTapped; 504 //printf("Mouse second at (%u, %u). State now %s.\n", x, y, _secondaryTapped ? "on" : "off"); 505 if (_secondaryTapped) { 506 _lastSecondaryDown = curTime; 507 _gestureStartX = x; 508 _gestureStartY = y; 509 return false; 510 } else if (curTime - _lastSecondaryDown < 250 ) { 511 if (curTime - _lastSecondaryTap < 250 && !_overlayVisible) { 512 event.type = Common::EVENT_KEYDOWN; 513 _queuedInputEvent.type = Common::EVENT_KEYUP; 514 515 event.kbd.flags = _queuedInputEvent.kbd.flags = 0; 516 event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE; 517 event.kbd.ascii = _queuedInputEvent.kbd.ascii = 27; 518 519 _lastSecondaryTap = 0; 520 } else { 521 event.type = Common::EVENT_RBUTTONDOWN; 522 event.mouse.x = _mouseX; 523 event.mouse.y = _mouseY; 524 _queuedInputEvent.type = Common::EVENT_RBUTTONUP; 525 _queuedInputEvent.mouse.x = _mouseX; 526 _queuedInputEvent.mouse.y = _mouseY; 527 _lastSecondaryTap = curTime; 528 } 529 } else { 530 return false; 531 } 532 break; 533 default: 534 break; 535 } 536 537 return true; 538 } 539 return false; 540 } 541 542 uint32 OSystem_IPHONE::getMillis() { 543 //printf("getMillis()\n"); 544 545 struct timeval currentTime; 546 gettimeofday(¤tTime, NULL); 547 return (uint32)(((currentTime.tv_sec - _startTime.tv_sec) * 1000) + 548 ((currentTime.tv_usec - _startTime.tv_usec) / 1000)); 549 } 550 551 void OSystem_IPHONE::delayMillis(uint msecs) { 552 //printf("delayMillis(%d)\n", msecs); 553 usleep(msecs * 1000); 554 } 555 556 OSystem::MutexRef OSystem_IPHONE::createMutex(void) { 557 pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); 558 pthread_mutex_init(mutex, NULL); 559 return (MutexRef)mutex; 560 } 561 562 void OSystem_IPHONE::lockMutex(MutexRef mutex) { 563 pthread_mutex_lock((pthread_mutex_t *) mutex); 564 } 565 566 void OSystem_IPHONE::unlockMutex(MutexRef mutex) { 567 pthread_mutex_unlock((pthread_mutex_t *) mutex); 568 } 569 570 void OSystem_IPHONE::deleteMutex(MutexRef mutex) { 571 pthread_mutex_destroy((pthread_mutex_t *) mutex); 572 free(mutex); 573 } 574 575 bool OSystem_IPHONE::setSoundCallback(SoundProc proc, void *param) { 576 return true; 577 } 578 579 void OSystem_IPHONE::clearSoundCallback() { 580 } 581 582 int OSystem_IPHONE::getOutputSampleRate() const { 583 return 22050; 584 } 585 586 void OSystem_IPHONE::quit() { 587 //exit(0); 588 } 589 590 void OSystem_IPHONE::setWindowCaption(const char *caption) { 591 } 592 593 Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() { 594 assert(_savefile); 595 return _savefile; 596 } 597 598 Audio::Mixer *OSystem_IPHONE::getMixer() { 599 assert(_mixer); 600 return _mixer; 601 } 602 603 Common::TimerManager *OSystem_IPHONE::getTimerManager() { 604 assert(_timer); 605 return _timer; 606 } 607 608 OSystem *OSystem_IPHONE_create() { 609 return new OSystem_IPHONE(); 610 } 611 612 void iphone_main(int argc, char *argv[]) { 613 g_system = OSystem_IPHONE_create(); 614 assert(g_system); 615 616 // Invoke the actual ScummVM main entry point: 617 scummvm_main(argc, argv); 618 g_system->quit(); // TODO: Consider removing / replacing this! 619 } 620 621 #endif -
backends/platform/iphone/iphone_main.m
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * $URL$ 22 * $Id$ 23 * 24 */ 25 26 #import <UIKit/UIKit.h> 27 #import <Foundation/NSThread.h> 28 #include "iphone_video.h" 29 30 void iphone_main(int argc, char *argv[]); 31 32 @interface iPhoneMain : UIApplication { 33 UIWindow* _window; 34 iPhoneView* _view; 35 } 36 37 - (void) mainLoop: (id)param; 38 - (iPhoneView*) getView; 39 - (UIWindow*) getWindow; 40 @end 41 42 static int gArgc; 43 static char** gArgv; 44 45 int main(int argc, char** argv) { 46 gArgc = argc; 47 gArgv = argv; 48 49 [[NSAutoreleasePool alloc] init]; 50 51 return UIApplicationMain(argc, argv, [iPhoneMain class]); 52 } 53 54 @implementation iPhoneMain 55 56 -(id) init { 57 [super init]; 58 _window = nil; 59 _view = nil; 60 return self; 61 } 62 63 - (void) mainLoop: (id)param { 64 [[NSAutoreleasePool alloc] init]; 65 66 iphone_main(gArgc, gArgv); 67 [UIApp terminate]; 68 } 69 70 - (iPhoneView*) getView { 71 return _view; 72 } 73 74 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 75 // hide the status bar 76 [UIHardware _setStatusBarHeight:0.0f]; 77 [self setStatusBarMode:2 orientation:0 duration:0.0f fenceID:0]; 78 79 _window = [[UIWindow alloc] initWithContentRect: [UIHardware fullScreenApplicationContentRect]]; 80 [_window retain]; 81 82 _view = [[iPhoneView alloc] initWithFrame: [UIHardware fullScreenApplicationContentRect]]; 83 [_window setContentView: _view]; 84 85 [_window orderFront: self]; 86 [_window makeKey: self]; 87 88 [NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil]; 89 } 90 91 - (UIWindow*) getWindow { 92 return _window; 93 } 94 95 @end 96 -
backends/platform/iphone/iphone_video.m
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * $URL$ 22 * $Id$ 23 * 24 */ 25 26 #include "iphone_video.h" 27 #include "iphone_common.h" 28 29 #import <UIKit/UIKit.h> 30 #import <UIKit/UIView-Geometry.h> 31 #import <GraphicsServices/GraphicsServices.h> 32 #import <Foundation/Foundation.h> 33 #import <CoreSurface/CoreSurface.h> 34 #import <LayerKit/LKLayer.h> 35 36 static iPhoneView *sharedInstance = nil; 37 static int _width = 0; 38 static int _height = 0; 39 40 // static long lastTick = 0; 41 // static int frames = 0; 42 43 unsigned short* iPhone_getSurface() { 44 return CoreSurfaceBufferGetBaseAddress([sharedInstance getSurface]); 45 } 46 47 void iPhone_updateScreen() { 48 [sharedInstance performSelectorOnMainThread:@selector(updateScreen) withObject:nil waitUntilDone: NO]; 49 } 50 51 void iPhone_lockSurface() { 52 CoreSurfaceBufferLock([sharedInstance getSurface], 3); 53 } 54 55 void iPhone_unlockSurface() { 56 CoreSurfaceBufferUnlock([sharedInstance getSurface]); 57 } 58 59 void iPhone_initSurface(int width, int height) { 60 _width = width; 61 _height = height; 62 63 [sharedInstance performSelectorOnMainThread:@selector(initSurface) withObject:nil waitUntilDone: YES]; 64 } 65 66 bool iPhone_fetchEvent(int *outEvent, float *outX, float *outY) 67 { 68 id event = [sharedInstance getEvent]; 69 if (event == nil) { 70 return false; 71 } 72 73 id type = [event objectForKey:@"type"]; 74 75 if (type == nil) { 76 printf("fetchEvent says: No type!\n"); 77 return false; 78 } 79 80 *outEvent = [type intValue]; 81 *outX = [[event objectForKey:@"x"] floatValue]; 82 *outY = [[event objectForKey:@"y"] floatValue]; 83 return true; 84 } 85 86 @implementation iPhoneView 87 88 - (id)initWithFrame:(struct CGRect)frame { 89 [super initWithFrame: frame]; 90 91 _fullWidth = frame.size.width; 92 _fullHeight = frame.size.height; 93 94 sharedInstance = self; 95 96 return self; 97 } 98 99 -(void) dealloc { 100 [super dealloc]; 101 } 102 103 - (CoreSurfaceBufferRef)getSurface { 104 return _screenSurface; 105 } 106 107 - (void)drawRect:(CGRect)frame { 108 // if (lastTick == 0) { 109 // lastTick = time(0); 110 // } 111 // 112 // frames++; 113 // if (time(0) > lastTick) { 114 // lastTick = time(0); 115 // printf("FPS: %i\n", frames); 116 // frames = 0; 117 // } 118 } 119 120 - (void)updateScreen { 121 [sharedInstance setNeedsDisplay]; 122 } 123 124 - (void)initSurface { 125 //printf("Window: (%d, %d), Surface: (%d, %d)\n", _fullWidth, _fullHeight, _width, _height); 126 127 int pitch = _width * 2; 128 int allocSize = 2 * _width * _height; 129 char *pixelFormat = "565L"; 130 131 NSDictionary* dict = [[NSDictionary alloc] initWithObjectsAndKeys: 132 kCFBooleanTrue, kCoreSurfaceBufferGlobal, 133 @"PurpleGFXMem", kCoreSurfaceBufferMemoryRegion, 134 [NSNumber numberWithInt: pitch], kCoreSurfaceBufferPitch, 135 [NSNumber numberWithInt: _width], kCoreSurfaceBufferWidth, 136 [NSNumber numberWithInt: _height], kCoreSurfaceBufferHeight, 137 [NSNumber numberWithInt: *(int*)pixelFormat], kCoreSurfaceBufferPixelFormat, 138 [NSNumber numberWithInt: allocSize], kCoreSurfaceBufferAllocSize, 139 nil 140 ]; 141 142 //("Allocating surface: %d\n", allocSize); 143 _screenSurface = CoreSurfaceBufferCreate((CFDictionaryRef)dict); 144 //printf("Surface created.\n"); 145 CoreSurfaceBufferLock(_screenSurface, 3); 146 147 LKLayer* screenLayer = [[LKLayer layer] retain]; 148 149 float ratioDifference = ((float)_width / (float)_height) / ((float)_fullWidth / (float)_fullHeight); 150 int rectWidth, rectHeight; 151 if (ratioDifference < 1.0f) { 152 rectWidth = _fullWidth * ratioDifference; 153 rectHeight = _fullHeight; 154 _widthOffset = (_fullWidth - rectWidth)/2; 155 _heightOffset = 0; 156 } else { 157 rectWidth = _fullWidth; 158 rectHeight = _fullHeight / ratioDifference; 159 _heightOffset = (_fullHeight - rectHeight)/2; 160 _widthOffset = 0; 161 } 162 163 //printf("Rect: %i, %i, %i, %i\n", _widthOffset, _heightOffset, rectWidth + _widthOffset, rectHeight + _heightOffset); 164 [screenLayer setFrame: CGRectMake(_widthOffset, _heightOffset, rectWidth + _widthOffset, rectHeight + _heightOffset)]; 165 166 [screenLayer setContents: _screenSurface]; 167 [screenLayer setOpaque: YES]; 168 [[sharedInstance _layer] addSublayer: screenLayer]; 169 170 CoreSurfaceBufferUnlock(_screenSurface); 171 [dict release]; 172 } 173 174 175 - (void)lock 176 { 177 [_lock lock]; 178 } 179 180 - (void)unlock 181 { 182 [_lock unlock]; 183 } 184 185 - (id)getEvent 186 { 187 if (_events == nil || [_events count] == 0) { 188 return nil; 189 } 190 191 [self lock]; 192 193 id event = [_events objectAtIndex: 0]; 194 if (event == nil) { 195 return nil; 196 } 197 198 [_events removeObjectAtIndex: 0]; 199 [self unlock]; 200 201 return event; 202 } 203 204 - (void)addEvent:(NSDictionary*)event 205 { 206 [self lock]; 207 208 if(_events == nil) 209 _events = [[NSMutableArray alloc] init]; 210 211 [_events addObject: event]; 212 213 [self unlock]; 214 } 215 216 - (void)mouseDown:(GSEvent*)event 217 { 218 struct CGPoint point = GSEventGetLocationInWindow(event); 219 220 [self addEvent: 221 [[NSDictionary alloc] initWithObjectsAndKeys: 222 [NSNumber numberWithInt:kInputMouseDown], @"type", 223 [NSNumber numberWithFloat:(point.x/_fullWidth)], @"x", 224 [NSNumber numberWithFloat:(point.y/_fullHeight)], @"y", 225 nil 226 ] 227 ]; 228 } 229 230 - (void)mouseUp:(GSEvent*)event 231 { 232 struct CGPoint point = GSEventGetLocationInWindow(event); 233 [self addEvent: 234 [[NSDictionary alloc] initWithObjectsAndKeys: 235 [NSNumber numberWithInt:kInputMouseUp], @"type", 236 [NSNumber numberWithFloat:(point.x/_fullWidth)], @"x", 237 [NSNumber numberWithFloat:(point.y/_fullHeight)], @"y", 238 nil 239 ] 240 ]; 241 } 242 243 - (void)mouseDragged:(GSEvent*)event 244 { 245 struct CGPoint point = GSEventGetLocationInWindow(event); 246 [self addEvent: 247 [[NSDictionary alloc] initWithObjectsAndKeys: 248 [NSNumber numberWithInt:kInputMouseDragged], @"type", 249 [NSNumber numberWithFloat:(point.x/_fullWidth)], @"x", 250 [NSNumber numberWithFloat:(point.y/_fullHeight)], @"y", 251 nil 252 ] 253 ]; 254 } 255 256 - (void)mouseEntered:(GSEvent*)event 257 { 258 //printf("mouseEntered()\n"); 259 // struct CGPoint point = GSEventGetLocationInWindow(event); 260 // [self addEvent: 261 // [[NSDictionary alloc] initWithObjectsAndKeys: 262 // [NSNumber numberWithInt:kInputMouseSecondStartDrag], @"type", 263 // [NSNumber numberWithFloat:(point.x/_fullWidth)], @"x", 264 // [NSNumber numberWithFloat:(point.y/_fullHeight)], @"y", 265 // nil 266 // ] 267 // ]; 268 } 269 270 - (void)mouseExited:(GSEvent*)event 271 { 272 //printf("mouseExited().\n"); 273 // [self addEvent: 274 // [[NSDictionary alloc] initWithObjectsAndKeys: 275 // @"mouseExited", @"type", 276 // nil 277 // ] 278 // ]; 279 } 280 281 - (void)mouseMoved:(GSEvent*)event 282 { 283 //printf("mouseMoved()\n"); 284 struct CGPoint point = GSEventGetLocationInWindow(event); 285 [self addEvent: 286 [[NSDictionary alloc] initWithObjectsAndKeys: 287 [NSNumber numberWithInt:kInputMouseSecondToggled], @"type", 288 [NSNumber numberWithFloat:(point.x/_fullWidth)], @"x", 289 [NSNumber numberWithFloat:(point.y/_fullHeight)], @"y", 290 nil 291 ] 292 ]; 293 } 294 295 - (void)keyDown:(GSEvent*)event 296 { 297 printf("keyDown()\n"); 298 [self addEvent: 299 [[NSDictionary alloc] initWithObjectsAndKeys: 300 @"keyDown", @"type", 301 nil 302 ] 303 ]; 304 } 305 306 - (void)keyUp:(GSEvent*)event 307 { 308 printf("keyUp()\n"); 309 [self addEvent: 310 [[NSDictionary alloc] initWithObjectsAndKeys: 311 @"keyUp", @"type", 312 nil 313 ] 314 ]; 315 } 316 317 @end 318 -
backends/platform/iphone/osys_iphone.h
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * $URL$ 22 * $Id$ 23 * 24 */ 25 26 #ifdef IPHONE_BACKEND 27 28 #include "graphics/surface.h" 29 30 class OSystem_IPHONE : public OSystem { 31 protected: 32 static const OSystem::GraphicsMode s_supportedGraphicsModes[]; 33 34 Common::SaveFileManager *_savefile; 35 Audio::Mixer *_mixer; 36 Common::TimerManager *_timer; 37 38 Graphics::Surface _framebuffer; 39 byte *_offscreen; 40 OverlayColor *_overlayBuffer; 41 uint16 *_fullscreen; 42 43 uint16 _palette[256]; 44 bool _overlayVisible; 45 uint16 _screenWidth; 46 uint16 _screenHeight; 47 48 struct timeval _startTime; 49 50 bool _mouseVisible; 51 byte *_mouseBuf; 52 byte _mouseKeyColour; 53 uint _mouseWidth, _mouseHeight; 54 int _mouseX, _mouseY; 55 int _mouseHotspotX, _mouseHotspotY; 56 long _lastMouseDown; 57 long _lastMouseTap; 58 Common::Event _queuedInputEvent; 59 bool _secondaryTapped; 60 long _lastSecondaryDown; 61 long _lastSecondaryTap; 62 int _gestureStartX, _gestureStartY; 63 64 public: 65 66 OSystem_IPHONE(); 67 virtual ~OSystem_IPHONE(); 68 69 virtual void initBackend(); 70 71 virtual bool hasFeature(Feature f); 72 virtual void setFeatureState(Feature f, bool enable); 73 virtual bool getFeatureState(Feature f); 74 virtual const GraphicsMode *getSupportedGraphicsModes() const; 75 virtual int getDefaultGraphicsMode() const; 76 bool setGraphicsMode(const char *name); 77 virtual bool setGraphicsMode(int mode); 78 virtual int getGraphicsMode() const; 79 virtual void initSize(uint width, uint height); 80 virtual int16 getHeight(); 81 virtual int16 getWidth(); 82 virtual void setPalette(const byte *colors, uint start, uint num); 83 virtual void grabPalette(byte *colors, uint start, uint num); 84 virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); 85 virtual void updateScreen(); 86 virtual Graphics::Surface *lockScreen(); 87 virtual void unlockScreen(); 88 virtual void setShakePos(int shakeOffset); 89 90 virtual void showOverlay(); 91 virtual void hideOverlay(); 92 virtual void clearOverlay(); 93 virtual void grabOverlay(OverlayColor *buf, int pitch); 94 virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); 95 virtual int16 getOverlayHeight(); 96 virtual int16 getOverlayWidth(); 97 98 virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b); 99 virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b); 100 101 virtual bool showMouse(bool visible); 102 103 virtual void warpMouse(int x, int y); 104 virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1); 105 106 virtual bool pollEvent(Common::Event &event); 107 virtual uint32 getMillis(); 108 virtual void delayMillis(uint msecs); 109 110 virtual MutexRef createMutex(void); 111 virtual void lockMutex(MutexRef mutex); 112 virtual void unlockMutex(MutexRef mutex); 113 virtual void deleteMutex(MutexRef mutex); 114 115 typedef void (*SoundProc)(void *param, byte *buf, int len); 116 virtual bool setSoundCallback(SoundProc proc, void *param); 117 virtual void clearSoundCallback(); 118 virtual int getOutputSampleRate() const; 119 120 virtual void quit(); 121 122 virtual void setWindowCaption(const char *caption); 123 124 virtual Common::SaveFileManager *getSavefileManager(); 125 virtual Audio::Mixer *getMixer(); 126 virtual Common::TimerManager *getTimerManager(); 127 }; 128 129 #endif -
backends/platform/iphone/module.mk
1 MODULE := backends/platform/iphone 2 3 MODULE_OBJS := \ 4 osys_iphone.o \ 5 iphone_main.o \ 6 iphone_video.o 7 8 MODULE_DIRS += \ 9 backends/platform/iphone/ 10 11 # We don't use the rules.mk here on purpose 12 OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) -
backends/platform/iphone/iphone_video.h
1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * $URL$ 22 * $Id$ 23 * 24 */ 25 26 #ifndef _IPHONE_VIDEO__H 27 #define _IPHONE_VIDEO__H 28 29 #import <UIKit/UIKit.h> 30 #import <UIKit/UIView-Geometry.h> 31 #import <GraphicsServices/GraphicsServices.h> 32 #import <Foundation/Foundation.h> 33 #import <CoreSurface/CoreSurface.h> 34 #import <LayerKit/LKLayer.h> 35 36 37 @interface iPhoneView : UIView 38 { 39 CoreSurfaceBufferRef _screenSurface; 40 NSMutableArray* _events; 41 NSLock* _lock; 42 int _fullWidth; 43 int _fullHeight; 44 int _widthOffset; 45 int _heightOffset; 46 } 47 48 - (id)initWithFrame:(struct CGRect)frame; 49 50 - (void)drawRect:(CGRect)frame; 51 52 - (CoreSurfaceBufferRef)getSurface; 53 54 - (void)initSurface; 55 56 - (void)updateScreen; 57 58 - (id)getEvent; 59 @end 60 61 #endif /* _IPHONE_VIDEO__H */ -
base/commandLine.cpp
214 214 // Register default savepath 215 215 #ifdef DEFAULT_SAVE_PATH 216 216 char savePath[MAXPATHLEN]; 217 #if def UNIX217 #if defined(UNIX) && !defined(IPHONE) 218 218 const char *home = getenv("HOME"); 219 219 if (home && *home && strlen(home) < MAXPATHLEN) { 220 220 snprintf(savePath, MAXPATHLEN, "%s/%s", home, DEFAULT_SAVE_PATH); … … 224 224 strcpy(savePath, Symbian::GetExecutablePath()); 225 225 strcat(savePath, DEFAULT_SAVE_PATH); 226 226 ConfMan.registerDefault("savepath", savePath); 227 #elif defined (IPHONE) // The iphone has / set as home dir when launching from the Springboard. 228 strcpy(savePath, "/var/root/"); 229 strcat(savePath, DEFAULT_SAVE_PATH); 230 ConfMan.registerDefault("savepath", savePath); 227 231 #endif 228 232 #endif // #ifdef DEFAULT_SAVE_PATH 229 233 … … 527 531 DO_LONG_OPTION("record-time-file-name") 528 532 END_OPTION 529 533 534 #ifdef IPHONE 535 // This is automatically set when launched from the Springboard. 536 DO_LONG_OPTION_OPT("launchedFromSB", 0) 537 END_OPTION 538 #endif 530 539 531 540 unknownOption: 541 532 542 // If we get till here, the option is unhandled and hence unknown. 533 543 usage("Unrecognized option '%s'", argv[i]); 534 544 } … … 679 689 #endif 680 690 681 691 692 682 693 // If a target was specified, check whether there is either a game 683 694 // domain (i.e. a target) matching this argument, or alternatively 684 695 // whether there is a gameid matching that name. -
Makefile
103 103 $(srcdir)/tools/credits.pl --rtf > $(bundle_name)/Contents/Resources/Credits.rtf 104 104 strip $(bundle_name)/Contents/MacOS/scummvm 105 105 106 iphonebundle: 107 mkdir -p $(bundle_name) 108 cp $(srcdir)/dists/iphone/Info.plist $(bundle_name)/ 109 cp $(srcdir)/gui/themes/modern.ini $(bundle_name)/ 110 cp $(srcdir)/gui/themes/modern.zip $(bundle_name)/ 111 cp scummvm $(bundle_name)/ScummVM 112 cp backends/platform/gp2x/build/scummvm.png $(bundle_name)/icon.png 113 cp backends/platform/psp/icon0.png $(bundle_name)/Default.png 114 106 115 # location of additional libs for OS X usually /sw/ for fink or 107 116 # /opt/local/ for darwinports 108 117 OSXOPT=/sw