Ticket #8883: mousepad-like-options.diff
File mousepad-like-options.diff, 15.9 KB (added by , 16 years ago) |
---|
-
backends/platform/ds/arm9/source/dsmain.cpp
197 197 int touchScX, touchScY, touchX, touchY; 198 198 int mouseHotspotX, mouseHotspotY; 199 199 bool cursorEnable = false; 200 bool mouseCursorVisible = true; 200 bool mouseCursorVisibleMain = true; 201 bool mouseCursorVisibleAux = true; 202 bool forceHoverMode = false; 201 203 bool rightButtonDown = false; 202 204 203 205 // Dragging … … 213 215 int gameHeight = 200; 214 216 215 217 // Scale 216 bool twoHundredPercentFixedScale = false;218 scaleSize fixedScaleSize = SCALESIZE_DYNAMIC; 217 219 bool cpuScalerEnable = false; 218 220 #define NUM_SUPPORTED_GAMES 20 219 221 … … 286 288 void triggerIcon(int imageNum); 287 289 void setIcon(int num, int x, int y, int imageNum, int flags, bool enable); 288 290 void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable); 291 void setIconAux(int num, int x, int y, int imageNum, int flags, bool enable); 289 292 void uploadSpriteGfx(); 290 293 291 294 TransferSound soundControl; … … 481 484 touchYOffset = y; 482 485 } 483 486 484 void set200PercentFixedScale(bool on) { 485 twoHundredPercentFixedScale = on; 487 void setForcedHoverMode(bool fhm) 488 { 489 forceHoverMode = fhm; 490 } 491 492 void setScaleSize(scaleSize size) { 493 fixedScaleSize = size; 486 494 } 487 495 488 496 void setUnscaledMode(bool enable) { … … 637 645 { 638 646 if (cursorEnable) { 639 647 sprites[1].attribute[0] = ATTR0_BMP | 150; 648 spritesMain[1].attribute[0] = ATTR0_BMP | 150; 640 649 } else { 641 650 sprites[1].attribute[0] = ATTR0_DISABLED; 651 spritesMain[1].attribute[0] = ATTR0_DISABLED; 642 652 } 643 653 644 654 } … … 646 656 cursorEnable = enable; 647 657 } 648 658 649 void setMouseCursorVisible(bool enable) 659 void setMouseCursorVisibleMain(bool enable) 660 { 661 mouseCursorVisibleMain = enable; 662 } 663 664 void setMouseCursorVisibleAux(bool enable) 650 665 { 651 mouseCursorVisible = enable;666 mouseCursorVisibleAux = enable; 652 667 } 653 668 654 669 void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY) { … … 730 745 sprites[1].attribute[0] = ATTR0_BMP | 150; 731 746 sprites[1].attribute[1] = ATTR1_SIZE_64 | pos; 732 747 sprites[1].attribute[2] = ATTR2_ALPHA(1) | 176; 748 spritesMain[1].attribute[0] = ATTR0_BMP | 150; 749 spritesMain[1].attribute[1] = ATTR1_SIZE_64 | pos; 750 spritesMain[1].attribute[2] = ATTR2_ALPHA(1) | 176; 733 751 } else { 734 752 sprites[1].attribute[0] = ATTR0_DISABLED | 150; 735 753 sprites[1].attribute[1] = ATTR1_SIZE_64 | pos; 736 754 sprites[1].attribute[2] = ATTR2_ALPHA(1) | 176; 755 spritesMain[1].attribute[0] = ATTR0_DISABLED | 150; 756 spritesMain[1].attribute[1] = ATTR1_SIZE_64 | pos; 757 spritesMain[1].attribute[2] = ATTR2_ALPHA(1) | 176; 737 758 } 738 759 } 739 760 … … 1295 1316 1296 1317 if (!getPenHeld() || (mouseMode != MOUSE_HOVER)) { 1297 1318 if (getKeysDown() & KEY_LEFT) { 1298 mouseMode = MOUSE_LEFT;1319 mouseMode = forceHoverMode ? MOUSE_HOVER : MOUSE_LEFT; 1299 1320 } 1300 1321 1301 1322 if (rightButtonDown) … … 1310 1331 1311 1332 if (getKeysDown() & KEY_RIGHT) { 1312 1333 if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) { 1313 mouseMode = MOUSE_RIGHT;1334 mouseMode = forceHoverMode ? MOUSE_HOVER : MOUSE_RIGHT; 1314 1335 } else { 1315 1336 // If we're playing sam and max, click and release the right mouse 1316 1337 // button to change verb … … 1549 1570 sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16); 1550 1571 } 1551 1572 1573 void setIconAux(int num, int x, int y, int imageNum, int flags, bool enable) { 1574 sprites[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0); 1575 sprites[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags; 1576 sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16); 1577 } 1578 1552 1579 void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) { 1553 1580 spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0); 1554 1581 spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags; … … 1579 1606 } 1580 1607 } 1581 1608 1582 setIcon(0, 208, 150, offs, 0, true); 1609 if (!forceHoverMode) 1610 { 1611 setIcon(0, 208, 150, offs, 0, true); 1612 } 1613 else 1614 { 1615 setIcon(0, 0, 0, 0, 0, false); 1616 } 1583 1617 1584 1618 if (indyFightState) { 1585 1619 setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true); … … 1599 1633 setIcon(0, 0, 0, 0, 0, false); 1600 1634 setIcon(1, 0, 0, 0, 0, false); 1601 1635 setIcon(2, 0, 0, 0, 0, false); 1602 setIcon(3, 0, 0, 0, 0, false);1603 1636 setIcon(4, 0, 0, 0, 0, false); 1604 1637 } 1605 1638 … … 1719 1752 void VBlankHandler(void) __attribute__ ((no_instrument_function)); 1720 1753 #endif 1721 1754 1755 bool getMouseCoords(bool auxscreen, int& X, int& Y) 1756 { 1757 if (auxscreen && gameScreenSwap) 1758 { 1759 if (isCpuScalerEnabled()) 1760 { 1761 X = (getPenX() << 8) / 320; 1762 Y = getPenY(); 1763 return Y <= 192; 1764 } 1765 else 1766 { 1767 return false; 1768 } 1769 } 1770 else if (auxscreen) 1771 { 1772 X = getPenX(); 1773 Y = getPenY(); 1774 int ssX = subScTargetX >> 8; 1775 int ssY = subScTargetY >> 8; 1776 1777 if ((ssX <= X)&&(ssY <= Y)&&(X <= ssX + subScreenWidth)&&(Y <= ssY + subScreenHeight)) 1778 { 1779 X = (((X - ssX)*256) / subScreenWidth) - mouseHotspotX; 1780 Y = (((Y - ssY)*192) / subScreenHeight) - mouseHotspotY; 1781 return true; 1782 } 1783 else 1784 { 1785 return false; 1786 } 1787 } 1788 else 1789 { 1790 X = storedMouseX - mouseHotspotX; 1791 Y = storedMouseY - mouseHotspotY; 1792 return true; 1793 } 1794 } 1795 1796 1722 1797 void VBlankHandler(void) { 1723 1798 // BG_PALETTE[0] = RGB15(31, 31, 31); 1724 1799 // if (*((int *) (0x023FFF00)) != 0xBEEFCAFE) { … … 1764 1839 1765 1840 frameCount++; 1766 1841 1767 if ((cursorEnable) && (mouseCursorVisible)) 1842 int X, Y; 1843 1844 if ((cursorEnable) && (mouseCursorVisibleMain)) 1768 1845 { 1769 1846 if (!keyboardEnable) { 1770 1847 storedMouseX = penX; 1771 1848 storedMouseY = penY; 1772 1849 } 1773 1774 setIconMain(3, storedMouseX - mouseHotspotX, storedMouseY - mouseHotspotY, 8, 0, true); 1850 1851 if (getMouseCoords(false, X, Y)) 1852 { 1853 setIconMain(3, X, Y, 8, 0, true); 1854 } 1855 else 1856 { 1857 setIconMain(3, 0, 0, 0, 0, false); 1858 } 1775 1859 } 1776 1860 else 1777 1861 { 1778 1862 setIconMain(3, 0, 0, 0, 0, false); 1779 1863 } 1864 1865 if ((cursorEnable) && (mouseCursorVisibleAux)) 1866 { 1867 if (!keyboardEnable) { 1868 storedMouseX = penX; 1869 storedMouseY = penY; 1870 } 1871 1872 if (getMouseCoords(true, X, Y)) 1873 { 1874 setIconAux(3, X, Y, 8, 0, true); 1875 } 1876 else 1877 { 1878 setIconAux(3, 0, 0, 0, 0, false); 1879 } 1880 } 1881 else 1882 { 1883 setIconAux(3, 0, 0, 0, 0, false); 1884 } 1780 1885 1781 1886 1782 1887 if (callback) { … … 1854 1959 int yCenter = subScTargetY + ((subScreenHeight >> 1) << 8); 1855 1960 1856 1961 1857 if (twoHundredPercentFixedScale) { 1962 if (fixedScaleSize == SCALESIZE_FIXED100) { 1963 subScreenWidth = 256; 1964 subScreenHeight = 192; 1965 } else if (fixedScaleSize == SCALESIZE_FIXED200) { 1858 1966 subScreenWidth = 256 >> 1; 1859 1967 subScreenHeight = 192 >> 1; 1860 1968 } else { … … 2187 2295 // This is a bodge to get around the fact that the cursor is turned on before it's image is set 2188 2296 // during startup in Sam & Max. This bodge moves the cursor offscreen so it is not seen. 2189 2297 sprites[1].attribute[1] = ATTR1_SIZE_64 | 192; 2298 spritesMain[1].attribute[1] = ATTR1_SIZE_64 | 192; 2190 2299 2191 2300 } 2192 2301 … … 2641 2750 2642 2751 2643 2752 lastEventFrame = 0; 2644 mouseMode = MOUSE_ LEFT;2753 mouseMode = MOUSE_HOVER; 2645 2754 2646 2755 2647 2756 /* … … 2692 2801 consolePrintf("The Legend of Kyrandia (KYRA)\n"); 2693 2802 consolePrintf("-------------------------------\n"); 2694 2803 #elif defined(DS_BUILD_G) 2695 consolePrintf("build F\n");2804 consolePrintf("build G\n"); 2696 2805 consolePrintf("Lure of the Temptress (LURE)\n"); 2697 2806 consolePrintf("-------------------------------\n"); 2698 2807 #endif -
backends/platform/ds/arm9/source/dsmain.h
30 30 31 31 namespace DS { 32 32 33 enum scaleSize { 34 SCALESIZE_DYNAMIC = 0, SCALESIZE_FIXED100, SCALESIZE_FIXED200, SCALESIZE_NUM_MODES 35 }; 33 36 34 37 enum controlType { 35 38 CONT_SCUMM_ORIGINAL, … … 80 83 81 84 void setTalkPos(int x, int y); 82 85 void setTopScreenTarget(int x, int y); 83 void set 200PercentFixedScale(bool on);86 void setScaleSize(scaleSize size); 84 87 85 88 // Timers 86 89 void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval … … 102 105 void setGameID(int id); 103 106 void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY); 104 107 void setShowCursor(bool enable); 105 void setMouseCursorVisible(bool visible); 108 109 110 // options 111 void setMouseCursorVisibleMain(bool visible); 112 void setMouseCursorVisibleAux(bool visible); 113 void setForcedHoverMode(bool fhm); 106 114 107 115 // Shake 108 116 void setShakePos(int shakePos); -
backends/platform/ds/arm9/source/dsoptions.cpp
54 54 55 55 new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter); 56 56 57 _leftHandedCheckbox = new GUI::CheckboxWidget(this, 5, 70, 130, 20, "Left handed mode", 0, 'L');57 _leftHandedCheckbox = new GUI::CheckboxWidget(this, 5, 85, 130, 20, "Left handed mode", 0, 'L'); 58 58 _indyFightCheckbox = new GUI::CheckboxWidget(this, 5, 40, 200, 20, "Indy fighting controls", 0, 'I'); 59 _twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 5, 55, 230, 20, "Zoomed screen at fixed 200% zoom", 0, 'T'); 59 60 _dynamicZoomCheckbox = new GUI::CheckboxWidget(this, 5, 55, 100, 20, "Dynamic Zoom", 0x20000003, 'T'); 61 _oneHundredPercentCheckbox = new GUI::CheckboxWidget(this, 105, 55, 90, 20, "Zoom 100%", 0x20000001, 'T'); 62 _twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 195, 55, 90, 20, "Zoom 200%", 0x20000002, 'T'); 63 60 64 _highQualityAudioCheckbox = new GUI::CheckboxWidget(this, 5, 25, 250, 20, "High quality audio (slower) (reboot)", 0, 'T'); 61 _disablePowerOff = new GUI::CheckboxWidget(this, 5, 85, 130, 20, "Disable power off", 0, 'T'); 62 _showCursorCheckbox = new GUI::CheckboxWidget(this, 5, 100, 130, 20, "Show mouse cursor", 0, 'T'); 65 _disablePowerOff = new GUI::CheckboxWidget(this, 5, 100, 130, 20, "Disable power off", 0, 'T'); 66 _showCursorMainCheckbox = new GUI::CheckboxWidget(this, 5, 130, 130, 20, "Show mouse cursor", 0, 'T'); 67 _showCursorAuxCheckbox = new GUI::CheckboxWidget(this, 140, 130, 170, 20, "Show mouse cursor (aux)", 0, 'T'); 68 _forceHoverMouseCheckbox = new GUI::CheckboxWidget(this, 5, 70, 130, 20, "Force hover mode", 0, 'T'); 63 69 64 70 //#ifdef ALLOW_CPU_SCALER 65 71 // _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T'); … … 107 113 #endif 108 114 } 109 115 110 if (ConfMan.hasKey("showcursor", "ds")) { 111 _showCursorCheckbox->setState(ConfMan.getBool("showcursor", "ds")); 116 if (ConfMan.hasKey("showcursorMain", "ds")) { 117 _showCursorMainCheckbox->setState(ConfMan.getBool("showcursorMain", "ds")); 118 } else { 119 _showCursorMainCheckbox->setState(true); 120 } 121 122 if (ConfMan.hasKey("showcursorAux", "ds")) { 123 _showCursorAuxCheckbox->setState(ConfMan.getBool("showcursorAux", "ds")); 112 124 } else { 113 _showCursorCheckbox->setState(true); 125 _showCursorAuxCheckbox->setState(true); 126 } 127 128 if (ConfMan.hasKey("forceHover", "ds")) { 129 _forceHoverMouseCheckbox->setState(ConfMan.getBool("forceHover", "ds")); 130 } else { 131 _forceHoverMouseCheckbox->setState(false); 114 132 } 115 133 116 134 if (ConfMan.hasKey("lefthanded", "ds")) { … … 125 143 _unscaledCheckbox->setState(false); 126 144 } 127 145 128 if (ConfMan.hasKey("twohundredpercent", "ds")) { 129 _twoHundredPercentCheckbox->setState(ConfMan.getBool("twohundredpercent", "ds")); 146 if (ConfMan.hasKey("scalesize", "ds")) { 147 int scalesize = ConfMan.getInt("scalesize", "ds"); 148 _twoHundredPercentCheckbox->setState(scalesize == (int)SCALESIZE_FIXED200); 149 _oneHundredPercentCheckbox->setState(scalesize == (int)SCALESIZE_FIXED100); 150 _dynamicZoomCheckbox->setState((scalesize != (int)SCALESIZE_FIXED100)&&(scalesize != (int)SCALESIZE_FIXED200)); 130 151 } else { 131 152 _twoHundredPercentCheckbox->setState(false); 153 _oneHundredPercentCheckbox->setState(false); 154 _dynamicZoomCheckbox->setState(true); 132 155 } 133 156 134 157 if (ConfMan.hasKey("22khzaudio", "ds")) { … … 180 203 void DSOptionsDialog::updateConfigManager() { 181 204 ConfMan.setBool("lefthanded", _leftHandedCheckbox->getState(), "ds"); 182 205 ConfMan.setBool("unscaled", _unscaledCheckbox->getState(), "ds"); 183 ConfMan.setBool("twohundredpercent", _twoHundredPercentCheckbox->getState(), "ds"); 206 207 if (_twoHundredPercentCheckbox->getState()) { 208 ConfMan.setInt("scalesize", (int)SCALESIZE_FIXED200, "ds"); 209 } else if (_oneHundredPercentCheckbox->getState()) { 210 ConfMan.setInt("scalesize", (int)SCALESIZE_FIXED100, "ds"); 211 } else { 212 ConfMan.setInt("scalesize", (int)SCALESIZE_DYNAMIC, "ds"); 213 } 214 184 215 ConfMan.setBool("22khzaudio", _highQualityAudioCheckbox->getState(), "ds"); 185 216 ConfMan.setBool("disablepoweroff", _disablePowerOff->getState(), "ds"); 186 217 #ifdef ALLOW_CPU_SCALER … … 188 219 #endif 189 220 ConfMan.setInt("xoffset", _touchX->getValue(), "ds"); 190 221 ConfMan.setInt("yoffset", _touchY->getValue(), "ds"); 191 ConfMan.setBool("showcursor", _showCursorCheckbox->getState(), "ds"); 222 ConfMan.setBool("showcursorMain", _showCursorMainCheckbox->getState(), "ds"); 223 ConfMan.setBool("showcursorAux", _showCursorAuxCheckbox->getState(), "ds"); 224 ConfMan.setBool("forceHover", _forceHoverMouseCheckbox->getState(), "ds"); 192 225 ConfMan.setBool("snaptoborder", _snapToBorderCheckbox->getState(), "ds"); 193 226 DS::setOptions(); 194 227 } … … 222 255 _unscaledCheckbox->setState(true); 223 256 } 224 257 } 258 else if ((cmd & 0xFF000000) == 0x20000000) 259 { 260 _dynamicZoomCheckbox->setState((sender == _dynamicZoomCheckbox) && (cmd == 0x20000003)); 261 _oneHundredPercentCheckbox->setState((sender == _oneHundredPercentCheckbox) && (cmd == 0x20000001)); 262 _twoHundredPercentCheckbox->setState((sender == _twoHundredPercentCheckbox) && (cmd == 0x20000002)); 263 } 225 264 226 265 guard = false; 227 266 … … 305 344 DS::setLeftHanded(false); 306 345 } 307 346 308 if (ConfMan.hasKey("showcursor", "ds")) { 309 DS::setMouseCursorVisible(ConfMan.getBool("showcursor", "ds")); 347 if (ConfMan.hasKey("showcursorMain", "ds")) { 348 DS::setMouseCursorVisibleMain(ConfMan.getBool("showcursorMain", "ds")); 349 } else { 350 DS::setMouseCursorVisibleMain(true); 351 } 352 353 if (ConfMan.hasKey("showcursorAux", "ds")) { 354 DS::setMouseCursorVisibleAux(ConfMan.getBool("showcursorAux", "ds")); 310 355 } else { 311 DS::setMouseCursorVisible (true);356 DS::setMouseCursorVisibleAux(true); 312 357 } 313 358 359 if (ConfMan.hasKey("forceHover", "ds")) { 360 DS::setForcedHoverMode(ConfMan.getBool("forceHover", "ds")); 361 } else { 362 DS::setForcedHoverMode(false); 363 } 364 314 365 if (ConfMan.hasKey("snaptoborder", "ds")) { 315 366 DS::setSnapToBorder(ConfMan.getBool("snaptoborder", "ds")); 316 367 } else { … … 327 378 DS::setUnscaledMode(false); 328 379 } 329 380 330 if (ConfMan.hasKey(" twohundredpercent", "ds")) {331 DS::set 200PercentFixedScale(ConfMan.getBool("twohundredpercent", "ds"));381 if (ConfMan.hasKey("scalesize", "ds")) { 382 DS::setScaleSize((scaleSize)ConfMan.getInt("scalesize", "ds")); 332 383 } else { 333 DS::set 200PercentFixedScale(false);384 DS::setScaleSize(SCALESIZE_DYNAMIC); 334 385 } 335 386 336 387 if (ConfMan.hasKey("xoffset", "ds")) { -
backends/platform/ds/arm9/source/dsoptions.h
50 50 GUI::CheckboxWidget* _leftHandedCheckbox; 51 51 GUI::CheckboxWidget* _unscaledCheckbox; 52 52 GUI::CheckboxWidget* _twoHundredPercentCheckbox; 53 GUI::CheckboxWidget* _oneHundredPercentCheckbox; 54 GUI::CheckboxWidget* _dynamicZoomCheckbox; 53 55 GUI::CheckboxWidget* _indyFightCheckbox; 54 56 GUI::CheckboxWidget* _highQualityAudioCheckbox; 55 57 GUI::CheckboxWidget* _disablePowerOff; 56 GUI::CheckboxWidget* _showCursorCheckbox; 58 GUI::CheckboxWidget* _showCursorMainCheckbox; 59 GUI::CheckboxWidget* _showCursorAuxCheckbox; 60 GUI::CheckboxWidget* _forceHoverMouseCheckbox; 57 61 GUI::CheckboxWidget* _snapToBorderCheckbox; 58 62 59 63 GUI::CheckboxWidget* _hardScaler;