[Scummvm-cvs-logs] CVS: scummvm/backends/ps2 asyncfio.cpp,1.5.2.3,1.5.2.4 asyncfio.h,1.4.2.2,1.4.2.3 fileio.cpp,1.4.2.4,1.4.2.5 systemps2.cpp,1.8.2.4,1.8.2.5 systemps2.h,1.7.2.4,1.7.2.5
Robert Göffringmann
lavosspawn at users.sourceforge.net
Wed Nov 16 17:54:02 CET 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/backends/ps2/iop/CoDyVDfs/iop cdtypes.h,NONE,1.1.2.1 codyvdfs.c,NONE,1.1.2.1 codyvdfs.h,NONE,1.1.2.1 fiofs.c,NONE,1.1.2.1 fiofs.h,NONE,1.1.2.1 imports.lst,NONE,1.1.2.1 irx_imports.h,NONE,1.1.2.1 rpcfs.c,NONE,1.1.2.1
- Next message: [Scummvm-cvs-logs] CVS: scummvm/simon game.cpp,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/backends/ps2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3573/backends/ps2
Modified Files:
Tag: branch-0-8-0
asyncfio.cpp asyncfio.h fileio.cpp systemps2.cpp systemps2.h
Log Message:
some ps2 changes, added HDD support
Index: asyncfio.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/ps2/asyncfio.cpp,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -d -r1.5.2.3 -r1.5.2.4
--- asyncfio.cpp 26 Oct 2005 16:34:58 -0000 1.5.2.3
+++ asyncfio.cpp 17 Nov 2005 01:53:26 -0000 1.5.2.4
@@ -143,6 +143,26 @@
SignalSema(_ioSema);
}
+int AsyncFio::mount(const char *mountpoint, const char *mountstring, int flag) {
+ int res;
+ WaitSema(_ioSema);
+ checkSync();
+ fileXioMount(mountpoint, mountstring, flag);
+ fileXioWaitAsync(FXIO_WAIT, &res);
+ SignalSema(_ioSema);
+ return res;
+}
+
+int AsyncFio::umount(const char *mountpoint) {
+ int res;
+ WaitSema(_ioSema);
+ checkSync();
+ fileXioUmount(mountpoint);
+ fileXioWaitAsync(FXIO_WAIT, &res);
+ SignalSema(_ioSema);
+ return res;
+}
+
int AsyncFio::sync(int fd) {
WaitSema(_ioSema);
if (_runningOp == _ioSlots + fd)
Index: asyncfio.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/ps2/asyncfio.h,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -d -r1.4.2.2 -r1.4.2.3
--- asyncfio.h 25 Oct 2005 06:56:28 -0000 1.4.2.2
+++ asyncfio.h 17 Nov 2005 01:53:26 -0000 1.4.2.3
@@ -35,6 +35,8 @@
int dopen(const char *name);
int dread(int fd, iox_dirent_t *dest);
void dclose(int fd);
+ int mount(const char *mountpoint, const char *mountstring, int flag);
+ int umount(const char *mountpoint);
int sync(int fd);
bool poll(int fd);
bool fioAvail(void);
Index: fileio.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/ps2/fileio.cpp,v
retrieving revision 1.4.2.4
retrieving revision 1.4.2.5
diff -u -d -r1.4.2.4 -r1.4.2.5
--- fileio.cpp 26 Oct 2005 18:09:22 -0000 1.4.2.4
+++ fileio.cpp 17 Nov 2005 01:53:26 -0000 1.4.2.5
@@ -26,10 +26,10 @@
#include <fileio.h>
#include <assert.h>
#include <string.h>
-#include <cdvd_rpc.h>
#include "backends/ps2/asyncfio.h"
#include "base/engine.h"
#include "common/file.h"
+#include "eecodyvdfs.h"
#define CACHE_SIZE (2048 * 32)
#define MAX_READ_STEP (2048 * 16)
@@ -395,7 +395,7 @@
uint8 _rootLen;
};
-TocManager tocManager;
+static TocManager tocManager;
struct FioHandleCache {
Ps2File *file;
@@ -408,6 +408,8 @@
static int openFileCount = 0;
static int cacheListSema = -1;
+static bool checkedPath = false;
+
Ps2File *findInCache(int64 id);
FILE *ps2_fopen(const char *fname, const char *mode) {
@@ -418,8 +420,15 @@
cacheListSema = CreateSema(&newSema);
assert(cacheListSema >= 0);
}
- if (!tocManager.haveEntries() && g_engine) // read the TOC the first time the engine opens a file
+
+ if (!checkedPath && g_engine) {
+ // are we playing from HDD?
+ if (strncmp(g_engine->getGameDataPath(), "pfs0:", 5) == 0)
+ driveStop(); // yes we are. stop dvd drive. it's noisy.
+ // now cache the dir tree
tocManager.readEntries(g_engine->getGameDataPath());
+ checkedPath = true;
+ }
if (((mode[0] != 'r') && (mode[0] != 'w')) || ((mode[1] != '\0') && (mode[1] != 'b'))) {
printf("unsupported mode \"%s\" for file \"%s\"\n", mode, fname);
@@ -621,7 +630,6 @@
}
TocManager::~TocManager(void) {
- // todo: write this...
}
bool TocManager::haveEntries(void) {
@@ -635,34 +643,36 @@
_rootLen--;
_root[_rootLen] = '\0';
}
- readDir(_root, &_rootNode, 0);
+ char readPath[256];
+ sprintf(readPath, "%s/", _root);
+ readDir(readPath, &_rootNode, 0);
}
-#define MAX_DIR_ENTRIES 512
-
void TocManager::readDir(const char *path, TocNode **node, int level) {
if (level <= 2) { // we don't scan deeper than that
- struct TocEntry tocEntries[MAX_DIR_ENTRIES];
- int files = CDVD_GetDir(path + 5, NULL, CDVD_GET_FILES_AND_DIRS, tocEntries, MAX_DIR_ENTRIES, NULL);
-
- for (int cnt = 0; cnt < files; cnt++) {
- if (tocEntries[cnt].filename[0] != '.') { // skip '.' and '..'
- *node = new TocNode;
- (*node)->sub = (*node)->next = NULL;
+ iox_dirent_t dirent;
+ int fd = fio.dopen(path);
+ if (fd >= 0) {
+ while (fio.dread(fd, &dirent) != 0)
+ if (dirent.name[0] != '.') { // skip '.' and '..'
+ *node = new TocNode;
+ (*node)->sub = (*node)->next = NULL;
- (*node)->nameLen = strlen(tocEntries[cnt].filename);
- memcpy((*node)->name, tocEntries[cnt].filename, (*node)->nameLen + 1);
+ (*node)->nameLen = strlen(dirent.name);
+ memcpy((*node)->name, dirent.name, (*node)->nameLen + 1);
- if (tocEntries[cnt].fileProperties & 2) { // directory
- (*node)->isDir = true;
- char nextPath[256];
- sprintf(nextPath, "%s/%s", path, tocEntries[cnt].filename);
- readDir(nextPath, &((*node)->sub), level + 1);
- } else
- (*node)->isDir = false;
- node = &((*node)->next);
- }
- }
+ if (dirent.stat.mode & FIO_S_IFDIR) { // directory
+ (*node)->isDir = true;
+ char nextPath[256];
+ sprintf(nextPath, "%s%s/", path, dirent.name);
+ readDir(nextPath, &((*node)->sub), level + 1);
+ } else
+ (*node)->isDir = false;
+ node = &((*node)->next);
+ }
+ fio.dclose(fd);
+ } else
+ printf("Can't open path: %s\n", path);
}
}
Index: systemps2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/ps2/systemps2.cpp,v
retrieving revision 1.8.2.4
retrieving revision 1.8.2.5
diff -u -d -r1.8.2.4 -r1.8.2.5
--- systemps2.cpp 12 Nov 2005 07:19:46 -0000 1.8.2.4
+++ systemps2.cpp 17 Nov 2005 01:53:26 -0000 1.8.2.5
@@ -38,7 +38,7 @@
#include "backends/ps2/Gs2dScreen.h"
#include "backends/ps2/ps2input.h"
#include <sjpcm.h>
-#include <cdvd_rpc.h>
+#include <libhdd.h>
#include "backends/ps2/savefile.h"
#include "common/file.h"
#include "backends/ps2/sysdefs.h"
@@ -49,6 +49,7 @@
#include <fileXio_rpc.h>
#include "graphics/surface.h"
#include "graphics/font.h"
+#include "eecodyvdfs.h"
#define TIMER_STACK_SIZE (1024 * 32)
#define SOUND_STACK_SIZE (1024 * 32)
@@ -79,6 +80,8 @@
namespace Graphics {
extern const NewFont g_sysfont;
};
+#include "asyncfio.h"
+extern AsyncFio fio;
void sioprintf(const char *zFormat, ...) {
va_list ap;
@@ -194,21 +197,19 @@
sioprintf("Loading IOP modules...");
loadModules();
+ printf("Modules done\n");
+
int res;
- if ((res = SjPCM_Init(0)) < 0) {
- msgPrintf(FOREVER, "SjPCM Bind failed: %d", res);
+ if ((res = initCdvdFs()) < 0) {
+ msgPrintf(FOREVER, "CoDyVDfs bind failed: %d", res);
quit();
}
- if ((res = CDVD_Init()) != 0) {
- msgPrintf(FOREVER, "CDVD Init failed: %d", res);
- quit();
- }
-
- if ((res = fileXioInit()) < 0) {
- msgPrintf(FOREVER, "FXIO Init failed: %d", res);
+ if ((res = SjPCM_Init(0)) < 0) {
+ msgPrintf(FOREVER, "SjPCM Bind failed: %d", res);
quit();
}
+
fileXioSetBlockMode(FXIO_NOWAIT);
_mouseVisible = false;
@@ -216,6 +217,13 @@
sioprintf("reading RTC");
readRtcTime();
+ if (_useHdd) {
+ if (fio.mount("pfs0:", "hdd0:+ScummVM", 0) >= 0)
+ printf("Successfully mounted!\n");
+ else
+ _useHdd = false;
+ }
+
sioprintf("Starting SavefileManager");
_saveManager = new Ps2SaveFileManager(this, _screen);
@@ -389,13 +397,18 @@
IRX_PREFIX "IOMANX.IRX" IRX_SUFFIX,
#endif
IRX_PREFIX "FILEXIO.IRX" IRX_SUFFIX,
- IRX_PREFIX "CDVD.IRX" IRX_SUFFIX,
- IRX_PREFIX "SJPCM.IRX" IRX_SUFFIX
+ IRX_PREFIX "CODYVDFS.IRX" IRX_SUFFIX,
+ IRX_PREFIX "SJPCM.IRX" IRX_SUFFIX,
+#ifndef USE_PS2LINK
+ IRX_PREFIX "PS2DEV9.IRX" IRX_SUFFIX
+#endif
};
void OSystem_PS2::loadModules(void) {
- _useMouse = _useKbd = false;
+ _useMouse = _useKbd = _useHdd = false;
+ static char hddarg[] = "-o" "\0" "4" "\0" "-n" "\0" "20";
+ static char pfsarg[] = "-m" "\0" "2" "\0" "-o" "\0" "16" "\0" "-n" "\0" "40" /*"\0" "-debug"*/;
int res;
for (int i = 0; i < ARRAYSIZE(irxModules); i++) {
@@ -418,7 +431,28 @@
else
_useKbd = true;
}
- sioprintf("Modules: UsbMouse %sloaded, UsbKbd %sloaded.", _useMouse ? "" : "not ", _useKbd ? "" : "not ");
+
+ if ((res = fileXioInit()) < 0) {
+ msgPrintf(FOREVER, "FXIO Init failed: %d", res);
+ quit();
+ }
+
+ if ((res = SifLoadModule(IRX_PREFIX "PS2ATAD.IRX" IRX_SUFFIX, 0, NULL)) < 0)
+ printf("Cannot load module: PS2ATAD.IRX (%d)\n", res);
+ else if ((res = SifLoadModule(IRX_PREFIX "PS2HDD.IRX" IRX_SUFFIX, sizeof(hddarg), hddarg)) < 0)
+ printf("Cannot load module: PS2HDD.IRX (%d)\n", res);
+ else if ((res = SifLoadModule(IRX_PREFIX "PS2FS.IRX" IRX_SUFFIX, sizeof(pfsarg), pfsarg)) < 0)
+ printf("Cannot load module: PS2FS.IRX (%d)\n", res);
+ else {
+ if ((hddCheckPresent() >= 0) && (hddCheckFormatted() >= 0))
+ _useHdd = true;
+ }
+
+ sioprintf("Modules: UsbMouse %sloaded, UsbKbd %sloaded, HDD %sloaded.", _useMouse ? "" : "not ", _useKbd ? "" : "not ", _useHdd ? "" : "not ");
+}
+
+bool OSystem_PS2::hddPresent(void) {
+ return _useHdd;
}
void OSystem_PS2::initSize(uint width, uint height, int overscale) {
@@ -825,7 +859,8 @@
void OSystem_PS2::readRtcTime(void) {
struct CdClock cdClock;
- CDVD_ReadClock(&cdClock);
+ readRTC(&cdClock);
+
g_lastTimeCheck = msecCount;
if (cdClock.stat) {
Index: systemps2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/ps2/systemps2.h,v
retrieving revision 1.7.2.4
retrieving revision 1.7.2.5
diff -u -d -r1.7.2.4 -r1.7.2.5
--- systemps2.h 12 Nov 2005 07:19:46 -0000 1.7.2.4
+++ systemps2.h 17 Nov 2005 01:53:26 -0000 1.7.2.5
@@ -104,6 +104,8 @@
void msgPrintf(int millis, char *format, ...);
void makeConfigPath(char *dest);
+ bool hddPresent(void);
+
private:
volatile OSystem::TimerProc _scummTimerProc;
volatile OSystem::SoundProc _scummSoundProc;
@@ -115,7 +117,7 @@
void loadModules(void);
bool _mouseVisible;
- bool _useMouse, _useKbd;
+ bool _useMouse, _useKbd, _useHdd;
Ps2SaveFileManager *_saveManager;
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/backends/ps2/iop/CoDyVDfs/iop cdtypes.h,NONE,1.1.2.1 codyvdfs.c,NONE,1.1.2.1 codyvdfs.h,NONE,1.1.2.1 fiofs.c,NONE,1.1.2.1 fiofs.h,NONE,1.1.2.1 imports.lst,NONE,1.1.2.1 irx_imports.h,NONE,1.1.2.1 rpcfs.c,NONE,1.1.2.1
- Next message: [Scummvm-cvs-logs] CVS: scummvm/simon game.cpp,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list