[Scummvm-cvs-logs] SF.net SVN: scummvm:[35930] scummvm/trunk/backends

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Tue Jan 20 00:57:49 CET 2009


Revision: 35930
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35930&view=rev
Author:   dhewg
Date:     2009-01-19 23:57:49 +0000 (Mon, 19 Jan 2009)

Log Message:
-----------
Added ISO9660/Joliet DVD support

Modified Paths:
--------------
    scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp
    scummvm/trunk/backends/fs/wii/wii-fs-factory.h
    scummvm/trunk/backends/fs/wii/wii-fs.cpp
    scummvm/trunk/backends/platform/wii/Makefile
    scummvm/trunk/backends/platform/wii/main.cpp
    scummvm/trunk/backends/platform/wii/osystem.cpp
    scummvm/trunk/backends/platform/wii/osystem.h

Modified: scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp
===================================================================
--- scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp	2009-01-19 23:35:27 UTC (rev 35929)
+++ scummvm/trunk/backends/fs/wii/wii-fs-factory.cpp	2009-01-19 23:57:49 UTC (rev 35930)
@@ -45,5 +45,10 @@
 AbstractFSNode *WiiFilesystemFactory::makeFileNodePath(const Common::String &path) const {
 	return new WiiFilesystemNode(path);
 }
+
+void WiiFilesystemFactory::asyncHandler(bool mount, const Common::String *path) {
+	WiiFilesystemNode::asyncHandler(mount, path);
+}
+
 #endif
 

Modified: scummvm/trunk/backends/fs/wii/wii-fs-factory.h
===================================================================
--- scummvm/trunk/backends/fs/wii/wii-fs-factory.h	2009-01-19 23:35:27 UTC (rev 35929)
+++ scummvm/trunk/backends/fs/wii/wii-fs-factory.h	2009-01-19 23:57:49 UTC (rev 35930)
@@ -37,6 +37,8 @@
 	virtual AbstractFSNode *makeCurrentDirectoryFileNode() const;
 	virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const;
 
+	static void asyncHandler(bool mount, const Common::String *path);
+
 protected:
 	WiiFilesystemFactory() {};
 

Modified: scummvm/trunk/backends/fs/wii/wii-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/wii/wii-fs.cpp	2009-01-19 23:35:27 UTC (rev 35929)
+++ scummvm/trunk/backends/fs/wii/wii-fs.cpp	2009-01-19 23:57:49 UTC (rev 35930)
@@ -33,6 +33,10 @@
 
 #include <gctypes.h>
 
+#ifndef GAMECUBE
+#include <di/di.h>
+#endif
+
 /**
  * Implementation of the ScummVM file system API based on Wii.
  *
@@ -77,8 +81,60 @@
 
 	virtual Common::SeekableReadStream *openForReading();
 	virtual Common::WriteStream *openForWriting();
+
+	static void asyncHandler(bool umount, const Common::String *path);
 };
 
+void WiiFilesystemNode::asyncHandler(bool mount, const Common::String *path) {
+#ifndef GAMECUBE
+	static bool di_tryMount = true;
+	static bool di_isMounted = false;
+
+	// umount not required filesystems
+	if (!mount) {
+		if (di_isMounted && (!path || (path && !path->hasPrefix("dvd:/")))) {
+			printf("umount ISO9660\n");
+			ISO9660_Unmount();
+			DI_StopMotor();
+			di_tryMount = false;
+			di_isMounted = false;
+		}
+
+		if (!path)
+			return;
+	}
+
+	// re-mount DVD if data from its path has been requested. in this case, we
+	// have to wait for DI_Mount() to finish
+	if (!di_tryMount && !di_isMounted && path && path->hasPrefix("dvd:/")) {
+		printf("remount ISO9660\n");
+		DI_Mount();
+
+		while (DI_GetStatus() & DVD_INIT)
+			usleep(20 * 1000);
+
+		di_tryMount = true;
+	}
+
+	if (!di_tryMount)
+		return;
+
+	// check if the async DI_Mount() call has finished
+	if (DI_GetStatus() & DVD_READY) {
+		di_tryMount = false;
+
+		printf("mount ISO9660\n");
+		if (ISO9660_Mount()) {
+			di_isMounted = true;
+			printf("ISO9660 mounted\n");
+		} else {
+			DI_StopMotor();
+			printf("ISO9660 mount failed\n");
+		}
+	}
+#endif
+}
+
 // gets all registered devoptab devices
 bool WiiFilesystemNode::getDevopChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
 	u8 i;
@@ -87,6 +143,8 @@
 	if (mode == Common::FSNode::kListFilesOnly)
 		return true;
 
+	asyncHandler(true, NULL);
+
 	// skip in, out and err
 	for (i = 3; i < STD_MAX; ++i) {
 		dt = devoptab_list[i];
@@ -142,6 +200,8 @@
 
 	_displayName = lastPathComponent(_path, '/');
 
+	asyncHandler(true, &_path);
+
 	struct stat st;
 	if (!stat(_path.c_str(), &st))
 		setFlags(&st);

Modified: scummvm/trunk/backends/platform/wii/Makefile
===================================================================
--- scummvm/trunk/backends/platform/wii/Makefile	2009-01-19 23:35:27 UTC (rev 35929)
+++ scummvm/trunk/backends/platform/wii/Makefile	2009-01-19 23:57:49 UTC (rev 35930)
@@ -100,7 +100,7 @@
 MACHDEP  = -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float \
 			-ffunction-sections -fdata-sections -fmodulo-sched
 LIBDIR   = $(DEVKITPRO)/libogc/lib/wii
-LIBS      = -lstdc++ -lfat -lwiiuse -lbte -logc -lm
+LIBS      = -lstdc++ -ldi -lfat -lwiiuse -lbte -logc -lm
 endif
 
 INCDIR   = $(srcdir) . $(srcdir)/engines/ $(DEVKITPRO)/libogc/include

Modified: scummvm/trunk/backends/platform/wii/main.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/main.cpp	2009-01-19 23:35:27 UTC (rev 35929)
+++ scummvm/trunk/backends/platform/wii/main.cpp	2009-01-19 23:57:49 UTC (rev 35930)
@@ -27,12 +27,16 @@
 #include <ogc/machine/processor.h>
 #include <fat.h>
 
-#include "osystem.h"
+#ifndef GAMECUBE
+#include <di/di.h>
+#endif
 
 #ifdef DEBUG_WII_GDB
 #include <debug.h>
 #endif
 
+#include "osystem.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -79,6 +83,10 @@
 int main(int argc, char *argv[]) {
 	s32 res;
 
+#ifndef GAMECUBE
+	DI_Init();
+#endif
+
 	VIDEO_Init();
 	PAD_Init();
 	AUDIO_Init(NULL);
@@ -102,6 +110,11 @@
 	SYS_SetPowerCallback(power_cb);
 #endif
 
+#ifndef GAMECUBE
+	// initial async mount for the browser, see wii-fs.cpp
+	DI_Mount();
+#endif
+
 	if (!fatInitDefault()) {
 		printf("fatInitDefault failed\n");
 	} else {
@@ -136,6 +149,10 @@
 	fatUnmountDefault();
 #endif
 
+#ifndef GAMECUBE
+	DI_Close();
+#endif
+
 	if (power_btn_pressed) {
 		printf("shutting down\n");
 		SYS_ResetSystem(SYS_POWEROFF, 0, 0);

Modified: scummvm/trunk/backends/platform/wii/osystem.cpp
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.cpp	2009-01-19 23:35:27 UTC (rev 35929)
+++ scummvm/trunk/backends/platform/wii/osystem.cpp	2009-01-19 23:57:49 UTC (rev 35930)
@@ -115,6 +115,9 @@
 	deinitEvents();
 	deinitSfx();
 	deinitGfx();
+
+	// umount all async filesystems
+	WiiFilesystemFactory::asyncHandler(false, NULL);
 }
 
 bool OSystem_Wii::hasFeature(Feature f) {
@@ -212,3 +215,8 @@
 	t = *localtime(&curTime);
 }
 
+void OSystem_Wii::engineInit() {
+	// umount not required filesystems for this game
+	WiiFilesystemFactory::asyncHandler(false, &ConfMan.get("path"));
+}
+

Modified: scummvm/trunk/backends/platform/wii/osystem.h
===================================================================
--- scummvm/trunk/backends/platform/wii/osystem.h	2009-01-19 23:35:27 UTC (rev 35929)
+++ scummvm/trunk/backends/platform/wii/osystem.h	2009-01-19 23:57:49 UTC (rev 35930)
@@ -167,8 +167,10 @@
 	virtual Common::SaveFileManager *getSavefileManager();
 	virtual Audio::Mixer *getMixer();
 	virtual Common::TimerManager *getTimerManager();
-	FilesystemFactory *getFilesystemFactory();
-	void getTimeAndDate(struct tm &t) const;
+	virtual FilesystemFactory *getFilesystemFactory();
+	virtual void getTimeAndDate(struct tm &t) const;
+
+	virtual void engineInit();
 };
 
 #endif


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