[Scummvm-cvs-logs] SF.net SVN: scummvm:[33089] scummvm/trunk/backends/platform/ps2

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Jul 17 17:57:14 CEST 2008


Revision: 33089
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33089&view=rev
Author:   fingolfin
Date:     2008-07-17 15:56:24 +0000 (Thu, 17 Jul 2008)

Log Message:
-----------
Committing PS2 changes on behalf of the other Max ;)

Modified Paths:
--------------
    scummvm/trunk/backends/platform/ps2/Makefile.ps2
    scummvm/trunk/backends/platform/ps2/fileio.cpp
    scummvm/trunk/backends/platform/ps2/irxboot.cpp
    scummvm/trunk/backends/platform/ps2/systemps2.cpp
    scummvm/trunk/backends/platform/ps2/systemps2.h

Modified: scummvm/trunk/backends/platform/ps2/Makefile.ps2
===================================================================
--- scummvm/trunk/backends/platform/ps2/Makefile.ps2	2008-07-17 08:36:16 UTC (rev 33088)
+++ scummvm/trunk/backends/platform/ps2/Makefile.ps2	2008-07-17 15:56:24 UTC (rev 33089)
@@ -23,12 +23,12 @@
 DEFINES  = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_MPEG2 -DUSE_ZLIB -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
 
 # PS2SDK-Ports from ps2dev.org's SVN repository for libmad, zlib and ucl
-PS2SDK_PORTS = /home/robby/libStuffNew/ps2sdk-ports
+PS2SDK_PORTS = /mnt/winxp/scummvm/ports
 PS2SDK_PORTS_INCS = /ucl /zlib/include /libmad/ee/include
 PS2SDK_PORTS_LIBS = /ucl /zlib/lib /libmad/ee/lib
 
 # we also need SjPcm, Tremor and libmpeg2
-MORE_LIBS_DIR = /home/robby/libStuff
+MORE_LIBS_DIR = /mnt/winxp/scummvm/ports
 MORE_LIBS_INCS = /SjPcm/ee/src /mpeg2dec/include /tremor
 MORE_LIBS_LIBS = /SjPcm/ee/lib /mpeg2dec/libmpeg2 /tremor/tremor
 

Modified: scummvm/trunk/backends/platform/ps2/fileio.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/fileio.cpp	2008-07-17 08:36:16 UTC (rev 33088)
+++ scummvm/trunk/backends/platform/ps2/fileio.cpp	2008-07-17 15:56:24 UTC (rev 33089)
@@ -340,8 +340,6 @@
 		assert(cacheListSema >= 0);
 	}
 
-	//printf("ps2_fopen: %s, %s\n", fname, mode);
-
 	if (((mode[0] != 'r') && (mode[0] != 'w')) || ((mode[1] != '\0') && (mode[1] != 'b'))) {
 		printf("unsupported mode \"%s\" for file \"%s\"\n", mode, fname);
 		return NULL;
@@ -363,6 +361,8 @@
 	} else {
 		// Regular access to one of the devices
 
+		printf("ps2_fopen = %s\n", fname); // romeo : temp
+
 		if (!rdOnly)
 			return NULL; // we only provide readaccess for cd,dvd,hdd,usb
 
@@ -378,19 +378,22 @@
 		}
 
 		int64 cacheId = -1;
-		if (rdOnly && tocManager.haveEntries())
+		if (tocManager.haveEntries())
 			cacheId = tocManager.fileExists(fname);
 
 		if (cacheId != 0) {
 			Ps2File *file = findInCache(cacheId);
-			if (file)
+			if (file) {
+				printf("  findInCache(%x)\n", cacheId); // romeo : temp
 				return (FILE*)file;
+			}
 
 			bool isAudioFile = strstr(fname, ".bun") || strstr(fname, ".BUN") || strstr(fname, ".Bun");
 			file = new Ps2ReadFile(cacheId, isAudioFile);
 
 			if (file->open(fname)) {
 				openFileCount++;
+				printf("  new cacheID = %x\n", cacheId); // romeo : temp
 				return (FILE*)file;
 			} else
 				delete file;
@@ -579,7 +582,7 @@
 	}
 	char readPath[256];
 	sprintf(readPath, "%s/", _root);
-	printf("readDir: %s\n", readPath);
+	printf("readDir: %s    (root: %s )\n", readPath, root);
 	readDir(readPath, &_rootNode, 0);
 }
 
@@ -587,28 +590,62 @@
 	if (level <= 2) { // we don't scan deeper than that
 		iox_dirent_t dirent;
 		int fd = fio.dopen(path);
+		TocNode *eNode = NULL; // = *node; // entry node
+		bool first = true;
+
+		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 '.' and '..'
+			while (fio.dread(fd, &dirent) > 0) {
+				if (dirent.name[0] != '.') { // skip '.' & '..' - romeo : check
+				                             // --- do we have them on PS2?
 					*node = new TocNode;
+					if (first) {
+						eNode = *node;
+						first = false;
+					}
 					(*node)->sub = (*node)->next = NULL;
-
 					(*node)->nameLen = strlen(dirent.name);
 					memcpy((*node)->name, dirent.name, (*node)->nameLen + 1);
 
-					if (dirent.stat.mode & FIO_S_IFDIR) { // directory
+					if (dirent.stat.mode & FIO_S_IFDIR) {
 						(*node)->isDir = true;
-						char nextPath[256];
-						sprintf(nextPath, "%s%s/", path, dirent.name);
-						readDir(nextPath, &((*node)->sub), level + 1);
-					} else
+						printf("dirent.name = %s [DIR]\n", dirent.name);
+					}
+					else {
 						(*node)->isDir = false;
+						printf("dirent.name = %s\n", dirent.name);
+					}
+
 					node = &((*node)->next);
 				}
+			}
+
 			fio.dclose(fd);
-		} else
-			printf("Can't open path: %s\n", path);
+		}
+
+		TocNode *iNode = eNode;
+		char nextPath[256];
+
+		while (iNode) {
+			if (iNode->isDir == true) {
+				sprintf(nextPath, "%s%s/", path, iNode->name);
+				readDir(nextPath, &(iNode->sub), level + 1);
+			}
+			iNode = iNode->next;
+		}
+
 	}
+
+	/*
+		** Wizard of Oz' trick (to get all games running from USB on PS2):
+
+		1. Make a list of files / dirs in level #0 (dclose before continuing)
+
+		2. Go through the dirs : dopen / dread them / mark dirs / dclose
+
+		   It's a safe recursion, cause it recurses on 'isDir' nodes
+		   after dclosing the higher hierarchy
+	*/
 }
 
 int64 TocManager::fileExists(const char *name) {

Modified: scummvm/trunk/backends/platform/ps2/irxboot.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/irxboot.cpp	2008-07-17 08:36:16 UTC (rev 33088)
+++ scummvm/trunk/backends/platform/ps2/irxboot.cpp	2008-07-17 15:56:24 UTC (rev 33089)
@@ -43,7 +43,7 @@
 	{ "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 /*| NOT_HOST*/, NOTHING, NULL, 0 }, // already loaded by ps2link
 	{ "FILEXIO.IRX",  SYSTEM, NOTHING, NULL, 0 },
 	{ "CODYVDFS.IRX", SYSTEM, NOTHING, NULL, 0 },
 	{ "SJPCM.IRX",    SYSTEM, NOTHING, NULL, 0 },

Modified: scummvm/trunk/backends/platform/ps2/systemps2.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.cpp	2008-07-17 08:36:16 UTC (rev 33088)
+++ scummvm/trunk/backends/platform/ps2/systemps2.cpp	2008-07-17 15:56:24 UTC (rev 33089)
@@ -54,9 +54,11 @@
 #include "graphics/surface.h"
 #include "graphics/font.h"
 #include "backends/timer/default/default-timer.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
 #include "common/events.h"
 #include "backends/platform/ps2/ps2debug.h"
+#include "backends/fs/ps2/ps2-fs-factory.h"
+
 // asm("mfc0	%0, $9\n" : "=r"(tickStart));
 
 extern void *_gp;
@@ -309,7 +311,9 @@
 void OSystem_PS2::init(void) {
 	sioprintf("Timer...\n");
 	_scummTimerManager = new DefaultTimerManager();
-	_scummMixer = new Audio::Mixer();
+	_scummMixer = new Audio::MixerImpl(this);
+	_scummMixer->setOutputRate(44100);
+	_scummMixer->setReady(true);
 	initTimer();
 
 	sioprintf("Starting SavefileManager\n");
@@ -410,7 +414,8 @@
 			// we have to produce more samples, call sound mixer
 			// the scratchpad at 0x70000000 is used as temporary soundbuffer
 			//_scummSoundProc(_scummSoundParam, (uint8*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
-			Audio::Mixer::mixCallback(_scummMixer, (byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
+			// Audio::Mixer::mixCallback(_scummMixer, (byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
+			_scummMixer->mixCallback((byte*)0x70000000, SMP_PER_BLOCK * 2 * sizeof(int16));
 
 			// demux data into 2 buffers, L and R
 			 __asm__ (
@@ -534,10 +539,6 @@
 	return _scummTimerManager;
 }
 
-int OSystem_PS2::getOutputSampleRate(void) const {
-	return 48000;
-}
-
 Audio::Mixer *OSystem_PS2::getMixer() {
 	return _scummMixer;
 }
@@ -546,6 +547,10 @@
 	return _saveManager;
 }
 
+FilesystemFactory *OSystem_PS2::getFilesystemFactory() {
+	return &Ps2FilesystemFactory::instance();
+}
+
 void OSystem_PS2::setShakePos(int shakeOffset) {
 	_screen->setShakePos(shakeOffset);
 }

Modified: scummvm/trunk/backends/platform/ps2/systemps2.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.h	2008-07-17 08:36:16 UTC (rev 33088)
+++ scummvm/trunk/backends/platform/ps2/systemps2.h	2008-07-17 15:56:24 UTC (rev 33089)
@@ -33,6 +33,7 @@
 class Gs2dScreen;
 class Ps2Input;
 class Ps2SaveFileManager;
+// class Ps2FilesystemFactory;
 struct IrxReference;
 
 #define MAX_MUTEXES 16
@@ -48,7 +49,7 @@
 };
 
 namespace Audio {
-	class Mixer;
+	class MixerImpl;
 };
 
 class OSystem_PS2 : public OSystem {
@@ -87,7 +88,6 @@
 	virtual bool pollEvent(Common::Event &event);
 
 	virtual Audio::Mixer *getMixer();
-	virtual int  getOutputSampleRate(void) const;
 
 	virtual bool openCD(int drive);
 	virtual bool pollCD();
@@ -112,6 +112,7 @@
 	virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
 
 	virtual Common::SaveFileManager *getSavefileManager();
+	virtual FilesystemFactory *getFilesystemFactory();
 
 	virtual void getTimeAndDate(struct tm &t) const;
 
@@ -133,7 +134,7 @@
 	void readRtcTime(void);
 
 	DefaultTimerManager *_scummTimerManager;
-	Audio::Mixer *_scummMixer;
+	Audio::MixerImpl *_scummMixer;
 
 
 	bool _mouseVisible;


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