aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wii
diff options
context:
space:
mode:
authorAndre Heider2009-09-05 17:53:55 +0000
committerAndre Heider2009-09-05 17:53:55 +0000
commit0b002beccd31fa2796a319427624af1b2ad580b6 (patch)
treee625a36d21708cb2105e2979bbb9a29934ef03c0 /backends/platform/wii
parent549e2b054092d3ba2ef1c53245227107d406b4c8 (diff)
downloadscummvm-rg350-0b002beccd31fa2796a319427624af1b2ad580b6.tar.gz
scummvm-rg350-0b002beccd31fa2796a319427624af1b2ad580b6.tar.bz2
scummvm-rg350-0b002beccd31fa2796a319427624af1b2ad580b6.zip
Support for SMB shares, cleaned up async FS functions.
svn-id: r43965
Diffstat (limited to 'backends/platform/wii')
-rw-r--r--backends/platform/wii/main.cpp9
-rw-r--r--backends/platform/wii/options.cpp136
-rw-r--r--backends/platform/wii/options.h16
-rw-r--r--backends/platform/wii/osystem.cpp42
-rw-r--r--backends/platform/wii/osystem_gfx.cpp22
5 files changed, 185 insertions, 40 deletions
diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp
index 801778395f..e0115c99ef 100644
--- a/backends/platform/wii/main.cpp
+++ b/backends/platform/wii/main.cpp
@@ -112,11 +112,6 @@ int main(int argc, char *argv[]) {
SYS_SetPowerCallback(power_cb);
#endif
-#ifdef USE_WII_DI
- // initial async mount for the browser, see wii-fs.cpp
- DI_Mount();
-#endif
-
if (!fatInitDefault()) {
printf("fatInitDefault failed\n");
} else {
@@ -144,10 +139,6 @@ int main(int argc, char *argv[]) {
fatUnmountDefault();
-#ifdef USE_WII_DI
- DI_Close();
-#endif
-
if (power_btn_pressed) {
printf("shutting down\n");
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp
index f8b70804d0..1e35a23005 100644
--- a/backends/platform/wii/options.cpp
+++ b/backends/platform/wii/options.cpp
@@ -20,15 +20,18 @@
*
*/
+#include <network.h>
+
#include "common/config-manager.h"
#include "gui/dialog.h"
#include "gui/TabWidget.h"
+#include "backends/fs/wii/wii-fs-factory.h"
#include "options.h"
#include "gfx.h"
WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) :
- Dialog(180, 120, 304, 200),
+ Dialog((640 - 400) / 2, (480 - 340) / 2, 400, 340),
_doubleStrike(doubleStrike) {
if (_doubleStrike) {
@@ -39,12 +42,12 @@ WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) :
_strUnderscanY = "wii_video_default_underscan_y";
}
- new ButtonWidget(this, 56, 160, 108, 24, "Cancel", 'c');
- new ButtonWidget(this, 180, 160, 108, 24, "Ok", 'k');
+ 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');
- TabWidget *tab = new TabWidget(this, 0, 0, 304, 146);
+ TabWidget *tab = new TabWidget(this, 0, 0, _w, _h - 54);
- tab->addTab("Video");
+ int tabVideo = tab->addTab("Video");
new StaticTextWidget(tab, 16, 16, 128, 16,
"Current video mode:", Graphics::kTextAlignRight);
@@ -64,14 +67,86 @@ WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) :
_sliderUnderscanY->setMinValue(0);
_sliderUnderscanY->setMaxValue(32);
+#ifdef USE_WII_DI
+ tab->addTab("DVD");
+
+ new StaticTextWidget(tab, 16, 16, 64, 16,
+ "Status:", Graphics::kTextAlignRight);
+ _textDVDStatus = new StaticTextWidget(tab, 96, 16, 192, 16, "Unknown",
+ Graphics::kTextAlignLeft);
+
+ new ButtonWidget(tab, 16, 48, 108, 24, "Mount DVD", 'mdvd');
+ new ButtonWidget(tab, 140, 48, 108, 24, "Unmount DVD", 'udvd');
+#endif
+
+#ifdef USE_WII_SMB
+ tab->addTab("SMB");
+
+ new StaticTextWidget(tab, 16, 16, 64, 16,
+ "Status:", Graphics::kTextAlignRight);
+ _textSMBStatus = new StaticTextWidget(tab, 96, 16, 192, 16, "Unknown",
+ Graphics::kTextAlignLeft);
+
+ new StaticTextWidget(tab, 16, 52, 64, 16,
+ "Server:", Graphics::kTextAlignRight);
+ _editSMBServer = new EditTextWidget(tab, 96, 48, _w - 96 - 32, 24, "");
+
+ new StaticTextWidget(tab, 16, 92, 64, 16,
+ "Share:", Graphics::kTextAlignRight);
+ _editSMBShare = new EditTextWidget(tab, 96, 88, _w - 96 - 32, 24, "");
+
+ new StaticTextWidget(tab, 16, 132, 64, 16,
+ "Username:", Graphics::kTextAlignRight);
+ _editSMBUsername = new EditTextWidget(tab, 96, 128, _w - 96 - 32, 24, "");
+
+ new StaticTextWidget(tab, 16, 172, 64, 16,
+ "Password:", Graphics::kTextAlignRight);
+ _editSMBPassword = new EditTextWidget(tab, 96, 168, _w - 96 - 32, 24, "");
+
+ new ButtonWidget(tab, 16, 208, 108, 24, "Init network", 'net');
+
+ new ButtonWidget(tab, 140, 208, 108, 24, "Mount SMB", 'msmb');
+ new ButtonWidget(tab, 264, 208, 108, 24, "Unmount SMB", 'usmb');
+#endif
+
+ tab->setActiveTab(tabVideo);
+
load();
}
WiiOptionsDialog::~WiiOptionsDialog() {
}
+void WiiOptionsDialog::handleTickle() {
+#ifdef USE_WII_DI
+ if (WiiFilesystemFactory::instance().isMounted(WiiFilesystemFactory::kDVD))
+ _textDVDStatus->setLabel("Mounted");
+ else
+ _textDVDStatus->setLabel("Not mounted");
+#endif
+#ifdef USE_WII_SMB
+ s32 net = net_get_status();
+ String label;
+
+ if (net) {
+ label = String::printf("Network not initialsed (%d)\n", net);
+ } else {
+ if (WiiFilesystemFactory::instance().isMounted(WiiFilesystemFactory::kSMB))
+ label = "Mounted";
+ else
+ label = "Not mounted";
+ }
+
+ _textSMBStatus->setLabel(label);
+#endif
+
+ Dialog::handleTickle();
+}
+
void WiiOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd,
uint32 data) {
+ WiiFilesystemFactory &fsf = WiiFilesystemFactory::instance();
+
switch (cmd) {
case 'x':
case 'y':
@@ -89,6 +164,34 @@ void WiiOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd,
close();
break;
+#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
+
default:
Dialog::handleCommand(sender, cmd, data);
break;
@@ -110,6 +213,17 @@ void WiiOptionsDialog::load() {
_sliderUnderscanX->setValue(x);
_sliderUnderscanY->setValue(y);
+
+#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
}
void WiiOptionsDialog::save() {
@@ -119,6 +233,18 @@ void WiiOptionsDialog::save() {
ConfMan.setInt(_strUnderscanY,
_sliderUnderscanY->getValue(),
Common::ConfigManager::kApplicationDomain);
+
+#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
+
ConfMan.flushToDisk();
}
diff --git a/backends/platform/wii/options.h b/backends/platform/wii/options.h
index 83c8ddd0d6..3e84933efd 100644
--- a/backends/platform/wii/options.h
+++ b/backends/platform/wii/options.h
@@ -25,6 +25,7 @@
#include "common/str.h"
#include "gui/dialog.h"
+#include "gui/EditTextWidget.h"
using namespace GUI;
@@ -35,6 +36,8 @@ public:
WiiOptionsDialog(bool doubleStrike);
virtual ~WiiOptionsDialog();
+protected:
+ virtual void handleTickle();
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
private:
@@ -45,6 +48,19 @@ private:
SliderWidget *_sliderUnderscanX;
SliderWidget *_sliderUnderscanY;
+#ifdef USE_WII_DI
+ StaticTextWidget *_textDVDStatus;
+#endif
+
+#ifdef USE_WII_SMB
+ StaticTextWidget *_textNetworkStatus;
+ StaticTextWidget *_textSMBStatus;
+ EditTextWidget *_editSMBServer;
+ EditTextWidget *_editSMBShare;
+ EditTextWidget *_editSMBUsername;
+ EditTextWidget *_editSMBPassword;
+#endif
+
void revert();
void load();
void save();
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 39c6b9df53..a32752104b 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -23,6 +23,7 @@
#include "backends/fs/wii/wii-fs-factory.h"
#include "osystem.h"
+#include "options.h"
#include <unistd.h>
@@ -103,6 +104,28 @@ OSystem_Wii::~OSystem_Wii() {
void OSystem_Wii::initBackend() {
_startup_time = gettime();
+ ConfMan.registerDefault("fullscreen", true);
+ ConfMan.registerDefault("aspect_ratio", true);
+ ConfMan.registerDefault("wii_video_default_underscan_x", 16);
+ ConfMan.registerDefault("wii_video_default_underscan_y", 16);
+ ConfMan.registerDefault("wii_video_ds_underscan_x", 16);
+ ConfMan.registerDefault("wii_video_ds_underscan_y", 16);
+ ConfMan.registerDefault("wii_smb_server", "");
+ ConfMan.registerDefault("wii_smb_share", "");
+ ConfMan.registerDefault("wii_smb_username", "");
+ ConfMan.registerDefault("wii_smb_password", "");
+
+ WiiFilesystemFactory &fsf = WiiFilesystemFactory::instance();
+
+#ifdef USE_WII_SMB
+ fsf.setSMBLoginData(ConfMan.get("wii_smb_server"),
+ ConfMan.get("wii_smb_share"),
+ ConfMan.get("wii_smb_username"),
+ ConfMan.get("wii_smb_password"));
+#endif
+
+ fsf.asyncInit();
+
char buf[MAXPATHLEN];
if (!getcwd(buf, MAXPATHLEN))
strcpy(buf, "/");
@@ -123,14 +146,12 @@ void OSystem_Wii::quit() {
deinitSfx();
deinitGfx();
- // umount all async filesystems
- WiiFilesystemFactory::asyncHandler(false, NULL);
+ WiiFilesystemFactory::instance().asyncDeinit();
}
void OSystem_Wii::engineInit() {
_gameRunning = true;
- // umount not required filesystems for this game
- WiiFilesystemFactory::asyncHandler(false, &ConfMan.get("path"));
+ WiiFilesystemFactory::instance().umountUnused(ConfMan.get("path"));
}
void OSystem_Wii::engineDone() {
@@ -241,3 +262,16 @@ void OSystem_Wii::getTimeAndDate(struct tm &t) const {
t = *localtime(&curTime);
}
+void OSystem_Wii::showOptionsDialog() {
+ if (_optionsDlgActive)
+ return;
+
+ bool ds = (_actualGraphicsMode == gmDoubleStrike) ||
+ (_actualGraphicsMode == gmDoubleStrikeFiltered);
+
+ _optionsDlgActive = true;
+ WiiOptionsDialog dlg(ds);
+ dlg.runModal();
+ _optionsDlgActive = false;
+}
+
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 3feaf65c1e..d33643193d 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -26,7 +26,6 @@
#include "backends/fs/wii/wii-fs-factory.h"
#include "osystem.h"
-#include "options.h"
#include "gfx.h"
#define ROUNDUP(x,n) (-(-(x) & -(n)))
@@ -59,13 +58,6 @@ static const OSystem::GraphicsMode _supportedGraphicsModes[] = {
};
void OSystem_Wii::initGfx() {
- ConfMan.registerDefault("fullscreen", true);
- ConfMan.registerDefault("aspect_ratio", true);
- ConfMan.registerDefault("wii_video_default_underscan_x", 16);
- ConfMan.registerDefault("wii_video_default_underscan_y", 16);
- ConfMan.registerDefault("wii_video_ds_underscan_x", 16);
- ConfMan.registerDefault("wii_video_ds_underscan_y", 16);
-
gfx_video_init(GFX_STANDARD_AUTO, GFX_MODE_DEFAULT);
gfx_init();
gfx_set_underscan(ConfMan.getInt("wii_video_default_underscan_x"),
@@ -718,17 +710,3 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
_cursorPaletteDirty = true;
}
-void OSystem_Wii::showOptionsDialog() {
- if (_optionsDlgActive)
- return;
-
- bool ds = (_actualGraphicsMode == gmDoubleStrike) ||
- (_actualGraphicsMode == gmDoubleStrikeFiltered);
-
- _optionsDlgActive = true;
- WiiOptionsDialog dlg(ds);
- dlg.runModal();
- _optionsDlgActive = false;
-}
-
-