Ticket #8159: scummvm-ratio800-20030620.diff
File scummvm-ratio800-20030620.diff, 15.3 KB (added by , 21 years ago) |
---|
-
backends/sdl/sdl-common.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v retrieving revision 1.62 diff -u -r1.62 sdl-common.cpp
462 462 463 463 void OSystem_SDL_Common::warp_mouse(int x, int y) { 464 464 if (_mouseCurState.x != x || _mouseCurState.y != y) { 465 SDL_WarpMouse(x * _scaleFactor, y * _scaleFactor); 465 SDL_WarpMouse(x * _scaleFactor_hmul / _scaleFactor_hdiv, 466 y * _scaleFactor_vmul / _scaleFactor_vdiv); 466 467 467 468 // SDL_WarpMouse() generates a mouse movement event, so 468 469 // set_mouse_pos() would be called eventually. However, the … … 695 696 km.x = event->mouse.x = ev.motion.x; 696 697 km.y = event->mouse.y = ev.motion.y; 697 698 698 event->mouse.x /= _scaleFactor; 699 event->mouse.y /= _scaleFactor; 699 event->mouse.x *= _scaleFactor_hdiv; 700 event->mouse.x /= _scaleFactor_hmul; 701 event->mouse.y *= _scaleFactor_vdiv; 702 event->mouse.y /= _scaleFactor_vmul; 700 703 701 704 return true; 702 705 … … 715 718 break; 716 719 km.x = event->mouse.x = ev.button.x; 717 720 km.y = event->mouse.y = ev.button.y; 718 event->mouse.x /= _scaleFactor; 719 event->mouse.y /= _scaleFactor; 721 event->mouse.x *= _scaleFactor_hdiv; 722 event->mouse.x /= _scaleFactor_hmul; 723 event->mouse.y *= _scaleFactor_vdiv; 724 event->mouse.y /= _scaleFactor_vmul; 720 725 721 726 return true; 722 727 … … 729 734 break; 730 735 event->mouse.x = ev.button.x; 731 736 event->mouse.y = ev.button.y; 732 event->mouse.x /= _scaleFactor; 733 event->mouse.y /= _scaleFactor; 737 event->mouse.x *= _scaleFactor_hdiv; 738 event->mouse.x /= _scaleFactor_hmul; 739 event->mouse.y *= _scaleFactor_vdiv; 740 event->mouse.y /= _scaleFactor_vmul; 734 741 return true; 735 742 736 743 case SDL_JOYBUTTONDOWN: … … 833 840 } 834 841 event->mouse.x = km.x; 835 842 event->mouse.y = km.y; 836 event->mouse.x /= _scaleFactor; 837 event->mouse.y /= _scaleFactor; 843 event->mouse.x *= _scaleFactor_hdiv; 844 event->mouse.x /= _scaleFactor_hmul; 845 event->mouse.y *= _scaleFactor_vdiv; 846 event->mouse.y /= _scaleFactor_vmul; 838 847 return true; 839 848 840 849 case SDL_VIDEOEXPOSE: -
backends/sdl/sdl-common.h
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v retrieving revision 1.27 diff -u -r1.27 sdl-common.h
153 153 }; 154 154 155 155 bool _forceFull; // Force full redraw on next update_screen 156 int _scaleFactor; 156 int _scaleFactor_hmul; 157 int _scaleFactor_hdiv; 158 int _scaleFactor_vmul; 159 int _scaleFactor_vdiv; 157 160 int _mode; 158 161 bool _full_screen; 159 162 uint32 _mode_flags; -
backends/sdl/sdl.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v retrieving revision 1.34 diff -u -r1.34 sdl.cpp
84 84 85 85 switch(_mode) { 86 86 case GFX_2XSAI: 87 _scaleFactor = 2; 87 _scaleFactor_hmul = _scaleFactor_vmul = 2; 88 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 88 89 _scaler_proc = _2xSaI; 89 90 break; 90 91 case GFX_SUPER2XSAI: 91 _scaleFactor = 2; 92 _scaleFactor_hmul = _scaleFactor_vmul = 2; 93 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 92 94 _scaler_proc = Super2xSaI; 93 95 break; 94 96 case GFX_SUPEREAGLE: 95 _scaleFactor = 2; 97 _scaleFactor_hmul = _scaleFactor_vmul = 2; 98 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 96 99 _scaler_proc = SuperEagle; 97 100 break; 98 101 case GFX_ADVMAME2X: 99 _scaleFactor = 2; 102 _scaleFactor_hmul = _scaleFactor_vmul = 2; 103 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 100 104 _scaler_proc = AdvMame2x; 101 105 break; 102 106 case GFX_ADVMAME3X: 103 _scaleFactor = 3; 107 _scaleFactor_hmul = _scaleFactor_vmul = 3; 108 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 104 109 _scaler_proc = AdvMame3x; 105 110 break; 106 111 case GFX_TV2X: 107 _scaleFactor = 2; 112 _scaleFactor_hmul = _scaleFactor_vmul = 2; 113 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 108 114 _scaler_proc = TV2x; 109 115 break; 110 116 case GFX_DOTMATRIX: 111 _scaleFactor = 2; 117 _scaleFactor_hmul = _scaleFactor_vmul = 2; 118 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 112 119 _scaler_proc = DotMatrix; 113 120 break; 114 121 122 case GFX_RATIO800: 123 _scaleFactor_hmul = 5; 124 _scaleFactor_hdiv = 2; 125 _scaleFactor_vmul = 3; 126 _scaleFactor_vdiv = 1; 127 _scaler_proc = Ratio800; 128 break; 129 115 130 case GFX_DOUBLESIZE: 116 _scaleFactor = 2; 131 _scaleFactor_hmul = _scaleFactor_vmul = 2; 132 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 117 133 _scaler_proc = Normal2x; 118 134 break; 119 135 … … 122 138 warning("full screen in useless in triplesize mode, reverting to normal mode"); 123 139 goto normal_mode; 124 140 } 125 _scaleFactor = 3; 141 _scaleFactor_hmul = _scaleFactor_vmul = 3; 142 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 126 143 _scaler_proc = Normal3x; 127 144 break; 128 145 129 146 case GFX_NORMAL: 130 147 normal_mode:; 131 _scaleFactor = 1; 148 _scaleFactor_hmul = _scaleFactor_vmul = 1; 149 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 132 150 _scaler_proc = Normal1x; 133 151 break; 134 152 default: 135 153 error("unknown gfx mode %d", _mode); 136 _scaleFactor = 1; 154 _scaleFactor_hmul = _scaleFactor_vmul = 1; 155 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 137 156 _scaler_proc = NULL; 138 157 } 139 158 … … 147 166 // 148 167 // Create the surface that contains the scaled graphics in 16 bit mode 149 168 // 150 _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor , _screenHeight * _scaleFactor, 16,169 _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv, _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv, 16, 151 170 _full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE 152 171 ); 153 172 if (_hwscreen == NULL) … … 176 195 error("_tmpscreen failed"); 177 196 178 197 // keyboard cursor control, some other better place for it? 179 km.x_max = _screenWidth * _scaleFactor - 1;180 km.y_max = _screenHeight * _scaleFactor - 1;198 km.x_max = _screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv - 1; 199 km.y_max = _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv - 1; 181 200 km.delay_time = 25; 182 201 km.last_time = 0; 183 202 } … … 240 259 241 260 // If the shake position changed, fill the dirty area with blackness 242 261 if (_currentShakePos != _newShakePos) { 243 SDL_Rect blackrect = {0, 0, _screenWidth * _scaleFactor, _newShakePos * _scaleFactor}; 262 /* ratio: FIXME */ 263 SDL_Rect blackrect = {0, 0, _screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv, _newShakePos * _scaleFactor_vmul / _scaleFactor_vdiv}; 244 264 SDL_FillRect(_hwscreen, &blackrect, 0); 245 265 246 266 _currentShakePos = _newShakePos; … … 307 327 308 328 SDL_LockSurface(_tmpscreen); 309 329 SDL_LockSurface(_hwscreen); 310 330 311 331 srcPitch = _tmpscreen->pitch; 312 332 dstPitch = _hwscreen->pitch; 313 333 314 334 for(r = _dirty_rect_list; r != last_rect; ++r) { 315 335 register int dst_y = r->y + _currentShakePos; 316 336 register int dst_h = 0; … … 319 339 if (dst_h > _screenHeight - dst_y) 320 340 dst_h = _screenHeight - dst_y; 321 341 322 dst_y *= _scaleFactor; 342 dst_y *= _scaleFactor_vmul; 343 dst_y /= _scaleFactor_vdiv; 323 344 324 345 _scaler_proc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch, 325 (byte *)_hwscreen->pixels + r->x * 2 * _scaleFactor + dst_y * dstPitch, dstPitch, r->w, dst_h);346 (byte *)_hwscreen->pixels + (r->x * _scaleFactor_hmul / _scaleFactor_hdiv) * 2 + dst_y*dstPitch, dstPitch, r->x, r->y, r->w, dst_h); 326 347 } 327 348 328 r->x *= _scaleFactor; 349 r->w = (r->x + r->w) * _scaleFactor_hmul / _scaleFactor_hdiv; 350 r->x *= _scaleFactor_hmul; 351 r->x /= _scaleFactor_hdiv; 352 r->w -= r->x; 353 r->h = (r->y + r->h) * _scaleFactor_vmul / _scaleFactor_vdiv; 329 354 r->y = dst_y; 330 r->w *= _scaleFactor; 331 r->h = dst_h * _scaleFactor; 355 r->h -= r->y; 332 356 } 333 357 334 358 SDL_UnlockSurface(_tmpscreen); … … 339 363 // This is necessary if shaking is active. 340 364 if (_forceFull) { 341 365 _dirty_rect_list[0].y = 0; 342 _dirty_rect_list[0].h = _screenHeight * _scaleFactor ;366 _dirty_rect_list[0].h = _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv; 343 367 } 344 368 345 369 // Finally, blit all our changes to the screen -
common/gameDetector.cpp
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v retrieving revision 1.111 diff -u -r1.111 gameDetector.cpp
53 53 "\t-p<path> - look for game in <path>\n" 54 54 "\t-x[<num>] - load this savegame (default: 0 - autosave)\n" 55 55 "\t-f - fullscreen mode\n" 56 "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,advmame3x,tv2x,dotmatrix )\n"56 "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,advmame3x,tv2x,dotmatrix,ratio800)\n" 57 57 "\t-e<mode> - set music engine (see README for details)\n" 58 58 "\t-a - specify game is amiga version\n" 59 59 "\t-q<lang> - specify language (en,de,fr,it,pt,es,jp,zh,kr,hb)\n" … … 100 100 {"advmame3x", "AdvMAME3x", GFX_ADVMAME3X}, 101 101 {"tv2x", "TV2x", GFX_TV2X}, 102 102 {"dotmatrix", "DotMatrix", GFX_DOTMATRIX}, 103 {"ratio800", "Ratio800", GFX_RATIO800}, 103 104 #else 104 105 {"flipping", "Page Flipping", GFX_FLIPPING}, 105 106 {"dbuffer", "Double Buffer", GFX_DOUBLEBUFFER}, -
common/scaler.cpp
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v retrieving revision 1.21 diff -u -r1.21 scaler.cpp
106 106 return x + y; 107 107 } 108 108 109 void Super2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {109 void Super2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) { 110 110 const uint16 *bP; 111 111 uint16 *dP; 112 112 const uint32 nextlineSrc = srcPitch >> 1; … … 212 212 } 213 213 } 214 214 215 void SuperEagle(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {215 void SuperEagle(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) { 216 216 const uint16 *bP; 217 217 uint16 *dP; 218 218 const uint32 nextlineSrc = srcPitch >> 1; … … 317 317 } 318 318 } 319 319 320 void _2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {320 void _2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) { 321 321 const uint16 *bP; 322 322 uint16 *dP; 323 323 const uint32 nextlineSrc = srcPitch >> 1; … … 451 451 } 452 452 453 453 void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 454 int width, int height) {454 int x, int y, int width, int height) { 455 455 unsigned int nextlineSrc = srcPitch / sizeof(uint16); 456 456 const uint16 *p = (const uint16 *)srcPtr; 457 457 … … 487 487 } 488 488 489 489 void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 490 int width, int height) {490 int x, int y, int width, int height) { 491 491 unsigned int nextlineSrc = srcPitch / sizeof(uint16); 492 492 const uint16 *p = (const uint16 *)srcPtr; 493 493 … … 528 528 } 529 529 530 530 void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 531 int width, int height) {531 int x, int y, int width, int height) { 532 532 while (height--) { 533 533 memcpy(dstPtr, srcPtr, 2 * width); 534 534 srcPtr += srcPitch; … … 537 537 } 538 538 539 539 void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 540 int width, int height) {540 int x, int y, int width, int height) { 541 541 uint8 *r; 542 542 543 543 while (height--) { … … 556 556 } 557 557 558 558 void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 559 int width, int height) {559 int x, int y, int width, int height) { 560 560 uint8 *r; 561 561 uint32 dstPitch2 = dstPitch * 2; 562 562 uint32 dstPitch3 = dstPitch * 3; … … 582 582 } 583 583 584 584 void TV2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 585 int width, int height) {585 int x, int y, int width, int height) { 586 586 unsigned int nextlineSrc = srcPitch / sizeof(uint16); 587 587 const uint16 *p = (const uint16 *)srcPtr; 588 588 … … 612 612 } 613 613 614 614 void DotMatrix(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 615 int width, int height)615 int x, int y, int width, int height) 616 616 { 617 617 unsigned int nextlineSrc = srcPitch / sizeof(uint16); 618 618 const uint16 *p = (const uint16 *)srcPtr; … … 630 630 } 631 631 p += nextlineSrc; 632 632 q += nextlineDst << 1; 633 } 634 } 635 636 void Ratio800(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 637 int x, int y, int width, int height) 638 { 639 unsigned int nextlineSrc = srcPitch / sizeof(uint16); 640 const uint16 *p = (const uint16 *)srcPtr; 641 642 unsigned int nextlineDst = dstPitch / sizeof(uint16); 643 uint16 *q0 = (uint16 *)dstPtr; 644 uint16 *q1, *q2, *q3; 645 646 int i, j; 647 uint16 va, vb, vc, vd, ve, vf, vg, vh; 648 uint16 vbc; 649 650 if(x & 1) { 651 width++; 652 x--; 653 p--; 654 q0 -= 2; 655 } 656 if(width & 1) 657 width++; 658 for(i = 0; i < height; i++) { 659 q1 = q0; 660 q2 = q1 + nextlineDst; 661 q3 = q2 + nextlineDst; 662 vc = p[-1]; 663 vd = p[0]; 664 665 for(j = 0; j < width; j += 2) { 666 ve = p[-nextlineSrc]; 667 vg = p[nextlineSrc]; 668 va = vc; 669 vb = vd; 670 p++; 671 vf = p[-nextlineSrc]; 672 vh = p[nextlineSrc]; 673 vc = *p; 674 p++; 675 vd = *p; 676 /* 677 E F 678 A B C D 679 G H 680 */ 681 682 vbc = INTERPOLATE(vb, vc); 683 684 *(q1++) = Q_INTERPOLATE(va, ve, vb, vb); 685 *(q1++) = Q_INTERPOLATE(ve, vb, vb, vb); 686 *(q1++) = Q_INTERPOLATE(INTERPOLATE(ve, vf), vbc, vbc, vbc); 687 *(q1++) = Q_INTERPOLATE(vf, vc, vc, vc); 688 *(q1++) = Q_INTERPOLATE(vd, vf, vc, vc); 689 *(q2++) = Q_INTERPOLATE(va, vb, vb, vb); 690 *(q2++) = vb; 691 *(q2++) = vbc; 692 *(q2++) = vc; 693 *(q2++) = Q_INTERPOLATE(vd, vc, vc, vc); 694 *(q3++) = Q_INTERPOLATE(va, vg, vb, vb); 695 *(q3++) = Q_INTERPOLATE(vg, vb, vb, vb); 696 *(q3++) = Q_INTERPOLATE(INTERPOLATE(vg, vh), vbc, vbc, vbc); 697 *(q3++) = Q_INTERPOLATE(vh, vc, vc, vc); 698 *(q3++) = Q_INTERPOLATE(vd, vh, vc, vc); 699 } 700 p += nextlineSrc - width; 701 q0 += nextlineDst * 3; 633 702 } 634 703 } -
common/scaler.h
RCS file: /cvsroot/scummvm/scummvm/common/scaler.h,v retrieving revision 1.11 diff -u -r1.11 scaler.h
24 24 extern int Init_2xSaI (uint32 BitFormat); 25 25 26 26 typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch, 27 uint8 *dstPtr, uint32 dstPitch, int width, int height);27 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 28 28 29 29 #define DECLARE_SCALER(x) \ 30 30 extern void x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \ 31 uint32 dstPitch, int width, int height)31 uint32 dstPitch, int x, int y, int width, int height) 32 32 33 33 DECLARE_SCALER(_2xSaI); 34 34 DECLARE_SCALER(Super2xSaI); … … 40 40 DECLARE_SCALER(Normal3x); 41 41 DECLARE_SCALER(TV2x); 42 42 DECLARE_SCALER(DotMatrix); 43 DECLARE_SCALER(Ratio800); 43 44 44 45 45 46 enum { … … 56 57 57 58 GFX_ASPECTRATIO = 11, // OpenGL backend 58 59 GFX_BILINEAR = 12, // OpenGL backend 60 61 GFX_RATIO800 = 13, 59 62 60 63 GFX_FLIPPING = 100, // Palmos 61 64 GFX_DOUBLEBUFFER = 101, // Palmos