[Scummvm-cvs-logs] CVS: scummvm/scumm imuse_player.cpp,2.47,2.48 instrument.h,2.13,2.14

Max Horn fingolfin at users.sourceforge.net
Fri Jan 7 06:43:33 CET 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19483

Modified Files:
	imuse_player.cpp instrument.h 
Log Message:
Flag 64 bit problem in iMuse, as well as what I think might be very old regression in our code

Index: imuse_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_player.cpp,v
retrieving revision 2.47
retrieving revision 2.48
diff -u -d -r2.47 -r2.48
--- imuse_player.cpp	1 Jan 2005 16:09:14 -0000	2.47
+++ imuse_player.cpp	7 Jan 2005 14:42:51 -0000	2.48
@@ -951,7 +951,12 @@
 			case 15:
 				return part->_vol;
 			case 16:
-				return (int)part->_instrument;
+// FIXME: Need to know where this occurs...
+error("Trying to cast instrument (%d, %d) -- please tell Fingolfin\n", param, chan);
+// In old versions of the code, this used to return part->_program.
+// This was changed in revision 2.29 of imuse.cpp (where this code used
+// to reside).
+//				return (int)part->_instrument;
 			case 17:
 				return part->_transpose;
 			default:

Index: instrument.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.h,v
retrieving revision 2.13
retrieving revision 2.14
diff -u -d -r2.13 -r2.14
--- instrument.h	1 Jan 2005 16:09:14 -0000	2.13
+++ instrument.h	7 Jan 2005 14:42:51 -0000	2.14
@@ -60,7 +60,20 @@
 
 	void clear();
 	void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); }
+
+	// FIXME: This is evil! We cast a pointer to an int. Besides not being
+	// portable to 64bit systems, it is unclear why this is needed.
+	// If the only reason is to supply a unique identifier of that
+	// instrument: there are better ways do do that.
+	// OTOH, maybe the code is simply wrong, and what is really meant
+	// here is to first dereference _instrument, then cast it? Like
+	// this: (int)*_instrument
+	// At least this would explain the otherwise unused operator int()
+	// supplied by class Instrument_Program.
+	// If that is the case, the operator int() should all be replaced by
+	// a proper method, like "get_something()"
 	operator int() { return (_instrument ? (int) _instrument : 255); }
+
 	void program (byte program, bool mt32);
 	void adlib (byte *instrument);
 	void roland (byte *instrument);





More information about the Scummvm-git-logs mailing list