[Scummvm-cvs-logs] CVS: scummvm/backends/fs/ps2 ps2-fs.cpp,1.3.2.3,1.3.2.4
Robert Göffringmann
lavosspawn at users.sourceforge.net
Wed Jan 25 18:33:00 CET 2006
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/backends/ps2 fileio.cpp,1.4.2.6,1.4.2.7 savefile.cpp,1.6.2.6,1.6.2.7 systemps2.cpp,1.8.2.8,1.8.2.9 systemps2.h,1.7.2.8,1.7.2.9
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common config-manager.cpp,1.41.2.4,1.41.2.5 scummsys.h,1.70.2.2,1.70.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/backends/fs/ps2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19322/backends/fs/ps2
Modified Files:
Tag: branch-0-8-0
ps2-fs.cpp
Log Message:
some ps2 changes...
Index: ps2-fs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/ps2/ps2-fs.cpp,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -d -r1.3.2.3 -r1.3.2.4
--- ps2-fs.cpp 18 Jan 2006 18:07:23 -0000 1.3.2.3
+++ ps2-fs.cpp 26 Jan 2006 02:32:44 -0000 1.3.2.4
@@ -22,9 +22,11 @@
#include <kernel.h>
#include <stdio.h>
#include <stdlib.h>
-#include <cdvd_rpc.h>
+#include "asyncfio.h"
+#include "systemps2.h"
-#define MAX_LIST_ENTRIES 512
+extern AsyncFio fio;
+extern OSystem_PS2 *g_systemPs2;
class Ps2FilesystemNode : public AbstractFilesystemNode {
protected:
@@ -39,7 +41,7 @@
Ps2FilesystemNode(const String &path);
virtual String displayName() const { return _displayName; }
- virtual bool isValid() const { return true; }
+ virtual bool isValid() const { return !_isRoot; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
@@ -59,20 +61,33 @@
Ps2FilesystemNode::Ps2FilesystemNode(void) {
_isDirectory = true;
_isRoot = true;
- _displayName = "CD Root";
- _path = "cdfs:";
+ _displayName = "PlayStation 2";
+ _path = "";
}
Ps2FilesystemNode::Ps2FilesystemNode(const String &path) {
- if (strcmp(path.c_str(), "cdfs:") == 0)
- _isRoot = true;
_path = path;
- const char *dsplName = NULL, *pos = path.c_str();
- while (*pos)
- if (*pos++ == '/')
- dsplName = pos;
- _displayName = String(dsplName);
_isDirectory = true;
+ if (strcmp(path.c_str(), "") == 0) {
+ _isRoot = true;
+ _displayName = String("PlayStation 2");
+ } else {
+ _isRoot = false;
+ const char *dsplName = NULL, *pos = path.c_str();
+ while (*pos)
+ if (*pos++ == '/')
+ dsplName = pos;
+ if (dsplName)
+ _displayName = String(dsplName);
+ else {
+ if (strncmp(path.c_str(), "cdfs", 4) == 0)
+ _displayName = "DVD Drive";
+ else if (strncmp(path.c_str(), "mass", 4) == 0)
+ _displayName = "USB Mass Storage";
+ else
+ _displayName = "Harddisk";
+ }
+ }
}
Ps2FilesystemNode::Ps2FilesystemNode(const Ps2FilesystemNode *node) {
@@ -86,38 +101,58 @@
assert(_isDirectory);
FSList myList;
- struct TocEntry *tocEntries = (struct TocEntry*)malloc(MAX_LIST_ENTRIES * sizeof(struct TocEntry));
- int files;
- char listDir[512];
- sprintf(listDir, "%s/", _path.c_str() + 5);
-
- switch(mode) {
- case kListFilesOnly:
- files = CDVD_GetDir(listDir, NULL, CDVD_GET_FILES_ONLY, tocEntries, MAX_LIST_ENTRIES, NULL);
- break;
- case kListDirectoriesOnly:
- files = CDVD_GetDir(listDir, NULL, CDVD_GET_DIRS_ONLY, tocEntries, MAX_LIST_ENTRIES, NULL);
- break;
- default:
- files = CDVD_GetDir(listDir, NULL, CDVD_GET_FILES_AND_DIRS, tocEntries, MAX_LIST_ENTRIES, NULL);
- break;
- }
- Ps2FilesystemNode dirEntry;
- for (int fCnt = 0; fCnt < files; fCnt++) {
- if (tocEntries[fCnt].filename[0] != '.') { // skip .. directory
- dirEntry._isDirectory = (bool)(tocEntries[fCnt].fileProperties & 2);
- dirEntry._isRoot = false;
+ if (_isRoot) {
+ Ps2FilesystemNode dirEntry;
+ dirEntry._isDirectory = true;
+ dirEntry._isRoot = false;
+ dirEntry._path = "cdfs:";
+ dirEntry._displayName = "DVD Drive";
+ myList.push_back(wrap(new Ps2FilesystemNode(&dirEntry)));
- dirEntry._path = _path;
- dirEntry._path += "/";
- dirEntry._path += tocEntries[fCnt].filename;
+ if (g_systemPs2->hddPresent()) {
+ dirEntry._path = "pfs0:";
+ dirEntry._displayName = "Harddisk";
+ myList.push_back(wrap(new Ps2FilesystemNode(&dirEntry)));
+ }
- dirEntry._displayName = tocEntries[fCnt].filename;
+ if (g_systemPs2->usbMassPresent()) {
+ dirEntry._path = "mass:";
+ dirEntry._displayName = "USB Mass Storage";
myList.push_back(wrap(new Ps2FilesystemNode(&dirEntry)));
}
+ } else {
+ char listDir[256];
+ sprintf(listDir, "%s/", _path.c_str());
+ int fd = fio.dopen(listDir);
+
+ if (fd >= 0) {
+ iox_dirent_t dirent;
+ Ps2FilesystemNode dirEntry;
+ int dreadRes;
+ while ((dreadRes = fio.dread(fd, &dirent)) > 0) {
+ if (dirent.name[0] == '.')
+ continue; // ignore '.' and '..'
+ if (((mode == kListDirectoriesOnly) && (dirent.stat.mode & FIO_S_IFDIR)) ||
+ ((mode == kListFilesOnly) && !(dirent.stat.mode & FIO_S_IFDIR)) ||
+ (mode == kListAll)) {
+
+ dirEntry._isDirectory = (bool)(dirent.stat.mode & FIO_S_IFDIR);
+ dirEntry._isRoot = false;
+
+ dirEntry._path = _path;
+ dirEntry._path += "/";
+ dirEntry._path += dirent.name;
+
+ dirEntry._displayName = dirent.name;
+
+ myList.push_back(wrap(new Ps2FilesystemNode(&dirEntry)));
+ }
+ }
+ fio.dclose(fd);
+ }
}
- free(tocEntries);
+
return myList;
}
@@ -125,8 +160,6 @@
if (_isRoot)
return new Ps2FilesystemNode(this);
- Ps2FilesystemNode *p = new Ps2FilesystemNode();
-
const char *slash = NULL;
const char *cnt = _path.c_str();
@@ -136,9 +169,9 @@
cnt++;
}
- p->_path = String(_path.c_str(), slash - _path.c_str());
- p->_isDirectory = true;
- p->_displayName = slash + 1;
- return p;
+ if (slash)
+ return new Ps2FilesystemNode(String(_path.c_str(), slash - _path.c_str()));
+ else
+ return new Ps2FilesystemNode();
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/backends/ps2 fileio.cpp,1.4.2.6,1.4.2.7 savefile.cpp,1.6.2.6,1.6.2.7 systemps2.cpp,1.8.2.8,1.8.2.9 systemps2.h,1.7.2.8,1.7.2.9
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common config-manager.cpp,1.41.2.4,1.41.2.5 scummsys.h,1.70.2.2,1.70.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list