2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-07-09 11:47:17 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dsoptions.h"
|
|
|
|
#include "dsmain.h"
|
|
|
|
#include "gui/dialog.h"
|
|
|
|
#include "gui/newgui.h"
|
2006-07-09 14:46:04 +00:00
|
|
|
#include "gui/ListWidget.h"
|
2006-07-09 11:47:17 +00:00
|
|
|
#include "osystem_ds.h"
|
|
|
|
#include "engines/scumm/scumm.h"
|
|
|
|
#include "touchkeyboard.h"
|
|
|
|
|
2007-12-05 22:19:33 +00:00
|
|
|
#define ALLOW_CPU_SCALER
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
#ifdef DS_SCUMM_BUILD
|
|
|
|
namespace Scumm {
|
|
|
|
extern Common::StringList generateSavegameList(Scumm::ScummEngine *scumm, bool saveMode);
|
|
|
|
extern Scumm::ScummEngine *g_scumm;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace DS {
|
|
|
|
|
2007-10-13 15:40:11 +00:00
|
|
|
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
|
|
|
|
addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
|
2006-07-09 11:47:17 +00:00
|
|
|
|
|
|
|
#ifdef DS_SCUMM_BUILD
|
|
|
|
if (!DS::isGBAMPAvailable()) {
|
|
|
|
// addButton(this, 100, 140, "Delete Save", 'dels', 'D');
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-11-03 23:16:29 +00:00
|
|
|
new GUI::StaticTextWidget(this, 80, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter);
|
2006-07-09 11:47:17 +00:00
|
|
|
|
2006-11-03 23:16:29 +00:00
|
|
|
_leftHandedCheckbox = new GUI::CheckboxWidget(this, 20, 25, 200, 20, "Left handed mode", 0, 'L');
|
|
|
|
_indyFightCheckbox = new GUI::CheckboxWidget(this, 20, 40, 200, 20, "Indy fighting controls", 0, 'I');
|
|
|
|
_unscaledCheckbox = new GUI::CheckboxWidget(this, 20, 55, 200, 20, "Unscaled main screen", 0, 'S');
|
|
|
|
_twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 20, 70, 230, 20, "Zoomed screen at fixed 200% zoom", 0, 'T');
|
|
|
|
_highQualityAudioCheckbox = new GUI::CheckboxWidget(this, 20, 85, 250, 20, "High quality audio (slower) (reboot)", 0, 'T');
|
|
|
|
_disablePowerOff = new GUI::CheckboxWidget(this, 20, 100, 250, 20, "Disable power off on quit", 0, 'T');
|
2007-12-05 22:19:33 +00:00
|
|
|
_showCursorCheckbox = new GUI::CheckboxWidget(this, 20, 115, 130, 20, "Show mouse cursor", 0, 'T');
|
|
|
|
#ifdef ALLOW_CPU_SCALER
|
|
|
|
_cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T');
|
|
|
|
#endif
|
2007-10-13 15:40:11 +00:00
|
|
|
_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 20, 130, 250, 20, "Snap to border", 0, 'T');
|
2006-07-09 11:47:17 +00:00
|
|
|
|
2007-10-13 15:40:11 +00:00
|
|
|
new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
|
|
|
|
_touchX = new GUI::SliderWidget(this, 130, 145, 130, 12, 1);
|
2006-07-09 11:47:17 +00:00
|
|
|
_touchX->setMinValue(-8);
|
|
|
|
_touchX->setMaxValue(+8);
|
|
|
|
_touchX->setValue(0);
|
|
|
|
_touchX->setFlags(GUI::WIDGET_CLEARBG);
|
|
|
|
|
2007-10-13 15:40:11 +00:00
|
|
|
new GUI::StaticTextWidget(this, 20, 160, 110, 15, "Touch Y Offset", GUI::kTextAlignLeft);
|
|
|
|
_touchY = new GUI::SliderWidget(this, 130, 160, 130, 12, 2);
|
2006-07-09 11:47:17 +00:00
|
|
|
_touchY->setMinValue(-8);
|
|
|
|
_touchY->setMaxValue(+8);
|
|
|
|
_touchY->setValue(0);
|
|
|
|
_touchY->setFlags(GUI::WIDGET_CLEARBG);
|
|
|
|
|
2007-10-13 15:40:11 +00:00
|
|
|
new GUI::StaticTextWidget(this, 130 + 65 - 10, 175, 20, 15, "0", GUI::kTextAlignCenter);
|
|
|
|
new GUI::StaticTextWidget(this, 130 + 130 - 10, 175, 20, 15, "8", GUI::kTextAlignCenter);
|
|
|
|
new GUI::StaticTextWidget(this, 130 - 10, 175, 20, 15, "-8", GUI::kTextAlignCenter);
|
2006-07-09 11:47:17 +00:00
|
|
|
|
|
|
|
#ifdef DS_SCUMM_BUILD
|
|
|
|
_delDialog = new Scumm::SaveLoadChooser("Delete game:", "Delete", false, Scumm::g_scumm);
|
|
|
|
#endif
|
|
|
|
|
2007-10-13 15:40:11 +00:00
|
|
|
if (ConfMan.hasKey("snaptoborder", "ds")) {
|
|
|
|
_snapToBorderCheckbox->setState(ConfMan.getBool("snaptoborder", "ds"));
|
|
|
|
} else {
|
|
|
|
#ifdef DS_BUILD_D
|
|
|
|
_snapToBorderCheckbox->setState(true);
|
|
|
|
#else
|
|
|
|
_snapToBorderCheckbox->setState(false);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-06-30 23:03:03 +00:00
|
|
|
if (ConfMan.hasKey("showcursor", "ds")) {
|
|
|
|
_showCursorCheckbox->setState(ConfMan.getBool("showcursor", "ds"));
|
|
|
|
} else {
|
2007-10-13 15:40:11 +00:00
|
|
|
_showCursorCheckbox->setState(true);
|
2007-06-30 23:03:03 +00:00
|
|
|
}
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
if (ConfMan.hasKey("lefthanded", "ds")) {
|
|
|
|
_leftHandedCheckbox->setState(ConfMan.getBool("lefthanded", "ds"));
|
|
|
|
} else {
|
|
|
|
_leftHandedCheckbox->setState(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("unscaled", "ds")) {
|
|
|
|
_unscaledCheckbox->setState(ConfMan.getBool("unscaled", "ds"));
|
|
|
|
} else {
|
|
|
|
_unscaledCheckbox->setState(false);
|
|
|
|
}
|
2006-11-03 23:16:29 +00:00
|
|
|
|
|
|
|
if (ConfMan.hasKey("twohundredpercent", "ds")) {
|
|
|
|
_twoHundredPercentCheckbox->setState(ConfMan.getBool("twohundredpercent", "ds"));
|
|
|
|
} else {
|
|
|
|
_twoHundredPercentCheckbox->setState(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("22khzaudio", "ds")) {
|
|
|
|
_highQualityAudioCheckbox->setState(ConfMan.getBool("22khzaudio", "ds"));
|
|
|
|
} else {
|
|
|
|
_highQualityAudioCheckbox->setState(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("disablepoweroff", "ds")) {
|
|
|
|
_disablePowerOff->setState(ConfMan.getBool("disablepoweroff", "ds"));
|
|
|
|
} else {
|
|
|
|
_disablePowerOff->setState(false);
|
|
|
|
}
|
2007-12-05 22:19:33 +00:00
|
|
|
|
|
|
|
#ifdef ALLOW_CPU_SCALER
|
2007-02-13 21:04:31 +00:00
|
|
|
if (ConfMan.hasKey("cpu_scaler", "ds")) {
|
|
|
|
_cpuScaler->setState(ConfMan.getBool("cpu_scaler", "ds"));
|
|
|
|
} else {
|
|
|
|
_cpuScaler->setState(false);
|
|
|
|
}
|
2007-12-05 22:19:33 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
_indyFightCheckbox->setState(DS::getIndyFightState());
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("xoffset", "ds")) {
|
|
|
|
_touchX->setValue(ConfMan.getInt("xoffset", "ds"));
|
|
|
|
} else {
|
|
|
|
_touchX->setValue(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("yoffset", "ds")) {
|
|
|
|
_touchY->setValue(ConfMan.getInt("yoffset", "ds"));
|
|
|
|
} else {
|
|
|
|
_touchY->setValue(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DSOptionsDialog::~DSOptionsDialog() {
|
|
|
|
ConfMan.setBool("lefthanded", _leftHandedCheckbox->getState(), "ds");
|
|
|
|
ConfMan.setBool("unscaled", _unscaledCheckbox->getState(), "ds");
|
2006-11-03 23:16:29 +00:00
|
|
|
ConfMan.setBool("twohundredpercent", _twoHundredPercentCheckbox->getState(), "ds");
|
|
|
|
ConfMan.setBool("22khzaudio", _highQualityAudioCheckbox->getState(), "ds");
|
|
|
|
ConfMan.setBool("disablepoweroff", _disablePowerOff->getState(), "ds");
|
2007-12-05 22:19:33 +00:00
|
|
|
#ifdef ALLOW_CPU_SCALER
|
|
|
|
ConfMan.setBool("cpu_scaler", _cpuScaler->getState(), "ds");
|
|
|
|
#endif
|
2006-07-09 11:47:17 +00:00
|
|
|
ConfMan.setInt("xoffset", _touchX->getValue(), "ds");
|
|
|
|
ConfMan.setInt("yoffset", _touchY->getValue(), "ds");
|
2007-06-30 23:03:03 +00:00
|
|
|
ConfMan.setBool("showcursor", _showCursorCheckbox->getState(), "ds");
|
2007-10-13 15:40:11 +00:00
|
|
|
ConfMan.setBool("snaptoborder", _snapToBorderCheckbox->getState(), "ds");
|
2006-07-09 11:47:17 +00:00
|
|
|
DS::setOptions();
|
|
|
|
DS::setIndyFightState(_indyFightCheckbox->getState());
|
|
|
|
ConfMan.flushToDisk();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
|
|
|
|
if (cmd == GUI::kCloseCmd) {
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DS_SCUMM_BUILD
|
|
|
|
/* if (cmd == 'dels') {
|
|
|
|
_delDialog->setList(Scumm::generateSavegameList(Scumm::g_scumm, false));
|
|
|
|
_delDialog->handleCommand(NULL, GUI::kListSelectionChangedCmd, 0);
|
|
|
|
|
2007-03-17 19:02:05 +00:00
|
|
|
Common::Event event;
|
|
|
|
event.type = Common::EVENT_KEYDOWN;
|
2007-06-22 20:04:44 +00:00
|
|
|
event.kbd.ascii = 0;
|
|
|
|
event.kbd.keycode = Common::KEYCODE_DOWN;
|
2006-07-09 11:47:17 +00:00
|
|
|
OSystem_DS::instance()->addEvent(event);
|
|
|
|
|
2007-03-17 19:02:05 +00:00
|
|
|
event.type = Common::EVENT_KEYUP;
|
2006-07-09 11:47:17 +00:00
|
|
|
OSystem_DS::instance()->addEvent(event);
|
|
|
|
|
|
|
|
int idx = _delDialog->runModal();
|
|
|
|
|
|
|
|
if (idx >= 0) {
|
|
|
|
char name[256];
|
|
|
|
Scumm::g_scumm->makeSavegameName(name, idx, false);
|
|
|
|
if (!DS::isGBAMPAvailable()) {
|
|
|
|
((DSSaveFileManager *) (OSystem_DS::instance()->getSavefileManager()))->deleteFile(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}*/
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-06-30 23:03:03 +00:00
|
|
|
void togglePause() {
|
|
|
|
// Toggle pause mode by simulating pressing 'p'. Not a good way of doing things!
|
|
|
|
|
|
|
|
if (getCurrentGame()->control == CONT_SCUMM_ORIGINAL) {
|
|
|
|
Common::Event event;
|
|
|
|
OSystem_DS* system = OSystem_DS::instance();
|
|
|
|
|
|
|
|
event.type = Common::EVENT_KEYDOWN;
|
2007-08-18 11:10:41 +00:00
|
|
|
event.kbd.keycode = Common::KEYCODE_p;
|
2007-06-30 23:03:03 +00:00
|
|
|
event.kbd.ascii = 'p';
|
|
|
|
event.kbd.flags = 0;
|
|
|
|
system->addEvent(event);
|
|
|
|
|
|
|
|
event.type = Common::EVENT_KEYUP;
|
|
|
|
system->addEvent(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
void showOptionsDialog() {
|
|
|
|
|
2007-06-30 23:03:03 +00:00
|
|
|
togglePause();
|
2006-07-09 11:47:17 +00:00
|
|
|
|
|
|
|
DS::displayMode16Bit();
|
|
|
|
|
|
|
|
|
|
|
|
DSOptionsDialog* d = new DSOptionsDialog();
|
|
|
|
d->runModal();
|
|
|
|
delete d;
|
|
|
|
|
|
|
|
|
|
|
|
DS::displayMode8Bit();
|
|
|
|
|
2007-06-30 23:03:03 +00:00
|
|
|
togglePause();
|
2006-07-09 11:47:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setOptions() {
|
|
|
|
ConfMan.addGameDomain("ds");
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("lefthanded", "ds")) {
|
|
|
|
DS::setLeftHanded(ConfMan.getBool("lefthanded", "ds"));
|
|
|
|
} else {
|
|
|
|
DS::setLeftHanded(false);
|
|
|
|
}
|
|
|
|
|
2007-06-30 23:03:03 +00:00
|
|
|
if (ConfMan.hasKey("showcursor", "ds")) {
|
|
|
|
DS::setMouseCursorVisible(ConfMan.getBool("showcursor", "ds"));
|
|
|
|
} else {
|
|
|
|
DS::setMouseCursorVisible(true);
|
|
|
|
}
|
|
|
|
|
2007-10-13 15:40:11 +00:00
|
|
|
if (ConfMan.hasKey("snaptoborder", "ds")) {
|
|
|
|
DS::setSnapToBorder(ConfMan.getBool("snaptoborder", "ds"));
|
|
|
|
} else {
|
|
|
|
#ifdef DS_BUILD_D
|
|
|
|
DS::setSnapToBorder(true);
|
|
|
|
#else
|
|
|
|
DS::setSnapToBorder(false);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
if (ConfMan.hasKey("unscaled", "ds")) {
|
|
|
|
DS::setUnscaledMode(ConfMan.getBool("unscaled", "ds"));
|
|
|
|
} else {
|
|
|
|
DS::setUnscaledMode(false);
|
|
|
|
}
|
|
|
|
|
2006-11-03 23:16:29 +00:00
|
|
|
if (ConfMan.hasKey("twohundredpercent", "ds")) {
|
|
|
|
DS::set200PercentFixedScale(ConfMan.getBool("twohundredpercent", "ds"));
|
|
|
|
} else {
|
|
|
|
DS::set200PercentFixedScale(false);
|
|
|
|
}
|
|
|
|
|
2006-07-09 11:47:17 +00:00
|
|
|
if (ConfMan.hasKey("xoffset", "ds")) {
|
|
|
|
DS::setTouchXOffset(ConfMan.getInt("xoffset", "ds"));
|
|
|
|
} else {
|
|
|
|
DS::setTouchXOffset(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("yoffset", "ds")) {
|
|
|
|
DS::setTouchYOffset(ConfMan.getInt("yoffset", "ds"));
|
|
|
|
} else {
|
|
|
|
DS::setTouchXOffset(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|