Ticket #8398: cga.v1.patch
File cga.v1.patch, 13.7 KB (added by , 19 years ago) |
---|
-
base/gameDetector.cpp
Index: base/gameDetector.cpp RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v retrieving revision 1.99 diff -u -r1.99 gameDetector.cpp
96 96 " --native-mt32 True Roland MT-32 (disable GM emulation)\n" 97 97 " --output-rate=RATE Select output sample rate in Hz (e.g. 22050)\n" 98 98 " --aspect-ratio Enable aspect ratio correction\n" 99 " --render-mode=MODE Enable additional render modes (cga, ega, herc)\n" 99 100 "\n" 100 101 #if !defined(DISABLE_SKY) || !defined(DISABLE_QUEEN) 101 102 " --alt-intro Use alternative intro for CD versions of Beneath a\n" … … 122 123 ConfMan.registerDefault("fullscreen", false); 123 124 ConfMan.registerDefault("aspect_ratio", false); 124 125 ConfMan.registerDefault("gfx_mode", "normal"); 126 ConfMan.registerDefault("render_mode", "default"); 125 127 126 128 // Sound & Music 127 129 ConfMan.registerDefault("music_volume", 192); … … 478 480 ConfMan.set("aspect_ratio", cmdValue, kTransientDomain); 479 481 END_OPTION 480 482 483 DO_LONG_OPTION("render-mode") 484 int renderMode = Common::parseRenderMode(option); 485 if (renderMode == Common::kRenderDefault) 486 goto ShowHelpAndExit; 487 488 ConfMan.set("render_mode", option, kTransientDomain); 489 END_OPTION 490 481 491 DO_LONG_OPTION("savepath") 482 492 // TODO: Verify whether the path is valid 483 493 ConfMan.set("savepath", option, kTransientDomain); -
common/util.cpp
RCS file: /cvsroot/scummvm/scummvm/common/util.cpp,v retrieving revision 1.47 diff -u -r1.47 util.cpp
219 219 } 220 220 221 221 222 #pragma mark - 223 224 225 const RenderModeDescription g_renderModes[] = { 226 {"herc", "Hercules", kRenderHerc}, 227 {"cga", "CGA", kRenderCGA}, 228 {"ega", "EGA", kRenderEGA}, 229 {0, 0, kRenderDefault} 230 }; 231 232 RenderMode parseRenderMode(const String &str) { 233 if (str.isEmpty()) 234 return kRenderDefault; 235 236 const char *s = str.c_str(); 237 const RenderModeDescription *l = g_renderModes; 238 for (; l->code; ++l) { 239 if (!scumm_stricmp(l->code, s)) 240 return l->id; 241 } 242 243 return kRenderDefault; 244 } 245 246 const char *getRenderModeCode(RenderMode id) { 247 const RenderModeDescription *l = g_renderModes; 248 for (; l->code; ++l) { 249 if (l->id == id) 250 return l->code; 251 } 252 return 0; 253 } 254 255 const char *getRenderModeDescription(RenderMode id) { 256 const RenderModeDescription *l = g_renderModes; 257 for (; l->code; ++l) { 258 if (l->id == id) 259 return l->description; 260 } 261 return 0; 262 } 263 222 264 223 265 } // End of namespace Common -
common/util.h
RCS file: /cvsroot/scummvm/scummvm/common/util.h,v retrieving revision 1.46 diff -u -r1.46 util.h
147 147 148 148 extern const PlatformDescription g_platforms[]; 149 149 150 151 150 /** Convert a string containing a platform name into a Platform enum value. */ 152 151 extern Platform parsePlatform(const String &str); 153 152 extern const char *getPlatformCode(Platform id); 154 153 extern const char *getPlatformDescription(Platform id); 155 154 155 /** 156 * List of render modes. It specifies which original graphics mode 157 * to use. Some targets used postprocessing dithering routines for 158 * reducing color depth of final image which let it to be rendered on 159 * such low-level adapters as CGA or Hercules. 160 */ 161 enum RenderMode { 162 kRenderDefault = -1, 163 kRenderEGA = 0, 164 kRenderCGA = 1, 165 kRenderHerc = 2 166 }; 167 168 struct RenderModeDescription { 169 const char *code; 170 const char *description; 171 Common::RenderMode id; 172 }; 173 174 extern const RenderModeDescription g_renderModes[]; 175 176 /** Convert a string containing a render mode name into a RenderingMode enum value. */ 177 extern RenderMode parseRenderMode(const String &str); 178 extern const char *getRenderModeCode(RenderMode id); 179 extern const char *getRenderModeDescription(RenderMode id); 180 156 181 } // End of namespace Common 157 182 158 183 -
gui/options.cpp
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v retrieving revision 1.68 diff -u -r1.68 options.cpp
75 75 : Dialog(x, y, w, h), 76 76 _domain(domain), 77 77 _enableGraphicSettings(false), 78 _gfxPopUp(0), _ fullscreenCheckbox(0), _aspectCheckbox(0),78 _gfxPopUp(0), _renderModePopUp(0), _fullscreenCheckbox(0), _aspectCheckbox(0), 79 79 _enableAudioSettings(false), 80 80 _multiMidiCheckbox(0), _mt32Checkbox(0), _subCheckbox(0), 81 81 _enableVolumeSettings(false), … … 108 108 } 109 109 } 110 110 111 _renderModePopUp->setSelected(0); 112 113 if (ConfMan.hasKey("render_mode", _domain)) { 114 const Common::RenderModeDescription *p = Common::g_renderModes; 115 const Common::RenderMode renderMode = Common::parseRenderMode(ConfMan.get("render_mode", _domain)); 116 int sel = 0; 117 for (int i = 0; p->code; ++p, ++i) { 118 if (renderMode == p->id) 119 sel = i + 2; 120 } 121 _renderModePopUp->setSelected(sel); 122 } 123 111 124 #ifndef _WIN32_WCE 112 125 // Fullscreen setting 113 126 _fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain)); … … 167 180 168 181 if ((int32)_gfxPopUp->getSelectedTag() >= 0) 169 182 ConfMan.set("gfx_mode", _gfxPopUp->getSelectedString(), _domain); 183 184 if ((int32)_renderModePopUp->getSelectedTag() >= 0) 185 ConfMan.set("render_mode", _renderModePopUp->getSelectedString(), _domain); 170 186 } else { 171 187 ConfMan.removeKey("fullscreen", _domain); 172 188 ConfMan.removeKey("aspect_ratio", _domain); 173 189 ConfMan.removeKey("gfx_mode", _domain); 190 ConfMan.removeKey("render_mode", _domain); 174 191 } 175 192 } 176 193 … … 240 257 _enableGraphicSettings = enabled; 241 258 242 259 _gfxPopUp->setEnabled(enabled); 260 _renderModePopUp->setEnabled(enabled); 243 261 #ifndef _WIN32_WCE 244 262 _fullscreenCheckbox->setEnabled(enabled); 245 263 _aspectCheckbox->setEnabled(enabled); … … 282 300 gm++; 283 301 } 284 302 303 // RenderMode popup 304 _renderModePopUp = new PopUpWidget(boss, x-5, yoffset, w+5, kLineHeight, "Render mode: ", 100); 305 yoffset += 16; 306 _renderModePopUp->appendEntry("<default>"); 307 _renderModePopUp->appendEntry(""); 308 const Common::RenderModeDescription *rm = Common::g_renderModes; 309 for (; rm->code; ++rm) { 310 _renderModePopUp->appendEntry(rm->description, rm->id); 311 } 312 285 313 // Fullscreen checkbox 286 314 _fullscreenCheckbox = new CheckboxWidget(boss, x, yoffset, w, 16, "Fullscreen mode"); 287 315 yoffset += 16; -
gui/options.h
RCS file: /cvsroot/scummvm/scummvm/gui/options.h,v retrieving revision 1.24 diff -u -r1.24 options.h
71 71 PopUpWidget *_gfxPopUp; 72 72 CheckboxWidget *_fullscreenCheckbox; 73 73 CheckboxWidget *_aspectCheckbox; 74 PopUpWidget *_renderModePopUp; 74 75 75 76 // 76 77 // Audio controls -
scumm/actor.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v retrieving revision 1.319 diff -u -r1.319 actor.cpp
1400 1400 } else if (_vm->_features & GF_OLD_BUNDLE) { 1401 1401 for (i = 0; i < 16; i++) 1402 1402 palette[i] = i; 1403 1404 // Make stuff more visible on CGA. Based on disassembly 1405 if (_vm->_features & GF_16COLOR && _vm->_renderMode == Common::kRenderCGA) { 1406 palette[6] = 5; 1407 palette[7] = 15; 1408 } 1403 1409 } else { 1404 1410 for (i = 0; i < 32; i++) 1405 1411 palette[i] = 0xFF; -
scumm/charset.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v retrieving revision 2.124 diff -u -r2.124 charset.cpp
1269 1269 if (chr == '@') 1270 1270 return; 1271 1271 1272 // Based on disassembly 1272 1273 _vm->_charsetColorMap[1] = _color; 1274 if (_vm->_features & GF_16COLOR && _vm->_renderMode == Common::kRenderCGA) { 1275 static byte CGAtextColorMap[16] = {0, 3, 3, 3, 5, 5, 5, 15, 1276 15, 3, 3, 3, 5, 5, 15, 15}; 1277 _color = CGAtextColorMap[_color & 0x0f]; 1278 is2byte = 0; 1279 } 1280 1281 if (_vm->_features & GF_16COLOR && _vm->_renderMode == Common::kRenderHerc) { 1282 static byte HercTextColorMap[16] = {0, 15, 2, 15, 15, 5, 15, 15, 1283 8, 15, 15, 15, 15, 15, 15, 15}; 1284 _color = HercTextColorMap[_color & 0x0f]; 1285 is2byte = 0; 1286 } 1287 1273 1288 1274 1289 int type = *_fontPtr; 1275 1290 if (is2byte) { -
scumm/gfx.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v retrieving revision 2.387 diff -u -r2.387 gfx.cpp
508 508 dst += _vm->_screenWidth; 509 509 text += _textSurface.pitch; 510 510 } 511 511 512 if (_vm->_features & GF_16COLOR && _vm->_renderMode == Common::kRenderCGA) 513 ditherCGA(_compositeBuf + x + y * _vm->_screenWidth, _vm->_screenWidth, x, y, width, height); 514 512 515 // Finally blit the whole thing to the screen 513 516 _vm->_system->copyRectToScreen(_compositeBuf + x + y * _vm->_screenWidth, _vm->_screenWidth, x, y, width, height); 514 517 } 515 518 519 // CGA 520 // indy3 loom maniac monkey1 zak 521 // 522 // Herc 523 // maniac monkey1 zak 524 // 525 // EGA 526 // monkey2 loom maniac monkey1 atlantis indy3 zak loomcd 527 528 // CGA dithers 4x4 square with direct substitutes 529 // Odd lines have colors swapped, so there will be checkered patterns. 530 // But apparently there is a mistake for 10th color. 531 void Gdi::ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const { 532 byte *ptr; 533 int idx1, idx2; 534 static byte cgaDither[2][2][16] = { 535 {{0, 1, 0, 1, 2, 2, 0, 0, 3, 1, 3, 1, 3, 2, 1, 3}, 536 {0, 0, 1, 1, 0, 2, 2, 3, 0, 3, 1, 1, 3, 3, 1, 3}}, 537 {{0, 0, 1, 1, 0, 2, 2, 3, 0, 3, 1, 1, 3, 3, 1, 3}, 538 {0, 1, 0, 1, 2, 2, 0, 0, 3, 1, 1, 1, 3, 2, 1, 3}}}; 539 540 for (int y1 = 0; y1 < height; y1++) { 541 ptr = dst + y1 * dstPitch; 542 543 idx1 = (y + y1) % 2; 544 for (int x1 = 0; x1 < width; x1++) { 545 idx2 = (x + x1) % 2; 546 *ptr++ = cgaDither[idx1][idx2][*ptr & 0xF]; 547 } 548 } 549 } 550 551 516 552 #pragma mark - 517 553 #pragma mark --- Background buffers & charset mask --- 518 554 #pragma mark - -
scumm/gfx.h
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v retrieving revision 1.99 diff -u -r1.99 gfx.h
256 256 /* Misc */ 257 257 void drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b); 258 258 void updateDirtyScreen(VirtScreen *vs); 259 259 void ditherCGA(byte *dst, int dstPitch, int x, int y, int width, int height) const; 260 260 261 byte *getMaskBuffer(int x, int y, int z); 261 262 262 263 int getZPlanes(const byte *smap_ptr, const byte *zplane_list[9], bool bmapImage) const; -
scumm/palette.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/palette.cpp,v retrieving revision 2.22 diff -u -r2.22 palette.cpp
48 48 setPalColor(15, 255, 255, 255); 49 49 } 50 50 51 void ScummEngine::setupCGAPalette() { 52 setPalColor( 0, 0, 0, 0); 53 setPalColor( 1, 0, 168, 168); 54 setPalColor( 2, 168, 0, 168); 55 setPalColor( 3, 168, 168, 168); 56 57 // Setup cursor palette 58 setPalColor( 7, 170, 170, 170); 59 setPalColor( 8, 85, 85, 85); 60 setPalColor(15, 255, 255, 255); 61 } 62 51 63 void ScummEngine::setupEGAPalette() { 52 64 setPalColor( 0, 0, 0, 0); 53 65 setPalColor( 1, 0, 0, 170); -
scumm/scumm.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v retrieving revision 1.322 diff -u -r1.322 scumm.cpp
981 981 } 982 982 _confirmExit = ConfMan.getBool("confirm_exit"); 983 983 984 if (ConfMan.hasKey("render_mode")) { 985 _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); 986 } 987 984 988 _hexdumpScripts = false; 985 989 _showStack = false; 986 990 … … 1252 1256 _shadowPalette[i] = i; 1253 1257 if ((_features & GF_AMIGA) || (_features & GF_ATARI_ST)) 1254 1258 setupAmigaPalette(); 1259 else if (_renderMode == Common::kRenderCGA) 1260 setupCGAPalette(); 1255 1261 else 1256 1262 setupEGAPalette(); 1257 1263 } -
scumm/scumm.h
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v retrieving revision 1.531 diff -u -r1.531 scumm.h
870 870 int _screenStartStrip, _screenEndStrip; 871 871 int _screenTop; 872 872 873 Common::RenderMode _renderMode; 874 873 875 protected: 874 876 ColorCycle _colorCycle[16]; // Palette cycles 875 877 … … 932 934 933 935 const byte *getPalettePtr(int palindex, int room); 934 936 void setupAmigaPalette(); 937 void setupCGAPalette(); 935 938 void setupEGAPalette(); 936 939 void setupV1ManiacPalette(); 937 940 void setupV1ZakPalette(); -
scumm/vars.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/vars.cpp,v retrieving revision 1.113 diff -u -r1.113 vars.cpp
553 553 VAR(VAR_VIDEOMODE) = 50; 554 554 else if (_gameId == GID_MONKEY2 && (_features & GF_AMIGA)) 555 555 VAR(VAR_VIDEOMODE) = 82; 556 else if (_features & GF_16COLOR && _renderMode == Common::kRenderCGA) 557 VAR(VAR_VIDEOMODE) = 4; 556 558 else 557 559 VAR(VAR_VIDEOMODE) = 19; 558 560 if (_gameId == GID_LOOM && _features & GF_OLD_BUNDLE) {