[Scummvm-cvs-logs] SF.net SVN: scummvm:[34134] scummvm/branches/branch-0-12-0/backends
sunmax at users.sourceforge.net
sunmax at users.sourceforge.net
Mon Aug 25 08:01:56 CEST 2008
Revision: 34134
http://scummvm.svn.sourceforge.net/scummvm/?rev=34134&view=rev
Author: sunmax
Date: 2008-08-25 06:01:55 +0000 (Mon, 25 Aug 2008)
Log Message:
-----------
*** Fixed following nasty bugs:
1906077 PS2: Black Screen of Death
-> rock solid on different mods to add
and play games (from DVD, USB, HD !)
1753511 PS2: Crash when push "quit" button
-> you can reboot ScummVM on exit but only
from CD/DVD (that's a BIOS call limit)
1753509 PS2: Scummvm.ini problem
-> you can have your SCUMMVM.INI on CD/DVD
*** Following bugs were also fixed:
- kyra/PS2 regression when playing from USB
- kyra saved games (you can now load them too)
Modified Paths:
--------------
scummvm/branches/branch-0-12-0/backends/fs/ps2/ps2-fs.cpp
scummvm/branches/branch-0-12-0/backends/platform/ps2/Makefile.ps2
scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.cpp
scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.h
scummvm/branches/branch-0-12-0/backends/platform/ps2/fileio.cpp
scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.cpp
scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.h
scummvm/branches/branch-0-12-0/backends/platform/ps2/ps2debug.h
scummvm/branches/branch-0-12-0/backends/platform/ps2/savefilemgr.cpp
scummvm/branches/branch-0-12-0/backends/platform/ps2/systemps2.cpp
Modified: scummvm/branches/branch-0-12-0/backends/fs/ps2/ps2-fs.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/fs/ps2/ps2-fs.cpp 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/fs/ps2/ps2-fs.cpp 2008-08-25 06:01:55 UTC (rev 34134)
@@ -27,13 +27,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include "backends/platform/ps2/asyncfio.h"
-#include "backends/platform/ps2/fileio.h"
-#include "backends/platform/ps2/systemps2.h"
-#include "backends/platform/ps2/ps2debug.h"
+#include "asyncfio.h"
+#include "fileio.h"
+#include "systemps2.h"
+#include "ps2debug.h"
#define DEFAULT_MODE (FIO_S_IRUSR | FIO_S_IWUSR | FIO_S_IRGRP | FIO_S_IWGRP | FIO_S_IROTH | FIO_S_IWOTH)
+FILE *ps2_fopen(const char *fname, const char *mode);
+int ps2_fclose(FILE *stream);
+// extern int fileXioChdir(const char* pathname);
+
+#include <fileXio_rpc.h>
+
+
extern AsyncFio fio;
extern OSystem_PS2 *g_systemPs2;
@@ -52,10 +59,6 @@
bool _isDirectory;
bool _isRoot;
-private:
- char *getDeviceDescription(const char *path) const;
- bool getDirectoryFlag(const char *path);
-
public:
/**
* Creates a PS2FilesystemNode with the root node as path.
@@ -74,23 +77,99 @@
* Copy constructor.
*/
Ps2FilesystemNode(const Ps2FilesystemNode *node);
+
+ virtual bool exists() const {
+ int fd;
- virtual bool exists(void) const;
+ dbg_printf("Q: Does %s exist ?\n", _path.c_str());
+ if (_path[4] != ':') { // don't bother for relative path...
+ // ...they always fail on PS2!
+ dbg_printf("A: nope -> skip relative path\n");
+ return false;
+ }
+
+ if (_path[0] == 'h') { // bypass host
+ dbg_printf("A: nope -> skip host\n");
+ return false;
+ }
+
+ if ((fd = fio.open(_path.c_str(), O_RDONLY)) >= 0) { /* it's a file */
+ fio.close(fd);
+ dbg_printf("A: yep -> file\n");
+ return true;
+ }
+
+ /* romeo's black magic */
+ fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
+ if (fd == -EISDIR) {
+ dbg_printf("A: yep -> dir\n");
+ return true;
+ }
+ /* NOTE: it cannot be a file cause it would have been caught by
+ the previous test, so no need to close it ;-) */
+
+ dbg_printf("A: nope\n");
+ return false;
+ }
+
virtual String getDisplayName() const { return _displayName; }
virtual String getName() const { return _displayName; }
virtual String getPath() const { return _path; }
+ virtual bool isDirectory() const {
- virtual bool isDirectory() const {
+ dbg_printf("Q: Is %s a dir?\n", _path.c_str());
+
+#if 0
+ int fd;
+
+ if (_path.empty()) {
+ printf("A: yep -> top level\n");
+ return true; // top level
+ }
+
+ if (_path.lastChar() == ':' ||
+ (_path.lastChar() == '/' && _path[_path.size()-2] == ':')) {
+ printf("A: yep -> device\n");
+ return true; // device
+ }
+
+ fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
+ if (fd == -EISDIR) {
+ printf("A: yep\n");
+ return true;
+ }
+
+ if (fd >= 0)
+ fio.close(fd);
+
+ printf("A: nope\n");
+ return false;
+#else
+ if (_isDirectory)
+ dbg_printf("A: yep -> _isDirectory == 1\n");
+ else
+ dbg_printf("A: nope -> _isDirectory == 0\n");
+
return _isDirectory;
+#endif
}
virtual bool isReadable() const {
- return exists();
+ int fd;
+ if ((fd = fio.open(_path.c_str(), O_RDONLY)) >= 0) {
+ fio.close(fd);
+ return true;
+ }
+ return false;
}
virtual bool isWritable() const {
- // The only writable device on the ps2 is the memory card
+ int fd;
+ if ((fd = fio.open(_path.c_str(), O_WRONLY)) >= 0) {
+ fio.close(fd);
+ return true;
+ }
return false;
}
@@ -117,7 +196,7 @@
--cur;
}
- printf("romeo : lastPathComponent = %s\n", cur + 1);
+ dbg_printf("romeo : lastPathComponent = %s\n", cur + 1);
return cur + 1;
}
@@ -130,6 +209,9 @@
}
Ps2FilesystemNode::Ps2FilesystemNode(const String &path) {
+
+ Ps2FilesystemNode(path, true);
+/*
_path = path;
_isDirectory = true;
if (strcmp(path.c_str(), "") == 0) {
@@ -143,91 +225,145 @@
dsplName = pos;
if (dsplName)
_displayName = String(dsplName);
- else
- _displayName = getDeviceDescription(path.c_str());
+ 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 String &path, bool verify) {
_path = path;
+ _isDirectory = true;
if (strcmp(path.c_str(), "") == 0) {
- _isRoot = true; /* root is always a dir*/
+ _isRoot = true;
_displayName = String("PlayStation 2");
- _isDirectory = true;
+ verify = false; /* root is always a dir*/
} else {
_isRoot = false;
const char *dsplName = NULL, *pos = path.c_str();
while (*pos)
if (*pos++ == '/')
dsplName = pos;
-
- if (dsplName) {
+ if (dsplName)
_displayName = String(dsplName);
- if (verify)
- _isDirectory = getDirectoryFlag(path.c_str());
+ 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
- _isDirectory = false;
- } else {
- _displayName = getDeviceDescription(path.c_str());
- _isDirectory = true; /* devices are always dir */
+ _displayName = "Harddisk";
+ verify = false; /* devices are always dir */
}
}
-}
-Ps2FilesystemNode::Ps2FilesystemNode(const Ps2FilesystemNode *node) {
- _displayName = node->_displayName;
- _isDirectory = node->_isDirectory;
- _path = node->_path;
- _isRoot = node->_isRoot;
-}
+ if (verify && !_isRoot) {
+ int medium, fd;
-bool Ps2FilesystemNode::exists(void) const {
-
- dbg_printf("Ps2FilesystemNode::exists: path \"%s\": ", _path.c_str());
+ if (strncmp(path.c_str(), "pfs0", 4) == 0)
+ medium = 0;
+ else if (strncmp(path.c_str(), "cdfs", 4) == 0)
+ medium = 1;
+ else if (strncmp(path.c_str(), "mass", 4) == 0)
+ medium = 2;
- if (_path[4] != ':') { // don't bother for relative path... they always fail on PS2!
- dbg_printf("NO, relative path\n");
- return false;
- }
+ switch(medium) {
- if (_path[0] == 'h') { // bypass host
- dbg_printf("NO, host device ignored\n");
- return false;
- }
+ case 0: /* hd */
+ dbg_printf("hd > ");
+ fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
- int fd = fio.open(_path.c_str(), O_RDONLY);
- if (fd == -EISDIR) {
- dbg_printf("YES, directory\n");
- return true;
- } else if (fd >= 0) {
- dbg_printf("YES, file\n");
- fio.close(fd);
- return true;
- }
+ if (fd == -EISDIR) {
+ dbg_printf(" romeo : new node [ %s ] is a dir\n", path.c_str());
+ }
+ else if (fd >=0) {
+ _isDirectory = false;
+ dbg_printf(" romeo : new node [ %s ] is -not- a dir (%d)\n",
+ path.c_str(), fd);
+ fio.close(fd);
+ }
+ else
+ dbg_printf(" romeo : new node [ %s ] is -not- (%d)\n",
+ path.c_str(), fd);
- printf("NO, not found\n");
- return false;
-}
+ break;
-bool Ps2FilesystemNode::getDirectoryFlag(const char *path) {
- if (strncmp(path, "host:", 5) == 0)
- return true; // Can't get listings from host: right now
+ case 1: /* cd */
+ dbg_printf("cd > ");
+ fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
- int fd = fio.open(_path.c_str(), O_RDONLY);
+ if (fd == -ENOENT) {
+ dbg_printf(" romeo : new node [ %s ] is a dir\n", path.c_str());
+ }
+ else if (fd >=0) {
+ _isDirectory = false;
+ dbg_printf(" romeo : new node [ %s ] is -not- a dir (%d)\n",
+ path.c_str(), fd);
+ fio.close(fd);
+ }
+ else
+ dbg_printf(" romeo : new node [ %s ] is -not- (%d)\n",
+ path.c_str(), fd);
- if (fd == -EISDIR) {
- dbg_printf(" romeo : new node [ %s ] is a dir\n", path);
- return true;
- } else if (fd >=0) {
- dbg_printf(" romeo : new node [ %s ] is -not- a dir (%d)\n", path, fd);
- fio.close(fd);
- } else
- dbg_printf(" romeo : new node [ %s ] is -not- (%d)\n", path, fd);
+ break;
- return false;
+ case 2: /* usb */
+ dbg_printf("usb > ");
+ // fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
+#if 1
+ fd = fio.open(_path.c_str(), O_RDONLY);
+ if (fd == -EISDIR) {
+ dbg_printf(" romeo : new node [ %s ] is a dir\n", path.c_str());
+ }
+ else if (fd > 0) {
+ _isDirectory = false;
+ dbg_printf(" romeo : new node [ %s ] is a -not- a dir (%d)\n",
+ path.c_str(), fd);
+ fio.close(fd);
+ }
+ else {
+ dbg_printf(" romeo : new node [ %s ] is a -not-\n", path.c_str());
+ _isDirectory = false;
+ }
+
+#else
+
+ fd = fio.chdir(path.c_str());
+
+ dbg_printf(" %d ", fd);
+
+ if (fd == -48) {
+ dbg_printf(" romeo : new node [ %s ] is a dir\n", path.c_str());
+ // fio.close(fd);
+ // chdir("");
+ }
+ else {
+ _isDirectory = false;
+ dbg_printf(" romeo : new node [ %s ] is a -not- a dir (%d)\n",
+ path.c_str(), fd);
+ }
+#endif
+
+ break;
+ } /* switch(medium) */
+
+ }
}
+Ps2FilesystemNode::Ps2FilesystemNode(const Ps2FilesystemNode *node) {
+ _displayName = node->_displayName;
+ _isDirectory = node->_isDirectory;
+ _path = node->_path;
+ _isRoot = node->_isRoot;
+}
+
AbstractFilesystemNode *Ps2FilesystemNode::getChild(const String &n) const {
if (!_isDirectory)
return NULL;
@@ -273,18 +409,18 @@
dirEntry._isDirectory = true;
dirEntry._isRoot = false;
dirEntry._path = "cdfs:";
- dirEntry._displayName = getDeviceDescription(dirEntry._path.c_str());
+ dirEntry._displayName = "DVD Drive";
list.push_back(new Ps2FilesystemNode(&dirEntry));
if (g_systemPs2->hddPresent()) {
dirEntry._path = "pfs0:";
- dirEntry._displayName = getDeviceDescription(dirEntry._path.c_str());
+ dirEntry._displayName = "Harddisk";
list.push_back(new Ps2FilesystemNode(&dirEntry));
}
if (g_systemPs2->usbMassPresent()) {
dirEntry._path = "mass:";
- dirEntry._displayName = getDeviceDescription(dirEntry._path.c_str());
+ dirEntry._displayName = "USB Mass Storage";
list.push_back(new Ps2FilesystemNode(&dirEntry));
}
return true;
@@ -348,14 +484,3 @@
else
return new Ps2FilesystemNode();
}
-
-
-char *Ps2FilesystemNode::getDeviceDescription(const char *path) const {
- if (strncmp(path, "cdfs", 4) == 0)
- return "DVD Drive";
- else if (strncmp(path, "mass", 4) == 0)
- return "USB Mass Storage";
- else
- return "Harddisk";
-}
-
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/Makefile.ps2
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/Makefile.ps2 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/Makefile.ps2 2008-08-25 06:01:55 UTC (rev 34134)
@@ -1,5 +1,5 @@
# $Header: Exp $
- include $(PS2SDK)/Defs.make
+include $(PS2SDK)/Defs.make
ENABLED=STATIC_PLUGIN
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.cpp 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.cpp 2008-08-25 06:01:55 UTC (rev 34134)
@@ -58,6 +58,17 @@
return res;
}
+int AsyncFio::open(const char *name, int ioMode, int mode) {
+ WaitSema(_ioSema);
+ checkSync();
+ int res;
+ fileXioOpen(name, ioMode, mode);
+ fileXioWaitAsync(FXIO_WAIT, &res);
+ SignalSema(_ioSema);
+ // dbg_printf("FIO: open ext(%s, %d, %d) => %d", name, ioMode, mode, res);
+ return res;
+}
+
void AsyncFio::close(int handle) {
WaitSema(_ioSema);
checkSync();
@@ -149,6 +160,16 @@
SignalSema(_ioSema);
}
+int AsyncFio::chdir(const char *name) {
+ int res;
+ WaitSema(_ioSema);
+ checkSync();
+ fileXioChdir(name);
+ fileXioWaitAsync(FXIO_WAIT, &res);
+ SignalSema(_ioSema);
+ return res;
+}
+
int AsyncFio::mount(const char *mountpoint, const char *mountstring, int flag) {
int res;
WaitSema(_ioSema);
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.h
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.h 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/asyncfio.h 2008-08-25 06:01:55 UTC (rev 34134)
@@ -31,6 +31,7 @@
AsyncFio(void);
~AsyncFio(void);
int open(const char *name, int ioMode);
+ int open(const char *name, int ioMode, int mode);
void close(int handle);
void read(int fd, void *dest, unsigned int len);
void write(int fd, const void *src, unsigned int len);
@@ -39,6 +40,7 @@
int dopen(const char *name);
int dread(int fd, iox_dirent_t *dest);
void dclose(int fd);
+ int chdir(const char *name);
int mount(const char *mountpoint, const char *mountstring, int flag);
int umount(const char *mountpoint);
int sync(int fd);
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/fileio.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/fileio.cpp 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/fileio.cpp 2008-08-25 06:01:55 UTC (rev 34134)
@@ -341,7 +341,7 @@
}
if (((mode[0] != 'r') && (mode[0] != 'w')) || ((mode[1] != '\0') && (mode[1] != 'b'))) {
- printf("unsupported mode \"%s\" for file \"%s\"\n", mode, fname);
+ dbg_printf("unsupported mode \"%s\" for file \"%s\"\n", mode, fname);
return NULL;
}
bool rdOnly = (mode[0] == 'r');
@@ -361,7 +361,7 @@
} else {
// Regular access to one of the devices
- printf("ps2_fopen = %s\n", fname); // romeo : temp
+ dbg_printf("ps2_fopen = %s\n", fname); // romeo : temp
if (!rdOnly)
return NULL; // we only provide readaccess for cd,dvd,hdd,usb
@@ -369,7 +369,7 @@
if (!checkedPath && g_engine) {
// are we playing from cd/dvd?
const char *gameDataPath = ConfMan.get("path").c_str();
- printf("Read TOC dir: %s\n", gameDataPath);
+ dbg_printf("Read TOC dir: %s\n", gameDataPath);
if (strncmp(gameDataPath, "cdfs:", 5) != 0)
driveStop(); // no, we aren't. stop the drive. it's noisy.
// now cache the dir tree
@@ -384,7 +384,7 @@
if (cacheId != 0) {
Ps2File *file = findInCache(cacheId);
if (file) {
- printf(" findInCache(%x)\n", cacheId); // romeo : temp
+ dbg_printf(" findInCache(%x)\n", cacheId); // romeo : temp
return (FILE*)file;
}
@@ -393,7 +393,7 @@
if (file->open(fname)) {
openFileCount++;
- printf(" new cacheID = %x\n", cacheId); // romeo : temp
+ dbg_printf(" new cacheID = %x\n", cacheId); // romeo : temp
return (FILE*)file;
} else
delete file;
@@ -530,7 +530,7 @@
int res = vsnprintf(resStr, 2048, zFormat, ap);
va_end(ap);
if ((pOut == stderr) || (pOut == stdout)) {
- printf("%s", resStr);
+ dbg_printf("%s", resStr);
sioprintf("%s", resStr);
} else
res = ps2_fwrite(resStr, 1, res, pOut);
@@ -558,7 +558,7 @@
}
int ps2_fflush(FILE *stream) {
- printf("fflush not implemented\n");
+ dbg_printf("fflush not implemented\n");
return 0;
}
@@ -582,7 +582,7 @@
}
char readPath[256];
sprintf(readPath, "%s/", _root);
- printf("readDir: %s (root: %s )\n", readPath, root);
+ dbg_printf("readDir: %s (root: %s )\n", readPath, root);
readDir(readPath, &_rootNode, 0);
}
@@ -593,7 +593,7 @@
TocNode *eNode = NULL; // = *node; // entry node
bool first = true;
- printf("path=%s - level=%d fd=%d\n", path, level, fd); // romeo : temp
+ dbg_printf("path=%s - level=%d fd=%d\n", path, level, fd); // romeo : temp
if (fd >= 0) {
while (fio.dread(fd, &dirent) > 0) {
if (dirent.name[0] != '.') { // skip '.' & '..' - romeo : check
@@ -609,11 +609,11 @@
if (dirent.stat.mode & FIO_S_IFDIR) {
(*node)->isDir = true;
- printf("dirent.name = %s [DIR]\n", dirent.name);
+ dbg_printf("dirent.name = %s [DIR]\n", dirent.name);
}
else {
(*node)->isDir = false;
- printf("dirent.name = %s\n", dirent.name);
+ dbg_printf("dirent.name = %s\n", dirent.name);
}
node = &((*node)->next);
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.cpp 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.cpp 2008-08-25 06:01:55 UTC (rev 34134)
@@ -38,26 +38,26 @@
IrxFile irxFiles[] = {
{ "SIO2MAN", BIOS, NOTHING, NULL, 0 },
- { "MCMAN", BIOS, NOTHING, NULL, 0 },
+ { "MCMAN", BIOS, NOTHING, NULL, 0 },
{ "MCSERV", BIOS, NOTHING, NULL, 0 },
{ "PADMAN", BIOS, NOTHING, NULL, 0 },
{ "LIBSD", BIOS, NOTHING, NULL, 0 },
- { "IOMANX.IRX", SYSTEM /*| NOT_HOST*/, NOTHING, NULL, 0 }, // already loaded by ps2link
+ { "IOMANX.IRX", SYSTEM, NOTHING, NULL, 0 },
{ "FILEXIO.IRX", SYSTEM, NOTHING, NULL, 0 },
{ "CODYVDFS.IRX", SYSTEM, NOTHING, NULL, 0 },
{ "SJPCM.IRX", SYSTEM, NOTHING, NULL, 0 },
{ "USBD.IRX", USB | OPTIONAL | DEPENDANCY, USB_DRIVER, NULL, 0 },
+ { "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 },
{ "PS2MOUSE.IRX", USB | OPTIONAL, MOUSE_DRIVER, NULL, 0 },
{ "RPCKBD.IRX", USB | OPTIONAL, KBD_DRIVER, NULL, 0 },
- { "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 },
- { "PS2DEV9.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, NULL, 0 },
+ { "POWEROFF.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 },
+ { "PS2DEV9.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 },
{ "PS2ATAD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, NULL, 0 },
{ "PS2HDD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, hddArg, sizeof(hddArg) },
- { "PS2FS.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) },
- { "POWEROFF.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, NULL, 0 }
+ { "PS2FS.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) }
};
static const int numIrxFiles = sizeof(irxFiles) / sizeof(irxFiles[0]);
@@ -66,8 +66,10 @@
BootDevice device;
- if (strncasecmp(elfPath, "cdrom0:", 7) == 0)
+ if (strncasecmp(elfPath, "cdrom", 5) == 0)
device = CDROM;
+ else if (strncasecmp(elfPath, "mass", 4) == 0)
+ device = MASS;
else if (strncasecmp(elfPath, "host", 4) == 0)
device = HOST;
else
@@ -111,7 +113,7 @@
} else {
sioprintf("path not recognized, default to host.\n");
strcpy(bootPath, "host:");
- device = UNKNOWN;
+ device = HOST; // UNKNOWN;
}
return device;
}
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.h
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.h 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/irxboot.h 2008-08-25 06:01:55 UTC (rev 34134)
@@ -57,8 +57,8 @@
enum BootDevice {
HOST = 0,
CDROM,
- OTHER,
- UNKNOWN
+ MASS,
+ OTHER
};
struct IrxFile {
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/ps2debug.h
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/ps2debug.h 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/ps2debug.h 2008-08-25 06:01:55 UTC (rev 34134)
@@ -26,7 +26,8 @@
#ifndef __PS2DEBUG_H__
#define __PS2DEBUG_H__
-#define dbg_printf sioprintf
+// #define dbg_printf(args...) printf(args)
+#define dbg_printf(args...) //
void sioprintf(const char *zFormat, ...);
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/savefilemgr.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/savefilemgr.cpp 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/savefilemgr.cpp 2008-08-25 06:01:55 UTC (rev 34134)
@@ -170,12 +170,12 @@
if ((res == 0) || (res == -1)) { // mc okay
_mcPresent = true;
- printf("MC okay, result = %d. Type %d, Free %d, Format %d\n", res, mcType, mcFree, mcFormat);
+ dbg_printf("MC okay, result = %d. Type %d, Free %d, Format %d\n", res, mcType, mcFree, mcFormat);
checkMainDirectory();
break;
} else {
_mcPresent = false;
- printf("MC failed, not present or not formatted, code %d\n", res);
+ dbg_printf("MC failed, not present or not formatted, code %d\n", res);
}
}
@@ -211,9 +211,9 @@
int ret, fd;
_mcNeedsUpdate = true;
ret = _mc->getDir("/ScummVM/*", 0, MAX_MC_ENTRIES, _mcDirList);
- printf("/ScummVM/* res = %d\n", ret);
+ dbg_printf("/ScummVM/* res = %d\n", ret);
if (ret <= 0) { // assume directory doesn't exist
- printf("Dir doesn't exist\n");
+ dbg_printf("Dir doesn't exist\n");
ret = _mc->mkDir("/ScummVM");
if (ret >= 0) {
fd = _mc->open("/ScummVM/scummvm.icn", O_WRONLY | O_CREAT);
@@ -224,12 +224,12 @@
_mc->close(fd);
free(icoBuf);
- printf(".icn written\n");
+ dbg_printf(".icn written\n");
setupIcon("/ScummVM/icon.sys", "scummvm.icn", "ScummVM", "Configuration");
} else
- printf("Can't create icon file: %d\n", fd);
+ dbg_printf("Can't create icon file: %d\n", fd);
} else
- printf("can't create scummvm directory: %d\n", ret);
+ dbg_printf("can't create scummvm directory: %d\n", ret);
}
}
@@ -257,7 +257,7 @@
checkMainDirectory(); // make sure ScummVM dir and icon are there
} else { // no memorycard in slot or not formatted or something like that
_mcPresent = false;
- printf("MC not found, error code %d\n", mcResult);
+ dbg_printf("MC not found, error code %d\n", mcResult);
return false;
}
}
@@ -279,15 +279,15 @@
char dir[256], name[256];
splitPath(filename, dir, name);
- printf("openForLoading: \"%s\" => \"%s\" + \"%s\"\n", filename, dir, name);
+ dbg_printf("openForLoading: \"%s\" => \"%s\" + \"%s\"\n", filename, dir, name);
if (mcReadyForDir(dir)) {
- printf("Ready\n");
+ dbg_printf("Ready\n");
bool fileExists = false;
for (int i = 0; i < _mcEntries; i++)
if (strcmp(name, (char*)_mcDirList[i].name) == 0)
fileExists = true;
if (fileExists) {
- printf("Found!\n");
+ dbg_printf("Found!\n");
char fullName[256];
sprintf(fullName, "/ScummVM-%s/%s", dir, name);
UclInSaveFile *file = new UclInSaveFile(fullName, _screen, _mc);
@@ -295,12 +295,12 @@
if (!file->ioFailed())
return file;
else {
- printf("IoFailed\n");
+ dbg_printf("IoFailed\n");
delete file;
}
}
} else
- printf("file %s (%s) doesn't exist\n", filename, name);
+ dbg_printf("file %s (%s) doesn't exist\n", filename, name);
}
_screen->wantAnim(false);
return NULL;
@@ -342,7 +342,7 @@
_mcNeedsUpdate = true;
return file;
} else {
- printf("UCL out create failed!\n");
+ dbg_printf("UCL out create failed!\n");
delete file;
}
}
@@ -385,7 +385,7 @@
char *stopCh;
int destNum = (int)strtoul((char*)mcEntries[i].name + searchLen, &stopCh, 10);
if ((!stopCh) || strcmp(stopCh, ".ucl"))
- printf("unexpected end %s in name %s, search %s\n", stopCh, (char*)mcEntries[i].name, prefix);
+ dbg_printf("unexpected end %s in name %s, search %s\n", stopCh, (char*)mcEntries[i].name, prefix);
if (destNum < num)
marks[destNum] = true;
}
@@ -399,7 +399,7 @@
Common::StringList results;
int mcType, mcFree, mcFormat, mcResult;
- printf("listSavefiles -> regex=%s\n", regex);
+ dbg_printf("listSavefiles -> regex=%s\n", regex);
mcResult = _mc->getInfo(&mcType, &mcFree, &mcFormat);
@@ -410,30 +410,41 @@
mcTable *mcEntries = (mcTable*)memalign(64, sizeof(mcTable) * MAX_MC_ENTRIES);
- char temp[256], mcSearchStr[256], *dir, *ext;
+ char temp[64], key[64], mcSearchStr[64], *dir, *ext;
strcpy(temp, regex);
dir = strdup(strtok(temp, "."));
- ext = strdup(strtok(NULL, "*"));
+ ext = strdup(strtok(NULL, "."));
- printf("dir = %s - ext = %s\n", dir, ext);
+ if (strcmp(ext, "???") == 0) {
+ free(ext);
+ ext = strdup("*"); // workaround for kyra in ScummVM > 0.11.1
+ // legitimte in PS2 cause there are only
+ // saved games inside "dir" so "*" will
+ // always give us what we are looking for ;-)
+ }
- sprintf(mcSearchStr, "/ScummVM-%s/%s*", dir, ext);
+ dbg_printf("dir = %s - ext = %s\n", dir, ext);
+ sprintf(mcSearchStr, "/ScummVM-%s/%s", dir, ext);
+ sprintf(key, "%s.ucl", ext);
+
+ dbg_printf("path = %s - key = %s\n", mcSearchStr, key);
+
int numEntries = _mc->getDir(mcSearchStr, 0, MAX_MC_ENTRIES, mcEntries);
char *name;
for (int i = 0; i < numEntries; i++) {
name = (char*)mcEntries[i].name;
if ((name[0] != '.') && stricmp(name, "icon.sys")) {
- printf(" name = %s\n", (char*)mcEntries[i].name);
- if (Common::matchString(name, "s*.ucl")) {
- sprintf(temp, "%s.%s%c%c", dir, ext, name[1], name[2]);
+ dbg_printf(" name = %s\n", (char*)mcEntries[i].name);
+ if (Common::matchString(name, key)) {
+ sprintf(temp, "%s.%c%c%c", dir, name[0], name[1], name[2]);
results.push_back(temp);
- printf(" -> match [%s] ;-)\n", temp);
+ dbg_printf(" -> match [%s] ;-)\n", temp);
}
else {
results.push_back(name); // ;-)
- printf(" -> no match :-(\n");
+ dbg_printf(" -> no match :-(\n");
}
}
}
Modified: scummvm/branches/branch-0-12-0/backends/platform/ps2/systemps2.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/backends/platform/ps2/systemps2.cpp 2008-08-24 23:17:17 UTC (rev 34133)
+++ scummvm/branches/branch-0-12-0/backends/platform/ps2/systemps2.cpp 2008-08-25 06:01:55 UTC (rev 34134)
@@ -257,6 +257,14 @@
SifLoadFileInit();
cdvdInit(CDVD_INIT_WAIT);
}
+ else {
+ // romeo : HOST : pre-load
+
+ // TODO: avoid re-loading USB_MASS.IRX -> it will jam mass:
+
+ // TODO: ps2link 1.46 will stall on "poweroff" init / cb
+ }
+
startIrxModules(numModules, modules);
int res;
@@ -281,12 +289,12 @@
dbg_printf("romeo : hddCheckPresent done : %d\n", _useHdd);
- // hddPreparePoweroff();
- //poweroffInit();
+ //hddPreparePoweroff();
+ poweroffInit();
dbg_printf("romeo : hddPreparePoweroff done\n");
- // hddSetUserPoweroffCallback(gluePowerOffCallback, this);
- //poweroffSetCallback(gluePowerOffCallback, this);
+ //hddSetUserPoweroffCallback(gluePowerOffCallback, this);
+ poweroffSetCallback(gluePowerOffCallback, this);
dbg_printf("romeo : hddSetUserPoweroffCallback done\n");
}
@@ -464,7 +472,16 @@
}
bool OSystem_PS2::usbMassPresent(void) {
-
+#if 1
+ int fd = fio.dopen("mass:");
+
+ if (fd > 0) {
+ fio.dclose(fd);
+ return true;
+ }
+ else
+ return false;
+#else
if (_usbMassLoaded) {
int testFd = fio.dopen("mass:/");
if (testFd >= 0)
@@ -473,6 +490,7 @@
return true;
}
return false;
+#endif
}
void OSystem_PS2::initSize(uint width, uint height) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list