1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
/* 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.
*
* 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"
#include "gui/ListWidget.h"
#include "osystem_ds.h"
#include "engines/scumm/scumm.h"
#include "touchkeyboard.h"
#ifdef DS_SCUMM_BUILD
namespace Scumm {
extern Common::StringList generateSavegameList(Scumm::ScummEngine *scumm, bool saveMode);
extern Scumm::ScummEngine *g_scumm;
}
#endif
namespace DS {
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 200 - 20) {
addButton(this, 10, 160, "Close", GUI::kCloseCmd, 'C');
#ifdef DS_SCUMM_BUILD
if (!DS::isGBAMPAvailable()) {
// addButton(this, 100, 140, "Delete Save", 'dels', 'D');
}
#endif
new GUI::StaticTextWidget(this, 80, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter);
_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');
// _cpuScaler = new GUI::CheckboxWidget(this, 20, 115, 250, 20, "CPU scaler", 0, 'T');
_showCursorCheckbox = new GUI::CheckboxWidget(this, 20, 115, 250, 20, "Show mouse cursor", 0, 'T');
new GUI::StaticTextWidget(this, 20, 130, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
_touchX = new GUI::SliderWidget(this, 130, 130, 130, 12, 1);
_touchX->setMinValue(-8);
_touchX->setMaxValue(+8);
_touchX->setValue(0);
_touchX->setFlags(GUI::WIDGET_CLEARBG);
new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch Y Offset", GUI::kTextAlignLeft);
_touchY = new GUI::SliderWidget(this, 130, 145, 130, 12, 2);
_touchY->setMinValue(-8);
_touchY->setMaxValue(+8);
_touchY->setValue(0);
_touchY->setFlags(GUI::WIDGET_CLEARBG);
new GUI::StaticTextWidget(this, 130 + 65 - 10, 160, 20, 15, "0", GUI::kTextAlignCenter);
new GUI::StaticTextWidget(this, 130 + 130 - 10, 160, 20, 15, "8", GUI::kTextAlignCenter);
new GUI::StaticTextWidget(this, 130 - 10, 160, 20, 15, "-8", GUI::kTextAlignCenter);
#ifdef DS_SCUMM_BUILD
_delDialog = new Scumm::SaveLoadChooser("Delete game:", "Delete", false, Scumm::g_scumm);
#endif
if (ConfMan.hasKey("showcursor", "ds")) {
_showCursorCheckbox->setState(ConfMan.getBool("showcursor", "ds"));
} else {
_showCursorCheckbox->setState(false);
}
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);
}
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);
}
/*
if (ConfMan.hasKey("cpu_scaler", "ds")) {
_cpuScaler->setState(ConfMan.getBool("cpu_scaler", "ds"));
} else {
_cpuScaler->setState(false);
}
*/
_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");
ConfMan.setBool("twohundredpercent", _twoHundredPercentCheckbox->getState(), "ds");
ConfMan.setBool("22khzaudio", _highQualityAudioCheckbox->getState(), "ds");
ConfMan.setBool("disablepoweroff", _disablePowerOff->getState(), "ds");
// ConfMan.setBool("cpu_scaler", _cpuScaler->getState(), "ds");
ConfMan.setInt("xoffset", _touchX->getValue(), "ds");
ConfMan.setInt("yoffset", _touchY->getValue(), "ds");
ConfMan.setBool("showcursor", _showCursorCheckbox->getState(), "ds");
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);
Common::Event event;
event.type = Common::EVENT_KEYDOWN;
event.kbd.ascii = 0;
event.kbd.keycode = Common::KEYCODE_DOWN;
OSystem_DS::instance()->addEvent(event);
event.type = Common::EVENT_KEYUP;
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
}
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;
event.kbd.keycode = Common::KEYCODE_p;
event.kbd.ascii = 'p';
event.kbd.flags = 0;
system->addEvent(event);
event.type = Common::EVENT_KEYUP;
system->addEvent(event);
}
}
void showOptionsDialog() {
togglePause();
DS::displayMode16Bit();
DSOptionsDialog* d = new DSOptionsDialog();
d->runModal();
delete d;
DS::displayMode8Bit();
togglePause();
}
void setOptions() {
ConfMan.addGameDomain("ds");
if (ConfMan.hasKey("lefthanded", "ds")) {
DS::setLeftHanded(ConfMan.getBool("lefthanded", "ds"));
} else {
DS::setLeftHanded(false);
}
if (ConfMan.hasKey("showcursor", "ds")) {
DS::setMouseCursorVisible(ConfMan.getBool("showcursor", "ds"));
} else {
DS::setMouseCursorVisible(true);
}
if (ConfMan.hasKey("unscaled", "ds")) {
DS::setUnscaledMode(ConfMan.getBool("unscaled", "ds"));
} else {
DS::setUnscaledMode(false);
}
if (ConfMan.hasKey("twohundredpercent", "ds")) {
DS::set200PercentFixedScale(ConfMan.getBool("twohundredpercent", "ds"));
} else {
DS::set200PercentFixedScale(false);
}
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);
}
}
}
|