Ticket #8926: sdl_transaction_rollback_v2.patch
File sdl_transaction_rollback_v2.patch, 37.2 KB (added by , 16 years ago) |
---|
-
backends/platform/sdl/graphics.cpp
49 49 }; 50 50 51 51 // Table of relative scalers magnitudes 52 // [definedScale - 1][ _scaleFactor - 1]52 // [definedScale - 1][scaleFactor - 1] 53 53 static ScalerProc *scalersMagn[3][3] = { 54 54 #ifndef DISABLE_SCALERS 55 55 { Normal1x, AdvMame2x, AdvMame3x }, … … 86 86 } 87 87 88 88 void OSystem_SDL::beginGFXTransaction(void) { 89 assert 89 assert(_transactionMode == kTransactionNone); 90 90 91 91 _transactionMode = kTransactionActive; 92 92 93 _transactionDetails.modeChanged = false;94 93 _transactionDetails.sizeChanged = false; 95 _transactionDetails.arChanged = false;96 _transactionDetails.fsChanged = false;97 94 98 95 _transactionDetails.needHotswap = false; 99 96 _transactionDetails.needUpdatescreen = false; 100 _transactionDetails.needUnload = false;101 97 102 98 _transactionDetails.normal1xScaler = false; 99 100 _oldVideoMode = _videoMode; 103 101 } 104 102 105 103 void OSystem_SDL::endGFXTransaction(void) { 104 assert(_transactionMode != kTransactionNone); 105 106 if (_transactionMode == kTransactionRollback) { 107 _videoMode = _oldVideoMode; 108 109 // Since loadGFXMode relies on _oldVideoMode.setup to be true 110 // if there was a mode setup before, we clear it so if resetting 111 // to the old video mode does not start a endless reset loop 112 // instead of erroring out 113 _oldVideoMode.setup = false; 114 } 115 106 116 // for each engine we run initCommonGFX() as first thing in the transaction 107 117 // and initSize() is called later. If user runs launcher at 320x200 with 108 // 2x overlay, setting to No mral1x sclaler in that case will be suppressed118 // 2x overlay, setting to Normal1x scaler in that case will be suppressed 109 119 // and backend is forced to 2x 110 120 // 111 121 // This leads to bad results such as 1280x960 window for 640x480 engines. 112 122 // To prevent that we rerun setGraphicsMode() if there was 1x scaler request 113 if (_transaction Details.normal1xScaler)123 if (_transactionMode != kTransactionRollback && _transactionDetails.normal1xScaler) 114 124 setGraphicsMode(GFX_NORMAL); 115 125 116 assert (_transactionMode == kTransactionActive); 117 118 _transactionMode = kTransactionCommit; 119 if (_transactionDetails.modeChanged) 120 setGraphicsMode(_transactionDetails.mode); 121 122 if (_transactionDetails.sizeChanged) 123 initSize(_transactionDetails.w, _transactionDetails.h); 124 125 if (_transactionDetails.arChanged) 126 setAspectRatioCorrection(_transactionDetails.ar); 127 128 if (_transactionDetails.needUnload) { 126 if (_transactionDetails.sizeChanged) { 129 127 unloadGFXMode(); 130 128 loadGFXMode(); 129 setGraphicsModeIntern(); 131 130 clearOverlay(); 132 } else {133 if (!_transactionDetails.fsChanged) {134 if (_transactionDetails.needHotswap)135 hotswapGFXMode();136 else if (_transactionDetails.needUpdatescreen)137 internUpdateScreen();138 }139 }140 131 141 if (_transactionDetails.fsChanged) 142 setFullscreenMode(_transactionDetails.fs); 132 _videoMode.setup = true; 133 _modeChanged = true; 134 } else if (_transactionDetails.needHotswap) { 135 setGraphicsModeIntern(); 136 hotswapGFXMode(); 143 137 138 _videoMode.setup = true; 139 _modeChanged = true; 140 141 if (_transactionDetails.needUpdatescreen) 142 internUpdateScreen(); 143 } 144 144 145 _transactionMode = kTransactionNone; 146 147 // TODO: endGFXTransaction should indicate error/success 145 148 } 146 149 147 150 bool OSystem_SDL::setGraphicsMode(int mode) { 148 151 Common::StackLock lock(_graphicsMutex); 149 152 153 assert(_transactionMode == kTransactionActive); 154 155 if (_oldVideoMode.setup && _oldVideoMode.mode == mode) 156 return true; 157 150 158 int newScaleFactor = 1; 151 ScalerProc *newScalerProc;152 159 153 160 switch(mode) { 154 161 case GFX_NORMAL: 155 162 newScaleFactor = 1; 156 newScalerProc = Normal1x;157 163 break; 158 164 #ifndef DISABLE_SCALERS 159 165 case GFX_DOUBLESIZE: 160 166 newScaleFactor = 2; 161 newScalerProc = Normal2x;162 167 break; 163 168 case GFX_TRIPLESIZE: 164 169 newScaleFactor = 3; 165 newScalerProc = Normal3x;166 170 break; 167 171 168 172 case GFX_2XSAI: 169 173 newScaleFactor = 2; 170 newScalerProc = _2xSaI;171 174 break; 172 175 case GFX_SUPER2XSAI: 173 176 newScaleFactor = 2; 174 newScalerProc = Super2xSaI;175 177 break; 176 178 case GFX_SUPEREAGLE: 177 179 newScaleFactor = 2; 178 newScalerProc = SuperEagle;179 180 break; 180 181 case GFX_ADVMAME2X: 181 182 newScaleFactor = 2; 182 newScalerProc = AdvMame2x;183 183 break; 184 184 case GFX_ADVMAME3X: 185 185 newScaleFactor = 3; 186 newScalerProc = AdvMame3x;187 186 break; 188 187 #ifndef DISABLE_HQ_SCALERS 189 188 case GFX_HQ2X: 190 189 newScaleFactor = 2; 191 newScalerProc = HQ2x;192 190 break; 193 191 case GFX_HQ3X: 194 192 newScaleFactor = 3; 195 newScalerProc = HQ3x;196 193 break; 197 194 #endif 198 195 case GFX_TV2X: 199 196 newScaleFactor = 2; 200 newScalerProc = TV2x;201 197 break; 202 198 case GFX_DOTMATRIX: 203 199 newScaleFactor = 2; 204 newScalerProc = DotMatrix;205 200 break; 206 201 #endif // DISABLE_SCALERS 207 202 … … 211 206 } 212 207 213 208 _transactionDetails.normal1xScaler = (mode == GFX_NORMAL); 209 if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor) 210 _transactionDetails.needHotswap = true; 214 211 215 _mode = mode; 216 _scalerProc = newScalerProc; 212 _transactionDetails.needUpdatescreen = true; 217 213 218 if (_transactionMode == kTransactionActive) { 219 _transactionDetails.mode = mode; 220 _transactionDetails.modeChanged = true; 214 _videoMode.mode = mode; 215 _videoMode.scaleFactor = newScaleFactor; 221 216 222 if (newScaleFactor != _scaleFactor) { 223 _transactionDetails.needHotswap = true; 224 _scaleFactor = newScaleFactor; 225 } 217 return true; 218 } 226 219 227 _transactionDetails.needUpdatescreen = true; 220 void OSystem_SDL::setGraphicsModeIntern() { 221 Common::StackLock lock(_graphicsMutex); 222 ScalerProc *newScalerProc = 0; 228 223 229 return true; 230 } 224 switch (_videoMode.mode) { 225 case GFX_NORMAL: 226 newScalerProc = Normal1x; 227 break; 228 #ifndef DISABLE_SCALERS 229 case GFX_DOUBLESIZE: 230 newScalerProc = Normal2x; 231 break; 232 case GFX_TRIPLESIZE: 233 newScalerProc = Normal3x; 234 break; 231 235 232 // NOTE: This should not be executed at transaction commit 233 // Otherwise there is some unsolicited setGraphicsMode() call 234 // which should be properly removed 235 if (newScaleFactor != _scaleFactor) { 236 assert(_transactionMode != kTransactionCommit); 236 case GFX_2XSAI: 237 newScalerProc = _2xSaI; 238 break; 239 case GFX_SUPER2XSAI: 240 newScalerProc = Super2xSaI; 241 break; 242 case GFX_SUPEREAGLE: 243 newScalerProc = SuperEagle; 244 break; 245 case GFX_ADVMAME2X: 246 newScalerProc = AdvMame2x; 247 break; 248 case GFX_ADVMAME3X: 249 newScalerProc = AdvMame3x; 250 break; 251 #ifndef DISABLE_HQ_SCALERS 252 case GFX_HQ2X: 253 newScalerProc = HQ2x; 254 break; 255 case GFX_HQ3X: 256 newScalerProc = HQ3x; 257 break; 258 #endif 259 case GFX_TV2X: 260 newScalerProc = TV2x; 261 break; 262 case GFX_DOTMATRIX: 263 newScalerProc = DotMatrix; 264 break; 265 #endif // DISABLE_SCALERS 237 266 238 _scaleFactor = newScaleFactor;239 hotswapGFXMode();267 default: 268 error("Unknown gfx mode %d", _videoMode.mode); 240 269 } 241 270 242 // Determine the "scaler type", i.e. essentially an index into the243 // s_gfxModeSwitchTable array defined in events.cpp.244 if (_ mode != GFX_NORMAL) {271 _scalerProc = newScalerProc; 272 273 if (_videoMode.mode != GFX_NORMAL) { 245 274 for (int i = 0; i < ARRAYSIZE(s_gfxModeSwitchTable); i++) { 246 if (s_gfxModeSwitchTable[i][1] == _ mode || s_gfxModeSwitchTable[i][2] == _mode) {275 if (s_gfxModeSwitchTable[i][1] == _videoMode.mode || s_gfxModeSwitchTable[i][2] == _videoMode.mode) { 247 276 _scalerType = i; 248 277 break; 249 278 } 250 279 } 251 280 } 252 281 253 if (!_screen )254 return true;282 if (!_screen || !_hwscreen) 283 return; 255 284 256 285 // Blit everything to the screen 257 286 _forceFull = true; … … 259 288 // Even if the old and new scale factors are the same, we may have a 260 289 // different scaler for the cursor now. 261 290 blitCursor(); 262 263 if (_transactionMode != kTransactionCommit)264 internUpdateScreen();265 266 // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later267 _modeChanged = true;268 269 return true;270 291 } 271 292 272 293 int OSystem_SDL::getGraphicsMode() const { 273 294 assert (_transactionMode == kTransactionNone); 274 return _ mode;295 return _videoMode.mode; 275 296 } 276 297 277 298 void OSystem_SDL::initSize(uint w, uint h) { 299 assert(_transactionMode == kTransactionActive); 300 278 301 // Avoid redundant res changes 279 if ((int)w == _screenWidth && (int)h == _screenHeight && 280 _transactionMode != kTransactionCommit) 302 if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight) 281 303 return; 282 304 283 _ screenWidth = w;284 _ screenHeight = h;305 _videoMode.screenWidth = w; 306 _videoMode.screenHeight = h; 285 307 286 _cksumNum = ( _screenWidth * _screenHeight/ (8 * 8));308 _cksumNum = (w * h / (8 * 8)); 287 309 288 if (_transactionMode == kTransactionActive) { 289 _transactionDetails.w = w; 290 _transactionDetails.h = h; 291 _transactionDetails.sizeChanged = true; 310 _transactionDetails.sizeChanged = true; 292 311 293 _transactionDetails.needUnload = true;294 295 return;296 }297 298 312 free(_dirtyChecksums); 299 313 _dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32)); 300 301 if (_transactionMode != kTransactionCommit) {302 unloadGFXMode();303 loadGFXMode();304 305 // if initSize() gets called in the middle, overlay is not transparent306 clearOverlay();307 }308 314 } 309 315 310 voidOSystem_SDL::loadGFXMode() {316 bool OSystem_SDL::loadGFXMode() { 311 317 assert(_inited); 312 318 _forceFull = true; 313 319 314 320 int hwW, hwH; 315 321 316 322 #ifndef __MAEMO__ 317 _ overlayWidth = _screenWidth * _scaleFactor;318 _ overlayHeight = _screenHeight * _scaleFactor;323 _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; 324 _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; 319 325 320 if (_ screenHeight != 200 && _screenHeight != 400)321 _ adjustAspectRatio = false;326 if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) 327 _videoMode.aspectRatio = false; 322 328 323 if (_ adjustAspectRatio)324 _ overlayHeight = real2Aspect(_overlayHeight);329 if (_videoMode.aspectRatio) 330 _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); 325 331 326 hwW = _ screenWidth * _scaleFactor;332 hwW = _videoMode.screenWidth * _videoMode.scaleFactor; 327 333 hwH = effectiveScreenHeight(); 328 334 #else 329 hwW = _ overlayWidth;330 hwH = _ overlayHeight;335 hwW = _videoMode.overlayWidth; 336 hwH = _videoMode.overlayHeight; 331 337 #endif 332 338 333 339 // 334 340 // Create the surface that contains the 8 bit game data 335 341 // 336 _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _ screenWidth, _screenHeight, 8, 0, 0, 0, 0);342 _screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth, _videoMode.screenHeight, 8, 0, 0, 0, 0); 337 343 if (_screen == NULL) 338 344 error("allocating _screen failed"); 339 345 … … 342 348 // 343 349 344 350 _hwscreen = SDL_SetVideoMode(hwW, hwH, 16, 345 _ fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE351 _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE 346 352 ); 347 353 if (_hwscreen == NULL) { 348 354 // DON'T use error(), as this tries to bring up the debug 349 355 // console, which WON'T WORK now that _hwscreen is hosed. 350 356 351 // FIXME: We should be able to continue the game without 352 // shutting down or bringing up the debug console, but at 353 // this point we've already screwed up all our member vars. 354 // We need to find a way to call SDL_SetVideoMode *before* 355 // that happens and revert to all the old settings if we 356 // can't pull off the switch to the new settings. 357 // 358 // Fingolfin says: the "easy" way to do that is not to modify 359 // the member vars before we are sure everything is fine. Think 360 // of "transactions, commit, rollback" style... we use local vars 361 // in place of the member vars, do everything etc. etc.. In case 362 // of a failure, rollback is trivial. Only if everything worked fine 363 // do we "commit" the changed values to the member vars. 364 warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError()); 365 quit(); 357 if (!_oldVideoMode.setup) { 358 warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError()); 359 quit(); 360 } else { 361 return false; 362 } 366 363 } 367 364 368 365 // … … 376 373 InitScalers(565); 377 374 378 375 // Need some extra bytes around when using 2xSaI 379 _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _ screenWidth + 3, _screenHeight + 3,376 _tmpscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.screenWidth + 3, _videoMode.screenHeight + 3, 380 377 16, 381 378 _hwscreen->format->Rmask, 382 379 _hwscreen->format->Gmask, … … 386 383 if (_tmpscreen == NULL) 387 384 error("allocating _tmpscreen failed"); 388 385 389 _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _ overlayWidth, _overlayHeight,386 _overlayscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth, _videoMode.overlayHeight, 390 387 16, 391 388 _hwscreen->format->Rmask, 392 389 _hwscreen->format->Gmask, … … 396 393 if (_overlayscreen == NULL) 397 394 error("allocating _overlayscreen failed"); 398 395 399 _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _ overlayWidth + 3, _overlayHeight + 3,396 _tmpscreen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, _videoMode.overlayWidth + 3, _videoMode.overlayHeight + 3, 400 397 16, 401 398 _hwscreen->format->Rmask, 402 399 _hwscreen->format->Gmask, … … 421 418 #endif 422 419 423 420 // keyboard cursor control, some other better place for it? 424 _km.x_max = _ screenWidth * _scaleFactor - 1;421 _km.x_max = _videoMode.screenWidth * _videoMode.scaleFactor - 1; 425 422 _km.y_max = effectiveScreenHeight() - 1; 426 423 _km.delay_time = 25; 427 424 _km.last_time = 0; 425 426 return true; 428 427 } 429 428 430 429 void OSystem_SDL::unloadGFXMode() { … … 470 469 // after the mode switch. 471 470 SDL_Surface *old_screen = _screen; 472 471 SDL_Surface *old_overlayscreen = _overlayscreen; 472 _screen = NULL; 473 _overlayscreen = NULL; 473 474 474 475 // Release the HW screen surface 475 SDL_FreeSurface(_hwscreen); 476 SDL_FreeSurface(_hwscreen); _hwscreen = NULL; 476 477 477 SDL_FreeSurface(_tmpscreen); 478 SDL_FreeSurface(_tmpscreen2); 478 SDL_FreeSurface(_tmpscreen); _tmpscreen = NULL; 479 SDL_FreeSurface(_tmpscreen2); _tmpscreen2 = NULL; 479 480 480 481 #ifdef USE_OSD 481 482 // Release the OSD surface 482 SDL_FreeSurface(_osdSurface); 483 SDL_FreeSurface(_osdSurface); _osdSurface = NULL; 483 484 #endif 484 485 485 486 // Setup the new GFX mode 486 loadGFXMode(); 487 if (!loadGFXMode()) { 488 unloadGFXMode(); 487 489 490 _screen = old_screen; 491 _overlayscreen = old_overlayscreen; 492 493 _transactionMode = kTransactionRollback; 494 // TODO: endGFXTransaction should indicate error/success which we should rather 495 // return to caller instead of doing this 496 endGFXTransaction(); 497 return; 498 } 499 488 500 // reset palette 489 501 SDL_SetColors(_screen, _currentPalette, 0, 256); 490 502 … … 501 513 502 514 // Blit everything to the screen 503 515 internUpdateScreen(); 504 505 // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later506 _modeChanged = true;507 516 } 508 517 509 518 void OSystem_SDL::updateScreen() { … … 527 536 528 537 // If the shake position changed, fill the dirty area with blackness 529 538 if (_currentShakePos != _newShakePos) { 530 SDL_Rect blackrect = {0, 0, _ screenWidth * _scaleFactor, _newShakePos * _scaleFactor};539 SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor}; 531 540 532 if (_ adjustAspectRatio && !_overlayVisible)541 if (_videoMode.aspectRatio && !_overlayVisible) 533 542 blackrect.h = real2Aspect(blackrect.h - 1) + 1; 534 543 535 544 SDL_FillRect(_hwscreen, &blackrect, 0); … … 574 583 if (!_overlayVisible) { 575 584 origSurf = _screen; 576 585 srcSurf = _tmpscreen; 577 width = _ screenWidth;578 height = _ screenHeight;586 width = _videoMode.screenWidth; 587 height = _videoMode.screenHeight; 579 588 scalerProc = _scalerProc; 580 scale1 = _ scaleFactor;589 scale1 = _videoMode.scaleFactor; 581 590 } else { 582 591 origSurf = _overlayscreen; 583 592 srcSurf = _tmpscreen2; 584 width = _ overlayWidth;585 height = _ overlayHeight;593 width = _videoMode.overlayWidth; 594 height = _videoMode.overlayHeight; 586 595 scalerProc = Normal1x; 587 596 588 597 scale1 = 1; … … 635 644 orig_dst_y = dst_y; 636 645 dst_y = dst_y * scale1; 637 646 638 if (_ adjustAspectRatio && !_overlayVisible)647 if (_videoMode.aspectRatio && !_overlayVisible) 639 648 dst_y = real2Aspect(dst_y); 640 649 641 650 assert(scalerProc != NULL); … … 649 658 r->h = dst_h * scale1; 650 659 651 660 #ifndef DISABLE_SCALERS 652 if (_ adjustAspectRatio && orig_dst_y < height && !_overlayVisible)661 if (_videoMode.aspectRatio && orig_dst_y < height && !_overlayVisible) 653 662 r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1); 654 663 #endif 655 664 } … … 692 701 void OSystem_SDL::setFullscreenMode(bool enable) { 693 702 Common::StackLock lock(_graphicsMutex); 694 703 695 if (_ fullscreen == enable)704 if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable) 696 705 return; 697 706 698 if (_transactionMode == kTransactionCommit) { 699 assert(_hwscreen != 0); 700 _fullscreen = enable; 701 702 // Switch between fullscreen and windowed mode by invoking hotswapGFXMode(). 703 // We used to use SDL_WM_ToggleFullScreen() in the past, but this caused various 704 // problems. E.g. on OS X, it was implemented incorrectly for a long time; on 705 // the MAEMO platform, it seems to have caused problems, too. 706 // And on Linux, there were some troubles, too (see bug #1705410). 707 // So, we just do it "manually" now. There shouldn't be any drawbacks to that 708 // anyway. 709 hotswapGFXMode(); 710 } else if (_transactionMode == kTransactionActive) { 711 _transactionDetails.fs = enable; 712 _transactionDetails.fsChanged = true; 713 707 if (_transactionMode == kTransactionActive) { 708 _videoMode.fullscreen = enable; 714 709 _transactionDetails.needHotswap = true; 715 710 } 716 711 } 717 712 718 713 void OSystem_SDL::setAspectRatioCorrection(bool enable) { 719 if (((_screenHeight == 200 || _screenHeight == 400) && _adjustAspectRatio != enable) || 720 _transactionMode == kTransactionCommit) { 721 Common::StackLock lock(_graphicsMutex); 714 Common::StackLock lock(_graphicsMutex); 722 715 723 //assert(_hwscreen != 0);724 _adjustAspectRatio = enable;716 if (_oldVideoMode.setup && _oldVideoMode.aspectRatio == enable) 717 return; 725 718 726 if (_transactionMode == kTransactionActive) { 727 _transactionDetails.ar = enable; 728 _transactionDetails.arChanged = true; 729 730 _transactionDetails.needHotswap = true; 731 732 return; 733 } else { 734 if (_transactionMode != kTransactionCommit) 735 hotswapGFXMode(); 736 } 737 738 // Make sure that an Common::EVENT_SCREEN_CHANGED gets sent later 739 _modeChanged = true; 719 if (_transactionMode == kTransactionActive) { 720 _videoMode.aspectRatio = enable; 721 _transactionDetails.needHotswap = true; 740 722 } 741 723 } 742 724 … … 751 733 752 734 Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends 753 735 754 assert(x >= 0 && x < _ screenWidth);755 assert(y >= 0 && y < _ screenHeight);756 assert(h > 0 && y + h <= _ screenHeight);757 assert(w > 0 && x + w <= _ screenWidth);736 assert(x >= 0 && x < _videoMode.screenWidth); 737 assert(y >= 0 && y < _videoMode.screenHeight); 738 assert(h > 0 && y + h <= _videoMode.screenHeight); 739 assert(w > 0 && x + w <= _videoMode.screenWidth); 758 740 759 if (((long)src & 3) == 0 && pitch == _ screenWidth && x == 0 && y == 0 &&760 w == _ screenWidth && h == _screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {741 if (((long)src & 3) == 0 && pitch == _videoMode.screenWidth && x == 0 && y == 0 && 742 w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) { 761 743 /* Special, optimized case for full screen updates. 762 744 * It tries to determine what areas were actually changed, 763 745 * and just updates those, on the actual display. */ … … 776 758 y = 0; 777 759 } 778 760 779 if (w > _ screenWidth - x) {780 w = _ screenWidth - x;761 if (w > _videoMode.screenWidth - x) { 762 w = _videoMode.screenWidth - x; 781 763 } 782 764 783 if (h > _ screenHeight - y) {784 h = _ screenHeight - y;765 if (h > _videoMode.screenHeight - y) { 766 h = _videoMode.screenHeight - y; 785 767 } 786 768 787 769 if (w <= 0 || h <= 0) … … 795 777 if (SDL_LockSurface(_screen) == -1) 796 778 error("SDL_LockSurface failed: %s", SDL_GetError()); 797 779 798 byte *dst = (byte *)_screen->pixels + y * _ screenWidth + x;780 byte *dst = (byte *)_screen->pixels + y * _videoMode.screenWidth + x; 799 781 800 if (_ screenWidth == pitch && pitch == w) {782 if (_videoMode.screenWidth == pitch && pitch == w) { 801 783 memcpy(dst, src, h*w); 802 784 } else { 803 785 do { 804 786 memcpy(dst, src, w); 805 787 src += pitch; 806 dst += _ screenWidth;788 dst += _videoMode.screenWidth; 807 789 } while (--h); 808 790 } 809 791 … … 863 845 int height, width; 864 846 865 847 if (!_overlayVisible && !realCoordinates) { 866 width = _ screenWidth;867 height = _ screenHeight;848 width = _videoMode.screenWidth; 849 height = _videoMode.screenHeight; 868 850 } else { 869 width = _ overlayWidth;870 height = _ overlayHeight;851 width = _videoMode.overlayWidth; 852 height = _videoMode.overlayHeight; 871 853 } 872 854 873 855 // Extend the dirty region by 1 pixel for scalers … … 899 881 } 900 882 901 883 #ifndef DISABLE_SCALERS 902 if (_ adjustAspectRatio && !_overlayVisible && !realCoordinates) {884 if (_videoMode.aspectRatio && !_overlayVisible && !realCoordinates) { 903 885 makeRectStretchable(x, y, w, h); 904 886 } 905 887 #endif … … 924 906 assert(buf); 925 907 uint32 *sums = _dirtyChecksums; 926 908 uint x,y; 927 const uint last_x = (uint)_ screenWidth / 8;928 const uint last_y = (uint)_ screenHeight / 8;909 const uint last_x = (uint)_videoMode.screenWidth / 8; 910 const uint last_y = (uint)_videoMode.screenHeight / 8; 929 911 930 912 const uint BASE = 65521; /* largest prime smaller than 65536 */ 931 913 932 914 /* the 8x8 blocks in buf are enumerated starting in the top left corner and 933 915 * reading each line at a time from left to right */ 934 for (y = 0; y != last_y; y++, buf += _ screenWidth * (8 - 1))916 for (y = 0; y != last_y; y++, buf += _videoMode.screenWidth * (8 - 1)) 935 917 for (x = 0; x != last_x; x++, buf += 8) { 936 918 // Adler32 checksum algorithm (from RFC1950, used by gzip and zlib). 937 919 // This computes the Adler32 checksum of a 8x8 pixel block. Note … … 947 929 s1 += ptr[subX]; 948 930 s2 += s1; 949 931 } 950 ptr += _ screenWidth;932 ptr += _videoMode.screenWidth; 951 933 } 952 934 953 935 s1 %= BASE; … … 977 959 int x, y, w; 978 960 uint32 *ck = _dirtyChecksums; 979 961 980 for (y = 0; y != _ screenHeight / 8; y++) {981 for (x = 0; x != _ screenWidth / 8; x++, ck++) {962 for (y = 0; y != _videoMode.screenHeight / 8; y++) { 963 for (x = 0; x != _videoMode.screenWidth / 8; x++, ck++) { 982 964 if (ck[0] != ck[_cksumNum]) { 983 965 /* found a dirty 8x8 block, now go as far to the right as possible, 984 966 and at the same time, unmark the dirty status by setting old to new. */ … … 986 968 do { 987 969 ck[w + _cksumNum] = ck[w]; 988 970 w++; 989 } while (x + w != _ screenWidth / 8 && ck[w] != ck[w + _cksumNum]);971 } while (x + w != _videoMode.screenWidth / 8 && ck[w] != ck[w + _cksumNum]); 990 972 991 973 addDirtyRect(x * 8, y * 8, w * 8, 8); 992 974 … … 1003 985 } 1004 986 1005 987 int16 OSystem_SDL::getHeight() { 1006 return _ screenHeight;988 return _videoMode.screenHeight; 1007 989 } 1008 990 1009 991 int16 OSystem_SDL::getWidth() { 1010 return _ screenWidth;992 return _videoMode.screenWidth; 1011 993 } 1012 994 1013 995 void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) { … … 1093 1075 1094 1076 // Since resolution could change, put mouse to adjusted position 1095 1077 // Fixes bug #1349059 1096 x = _mouseCurState.x * _ scaleFactor;1097 if (_ adjustAspectRatio)1098 y = real2Aspect(_mouseCurState.y) * _ scaleFactor;1078 x = _mouseCurState.x * _videoMode.scaleFactor; 1079 if (_videoMode.aspectRatio) 1080 y = real2Aspect(_mouseCurState.y) * _videoMode.scaleFactor; 1099 1081 else 1100 y = _mouseCurState.y * _ scaleFactor;1082 y = _mouseCurState.y * _videoMode.scaleFactor; 1101 1083 1102 1084 warpMouse(x, y); 1103 1085 … … 1116 1098 1117 1099 // Since resolution could change, put mouse to adjusted position 1118 1100 // Fixes bug #1349059 1119 x = _mouseCurState.x / _ scaleFactor;1120 y = _mouseCurState.y / _ scaleFactor;1121 if (_ adjustAspectRatio)1101 x = _mouseCurState.x / _videoMode.scaleFactor; 1102 y = _mouseCurState.y / _videoMode.scaleFactor; 1103 if (_videoMode.aspectRatio) 1122 1104 y = aspect2Real(y); 1123 1105 1124 1106 warpMouse(x, y); … … 1140 1122 SDL_Rect src, dst; 1141 1123 src.x = src.y = 0; 1142 1124 dst.x = dst.y = 1; 1143 src.w = dst.w = _ screenWidth;1144 src.h = dst.h = _ screenHeight;1125 src.w = dst.w = _videoMode.screenWidth; 1126 src.h = dst.h = _videoMode.screenHeight; 1145 1127 if (SDL_BlitSurface(_screen, &src, _tmpscreen, &dst) != 0) 1146 1128 error("SDL_BlitSurface failed: %s", SDL_GetError()); 1147 1129 1148 1130 SDL_LockSurface(_tmpscreen); 1149 1131 SDL_LockSurface(_overlayscreen); 1150 1132 _scalerProc((byte *)(_tmpscreen->pixels) + _tmpscreen->pitch + 2, _tmpscreen->pitch, 1151 (byte *)_overlayscreen->pixels, _overlayscreen->pitch, _ screenWidth, _screenHeight);1133 (byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight); 1152 1134 1153 1135 #ifndef DISABLE_SCALERS 1154 if (_ adjustAspectRatio)1136 if (_videoMode.aspectRatio) 1155 1137 stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch, 1156 _ overlayWidth, _screenHeight * _scaleFactor, 0, 0, 0);1138 _videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0); 1157 1139 #endif 1158 1140 SDL_UnlockSurface(_tmpscreen); 1159 1141 SDL_UnlockSurface(_overlayscreen); … … 1171 1153 error("SDL_LockSurface failed: %s", SDL_GetError()); 1172 1154 1173 1155 byte *src = (byte *)_overlayscreen->pixels; 1174 int h = _ overlayHeight;1156 int h = _videoMode.overlayHeight; 1175 1157 do { 1176 memcpy(buf, src, _ overlayWidth * 2);1158 memcpy(buf, src, _videoMode.overlayWidth * 2); 1177 1159 src += _overlayscreen->pitch; 1178 1160 buf += pitch; 1179 1161 } while (--h); … … 1199 1181 y = 0; 1200 1182 } 1201 1183 1202 if (w > _ overlayWidth - x) {1203 w = _ overlayWidth - x;1184 if (w > _videoMode.overlayWidth - x) { 1185 w = _videoMode.overlayWidth - x; 1204 1186 } 1205 1187 1206 if (h > _ overlayHeight - y) {1207 h = _ overlayHeight - y;1188 if (h > _videoMode.overlayHeight - y) { 1189 h = _videoMode.overlayHeight - y; 1208 1190 } 1209 1191 1210 1192 if (w <= 0 || h <= 0) … … 1260 1242 void OSystem_SDL::warpMouse(int x, int y) { 1261 1243 int y1 = y; 1262 1244 1263 if (_ adjustAspectRatio && !_overlayVisible)1245 if (_videoMode.aspectRatio && !_overlayVisible) 1264 1246 y1 = real2Aspect(y); 1265 1247 1266 1248 if (_mouseCurState.x != x || _mouseCurState.y != y) { 1267 1249 if (!_overlayVisible) 1268 SDL_WarpMouse(x * _ scaleFactor, y1 * _scaleFactor);1250 SDL_WarpMouse(x * _videoMode.scaleFactor, y1 * _videoMode.scaleFactor); 1269 1251 else 1270 1252 SDL_WarpMouse(x, y1); 1271 1253 … … 1368 1350 1369 1351 int rW, rH; 1370 1352 1371 if (_cursorTargetScale >= _ scaleFactor) {1353 if (_cursorTargetScale >= _videoMode.scaleFactor) { 1372 1354 // The cursor target scale is greater or equal to the scale at 1373 1355 // which the rest of the screen is drawn. We do not downscale 1374 1356 // the cursor image, we draw it at its original size. It will … … 1381 1363 1382 1364 // The virtual dimensions may be larger than the original. 1383 1365 1384 _mouseCurState.vW = w * _cursorTargetScale / _ scaleFactor;1385 _mouseCurState.vH = h * _cursorTargetScale / _ scaleFactor;1366 _mouseCurState.vW = w * _cursorTargetScale / _videoMode.scaleFactor; 1367 _mouseCurState.vH = h * _cursorTargetScale / _videoMode.scaleFactor; 1386 1368 _mouseCurState.vHotX = _mouseCurState.hotX * _cursorTargetScale / 1387 _ scaleFactor;1369 _videoMode.scaleFactor; 1388 1370 _mouseCurState.vHotY = _mouseCurState.hotY * _cursorTargetScale / 1389 _ scaleFactor;1371 _videoMode.scaleFactor; 1390 1372 } else { 1391 1373 // The cursor target scale is smaller than the scale at which 1392 1374 // the rest of the screen is drawn. We scale up the cursor 1393 1375 // image to make it appear correct. 1394 1376 1395 rW = w * _ scaleFactor / _cursorTargetScale;1396 rH = h * _ scaleFactor / _cursorTargetScale;1397 _mouseCurState.rHotX = _mouseCurState.hotX * _ scaleFactor /1377 rW = w * _videoMode.scaleFactor / _cursorTargetScale; 1378 rH = h * _videoMode.scaleFactor / _cursorTargetScale; 1379 _mouseCurState.rHotX = _mouseCurState.hotX * _videoMode.scaleFactor / 1398 1380 _cursorTargetScale; 1399 _mouseCurState.rHotY = _mouseCurState.hotY * _ scaleFactor /1381 _mouseCurState.rHotY = _mouseCurState.hotY * _videoMode.scaleFactor / 1400 1382 _cursorTargetScale; 1401 1383 1402 1384 // The virtual dimensions will be the same as the original. … … 1411 1393 int rH1 = rH; // store original to pass to aspect-correction function later 1412 1394 #endif 1413 1395 1414 if (_ adjustAspectRatio && _cursorTargetScale == 1) {1396 if (_videoMode.aspectRatio && _cursorTargetScale == 1) { 1415 1397 rH = real2Aspect(rH - 1) + 1; 1416 1398 _mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY); 1417 1399 } … … 1446 1428 // the game. This only works well with the non-blurring scalers so we 1447 1429 // actually only use the 1x, 1.5x, 2x and AdvMame scalers. 1448 1430 1449 if (_cursorTargetScale == 1 && (_ mode == GFX_DOUBLESIZE || _mode == GFX_TRIPLESIZE))1431 if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE)) 1450 1432 scalerProc = _scalerProc; 1451 1433 else 1452 scalerProc = scalersMagn[_cursorTargetScale - 1][_ scaleFactor - 1];1434 scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1]; 1453 1435 1454 1436 scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2, 1455 1437 _mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch, 1456 1438 _mouseCurState.w, _mouseCurState.h); 1457 1439 1458 1440 #ifndef DISABLE_SCALERS 1459 if (_ adjustAspectRatio && _cursorTargetScale == 1)1441 if (_videoMode.aspectRatio && _cursorTargetScale == 1) 1460 1442 cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0); 1461 1443 #endif 1462 1444 … … 1499 1481 1500 1482 // When we switch bigger overlay off mouse jumps. Argh! 1501 1483 // This is intended to prevent undrawing offscreen mouse 1502 if (!_overlayVisible && (x >= _ screenWidth || y >= _screenHeight)) {1484 if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight)) { 1503 1485 return; 1504 1486 } 1505 1487 … … 1522 1504 dst.y = _mouseCurState.y; 1523 1505 1524 1506 if (!_overlayVisible) { 1525 scale = _ scaleFactor;1526 width = _ screenWidth;1527 height = _ screenHeight;1507 scale = _videoMode.scaleFactor; 1508 width = _videoMode.screenWidth; 1509 height = _videoMode.screenHeight; 1528 1510 dst.w = _mouseCurState.vW; 1529 1511 dst.h = _mouseCurState.vH; 1530 1512 hotX = _mouseCurState.vHotX; 1531 1513 hotY = _mouseCurState.vHotY; 1532 1514 } else { 1533 1515 scale = 1; 1534 width = _ overlayWidth;1535 height = _ overlayHeight;1516 width = _videoMode.overlayWidth; 1517 height = _videoMode.overlayHeight; 1536 1518 dst.w = _mouseCurState.rW; 1537 1519 dst.h = _mouseCurState.rH; 1538 1520 hotX = _mouseCurState.rHotX; … … 1554 1536 dst.y += _currentShakePos; 1555 1537 } 1556 1538 1557 if (_ adjustAspectRatio && !_overlayVisible)1539 if (_videoMode.aspectRatio && !_overlayVisible) 1558 1540 dst.y = real2Aspect(dst.y); 1559 1541 1560 1542 dst.x = scale * dst.x - _mouseCurState.rHotX; … … 1670 1652 void OSystem_SDL::handleScalerHotkeys(const SDL_KeyboardEvent &key) { 1671 1653 // Ctrl-Alt-a toggles aspect ratio correction 1672 1654 if (key.keysym.sym == 'a') { 1673 setFeatureState(kFeatureAspectRatioCorrection, !_adjustAspectRatio); 1655 beginGFXTransaction(); 1656 setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatio); 1657 endGFXTransaction(); 1674 1658 #ifdef USE_OSD 1675 1659 char buffer[128]; 1676 if (_ adjustAspectRatio)1660 if (_videoMode.aspectRatio) 1677 1661 sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d", 1678 _ screenWidth, _screenHeight,1662 _videoMode.screenWidth, _videoMode.screenHeight, 1679 1663 _hwscreen->w, _hwscreen->h 1680 1664 ); 1681 1665 else 1682 1666 sprintf(buffer, "Disabled aspect ratio correction\n%d x %d -> %d x %d", 1683 _ screenWidth, _screenHeight,1667 _videoMode.screenWidth, _videoMode.screenHeight, 1684 1668 _hwscreen->w, _hwscreen->h 1685 1669 ); 1686 1670 displayMessageOnOSD(buffer); … … 1690 1674 } 1691 1675 1692 1676 int newMode = -1; 1693 int factor = _ scaleFactor - 1;1677 int factor = _videoMode.scaleFactor - 1; 1694 1678 1695 1679 // Increase/decrease the scale factor 1696 1680 if (key.keysym.sym == SDLK_EQUALS || key.keysym.sym == SDLK_PLUS || key.keysym.sym == SDLK_MINUS || … … 1716 1700 } 1717 1701 1718 1702 if (newMode >= 0) { 1719 setGraphicsMode(newMode); 1703 beginGFXTransaction(); 1704 setGraphicsMode(newMode); 1705 endGFXTransaction(); 1720 1706 #ifdef USE_OSD 1721 1707 if (_osdSurface) { 1722 1708 const char *newScalerName = 0; 1723 1709 const GraphicsMode *g = getSupportedGraphicsModes(); 1724 1710 while (g->name) { 1725 if (g->id == _ mode) {1711 if (g->id == _videoMode.mode) { 1726 1712 newScalerName = g->description; 1727 1713 break; 1728 1714 } … … 1732 1718 char buffer[128]; 1733 1719 sprintf(buffer, "Active graphics filter: %s\n%d x %d -> %d x %d", 1734 1720 newScalerName, 1735 _ screenWidth, _screenHeight,1721 _videoMode.screenWidth, _videoMode.screenHeight, 1736 1722 _hwscreen->w, _hwscreen->h 1737 1723 ); 1738 1724 displayMessageOnOSD(buffer); -
backends/platform/sdl/sdl.cpp
112 112 // Enable unicode support if possible 113 113 SDL_EnableUNICODE(1); 114 114 115 _oldVideoMode.setup = false; 116 _videoMode.setup = false; 117 115 118 _cksumValid = false; 116 119 #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && !defined(DISABLE_SCALERS) 117 _mode = GFX_DOUBLESIZE; 118 _scaleFactor = 2; 120 _videoMode.mode = GFX_DOUBLESIZE; 121 _videoMode.scaleFactor = 2; 122 _videoMode.aspectRatio = ConfMan.getBool("aspect_ratio"); 119 123 _scalerProc = Normal2x; 120 _adjustAspectRatio = ConfMan.getBool("aspect_ratio");121 124 #else // for small screen platforms 122 _mode = GFX_NORMAL; 123 _scaleFactor = 1; 125 _videoMode.mode = GFX_NORMAL; 126 _videoMode.scaleFactor = 1; 127 _videoMode.aspectRatio = false; 124 128 _scalerProc = Normal1x; 125 _adjustAspectRatio = false;126 129 #endif 127 130 _scalerType = 0; 128 131 _modeFlags = 0; 129 132 130 133 #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) 131 _ fullscreen = ConfMan.getBool("fullscreen");134 _videoMode.fullscreen = ConfMan.getBool("fullscreen"); 132 135 #else 133 _ fullscreen = true;136 _videoMode.fullscreen = true; 134 137 #endif 135 138 136 139 #if !defined(MACOSX) && !defined(__SYMBIAN32__) … … 184 187 #ifdef USE_OSD 185 188 _osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0), 186 189 #endif 187 _hwscreen(0), _screen(0), _screenWidth(0), _screenHeight(0), 188 _tmpscreen(0), _overlayWidth(0), _overlayHeight(0), 190 _hwscreen(0), _screen(0), _tmpscreen(0), 189 191 _overlayVisible(false), 190 192 _overlayscreen(0), _tmpscreen2(0), 191 193 _samplesPerSec(0), … … 423 425 424 426 switch (f) { 425 427 case kFeatureFullscreenMode: 426 return _ fullscreen;428 return _videoMode.fullscreen; 427 429 case kFeatureAspectRatioCorrection: 428 return _ adjustAspectRatio;430 return _videoMode.aspectRatio; 429 431 case kFeatureAutoComputeDirtyRects: 430 432 return _modeFlags & DF_WANT_RECT_OPTIM; 431 433 default: -
backends/platform/sdl/events.cpp
77 77 78 78 // Adjust for the screen scaling 79 79 if (!_overlayVisible) { 80 event.mouse.x /= _ scaleFactor;81 event.mouse.y /= _ scaleFactor;82 if (_ adjustAspectRatio)80 event.mouse.x /= _videoMode.scaleFactor; 81 event.mouse.y /= _videoMode.scaleFactor; 82 if (_videoMode.aspectRatio) 83 83 event.mouse.y = aspect2Real(event.mouse.y); 84 84 } 85 85 } … … 196 196 if (b == Common::KBD_ALT && (ev.key.keysym.sym == SDLK_RETURN 197 197 || ev.key.keysym.sym == SDLK_KP_ENTER)) { 198 198 beginGFXTransaction(); 199 setFullscreenMode(!_ fullscreen);199 setFullscreenMode(!_videoMode.fullscreen); 200 200 endGFXTransaction(); 201 201 #ifdef USE_OSD 202 if (_ fullscreen)202 if (_videoMode.fullscreen) 203 203 displayMessageOnOSD("Fullscreen mode"); 204 204 else 205 205 displayMessageOnOSD("Windowed mode"); -
backends/platform/sdl/sdl.h
183 183 virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); 184 184 virtual int16 getHeight(); 185 185 virtual int16 getWidth(); 186 virtual int16 getOverlayHeight() { return _ overlayHeight; }187 virtual int16 getOverlayWidth() { return _ overlayWidth; }186 virtual int16 getOverlayHeight() { return _videoMode.overlayHeight; } 187 virtual int16 getOverlayWidth() { return _videoMode.overlayWidth; } 188 188 189 189 // Methods that convert RGB to/from colors suitable for the overlay. 190 190 virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b); … … 235 235 // unseen game screen 236 236 SDL_Surface *_screen; 237 237 238 // TODO: We could get rid of the following two vars and just use _screen instead239 int _screenWidth, _screenHeight;240 241 238 // temporary screen (for scalers) 242 239 SDL_Surface *_tmpscreen; 243 240 SDL_Surface *_tmpscreen2; 244 241 245 242 // overlay 246 243 SDL_Surface *_overlayscreen; 247 int _overlayWidth, _overlayHeight;248 244 bool _overlayVisible; 249 245 250 246 // Audio … … 261 257 262 258 enum { 263 259 kTransactionNone = 0, 264 kTransaction Commit= 1,265 kTransaction Active= 2260 kTransactionActive = 1, 261 kTransactionRollback = 2 266 262 }; 267 263 268 264 struct TransactionDetails { 269 int mode;270 bool modeChanged;271 int w;272 int h;273 265 bool sizeChanged; 274 bool fs;275 bool fsChanged;276 bool ar;277 bool arChanged;278 266 bool needHotswap; 279 267 bool needUpdatescreen; 280 bool needUnload;281 bool needToggle;282 268 bool normal1xScaler; 283 269 }; 284 270 TransactionDetails _transactionDetails; 285 271 272 struct VideoState { 273 bool setup; 274 275 bool fullscreen; 276 bool aspectRatio; 277 278 int mode; 279 int scaleFactor; 280 281 int screenWidth, screenHeight; 282 int overlayWidth, overlayHeight; 283 }; 284 VideoState _videoMode, _oldVideoMode; 285 286 void setGraphicsModeIntern(); 287 286 288 /** Force full redraw on next updateScreen */ 287 289 bool _forceFull; 288 290 ScalerProc *_scalerProc; 289 291 int _scalerType; 290 int _scaleFactor;291 int _mode;292 292 int _transactionMode; 293 bool _fullscreen;294 293 295 294 bool _screenIsLocked; 296 295 Graphics::Surface _framebuffer; … … 300 299 bool _modeChanged; 301 300 int _screenChangeCount; 302 301 303 /** True if aspect ratio correction is enabled. */304 bool _adjustAspectRatio;305 306 302 enum { 307 303 NUM_DIRTY_RECT = 100, 308 304 MAX_SCALING = 3 … … 425 421 426 422 virtual void internUpdateScreen(); // overloaded by CE backend 427 423 428 virtual voidloadGFXMode(); // overloaded by CE backend424 virtual bool loadGFXMode(); // overloaded by CE backend 429 425 virtual void unloadGFXMode(); // overloaded by CE backend 430 426 virtual void hotswapGFXMode(); // overloaded by CE backend 431 427 … … 435 431 virtual bool saveScreenshot(const char *filename); // overloaded by CE backend 436 432 437 433 int effectiveScreenHeight() const { 438 return (_ adjustAspectRatio ? real2Aspect(_screenHeight) : _screenHeight)439 * _ scaleFactor;434 return (_videoMode.aspectRatio ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight) 435 * _videoMode.scaleFactor; 440 436 } 441 437 442 438 void setupIcon();