[Scummvm-cvs-logs] CVS: scummvm/morphos morphos.cpp,1.10,1.11 morphos.h,1.3,1.4 morphos_sound.cpp,1.6,1.7 morphos_start.cpp,1.1,1.2

Ruediger Hanke tomjoad at users.sourceforge.net
Thu Apr 18 14:44:31 CEST 2002


Update of /cvsroot/scummvm/scummvm/morphos
In directory usw-pr-cvs1:/tmp/cvs-serv18943/morphos

Modified Files:
	morphos.cpp morphos.h morphos_sound.cpp morphos_start.cpp 
Log Message:
Reenable MorphOS Midi driver, small updates to CD open code (only when CD audio is requested) and start options

Index: morphos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** morphos.cpp	16 Apr 2002 20:28:56 -0000	1.10
--- morphos.cpp	18 Apr 2002 21:40:24 -0000	1.11
***************
*** 221,233 ****
  void *OSystem_MorphOS::create_thread(ThreadProc *proc, void *param)
  {
! /*	  MyEmulFunc.Trap      = TRAP_FUNC;
! 	MyEmulFunc.Address	= (ULONG)proc;
! 	MyEmulFunc.StackSize	= 8192;
! 	MyEmulFunc.Extension	= 0;
! 	MyEmulFunc.Arg1	   = (ULONG)param;
! 	MyEmulFunc.Arg2	   = (ULONG)ScummMidiUnit;
! 	MyEmulFunc.Arg3	   = (ULONG)args[ USG_NOMUSIC ];
! 	ScummMusicThread = CreateNewProc( musicProcTags );*/
! 	return NULL;
  }
  
--- 221,234 ----
  void *OSystem_MorphOS::create_thread(ThreadProc *proc, void *param)
  {
! 	static EmulFunc ThreadEmulFunc;
! 
! 	ThreadEmulFunc.Trap      = TRAP_FUNC;
! 	ThreadEmulFunc.Address	 = (ULONG)proc;
! 	ThreadEmulFunc.StackSize = 16000;
! 	ThreadEmulFunc.Extension = 0;
! 	ThreadEmulFunc.Arg1	    = (ULONG)param;
! 	musicProcTags[ 0 ].ti_Data = (ULONG)&ThreadEmulFunc;
! 	ScummMusicThread = CreateNewProc( musicProcTags );
! 	return ScummMusicThread;
  }
  
***************
*** 247,276 ****
  
  		case PROP_OPEN_CD:
! 			FindCDTags[ 0 ].ti_Data = (ULONG)((GameID == GID_LOOM256) ? "LoomCD" : "Monkey1CD");
! 			if( !CDDABase ) CDDABase = OpenLibrary( "cdda.library", 0 );
! 			if( CDDABase )
  			{
! 				CDrive = CDDA_FindNextDrive( NULL, FindCDTags );
! 				if( CDrive )
  				{
! 					if( !CDDA_ObtainDrive( CDrive, CDDA_SHARED_ACCESS, NULL ) )
! 					{
! 						CDrive = NULL;
! 						warning( "Failed to obtain CD drive - music will not play" );
! 					}
! 					else if( GameID == GID_LOOM256 )
  					{
! 						// Offset correction *may* be required
! 						struct CDS_TrackInfo ti;
  
! 						if( CDDA_GetTrackInfo( CDrive, 1, 0, &ti ) )
! 							CDDATrackOffset = ti.ti_TrackStart.tm_Format.tm_Frame-22650;
  					}
  				}
  				else
! 					warning( "Could not find game CD inserted in CD-ROM drive - cd audio will not play" );
  			}
- 			else
- 				warning( "Failed to open cdda.library - cd audio will not play" );
  			break;
  
--- 248,280 ----
  
  		case PROP_OPEN_CD:
! 			if( value )
  			{
! 				FindCDTags[ 0 ].ti_Data = (ULONG)((GameID == GID_LOOM256) ? "LoomCD" : "Monkey1CD");
! 				if( !CDDABase ) CDDABase = OpenLibrary( "cdda.library", 0 );
! 				if( CDDABase )
  				{
! 					CDrive = CDDA_FindNextDrive( NULL, FindCDTags );
! 					if( CDrive )
  					{
! 						if( !CDDA_ObtainDrive( CDrive, CDDA_SHARED_ACCESS, NULL ) )
! 						{
! 							CDrive = NULL;
! 							warning( "Failed to obtain CD drive - music will not play" );
! 						}
! 						else if( GameID == GID_LOOM256 )
! 						{
! 							// Offset correction *may* be required
! 							struct CDS_TrackInfo ti;
  
! 							if( CDDA_GetTrackInfo( CDrive, 1, 0, &ti ) )
! 								CDDATrackOffset = ti.ti_TrackStart.tm_Format.tm_Frame-22650;
! 						}
  					}
+ 					else
+ 						warning( "Could not find game CD inserted in CD-ROM drive - cd audio will not play" );
  				}
  				else
! 					warning( "Failed to open cdda.library - cd audio will not play" );
  			}
  			break;
  

Index: morphos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** morphos.h	16 Apr 2002 20:28:56 -0000	1.3
--- morphos.h	18 Apr 2002 21:40:24 -0000	1.4
***************
*** 189,192 ****
--- 189,194 ----
  
  int morphos_sound_thread( OSystem_MorphOS *syst, ULONG SampleType );
+ bool init_morphos_music( ULONG MidiUnit );
+ void exit_morphos_music();
  
  int morphos_main( int argc, char *argv[] );
***************
*** 195,197 ****
--- 197,202 ----
  extern struct SignalSemaphore ScummMusicThreadRunning;
  extern struct SignalSemaphore ScummSoundThreadRunning;
+ 
+ extern struct IOMidiRequest *ScummMidiRequest;
+ extern struct timerequest   *MusicTimerIORequest;
  

Index: morphos_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos_sound.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** morphos_sound.cpp	14 Apr 2002 19:43:12 -0000	1.6
--- morphos_sound.cpp	18 Apr 2002 21:40:24 -0000	1.7
***************
*** 26,29 ****
--- 26,31 ----
  #include "stdafx.h"
  #include "scumm.h"
+ #include "mididrv.h"
+ #include "imuse.h"
  
  #include <dos/dos.h>
***************
*** 54,91 ****
  static struct MsgPort 		 *ScummMidiPort = NULL;
  		 struct IOMidiRequest *ScummMidiRequest = NULL;
  
! bool init_morphos_music( ULONG MidiUnit, bool NoMusic )
  {
! 	if( !NoMusic )
  	{
! 		ScummMidiPort = CreateMsgPort();
! 		if( ScummMidiPort )
  		{
! 			ScummMidiRequest = (struct IOMidiRequest *)CreateIORequest( ScummMidiPort, sizeof( struct IOMidiRequest ) );
! 			if( ScummMidiRequest )
! 			{
! 				ScummMidiRequest->amr_Version = 2;
! 				if( OpenDevice( "amidi.device", MidiUnit, (struct IORequest *)ScummMidiRequest, AMIDIF_MIDISERVER ) )
! 				{
! 					DeleteIORequest( (struct IORequest *)ScummMidiRequest );
! 					DeleteMsgPort( ScummMidiPort );
! 					ScummMidiRequest = NULL;
! 					ScummMidiPort = NULL;
! 				}
! 			}
! 			else
  			{
  				DeleteMsgPort( ScummMidiPort );
  				ScummMidiPort = NULL;
  			}
  		}
  
! 		if( !ScummMidiRequest )
  		{
! 			warning( "Could not open AMidi - music will not play" );
! 			return false;
  		}
  	}
  
  	return true;
  }
--- 56,119 ----
  static struct MsgPort 		 *ScummMidiPort = NULL;
  		 struct IOMidiRequest *ScummMidiRequest = NULL;
+ static struct MsgPort       *MusicTimerMsgPort = NULL;
+ 		 struct timerequest   *MusicTimerIORequest = NULL;
  
! bool init_morphos_music( ULONG MidiUnit )
  {
! 	ScummMidiPort = CreateMsgPort();
! 	if( ScummMidiPort )
  	{
! 		ScummMidiRequest = (struct IOMidiRequest *)CreateIORequest( ScummMidiPort, sizeof( struct IOMidiRequest ) );
! 		if( ScummMidiRequest )
  		{
! 			ScummMidiRequest->amr_Version = 2;
! 			if( OpenDevice( "amidi.device", MidiUnit, (struct IORequest *)ScummMidiRequest, AMIDIF_MIDISERVER ) )
  			{
+ 				DeleteIORequest( (struct IORequest *)ScummMidiRequest );
  				DeleteMsgPort( ScummMidiPort );
+ 				ScummMidiRequest = NULL;
  				ScummMidiPort = NULL;
  			}
  		}
+ 		else
+ 		{
+ 			DeleteMsgPort( ScummMidiPort );
+ 			ScummMidiPort = NULL;
+ 		}
+ 	}
  
! 	if( !ScummMidiRequest )
! 	{
! 		warning( "Could not open AMidi - music will not play" );
! 		return false;
! 	}
! 
! 	MusicTimerMsgPort = CreateMsgPort();
! 	if( MusicTimerMsgPort )
! 	{
! 		MusicTimerIORequest = (struct timerequest *)CreateIORequest( MusicTimerMsgPort, sizeof( struct timerequest ) );
! 		if( MusicTimerIORequest )
  		{
! 			if( OpenDevice( "timer.device", UNIT_MICROHZ, (struct IORequest *)MusicTimerIORequest, 0 ) )
! 			{
! 				DeleteIORequest( (struct IORequest *)MusicTimerIORequest );
! 				DeleteMsgPort( MusicTimerMsgPort );
! 				MusicTimerIORequest = NULL;
! 				MusicTimerMsgPort = NULL;
! 			}
! 		}
! 		else
! 		{
! 			DeleteMsgPort( MusicTimerMsgPort );
! 			MusicTimerMsgPort = NULL;
  		}
  	}
  
+ 	if( !MusicTimerIORequest )
+ 	{
+ 		warning( "Could not open timer device - music will not play" );
+ 		return false;
+ 	}
+ 
  	return true;
  }
***************
*** 100,103 ****
--- 128,138 ----
  		DeleteMsgPort( ScummMidiPort );
  	}
+ 
+ 	if( MusicTimerIORequest )
+ 	{
+ 		CloseDevice( (struct IORequest *)MusicTimerIORequest );
+ 		DeleteIORequest( (struct IORequest *)MusicTimerIORequest );
+ 		DeleteMsgPort( MusicTimerMsgPort );
+ 	}
  }
  
***************
*** 177,265 ****
  		DeleteMsgPort( ahiPort );
  }
- 
- 
- int morphos_music_thread( Scumm *s, ULONG MidiUnit, bool NoMusic )
- {
- #if 0
- 	int  old_time, cur_time;
- 	bool initialized;
-    bool TimerAvailable = false;
- 	struct MsgPort     *TimerMsgPort;
- 	struct timerequest *TimerIORequest;
- 
- 	ObtainSemaphore( &ScummMusicThreadRunning );
- 
- 	initialized = init_morphos_music( MidiUnit, NoMusic );
- 	if( !initialized )
- 		warning( "Sound could not be initialized" );
- 
- 	TimerMsgPort = CreateMsgPort();
- 	if( TimerMsgPort )
- 	{
- 		TimerIORequest = (struct timerequest *)CreateIORequest( TimerMsgPort, sizeof( struct timerequest ) );
- 		if( TimerIORequest )
- 		{
- 			if( OpenDevice( "timer.device", UNIT_MICROHZ, (struct IORequest *)TimerIORequest, 0 ) == 0 )
- 				TimerAvailable = true;
- 			else
- 			{
- 				DeleteIORequest( (struct IORequest *)TimerIORequest );
- 				DeleteMsgPort( TimerMsgPort );
- 			}
- 		}
- 		else
- 			DeleteMsgPort( TimerMsgPort );
- 	}
- 
- 	if( !TimerAvailable )
- 	{
- 		warning( "ScummVM Music Thread: no timer available! Sound and music will be disabled" );
- 		Wait( SIGBREAKF_CTRL_F );
- 	}
- 	else
- 	{
- 		old_time = 0;//GetTicks();
- 
- 		for(;;)
- 		{
- 			if( CheckSignal( SIGBREAKF_CTRL_F ) )
- 				break;
- 
- /*			  if( !snd_driv.wave_based() )
- 			{
- 				cur_time = GetTicks();
- 				while( old_time < cur_time )
- 				{
- 					old_time += 10;
- 					sound.on_timer();
- 				}*/
- /*				  TimerIORequest->tr_time.tv_micro = (old_time-cur_time)*1000;
- 				if( TimerIORequest->tr_time.tv_micro == 0 )
- 					TimerIORequest->tr_time.tv_micro = 100;*/
- /*				  TimerIORequest->tr_time.tv_micro = 10000;
- 			}
- 			else
- 				TimerIORequest->tr_time.tv_micro = 10000;*/
- 
- 			TimerIORequest->tr_node.io_Command  = TR_ADDREQUEST;
- 			TimerIORequest->tr_time.tv_secs  = 0;
- 			DoIO( (struct IORequest *)TimerIORequest );
- 		}
- 	}
- 
- 	if( TimerAvailable )
- 	{
- 		CloseDevice( (struct IORequest *)TimerIORequest );
- 		DeleteIORequest( (struct IORequest *)TimerIORequest );
- 		DeleteMsgPort( TimerMsgPort );
- 	}
- 
- 	exit_morphos_music();
- 
- 	ReleaseSemaphore( &ScummMusicThreadRunning );
- 	return 0;
- #endif
- }
- 
  
  int morphos_sound_thread( OSystem_MorphOS *syst, ULONG SampleType )
--- 212,215 ----

Index: morphos_start.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/morphos/morphos_start.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** morphos_start.cpp	14 Apr 2002 19:43:12 -0000	1.1
--- morphos_start.cpp	18 Apr 2002 21:40:24 -0000	1.2
***************
*** 41,51 ****
  
  // For command line parsing
! static STRPTR usageTemplate = "STORY/A,DATAPATH/K,WBWINDOW/S,SCALER/K,MIDIUNIT/K/N,NOMUSIC/S,VOLUME/K/N,TEMPO/K/N,ROLANDEMU/S,NOSUBTITLES=NST/S";
! typedef enum 					{ USG_STORY = 0,	USG_DATAPATH, 	USG_WBWINDOW,	USG_SCALER, 	USG_MIDIUNIT,	USG_NOMUSIC,	USG_VOLUME,		USG_TEMPO,	 USG_ROLANDEMU, USG_NOSUBTITLES } usageFields;
! static LONG	  args[ 10 ] =  { (ULONG)NULL, 	 (ULONG)NULL,	 FALSE, 			 (ULONG)NULL,	 (ULONG)NULL, 	 false,			 (ULONG)NULL,	 (ULONG)NULL, false, false };
  static struct RDArgs *ScummArgs = NULL;
  
  static char*ScummStory = NULL;
  static char*ScummPath = NULL;
  static LONG ScummMidiUnit = 0;
  static LONG ScummMidiVolume = 0;
--- 41,52 ----
  
  // For command line parsing
! static STRPTR usageTemplate = "STORY/A,DATAPATH/K,WBWINDOW/S,SCALER/K,AMIGA/S,MIDIUNIT/K/N,MUSIC/K,VOLUME/K/N,TEMPO/K/N,ROLANDEMU/S,NOSUBTITLES=NST/S";
! typedef enum 					{ USG_STORY = 0,	USG_DATAPATH, 	USG_WBWINDOW,	USG_SCALER, 	USG_AMIGA,	USG_MIDIUNIT,	USG_MUSIC,	 USG_VOLUME,	 USG_TEMPO,	  USG_ROLANDEMU, USG_NOSUBTITLES } usageFields;
! static LONG	  args[ 11 ] =  { (ULONG)NULL, 	 (ULONG)NULL,	 FALSE, 			 (ULONG)NULL,	false,      (ULONG)NULL,   (ULONG)NULL, (ULONG)NULL,	 (ULONG)NULL, false, false };
  static struct RDArgs *ScummArgs = NULL;
  
  static char*ScummStory = NULL;
  static char*ScummPath = NULL;
+ static STRPTR ScummMusicDriver = NULL;
  static LONG ScummMidiUnit = 0;
  static LONG ScummMidiVolume = 0;
***************
*** 109,113 ****
  }
  
! void ReadToolTypes( struct WBArg *OfFile )
  {
  	struct DiskObject *dobj;
--- 110,124 ----
  }
  
! static STRPTR FindMusicDriver( STRPTR argval )
! {
! 	if( !stricmp( argval, "off" ) )   return "-enull";
! 	if( !stricmp( argval, "midi" ) )	 return "-eamidi";
! 	if( !stricmp( argval, "adlib" ) ) return "-eadlib";
! 
! 	error( "No such music driver supported. Possible values are off, Midi and Adlib." );
! 	return NULL;
! }
! 
! static void ReadToolTypes( struct WBArg *OfFile )
  {
  	struct DiskObject *dobj;
***************
*** 158,165 ****
  	if( ToolValue = (char *)FindToolType( dobj->do_ToolTypes, "MUSIC" ) )
  	{
! 		if( MatchToolValue( ToolValue, "YES" ) )
! 			args[ USG_NOMUSIC ] = FALSE;
! 		else if( MatchToolValue( ToolValue, "NO" ) )
! 			args[ USG_NOMUSIC ] = TRUE;
  	}
  
--- 169,178 ----
  	if( ToolValue = (char *)FindToolType( dobj->do_ToolTypes, "MUSIC" ) )
  	{
! 		if( !(ScummMusicDriver = FindMusicDriver( ToolValue )) )
! 		{
! 			FreeDiskObject( dobj );
! 			exit( 1 );
! 		}
! 		args[ USG_MUSIC ] = (ULONG)&ScummMusicDriver;
  	}
  
***************
*** 199,202 ****
--- 212,223 ----
  	}
  
+ 	if( ToolValue = (char *)FindToolType( dobj->do_ToolTypes, "AMIGA" ) )
+ 	{
+ 		if( MatchToolValue( ToolValue, "YES" ) )
+ 			args[ USG_AMIGA ] = FALSE;
+ 		else if( MatchToolValue( ToolValue, "NO" ) )
+ 			args[ USG_AMIGA ] = TRUE;
+ 	}
+ 
  	FreeDiskObject( dobj );
  }
***************
*** 208,212 ****
  	int delta;
  	int last_time, new_time;
! 	char *argv[ 10 ];
  	char volume[ 6 ], tempo[ 12 ], scaler[ 14 ];
  	char *SVMScalers[] = { "", "normal", "2x", "supereagle", "super2xsai" };
--- 229,233 ----
  	int delta;
  	int last_time, new_time;
! 	char *argv[ 15 ];
  	char volume[ 6 ], tempo[ 12 ], scaler[ 14 ];
  	char *SVMScalers[] = { "", "normal", "2x", "supereagle", "super2xsai" };
***************
*** 254,257 ****
--- 275,284 ----
  		}
  
+ 		if( args[ USG_MUSIC ] )
+ 		{
+ 			if( !(ScummMusicDriver = FindMusicDriver( (char *)args[ USG_MUSIC ] )) )
+ 				exit( 1 );
+ 		}
+ 
  		if( args[ USG_MIDIUNIT ] )
  			ScummMidiUnit = *((LONG *)args[ USG_MIDIUNIT ]);
***************
*** 287,290 ****
--- 314,319 ----
  	if( args[ USG_NOSUBTITLES ] ) argv[ argc++ ] = "-n";
  	if( args[ USG_ROLANDEMU ] 	 ) argv[ argc++ ] = "-r";
+ 	if( args[ USG_AMIGA ]		 ) argv[ argc++ ] = "-a";
+ 	if( args[ USG_MUSIC ]	    ) argv[ argc++ ] = ScummMusicDriver;
  	if( ScummGfxScaler != OSystem_MorphOS::ST_INVALID )
  	{





More information about the Scummvm-git-logs mailing list