aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/wii/wii-fs.cpp
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/fs/wii/wii-fs.cpp
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/fs/wii/wii-fs.cpp')
-rw-r--r--backends/fs/wii/wii-fs.cpp67
1 files changed, 5 insertions, 62 deletions
diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp
index 7a144cddbf..e6ba2a4aa0 100644
--- a/backends/fs/wii/wii-fs.cpp
+++ b/backends/fs/wii/wii-fs.cpp
@@ -29,14 +29,11 @@
#include <sys/dir.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <unistd.h>
#include <gctypes.h>
-#ifdef USE_WII_DI
-#include <di/di.h>
-#endif
-
/**
* Implementation of the ScummVM file system API based on Wii.
*
@@ -81,60 +78,8 @@ public:
virtual Common::SeekableReadStream *createReadStream();
virtual Common::WriteStream *createWriteStream();
-
- static void asyncHandler(bool umount, const Common::String *path);
};
-void WiiFilesystemNode::asyncHandler(bool mount, const Common::String *path) {
-#ifdef USE_WII_DI
- static bool di_tryMount = true;
- static bool di_isMounted = false;
-
- // umount not required filesystems
- if (!mount) {
- if (di_isMounted && (!path || (path && !path->hasPrefix("dvd:/")))) {
- printf("umount ISO9660\n");
- ISO9660_Unmount();
- DI_StopMotor();
- di_tryMount = false;
- di_isMounted = false;
- }
-
- if (!path)
- return;
- }
-
- // re-mount DVD if data from its path has been requested. in this case, we
- // have to wait for DI_Mount() to finish
- if (!di_tryMount && !di_isMounted && path && path->hasPrefix("dvd:/")) {
- printf("remount ISO9660\n");
- DI_Mount();
-
- while (DI_GetStatus() & DVD_INIT)
- usleep(20 * 1000);
-
- di_tryMount = true;
- }
-
- if (!di_tryMount)
- return;
-
- // check if the async DI_Mount() call has finished
- if (DI_GetStatus() & DVD_READY) {
- di_tryMount = false;
-
- printf("mount ISO9660\n");
- if (ISO9660_Mount()) {
- di_isMounted = true;
- printf("ISO9660 mounted\n");
- } else {
- DI_StopMotor();
- printf("ISO9660 mount failed\n");
- }
- }
-#endif
-}
-
// gets all registered devoptab devices
bool WiiFilesystemNode::getDevopChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
u8 i;
@@ -143,8 +88,6 @@ bool WiiFilesystemNode::getDevopChildren(AbstractFSList &list, ListMode mode, bo
if (mode == Common::FSNode::kListFilesOnly)
return true;
- asyncHandler(true, NULL);
-
// skip in, out and err
for (i = 3; i < STD_MAX; ++i) {
dt = devoptab_list[i];
@@ -194,14 +137,14 @@ WiiFilesystemNode::WiiFilesystemNode(const Common::String &p) {
_path = Common::normalizePath(p, '/');
- // "fat:" is not a valid directory, but "fat:/" is
+ WiiFilesystemFactory::instance().mountByPath(_path);
+
+ // "sd:" is not a valid directory, but "sd:/" is
if (_path.lastChar() == ':')
_path += '/';
_displayName = lastPathComponent(_path, '/');
- asyncHandler(true, &_path);
-
struct stat st;
if (!stat(_path.c_str(), &st))
setFlags(&st);
@@ -217,7 +160,7 @@ WiiFilesystemNode::WiiFilesystemNode(const Common::String &p, const struct stat
_path = Common::normalizePath(p, '/');
- // "fat:" is not a valid directory, but "fat:/" is
+ // "sd:" is not a valid directory, but "sd:/" is
if (_path.lastChar() == ':')
_path += '/';