From 11cfa0d357193826fdf27b9f6fe07e71038d5eef Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Thu, 2 Jun 2011 10:34:41 +0200 Subject: PS3: Initial version of the PlayStation 3 backend --- backends/fs/posix/posix-fs-factory.cpp | 2 +- backends/fs/posix/posix-fs-factory.h | 1 + backends/fs/posix/posix-fs.cpp | 2 +- backends/fs/ps3/ps3-fs-factory.cpp | 26 ++++++++++++++++++++++++ backends/fs/ps3/ps3-fs-factory.h | 36 ++++++++++++++++++++++++++++++++++ 5 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 backends/fs/ps3/ps3-fs-factory.cpp create mode 100644 backends/fs/ps3/ps3-fs-factory.h (limited to 'backends/fs') diff --git a/backends/fs/posix/posix-fs-factory.cpp b/backends/fs/posix/posix-fs-factory.cpp index 829355be84..776ea86155 100644 --- a/backends/fs/posix/posix-fs-factory.cpp +++ b/backends/fs/posix/posix-fs-factory.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if defined(POSIX) +#if defined(POSIX) || defined(PLAYSTATION3) // Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h. // Also with clock() in sys/time.h in some Mac OS X SDKs. diff --git a/backends/fs/posix/posix-fs-factory.h b/backends/fs/posix/posix-fs-factory.h index a7075db94c..c7cec6fab5 100644 --- a/backends/fs/posix/posix-fs-factory.h +++ b/backends/fs/posix/posix-fs-factory.h @@ -30,6 +30,7 @@ * Parts of this class are documented in the base interface class, FilesystemFactory. */ class POSIXFilesystemFactory : public FilesystemFactory { +protected: virtual AbstractFSNode *makeRootFileNode() const; virtual AbstractFSNode *makeCurrentDirectoryFileNode() const; virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const; diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 0b94c37b16..320c5a6f39 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if defined(POSIX) +#if defined(POSIX) || defined(PLAYSTATION3) // Re-enable some forbidden symbols to avoid clashes with stat.h and unistd.h. // Also with clock() in sys/time.h in some Mac OS X SDKs. diff --git a/backends/fs/ps3/ps3-fs-factory.cpp b/backends/fs/ps3/ps3-fs-factory.cpp new file mode 100644 index 0000000000..3257246c50 --- /dev/null +++ b/backends/fs/ps3/ps3-fs-factory.cpp @@ -0,0 +1,26 @@ +/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "backends/fs/ps3/ps3-fs-factory.h" + +AbstractFSNode *PS3FilesystemFactory::makeCurrentDirectoryFileNode() const { + return makeRootFileNode(); +} diff --git a/backends/fs/ps3/ps3-fs-factory.h b/backends/fs/ps3/ps3-fs-factory.h new file mode 100644 index 0000000000..6c1988b1c9 --- /dev/null +++ b/backends/fs/ps3/ps3-fs-factory.h @@ -0,0 +1,36 @@ +/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PS3_FILESYSTEM_FACTORY_H +#define PS3_FILESYSTEM_FACTORY_H + +#include "backends/fs/posix/posix-fs-factory.h" + +/** + * Creates PS3FilesystemFactory objects. + * + * Parts of this class are documented in the base interface class, FilesystemFactory. + */ +class PS3FilesystemFactory : public POSIXFilesystemFactory { + virtual AbstractFSNode *makeCurrentDirectoryFileNode() const; +}; + +#endif /*PS3_FILESYSTEM_FACTORY_H*/ -- cgit v1.2.3 From 2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f Mon Sep 17 00:00:00 2001 From: Littleboy Date: Tue, 28 Jun 2011 01:57:21 -0400 Subject: BACKENDS: Update WindowsFilesystemNode::getChildren() to honor the hidden parameter (FR #1726611) Hidden folders (such as the recycle bin or temporary hidden folders) will no longer be visible in the file/folder browser (as is the case on the Posix and related backends) --- backends/fs/windows/windows-fs.cpp | 12 +++++++----- backends/fs/windows/windows-fs.h | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'backends/fs') diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 9e864753c9..c32ad2da94 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -54,7 +54,7 @@ bool WindowsFilesystemNode::isWritable() const { return _access(_path.c_str(), W_OK) == 0; } -void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data) { +void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, bool hidden, WIN32_FIND_DATA* find_data) { WindowsFilesystemNode entry; char *asciiName = toAscii(find_data->cFileName); bool isDirectory; @@ -63,6 +63,10 @@ void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const c if (!strcmp(asciiName, ".") || !strcmp(asciiName, "..")) return; + // Skip hidden files if asked + if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) && !hidden) + return; + isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false); if ((!isDirectory && mode == Common::FSNode::kListDirectoriesOnly) || @@ -163,8 +167,6 @@ AbstractFSNode *WindowsFilesystemNode::getChild(const Common::String &n) const { bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { assert(_isDirectory); - //TODO: honor the hidden flag - if (_isPseudoRoot) { #ifndef _WIN32_WCE // Drives enumeration @@ -200,10 +202,10 @@ bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b if (handle == INVALID_HANDLE_VALUE) return false; - addFile(myList, mode, _path.c_str(), &desc); + addFile(myList, mode, _path.c_str(), hidden, &desc); while (FindNextFile(handle, &desc)) - addFile(myList, mode, _path.c_str(), &desc); + addFile(myList, mode, _path.c_str(), hidden, &desc); FindClose(handle); } diff --git a/backends/fs/windows/windows-fs.h b/backends/fs/windows/windows-fs.h index 37d1e9099b..351307bef0 100644 --- a/backends/fs/windows/windows-fs.h +++ b/backends/fs/windows/windows-fs.h @@ -93,12 +93,13 @@ private: * Adds a single WindowsFilesystemNode to a given list. * This method is used by getChildren() to populate the directory entries list. * - * @param list List to put the file entry node in. - * @param mode Mode to use while adding the file entry to the list. - * @param base Common::String with the directory being listed. - * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. + * @param list List to put the file entry node in. + * @param mode Mode to use while adding the file entry to the list. + * @param base Common::String with the directory being listed. + * @param hidden true if hidden files should be added, false otherwise + * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. */ - static void addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data); + static void addFile(AbstractFSList &list, ListMode mode, const char *base, bool hidden, WIN32_FIND_DATA* find_data); /** * Converts a Unicode string to Ascii format. -- cgit v1.2.3 From aa0f307e06e5aae3b12f9f15b350dc81b30d61de Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Tue, 28 Jun 2011 02:06:23 +0300 Subject: ALL: Require DECLARE_SINGLETON to be used in the Common namepsace Silences the clang warning: static data member specialization of '_singleton' must originally be declared in namespace 'Common'; accepted as a C++0x extension [-Wc++0x-extensions] Wrapping "namespace Common {}" around the macro assignment causes clang to complain about a spurious semicolon, and removing the semicolon at the end of the macro causes some editors to misbehave. Changing the requirement of using the macro in one namespace (the global) to another (Common) seems a small price to pay to silence a warning. --- backends/fs/ds/ds-fs-factory.cpp | 2 ++ backends/fs/ps2/ps2-fs-factory.cpp | 2 ++ backends/fs/psp/psp-fs-factory.cpp | 2 ++ backends/fs/wii/wii-fs-factory.cpp | 2 ++ 4 files changed, 8 insertions(+) (limited to 'backends/fs') diff --git a/backends/fs/ds/ds-fs-factory.cpp b/backends/fs/ds/ds-fs-factory.cpp index 3fd97d07eb..4e09c3446b 100644 --- a/backends/fs/ds/ds-fs-factory.cpp +++ b/backends/fs/ds/ds-fs-factory.cpp @@ -27,7 +27,9 @@ #include "backends/fs/ds/ds-fs.h" #include "dsmain.h" //for the isGBAMPAvailable() function +namespace Common { DECLARE_SINGLETON(DSFilesystemFactory); +} AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const { if (DS::isGBAMPAvailable()) { diff --git a/backends/fs/ps2/ps2-fs-factory.cpp b/backends/fs/ps2/ps2-fs-factory.cpp index cad92b5dec..ef7b2013a3 100644 --- a/backends/fs/ps2/ps2-fs-factory.cpp +++ b/backends/fs/ps2/ps2-fs-factory.cpp @@ -27,7 +27,9 @@ #include "backends/fs/ps2/ps2-fs-factory.h" #include "backends/fs/ps2/ps2-fs.h" +namespace Common { DECLARE_SINGLETON(Ps2FilesystemFactory); +} AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const { return new Ps2FilesystemNode(); diff --git a/backends/fs/psp/psp-fs-factory.cpp b/backends/fs/psp/psp-fs-factory.cpp index ef1df246ba..bb3aca8ee6 100644 --- a/backends/fs/psp/psp-fs-factory.cpp +++ b/backends/fs/psp/psp-fs-factory.cpp @@ -43,7 +43,9 @@ #include +namespace Common { DECLARE_SINGLETON(PSPFilesystemFactory); +} AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const { return new PSPFilesystemNode(); diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 34cde8ef46..fbc9ef1da8 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -40,7 +40,9 @@ #include #endif +namespace Common { DECLARE_SINGLETON(WiiFilesystemFactory); +} WiiFilesystemFactory::WiiFilesystemFactory() : _dvdMounted(false), -- cgit v1.2.3