From eff22cb43d22b0f47ac2bf5063916639a632705d Mon Sep 17 00:00:00 2001 From: AReim1982 Date: Fri, 22 Nov 2013 15:13:56 +0100 Subject: WII: Implement changes needed by DevKitPPC R26 and later This changes makes ScummVM compilable with newer versions of DevKitPPC. ScummVM can be linked against the original libogc and libfat. That makes some newer WiiMotes work, improves audio-/video-playback and contains various improvements. --- backends/fs/wii/wii-fs-factory.cpp | 6 ++++-- backends/fs/wii/wii-fs.cpp | 44 ++++++++++++++++++++++++-------------- backends/fs/wii/wii-fs.h | 2 +- 3 files changed, 33 insertions(+), 19 deletions(-) (limited to 'backends/fs/wii') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 760e5316e7..987e7f56bf 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -125,6 +125,8 @@ bool WiiFilesystemFactory::failedToMount(FileSystemType type) { return false; } +const DISC_INTERFACE* dvd = &__io_wiidvd; + void WiiFilesystemFactory::mount(FileSystemType type) { switch (type) { case kDVD: @@ -133,7 +135,7 @@ void WiiFilesystemFactory::mount(FileSystemType type) { break; printf("mount dvd\n"); - if (ISO9660_Mount()) { + if (ISO9660_Mount("dvd", dvd)) { _dvdMounted = true; _dvdError = false; printf("ISO9660 mounted\n"); @@ -179,7 +181,7 @@ void WiiFilesystemFactory::umount(FileSystemType type) { printf("umount dvd\n"); - ISO9660_Unmount(); + ISO9660_Unmount("dvd:"); _dvdMounted = false; _dvdError = false; diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp index 4a19e18240..43f4f592b7 100644 --- a/backends/fs/wii/wii-fs.cpp +++ b/backends/fs/wii/wii-fs.cpp @@ -80,9 +80,9 @@ void WiiFilesystemNode::clearFlags() { void WiiFilesystemNode::setFlags(const struct stat *st) { _exists = true; - _isDirectory = S_ISDIR(st->st_mode); - _isReadable = (st->st_mode & S_IRUSR) > 0; - _isWritable = (st->st_mode & S_IWUSR) > 0; + _isDirectory = ( (st->st_mode & S_IFDIR) != 0 ); + _isReadable = ( (st->st_mode & S_IRUSR) != 0 ); + _isWritable = ( (st->st_mode & S_IWUSR) != 0 ); } WiiFilesystemNode::WiiFilesystemNode() { @@ -106,7 +106,7 @@ WiiFilesystemNode::WiiFilesystemNode(const Common::String &p) { _displayName = lastPathComponent(_path, '/'); struct stat st; - if (!stat(_path.c_str(), &st)) + if(stat(_path.c_str(), &st) != -1) setFlags(&st); else clearFlags(); @@ -152,33 +152,45 @@ bool WiiFilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi if (_path.empty()) return getDevopChildren(list, mode, hidden); - DIR_ITER* dp = diropen (_path.c_str()); + DIR* dp = opendir (_path.c_str()); + DIR* tmpdir; if (dp == NULL) return false; - char filename[MAXPATHLEN]; - struct stat st; + struct dirent *pent; - while (dirnext(dp, filename, &st) == 0) { - if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0) + while ((pent = readdir(dp)) != NULL) { + if (strcmp(pent->d_name, ".") == 0 || strcmp(pent->d_name, "..") == 0) continue; Common::String newPath(_path); if (newPath.lastChar() != '/') - newPath += '/'; - newPath += filename; - - bool isDir = S_ISDIR(st.st_mode); - + newPath += '/'; + newPath += pent->d_name; + + bool isDir = false; + tmpdir = opendir(newPath.c_str()); + if(tmpdir) + { + isDir = true; + closedir(tmpdir); + } + if ((mode == Common::FSNode::kListFilesOnly && isDir) || (mode == Common::FSNode::kListDirectoriesOnly && !isDir)) continue; - + + struct stat st; + st.st_mode = 0; + st.st_mode |= ( isDir ? S_IFDIR : 0 ); + st.st_mode |= S_IRUSR; + st.st_mode |= S_IWUSR; + list.push_back(new WiiFilesystemNode(newPath, &st)); } - dirclose(dp); + closedir(dp); return true; } diff --git a/backends/fs/wii/wii-fs.h b/backends/fs/wii/wii-fs.h index 11679d0c36..f785101099 100644 --- a/backends/fs/wii/wii-fs.h +++ b/backends/fs/wii/wii-fs.h @@ -51,7 +51,7 @@ public: * * @param path Common::String with the path the new node should point to. */ - WiiFilesystemNode(const Common::String &path); + WiiFilesystemNode(const Common::String &p); WiiFilesystemNode(const Common::String &p, const struct stat *st); virtual bool exists() const; -- cgit v1.2.3 From 417f755b90d3505994dc5c01e93699335966093e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 25 Jan 2014 18:50:20 +0000 Subject: WII: Fix Gamecube build. Missing ifdef guard for Wii DVD interface. --- backends/fs/wii/wii-fs-factory.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backends/fs/wii') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 987e7f56bf..3bebc2bed3 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -125,7 +125,9 @@ bool WiiFilesystemFactory::failedToMount(FileSystemType type) { return false; } +#ifdef USE_WII_DI const DISC_INTERFACE* dvd = &__io_wiidvd; +#endif void WiiFilesystemFactory::mount(FileSystemType type) { switch (type) { -- cgit v1.2.3 From 08d3b5754af625f0385aa28b225e82704659eab9 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 25 Jan 2014 21:32:07 +0000 Subject: WII: Another fix for Gamecube build. Corrected Disc Interface object. --- backends/fs/wii/wii-fs-factory.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backends/fs/wii') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 3bebc2bed3..1c67ae4823 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -126,7 +126,11 @@ bool WiiFilesystemFactory::failedToMount(FileSystemType type) { } #ifdef USE_WII_DI -const DISC_INTERFACE* dvd = &__io_wiidvd; +#ifndef GAMECUBE + const DISC_INTERFACE* dvd = &__io_wiidvd; +#else + const DISC_INTERFACE* dvd = &__io_gcdvd; +#endif #endif void WiiFilesystemFactory::mount(FileSystemType type) { -- cgit v1.2.3 From b6e5865fcebfbacaa401fe3ecb1e1951613263ab Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 26 Jan 2014 11:19:53 +0000 Subject: WII: Add missing dvd interface header for Gamecube build. --- backends/fs/wii/wii-fs-factory.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'backends/fs/wii') diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 1c67ae4823..f234c1e300 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -33,6 +33,9 @@ #ifdef USE_WII_DI #include #include +#ifdef GAMECUBE +#include +#endif #endif #ifdef USE_WII_SMB -- cgit v1.2.3