[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.392,1.393 simon.h,1.116,1.117

Max Horn fingolfin at users.sourceforge.net
Sun Dec 21 10:52:01 CET 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv21422

Modified Files:
	simon.cpp simon.h 
Log Message:
cleanup; fix endian bug which caused the dreaded Simon1 hang on MacOS (_palette_color_count was treated as a 32 bit int when it is only 16 bit -> once again proves that one should be really really carefully with pointer cast hacks!)

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.392
retrieving revision 1.393
diff -u -d -r1.392 -r1.393
--- simon.cpp	21 Dec 2003 16:55:50 -0000	1.392
+++ simon.cpp	21 Dec 2003 18:50:44 -0000	1.393
@@ -2420,7 +2420,7 @@
 	if (!(_game & GF_SIMON2)) {
 		if (_unk_pal_flag) {
 			_unk_pal_flag = false;
-			while (*(volatile int *)&_palette_color_count != 0) {
+			while (_palette_color_count != 0) {
 				delay(10);
 			}
 		}
@@ -2432,7 +2432,7 @@
 		lock();
 		if (_lock_word == 0) {
 			_sync_flag_1 = true;
-			while ((*(volatile bool *)&_sync_flag_1) == true) {
+			while (_sync_flag_1) {
 				delay(10);
 			}
 		}
@@ -2440,7 +2440,7 @@
 
 	_lock_word |= 0x20;
 
-	while ((*(volatile uint16*)&_lock_word) & 2) {
+	while (_lock_word & 2) {
 		delay(10);
 	}
 

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- simon.h	20 Dec 2003 06:39:24 -0000	1.116
+++ simon.h	21 Dec 2003 18:50:44 -0000	1.117
@@ -179,7 +179,7 @@
 	bool _vga_res_328_loaded;
 	bool _hitarea_unk_3;
 	bool _mortal_flag;
-	bool _sync_flag_1;
+	volatile bool _sync_flag_1;
 	byte _video_var_8;
 	bool _use_palette_delay;
 	bool _sync_flag_2;
@@ -248,12 +248,12 @@
 	Item *_dummy_item_2;
 	Item *_dummy_item_3;
 
-	uint16 _lock_word;
+	volatile uint16 _lock_word;
 	uint16 _scroll_up_hit_area;
 	uint16 _scroll_down_hit_area;
 
 	uint16 _video_var_7;
-	uint16 _palette_color_count;
+	volatile uint16 _palette_color_count;
 
 	byte _video_var_4;
 	bool _video_var_5;





More information about the Scummvm-git-logs mailing list