Ticket #8159: ratio800.diff
File ratio800.diff, 14.7 KB (added by , 22 years ago) |
---|
-
backends/sdl/sdl-common.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v retrieving revision 1.29 diff -u -r1.29 sdl-common.cpp
402 402 403 403 void OSystem_SDL_Common::warp_mouse(int x, int y) { 404 404 if (_mouseCurState.x != x || _mouseCurState.y != y) 405 SDL_WarpMouse(x * _scaleFactor, y * _scaleFactor); 405 SDL_WarpMouse(x * _scaleFactor_hmul / _scaleFactor_hdiv, 406 y * _scaleFactor_vmul / _scaleFactor_vdiv); 406 407 } 407 408 408 409 void OSystem_SDL_Common::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) { … … 602 603 km.x = event->mouse.x = ev.motion.x; 603 604 km.y = event->mouse.y = ev.motion.y; 604 605 605 event->mouse.x /= _scaleFactor; 606 event->mouse.y /= _scaleFactor; 606 event->mouse.x *= _scaleFactor_hdiv; 607 event->mouse.x /= _scaleFactor_hmul; 608 event->mouse.y *= _scaleFactor_vdiv; 609 event->mouse.y /= _scaleFactor_vmul; 607 610 608 611 return true; 609 612 … … 622 625 break; 623 626 km.x = event->mouse.x = ev.motion.x; 624 627 km.y = event->mouse.y = ev.motion.y; 625 event->mouse.x /= _scaleFactor; 626 event->mouse.y /= _scaleFactor; 628 event->mouse.x *= _scaleFactor_hdiv; 629 event->mouse.x /= _scaleFactor_hmul; 630 event->mouse.y *= _scaleFactor_vdiv; 631 event->mouse.y /= _scaleFactor_vmul; 627 632 628 633 return true; 629 634 … … 636 641 break; 637 642 event->mouse.x = ev.button.x; 638 643 event->mouse.y = ev.button.y; 639 event->mouse.x /= _scaleFactor; 640 event->mouse.y /= _scaleFactor; 644 event->mouse.x *= _scaleFactor_hdiv; 645 event->mouse.x /= _scaleFactor_hmul; 646 event->mouse.y *= _scaleFactor_vdiv; 647 event->mouse.y /= _scaleFactor_vmul; 641 648 return true; 642 649 643 650 case SDL_QUIT: -
backends/sdl/sdl-common.h
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v retrieving revision 1.14 diff -u -r1.14 sdl-common.h
125 125 126 126 protected: 127 127 typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, 128 uint8 *dstPtr, uint32 dstPitch, int width, int height);128 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 129 129 130 130 OSystem_SDL_Common(); 131 131 virtual ~OSystem_SDL_Common(); … … 150 150 }; 151 151 152 152 bool _forceFull; // Force full redraw on next update_screen 153 int _scaleFactor; 153 int _scaleFactor_hmul; 154 int _scaleFactor_hdiv; 155 int _scaleFactor_vmul; 156 int _scaleFactor_vdiv; 154 157 int _mode; 155 158 bool _full_screen; 156 159 uint32 _mode_flags; -
backends/sdl/sdl.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v retrieving revision 1.21 diff -u -r1.21 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_TV2X: 103 _scaleFactor = 2; 107 _scaleFactor_hmul = _scaleFactor_vmul = 2; 108 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 104 109 _scaler_proc = TV2x; 105 110 break; 106 111 112 case GFX_RATIO800: 113 _scaleFactor_hmul = 5; 114 _scaleFactor_hdiv = 2; 115 _scaleFactor_vmul = 3; 116 _scaleFactor_vdiv = 1; 117 _scaler_proc = Ratio800; 118 break; 119 107 120 case GFX_DOUBLESIZE: 108 _scaleFactor = 2; 121 _scaleFactor_hmul = _scaleFactor_vmul = 2; 122 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 109 123 _scaler_proc = Normal2x; 110 124 break; 111 125 … … 114 128 warning("full screen in useless in triplesize mode, reverting to normal mode"); 115 129 goto normal_mode; 116 130 } 117 _scaleFactor = 3; 131 _scaleFactor_hmul = _scaleFactor_vmul = 3; 132 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 118 133 _scaler_proc = Normal3x; 119 134 break; 120 135 121 136 case GFX_NORMAL: 122 137 normal_mode:; 123 _scaleFactor = 1; 138 _scaleFactor_hmul = _scaleFactor_vmul = 1; 139 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 124 140 _scaler_proc = Normal1x; 125 141 break; 126 142 default: 127 143 error("unknown gfx mode"); 128 _scaleFactor = 1; 144 _scaleFactor_hmul = _scaleFactor_vmul = 1; 145 _scaleFactor_hdiv = _scaleFactor_vdiv = 1; 129 146 _scaler_proc = NULL; 130 147 } 131 148 … … 140 157 // 141 158 // Create the surface that contains the scaled graphics in 16 bit mode 142 159 // 143 _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor , _screenHeight * _scaleFactor, 16,160 _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv, _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv, 16, 144 161 _full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE 145 162 ); 146 163 if (_hwscreen == NULL) … … 169 186 error("_tmpscreen failed"); 170 187 171 188 // keyboard cursor control, some other better place for it? 172 km.x_max = _screenWidth * _scaleFactor - 1;173 km.y_max = _screenHeight * _scaleFactor - 1;189 km.x_max = _screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv - 1; 190 km.y_max = _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv - 1; 174 191 km.delay_time = 25; 175 192 km.last_time = 0; 176 193 … … 231 248 232 249 // If the shake position changed, fill the dirty area with blackness 233 250 if (_currentShakePos != _newShakePos) { 234 SDL_Rect blackrect = {0, 0, _screenWidth*_scaleFactor, _newShakePos*_scaleFactor}; 251 /* ratio: FIXME */ 252 SDL_Rect blackrect = {0, 0, _screenWidth*_scaleFactor_hmul / _scaleFactor_hdiv, _newShakePos*_scaleFactor_vmul / _scaleFactor_vdiv}; 235 253 SDL_FillRect(_hwscreen, &blackrect, 0); 236 254 237 255 _currentShakePos = _newShakePos; … … 297 315 if (dst_h > _screenHeight - dst_y) 298 316 dst_h = _screenHeight - dst_y; 299 317 300 dst_y *= _scaleFactor; 318 dst_y *= _scaleFactor_vmul; 319 dst_y /= _scaleFactor_vdiv; 301 320 302 321 _scaler_proc((byte*)_tmpscreen->pixels + (r->x*2+2) + (r->y+1)*srcPitch, srcPitch, NULL, 303 (byte*)_hwscreen->pixels + r->x*2*_scaleFactor + dst_y*dstPitch, dstPitch, r->w, dst_h);322 (byte*)_hwscreen->pixels + (r->x*_scaleFactor_hmul / _scaleFactor_hdiv) * 2 + dst_y*dstPitch, dstPitch, r->x, r->y, r->w, dst_h); 304 323 } 305 324 306 r->x *= _scaleFactor; 325 r->w = (r->x + r->w) * _scaleFactor_hmul / _scaleFactor_hdiv; 326 r->x *= _scaleFactor_hmul; 327 r->x /= _scaleFactor_hdiv; 328 r->w -= r->x; 329 r->h = (r->y + r->h) * _scaleFactor_vmul / _scaleFactor_vdiv; 307 330 r->y = dst_y; 308 r->w *= _scaleFactor; 309 r->h = dst_h * _scaleFactor; 331 r->h -= r->y; 310 332 } 311 333 312 334 SDL_UnlockSurface(_tmpscreen); … … 316 338 // This is necessary if shaking is active. 317 339 if (_forceFull) { 318 340 _dirty_rect_list[0].y = 0; 319 _dirty_rect_list[0].h = _screenHeight * _scaleFactor ;341 _dirty_rect_list[0].h = _screenHeight * _scaleFactor_vmul / _scaleFactor_vdiv; 320 342 } 321 343 322 344 // Finally, blit all our changes to the screen -
common/gameDetector.cpp
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v retrieving revision 1.63 diff -u -r1.63 gameDetector.cpp
47 47 "\t-p<path> - look for game in <path>\n" 48 48 "\t-x[<num>] - load this savegame (default: 0 - autosave)\n" 49 49 "\t-f - fullscreen mode\n" 50 "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x )\n"50 "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,tv2x,ratio800)\n" 51 51 "\t-e<mode> - set music engine (see README for details)\n" 52 52 "\t-a - specify game is amiga version\n" 53 53 "\n" … … 183 183 {"supereagle", "SuperEagle", GFX_SUPEREAGLE}, 184 184 {"advmame2x", "AdvMAME2x", GFX_ADVMAME2X}, 185 185 {"tv2x", "TV2x", GFX_TV2X}, 186 {"ratio800", "Ratio800", GFX_RATIO800}, 186 187 {0, 0} 187 188 }; 188 189 -
common/scaler.cpp
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v retrieving revision 1.4 diff -u -r1.4 scaler.cpp
146 146 #define GREEN_MASK555 0x03E003E0 147 147 148 148 void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, 149 uint8 *deltaPtr, uint8 *dstPtr, uint32 dstPitch, int width, int height) 149 uint8 *deltaPtr, uint8 *dstPtr, uint32 dstPitch, 150 int x, int y, int width, int height) 150 151 { 151 152 uint16 *bP; 152 153 uint8 *dP; … … 265 266 } 266 267 267 268 void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, 268 uint8 *dstPtr, uint32 dstPitch, int width, int height) 269 uint8 *dstPtr, uint32 dstPitch, 270 int x, int y, int width, int height) 269 271 { 270 272 uint8 *dP; 271 273 uint16 *bP; … … 385 387 } 386 388 387 389 void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, 388 uint8 *dstPtr, uint32 dstPitch, int width, int height) 390 uint8 *dstPtr, uint32 dstPitch, 391 int x, int y, int width, int height) 389 392 { 390 393 uint8 *dP; 391 394 uint16 *bP; … … 582 585 return (result & redblueMask) | ((result >> 16) & greenMask); 583 586 } 584 587 588 /* not used */ 585 589 void Scale_2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 * /* deltaPtr */ , 586 590 uint8 *dstPtr, uint32 dstPitch, 587 uint32 dstWidth, uint32 dstHeight, int width, int height) 591 uint32 dstWidth, uint32 dstHeight, 592 int x, int y, int width, int height) 588 593 { 589 594 uint8 *dP; 590 595 uint16 *bP; … … 716 721 } 717 722 718 723 void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 719 724 int x, int y, int width, int height) 720 725 { 721 726 unsigned int nextlineSrc = srcPitch / sizeof(short); 722 727 short *p = (short *)srcPtr; … … 748 753 749 754 750 755 void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 751 756 int x, int y, int width, int height) 752 757 { 753 758 uint16 *r; 754 759 … … 765 770 } 766 771 767 772 void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 768 773 int x, int y, int width, int height) 769 774 { 770 775 uint8 *r; 771 776 … … 785 790 } 786 791 787 792 void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 788 793 int x, int y, int width, int height) 789 794 { 790 795 uint8 *r; 791 796 uint32 dstPitch2 = dstPitch * 2; … … 812 817 } 813 818 814 819 void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 815 int width, int height)820 int x, int y, int width, int height) 816 821 { 817 822 unsigned int nextlineSrc = srcPitch / sizeof(short); 818 823 short *p = (short *)srcPtr; … … 833 838 } 834 839 p += nextlineSrc; 835 840 q += nextlineDst << 1; 841 } 842 } 843 844 void Ratio800(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, 845 int x, int y, int width, int height) 846 { 847 unsigned int nextlineSrc = srcPitch / sizeof(short); 848 short *p = (short *)srcPtr - x - y * nextlineSrc; 849 850 unsigned int nextlineDst = dstPitch / sizeof(short); 851 short *q = (short *)dstPtr - x * 5 / 2 - 3 * y * nextlineDst; 852 853 int i, j; 854 short c; 855 856 for(i = y; i < y + height; i++) { 857 for(j = x; j < x + width; j++) { 858 c = p[i * nextlineSrc + j]; 859 q[i * 3 * nextlineDst + j * 5 / 2] = 860 q[i * 3 * nextlineDst + j * 5 / 2 + 1] = 861 q[i * 3 * nextlineDst + j * 5 / 2 + nextlineDst] = 862 q[i * 3 * nextlineDst + j * 5 / 2 + 1 + nextlineDst] = 863 q[i * 3 * nextlineDst + j * 5 / 2 + nextlineDst * 2] = 864 q[i * 3 * nextlineDst + j * 5 / 2 + 1 + nextlineDst * 2] = c; 865 if(j % 2) 866 q[i * 3 * nextlineDst + j * 5 / 2 + 2] = 867 q[i * 3 * nextlineDst + j * 5 / 2 + 2 + nextlineDst] = 868 q[i * 3 * nextlineDst + j * 5 / 2 + 2 + nextlineDst * 2] = c; 869 } 836 870 } 837 871 } -
common/scaler.h
RCS file: /cvsroot/scummvm/scummvm/common/scaler.h,v retrieving revision 1.2 diff -u -r1.2 scaler.h
23 23 24 24 extern int Init_2xSaI (uint32 BitFormat); 25 25 extern void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, uint8 *dstPtr, 26 uint32 dstPitch, int width, int height);26 uint32 dstPitch, int x, int y, int width, int height); 27 27 extern void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, 28 uint8 *dstPtr, uint32 dstPitch, int width, int height);28 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 29 29 extern void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, 30 uint8 *dstPtr, uint32 dstPitch, int width, int height);30 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 31 31 extern void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, 32 uint8 *dstPtr, uint32 dstPitch, int width, int height);32 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 33 33 extern void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, 34 uint8 *dstPtr, uint32 dstPitch, int width, int height);34 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 35 35 extern void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, 36 uint8 *dstPtr, uint32 dstPitch, int width, int height);36 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 37 37 extern void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, 38 uint8 *dstPtr, uint32 dstPitch, int width, int height);38 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 39 39 extern void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, 40 uint8 *dstPtr, uint32 dstPitch, int width, int height); 40 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 41 extern void Ratio800(uint8 *srcPtr, uint32 srcPitch, uint8 *null, 42 uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height); 41 43 42 44 #endif -
common/system.h
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v retrieving revision 1.16 diff -u -r1.16 system.h
221 221 GFX_SUPER2XSAI = 4, 222 222 GFX_SUPEREAGLE = 5, 223 223 GFX_ADVMAME2X = 6, 224 GFX_TV2X = 7 224 GFX_TV2X = 7, 225 GFX_RATIO800 = 8 225 226 }; 226 227 227 228