[Scummvm-cvs-logs] SF.net SVN: scummvm:[52425] scummvm/branches/gsoc2010-plugins

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Sat Aug 28 14:51:13 CEST 2010


Revision: 52425
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52425&view=rev
Author:   dhewg
Date:     2010-08-28 12:51:12 +0000 (Sat, 28 Aug 2010)

Log Message:
-----------
WII: svn merge Wii port commits from trunk

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/backends/fs/wii/wii-fs-factory.cpp
    scummvm/branches/gsoc2010-plugins/backends/platform/wii/main.cpp
    scummvm/branches/gsoc2010-plugins/backends/platform/wii/options.cpp
    scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem.h
    scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_gfx.cpp
    scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_sfx.cpp
    scummvm/branches/gsoc2010-plugins/configure
    scummvm/branches/gsoc2010-plugins/dists/wii/meta.xml
    scummvm/branches/gsoc2010-plugins/sound/mixer.cpp

Property Changed:
----------------
    scummvm/branches/gsoc2010-plugins/


Property changes on: scummvm/branches/gsoc2010-plugins
___________________________________________________________________
Modified: svn:mergeinfo
   - /scummvm/branches/gsoc2009-draci:41389-44325
/scummvm/trunk:49122-51947
   + /scummvm/branches/gsoc2009-draci:41389-44325
/scummvm/trunk:49122-51947,52074,52089,52161,52357

Modified: scummvm/branches/gsoc2010-plugins/backends/fs/wii/wii-fs-factory.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/fs/wii/wii-fs-factory.cpp	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/backends/fs/wii/wii-fs-factory.cpp	2010-08-28 12:51:12 UTC (rev 52425)
@@ -29,6 +29,7 @@
 
 #ifdef USE_WII_DI
 #include <di/di.h>
+#include <iso9660.h>
 #endif
 
 #ifdef USE_WII_SMB
@@ -71,8 +72,10 @@
 void WiiFilesystemFactory::asyncDeinit() {
 #ifdef USE_WII_DI
 	umount(kDVD);
+#ifndef GAMECUBE
 	DI_Close();
 #endif
+#endif
 #ifdef USE_WII_SMB
 	umount(kSMB);
 	net_deinit();
@@ -125,24 +128,11 @@
 			break;
 
 		printf("mount dvd\n");
-		DI_Mount();
-
-		while (DI_GetStatus() & DVD_INIT)
-			usleep(20 * 1000);
-
-		if (!(DI_GetStatus() & DVD_READY)) {
-			DI_StopMotor();
-			printf("error mounting dvd\n");
-			break;
-		}
-
-		printf("mount ISO9660\n");
 		if (ISO9660_Mount()) {
 			_dvdMounted = true;
 			_dvdError = false;
 			printf("ISO9660 mounted\n");
 		} else {
-			DI_StopMotor();
 			_dvdError = true;
 			printf("ISO9660 mount failed\n");
 		}
@@ -185,7 +175,6 @@
 		printf("umount dvd\n");
 
 		ISO9660_Unmount();
-		DI_StopMotor();
 
 		_dvdMounted = false;
 		_dvdError = false;
@@ -199,10 +188,7 @@
 
 		printf("umount smb\n");
 
-		if (smbClose("smb:"))
-			printf("smb umounted\n");
-		else
-			printf("error umounting smb\n");
+		smbClose("smb:");
 
 		_smbMounted = false;
 		_smbError = false;

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/wii/main.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/wii/main.cpp	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/wii/main.cpp	2010-08-28 12:51:12 UTC (rev 52425)
@@ -37,8 +37,7 @@
 #ifdef DEBUG_WII_GDB
 #include <debug.h>
 #endif
-#include <gfx/gfx.h>
-#include <gfx/gfx_con.h>
+#include <gxflux/gfx_con.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -51,7 +50,6 @@
 #ifdef DEBUG_WII_GDB
 	printf("attach gdb now\n");
 	_break();
-	SYS_SetResetCallback(reset_cb);
 #else
 	reset_btn_pressed = true;
 #endif
@@ -78,6 +76,11 @@
 	for (i = 0; i < 60 * 3; ++i)
 		VIDEO_WaitVSync();
 
+#ifdef DEBUG_WII_GDB
+	printf("attach gdb now\n");
+	_break();
+#endif
+
 	printf("Press any key to continue.\n");
 
 	if (!gfx_frame_start())
@@ -157,12 +160,13 @@
 int main(int argc, char *argv[]) {
 	s32 res;
 
-#ifdef USE_WII_DI
+#if defined(USE_WII_DI) && !defined(GAMECUBE)
 	DI_Init();
 #endif
 
 	VIDEO_Init();
 	PAD_Init();
+	DSP_Init();
 	AUDIO_Init(NULL);
 
 	gfx_video_init(NULL);

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/wii/options.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/wii/options.cpp	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/wii/options.cpp	2010-08-28 12:51:12 UTC (rev 52425)
@@ -22,7 +22,7 @@
 
 #include <errno.h>
 #include <network.h>
-#include <gfx/gfx.h>
+#include <gxflux/gfx.h>
 
 #include "common/config-manager.h"
 #include "gui/dialog.h"
@@ -133,11 +133,9 @@
 }
 
 void WiiOptionsDialog::handleTickle() {
-#ifndef GAMECUBE
 	WiiFilesystemFactory &fsf = WiiFilesystemFactory::instance();
 
 	int tab = _tab->getActiveTab();
-#endif
 
 #ifdef USE_WII_DI
 	if (tab == _tabDVD) {
@@ -198,9 +196,7 @@
 
 void WiiOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd,
 										uint32 data) {
-#ifndef GAMECUBE
 	WiiFilesystemFactory &fsf = WiiFilesystemFactory::instance();
-#endif
 
 	switch (cmd) {
 	case 'x':

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem.h	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem.h	2010-08-28 12:51:12 UTC (rev 52425)
@@ -26,7 +26,7 @@
 #include <gccore.h>
 #include <ogcsys.h>
 
-#include <gfx/gfx.h>
+#include <gxflux/gfx.h>
 
 #include "base/main.h"
 #include "common/fs.h"

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_gfx.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_gfx.cpp	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_gfx.cpp	2010-08-28 12:51:12 UTC (rev 52425)
@@ -21,8 +21,7 @@
 
 #include <malloc.h>
 
-#include <gfx/gfx.h>
-#include <gfx/gfx_con.h>
+#include <gxflux/gfx_con.h>
 
 #include "common/config-manager.h"
 #include "graphics/conversion.h"

Modified: scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_sfx.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_sfx.cpp	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/backends/platform/wii/osystem_sfx.cpp	2010-08-28 12:51:12 UTC (rev 52425)
@@ -25,7 +25,8 @@
 
 #define SFX_THREAD_STACKSIZE (1024 * 128)
 #define SFX_THREAD_PRIO 80
-#define SFX_THREAD_FRAG_SIZE 4096
+#define SFX_THREAD_FRAG_SIZE (1024 * 8)
+#define SFX_BUFFERS 3
 
 static lwpq_t sfx_queue;
 static lwp_t sfx_thread;
@@ -33,20 +34,18 @@
 static bool sfx_thread_running = false;
 static bool sfx_thread_quit = false;
 
-static u8 sb = 0;
-static u8 *sound_buffer[2];
+static u32 sb_hw;
+static u8 *sound_buffer[SFX_BUFFERS];
 
 static void audio_switch_buffers() {
-	AUDIO_StopDMA();
-	AUDIO_InitDMA((u32) sound_buffer[sb], SFX_THREAD_FRAG_SIZE);
-	AUDIO_StartDMA();
-
+	sb_hw = (sb_hw + 1) % SFX_BUFFERS;
+	AUDIO_InitDMA((u32) sound_buffer[sb_hw], SFX_THREAD_FRAG_SIZE);
 	LWP_ThreadSignal(sfx_queue);
 }
 
 static void * sfx_thread_func(void *arg) {
 	Audio::MixerImpl *mixer = (Audio::MixerImpl *) arg;
-	u8 next_sb;
+	u8 sb_sw;
 
 	while (true) {
 		LWP_ThreadSleep(sfx_queue);
@@ -54,11 +53,15 @@
 		if (sfx_thread_quit)
 			break;
 
-		next_sb = sb ^ 1;
-		mixer->mixCallback(sound_buffer[next_sb], SFX_THREAD_FRAG_SIZE);
-		DCFlushRange(sound_buffer[next_sb], SFX_THREAD_FRAG_SIZE);
-
-		sb = next_sb;
+		// the hardware uses two buffers: a front and a back buffer
+		// we use 3 buffers here: two are beeing pushed to the DSP,
+		// and the free one is where our mixer writes to
+		// thus the latency of our stream is:
+		// 8192 [frag size] / 48000 / 2 [16bit] / 2 [stereo] * 2 [hw buffers]
+		// -> 85.3ms
+		sb_sw = (sb_hw + 1) % SFX_BUFFERS;
+		mixer->mixCallback(sound_buffer[sb_sw], SFX_THREAD_FRAG_SIZE);
+		DCFlushRange(sound_buffer[sb_sw], SFX_THREAD_FRAG_SIZE);
 	}
 
 	return NULL;
@@ -89,21 +92,20 @@
 		sfx_thread_running = true;
 	}
 
-	sound_buffer[0] = (u8 *) memalign(32, SFX_THREAD_FRAG_SIZE);
-	sound_buffer[1] = (u8 *) memalign(32, SFX_THREAD_FRAG_SIZE);
+	for (u32 i = 0; i < SFX_BUFFERS; ++i) {
+		sound_buffer[i] = (u8 *) memalign(32, SFX_THREAD_FRAG_SIZE);
+		memset(sound_buffer[i], 0, SFX_THREAD_FRAG_SIZE);
+		DCFlushRange(sound_buffer[i], SFX_THREAD_FRAG_SIZE);
+	}
 
-	memset(sound_buffer[0], 0, SFX_THREAD_FRAG_SIZE);
-	memset(sound_buffer[1], 0, SFX_THREAD_FRAG_SIZE);
+	_mixer->setReady(true);
 
-	DCFlushRange(sound_buffer[0], SFX_THREAD_FRAG_SIZE);
-	DCFlushRange(sound_buffer[1], SFX_THREAD_FRAG_SIZE);
+	sb_hw = 0;
 
-	_mixer->setReady(true);
-
 	AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
 	AUDIO_RegisterDMACallback(audio_switch_buffers);
-
-	audio_switch_buffers();
+	AUDIO_InitDMA((u32) sound_buffer[sb_hw], SFX_THREAD_FRAG_SIZE);
+	AUDIO_StartDMA();
 }
 
 void OSystem_Wii::deinitSfx() {
@@ -123,8 +125,8 @@
 		free(sfx_stack);
 		sfx_thread_running = false;
 
-		free(sound_buffer[0]);
-		free(sound_buffer[1]);
+		for (u32 i = 0; i < SFX_BUFFERS; ++i)
+			free(sound_buffer[i]);
 	}
 }
 

Modified: scummvm/branches/gsoc2010-plugins/configure
===================================================================
--- scummvm/branches/gsoc2010-plugins/configure	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/configure	2010-08-28 12:51:12 UTC (rev 52425)
@@ -1415,9 +1415,9 @@
 	gamecube)
 		CXXFLAGS="$CXXFLAGS -Os -mogc -mcpu=750 -meabi -mhard-float"
 		CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fmodulo-sched"
-		CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include -I$DEVKITPRO/cube/include"
+		CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include"
 		# libogc is required to link the cc tests (includes _start())
-		LDFLAGS="$LDFLAGS -mogc -mcpu=750 -L$DEVKITPRO/libogc/lib/cube -L$DEVKITPRO/cube/lib -logc"
+		LDFLAGS="$LDFLAGS -mogc -mcpu=750 -L$DEVKITPRO/libogc/lib/cube -logc"
 		;;
 	haiku*)
 		DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE"
@@ -1475,9 +1475,9 @@
 	wii)
 		CXXFLAGS="$CXXFLAGS -Os -mrvl -mcpu=750 -meabi -mhard-float"
 		CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fmodulo-sched"
-		CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include -I$DEVKITPRO/wii/include"
+		CXXFLAGS="$CXXFLAGS -I$DEVKITPRO/libogc/include"
 		# libogc is required to link the cc tests (includes _start())
-		LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -L$DEVKITPRO/libogc/lib/wii -L$DEVKITPRO/wii/lib -logc"
+		LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -L$DEVKITPRO/libogc/lib/wii -logc"
 		;;
 	wince)
 		CXXFLAGS="$CXXFLAGS -O3 -march=armv4 -mtune=xscale"
@@ -1567,10 +1567,12 @@
 			_mt32emu=no
 			_port_mk="backends/platform/wii/wii.mk"
 			add_line_to_config_mk 'GAMECUBE = 1'
+			add_line_to_config_h '#define AUDIO_REVERSE_STEREO'
 			add_line_to_config_h '#define GAMECUBE'
 			add_line_to_config_h "/* #define DEBUG_WII_USBGECKO */"
 			add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */"
 			add_line_to_config_h "/* #define DEBUG_WII_GDB */"
+			add_line_to_config_h "#define USE_WII_DI"
 			;;
 		gp2x)
 			DEFINES="$DEFINES -DGP2X -DNDEBUG"
@@ -1766,6 +1768,7 @@
 			_build_scalers=no
 			_port_mk="backends/platform/wii/wii.mk"
 			add_line_to_config_mk 'GAMECUBE = 0'
+			add_line_to_config_h '#define AUDIO_REVERSE_STEREO'
 			add_line_to_config_h "#define DEBUG_WII_USBGECKO"
 			add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */"
 			add_line_to_config_h "/* #define DEBUG_WII_GDB */"
@@ -2628,10 +2631,10 @@
 		DEFINES="$DEFINES -D__WII__ -DGEKKO"
 		case $_host_os in
 		gamecube)
-			LIBS="$LIBS -lgxflux -lfat -logc -ldb"
+			LIBS="$LIBS -lgxflux -liso9660 -lfat -logc -ldb"
 			;;
 		*)
-			LIBS="$LIBS -lgxflux -ldi -ltinysmb -lfat -lwiiuse -lbte -logc -lwiikeyboard -ldb"
+			LIBS="$LIBS -lgxflux -ldi -liso9660 -ltinysmb -lfat -lwiiuse -lbte -logc -lwiikeyboard -ldb"
 			;;
 		esac
 		;;

Modified: scummvm/branches/gsoc2010-plugins/dists/wii/meta.xml
===================================================================
--- scummvm/branches/gsoc2010-plugins/dists/wii/meta.xml	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/dists/wii/meta.xml	2010-08-28 12:51:12 UTC (rev 52425)
@@ -8,5 +8,6 @@
   <long_description>ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games, provided you already have their data files. The clever part about this: ScummVM just replaces the executables shipped with the games, allowing you to play them on systems for which they were never designed!
 
 Some of the adventures ScummVM supports include Adventure Soft's Simon the Sorcerer 1 and 2; Revolution's Beneath A Steel Sky and Broken Sword I & II; Flight of the Amazon Queen; Wyrmkeep's Inherit the Earth; Coktel Vision's Gobliiins; Westwood Studios' The Legend of Kyrandia and games based on LucasArts' SCUMM (Script Creation Utility for Maniac Mansion) system such as Monkey Island, Day of the Tentacle, Sam and Max and more.</long_description>
+  <no_ios_reload/>
 </app>
 

Modified: scummvm/branches/gsoc2010-plugins/sound/mixer.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/sound/mixer.cpp	2010-08-28 12:36:19 UTC (rev 52424)
+++ scummvm/branches/gsoc2010-plugins/sound/mixer.cpp	2010-08-28 12:51:12 UTC (rev 52425)
@@ -246,6 +246,10 @@
 			}
 	}
 
+#ifdef AUDIO_REVERSE_STEREO
+	reverseStereo = !reverseStereo;
+#endif
+
 	// Create the channel
 	Channel *chan = new Channel(this, type, stream, autofreeStream, reverseStereo, id, permanent);
 	chan->setVolume(volume);


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