2009-09-01 19:33:47 +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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
#include <errno.h>
|
2009-09-05 17:53:55 +00:00
|
|
|
#include <network.h>
|
2009-09-18 18:56:16 +00:00
|
|
|
#include <gfx/gfx.h>
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-01 19:33:47 +00:00
|
|
|
#include "common/config-manager.h"
|
|
|
|
#include "gui/dialog.h"
|
2009-09-05 17:53:55 +00:00
|
|
|
#include "backends/fs/wii/wii-fs-factory.h"
|
2009-09-01 19:33:47 +00:00
|
|
|
|
|
|
|
#include "options.h"
|
|
|
|
|
2009-09-03 17:52:38 +00:00
|
|
|
WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) :
|
2009-09-05 17:53:55 +00:00
|
|
|
Dialog((640 - 400) / 2, (480 - 340) / 2, 400, 340),
|
2009-09-03 17:52:38 +00:00
|
|
|
_doubleStrike(doubleStrike) {
|
|
|
|
|
|
|
|
if (_doubleStrike) {
|
|
|
|
_strUnderscanX = "wii_video_ds_underscan_x";
|
|
|
|
_strUnderscanY = "wii_video_ds_underscan_y";
|
|
|
|
} else {
|
|
|
|
_strUnderscanX = "wii_video_default_underscan_x";
|
|
|
|
_strUnderscanY = "wii_video_default_underscan_y";
|
|
|
|
}
|
2009-09-01 19:33:47 +00:00
|
|
|
|
2009-09-05 17:53:55 +00:00
|
|
|
new ButtonWidget(this, _w - 108 - 16, _h - 24 - 16, 108, 24, "Ok", 'k');
|
|
|
|
new ButtonWidget(this, _w - 216 - 32, _h - 24 - 16, 108, 24, "Cancel", 'c');
|
2009-09-01 19:33:47 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
_tab = new TabWidget(this, 0, 0, _w, _h - 54);
|
2009-09-01 19:33:47 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
_tabVideo = _tab->addTab("Video");
|
2009-09-01 19:33:47 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 16, 128, 16,
|
2009-09-01 19:33:47 +00:00
|
|
|
"Current video mode:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 160, 16, 128, 16,
|
2009-09-03 17:52:38 +00:00
|
|
|
_doubleStrike ? "Double-strike" : "Default",
|
|
|
|
Graphics::kTextAlignLeft);
|
2009-09-01 19:33:47 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 48, 128, 16,
|
2009-09-01 19:33:47 +00:00
|
|
|
"Horizontal underscan:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_sliderUnderscanX = new SliderWidget(_tab, 160, 47, 128, 18, 'x');
|
2009-09-01 19:33:47 +00:00
|
|
|
_sliderUnderscanX->setMinValue(0);
|
|
|
|
_sliderUnderscanX->setMaxValue(32);
|
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 80, 128, 16,
|
2009-09-01 19:33:47 +00:00
|
|
|
"Vertical underscan:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_sliderUnderscanY = new SliderWidget(_tab, 160, 79, 128, 18, 'y');
|
2009-09-01 19:33:47 +00:00
|
|
|
_sliderUnderscanY->setMinValue(0);
|
|
|
|
_sliderUnderscanY->setMaxValue(32);
|
|
|
|
|
2009-09-05 17:53:55 +00:00
|
|
|
#ifdef USE_WII_DI
|
2009-09-20 11:29:33 +00:00
|
|
|
_tabDVD = _tab->addTab("DVD");
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 16, 64, 16,
|
2009-09-05 17:53:55 +00:00
|
|
|
"Status:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_textDVDStatus = new StaticTextWidget(_tab, 96, 16, 192, 16, "Unknown",
|
2009-09-05 17:53:55 +00:00
|
|
|
Graphics::kTextAlignLeft);
|
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new ButtonWidget(_tab, 16, 48, 108, 24, "Mount DVD", 'mdvd');
|
|
|
|
new ButtonWidget(_tab, 140, 48, 108, 24, "Unmount DVD", 'udvd');
|
2009-09-05 17:53:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_WII_SMB
|
2009-09-20 11:29:33 +00:00
|
|
|
_tabSMB = _tab->addTab("SMB");
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 16, 64, 16,
|
2009-09-05 17:53:55 +00:00
|
|
|
"Status:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_textSMBStatus = new StaticTextWidget(_tab, 96, 16, 192, 16, "Unknown",
|
2009-09-05 17:53:55 +00:00
|
|
|
Graphics::kTextAlignLeft);
|
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 52, 64, 16,
|
2009-09-05 17:53:55 +00:00
|
|
|
"Server:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_editSMBServer = new EditTextWidget(_tab, 96, 48, _w - 96 - 32, 24, "");
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 92, 64, 16,
|
2009-09-05 17:53:55 +00:00
|
|
|
"Share:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_editSMBShare = new EditTextWidget(_tab, 96, 88, _w - 96 - 32, 24, "");
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 132, 64, 16,
|
2009-09-05 17:53:55 +00:00
|
|
|
"Username:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_editSMBUsername = new EditTextWidget(_tab, 96, 128, _w - 96 - 32, 24, "");
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new StaticTextWidget(_tab, 16, 172, 64, 16,
|
2009-09-05 17:53:55 +00:00
|
|
|
"Password:", Graphics::kTextAlignRight);
|
2009-09-20 11:29:33 +00:00
|
|
|
_editSMBPassword = new EditTextWidget(_tab, 96, 168, _w - 96 - 32, 24, "");
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new ButtonWidget(_tab, 16, 208, 108, 24, "Init network", 'net');
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
new ButtonWidget(_tab, 140, 208, 108, 24, "Mount SMB", 'msmb');
|
|
|
|
new ButtonWidget(_tab, 264, 208, 108, 24, "Unmount SMB", 'usmb');
|
2009-09-05 17:53:55 +00:00
|
|
|
#endif
|
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
_tab->setActiveTab(_tabVideo);
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-01 19:33:47 +00:00
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
WiiOptionsDialog::~WiiOptionsDialog() {
|
|
|
|
}
|
|
|
|
|
2009-09-05 17:53:55 +00:00
|
|
|
void WiiOptionsDialog::handleTickle() {
|
2009-09-20 11:29:33 +00:00
|
|
|
WiiFilesystemFactory &fsf = WiiFilesystemFactory::instance();
|
|
|
|
|
|
|
|
int tab = _tab->getActiveTab();
|
|
|
|
|
2009-09-05 17:53:55 +00:00
|
|
|
#ifdef USE_WII_DI
|
2009-09-20 11:29:33 +00:00
|
|
|
if (tab == _tabDVD) {
|
|
|
|
if (fsf.isMounted(WiiFilesystemFactory::kDVD))
|
|
|
|
_textDVDStatus->setLabel("Mounted");
|
|
|
|
else
|
|
|
|
_textDVDStatus->setLabel("Not mounted");
|
|
|
|
}
|
2009-09-05 17:53:55 +00:00
|
|
|
#endif
|
2009-09-20 11:29:33 +00:00
|
|
|
|
2009-09-05 17:53:55 +00:00
|
|
|
#ifdef USE_WII_SMB
|
2009-09-20 11:29:33 +00:00
|
|
|
if (tab == _tabSMB) {
|
|
|
|
s32 status = net_get_status();
|
|
|
|
String label;
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
switch (status) {
|
|
|
|
case 0:
|
|
|
|
if (fsf.isMounted(WiiFilesystemFactory::kSMB))
|
|
|
|
label = "Network up, share mounted";
|
|
|
|
else
|
|
|
|
label = "Network up, share not mounted";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -ENETDOWN:
|
|
|
|
label = "Network down";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -EBUSY:
|
|
|
|
label = "Initialising network";
|
|
|
|
break;
|
2009-09-05 17:53:55 +00:00
|
|
|
|
2009-09-20 11:29:33 +00:00
|
|
|
case -ETIMEDOUT:
|
|
|
|
label = "Timeout while initialising network";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
label = String::printf("Network not initialsed (%d)", status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_textSMBStatus->setLabel(label);
|
|
|
|
}
|
2009-09-05 17:53:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
Dialog::handleTickle();
|
|
|
|
}
|
|
|
|
|
2009-09-01 19:33:47 +00:00
|
|
|
void WiiOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd,
|
|
|
|
uint32 data) {
|
2009-09-05 17:53:55 +00:00
|
|
|
WiiFilesystemFactory &fsf = WiiFilesystemFactory::instance();
|
|
|
|
|
2009-09-01 19:33:47 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case 'x':
|
|
|
|
case 'y':
|
|
|
|
gfx_set_underscan(_sliderUnderscanX->getValue(),
|
|
|
|
_sliderUnderscanY->getValue());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'k':
|
|
|
|
save();
|
|
|
|
close();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'c':
|
|
|
|
revert();
|
|
|
|
close();
|
|
|
|
break;
|
|
|
|
|
2009-09-05 17:53:55 +00:00
|
|
|
#ifdef USE_WII_DI
|
|
|
|
case 'mdvd':
|
|
|
|
fsf.mount(WiiFilesystemFactory::kDVD);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'udvd':
|
|
|
|
fsf.umount(WiiFilesystemFactory::kDVD);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_WII_SMB
|
|
|
|
case 'net':
|
|
|
|
fsf.asyncInitNetwork();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'msmb':
|
|
|
|
fsf.setSMBLoginData(_editSMBServer->getEditString(),
|
|
|
|
_editSMBShare->getEditString(),
|
|
|
|
_editSMBUsername->getEditString(),
|
|
|
|
_editSMBPassword->getEditString());
|
|
|
|
fsf.mount(WiiFilesystemFactory::kSMB);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'usmb':
|
|
|
|
fsf.umount(WiiFilesystemFactory::kSMB);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2009-09-01 19:33:47 +00:00
|
|
|
default:
|
|
|
|
Dialog::handleCommand(sender, cmd, data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WiiOptionsDialog::revert() {
|
2009-09-03 17:52:38 +00:00
|
|
|
gfx_set_underscan(ConfMan.getInt(_strUnderscanX,
|
2009-09-01 19:33:47 +00:00
|
|
|
Common::ConfigManager::kApplicationDomain),
|
2009-09-03 17:52:38 +00:00
|
|
|
ConfMan.getInt(_strUnderscanY,
|
2009-09-01 19:33:47 +00:00
|
|
|
Common::ConfigManager::kApplicationDomain));
|
|
|
|
}
|
|
|
|
|
|
|
|
void WiiOptionsDialog::load() {
|
2009-09-03 17:52:38 +00:00
|
|
|
int x = ConfMan.getInt(_strUnderscanX,
|
2009-09-01 19:33:47 +00:00
|
|
|
Common::ConfigManager::kApplicationDomain);
|
2009-09-03 17:52:38 +00:00
|
|
|
int y = ConfMan.getInt(_strUnderscanY,
|
2009-09-01 19:33:47 +00:00
|
|
|
Common::ConfigManager::kApplicationDomain);
|
|
|
|
|
|
|
|
_sliderUnderscanX->setValue(x);
|
|
|
|
_sliderUnderscanY->setValue(y);
|
2009-09-05 17:53:55 +00:00
|
|
|
|
|
|
|
#ifdef USE_WII_SMB
|
|
|
|
_editSMBServer->setEditString(ConfMan.get("wii_smb_server",
|
|
|
|
Common::ConfigManager::kApplicationDomain));
|
|
|
|
_editSMBShare->setEditString(ConfMan.get("wii_smb_share",
|
|
|
|
Common::ConfigManager::kApplicationDomain));
|
|
|
|
_editSMBUsername->setEditString(ConfMan.get("wii_smb_username",
|
|
|
|
Common::ConfigManager::kApplicationDomain));
|
|
|
|
_editSMBPassword->setEditString(ConfMan.get("wii_smb_password",
|
|
|
|
Common::ConfigManager::kApplicationDomain));
|
|
|
|
#endif
|
2009-09-01 19:33:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WiiOptionsDialog::save() {
|
2009-09-03 17:52:38 +00:00
|
|
|
ConfMan.setInt(_strUnderscanX,
|
2009-09-01 19:33:47 +00:00
|
|
|
_sliderUnderscanX->getValue(),
|
|
|
|
Common::ConfigManager::kApplicationDomain);
|
2009-09-03 17:52:38 +00:00
|
|
|
ConfMan.setInt(_strUnderscanY,
|
2009-09-01 19:33:47 +00:00
|
|
|
_sliderUnderscanY->getValue(),
|
|
|
|
Common::ConfigManager::kApplicationDomain);
|
2009-09-05 17:53:55 +00:00
|
|
|
|
|
|
|
#ifdef USE_WII_SMB
|
|
|
|
ConfMan.set("wii_smb_server", _editSMBServer->getEditString(),
|
|
|
|
Common::ConfigManager::kApplicationDomain);
|
|
|
|
ConfMan.set("wii_smb_share", _editSMBShare->getEditString(),
|
|
|
|
Common::ConfigManager::kApplicationDomain);
|
|
|
|
ConfMan.set("wii_smb_username", _editSMBUsername->getEditString(),
|
|
|
|
Common::ConfigManager::kApplicationDomain);
|
|
|
|
ConfMan.set("wii_smb_password", _editSMBPassword->getEditString(),
|
|
|
|
Common::ConfigManager::kApplicationDomain);
|
|
|
|
#endif
|
|
|
|
|
2009-09-01 19:33:47 +00:00
|
|
|
ConfMan.flushToDisk();
|
|
|
|
}
|
|
|
|
|