[Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,1.6,1.7 actor.cpp,1.9,1.10 animation.cpp,1.4,1.5 animation.h,1.4,1.5 font.cpp,1.6,1.7 image.cpp,1.7,1.8 isomap.cpp,1.5,1.6 module.mk,1.12,1.13 objectmap.cpp,1.7,1.8 palanim.cpp,1.6,1.7 rscfile.cpp,1.4,1.5 scene.cpp,1.7,1.8 script.cpp,1.5,1.6 script.h,1.4,1.5 sdebug.cpp,1.3,1.4 sndres.cpp,1.11,1.12 sprite.cpp,1.6,1.7 sthread.cpp,1.5,1.6 sthread.h,1.3,1.4 yslib.h,1.5,1.6 ys_binread.cpp,1.5,NONE ys_binwrite.cpp,1.4,NONE

Eugene Sandulenko sev at users.sourceforge.net
Mon May 3 20:34:05 CEST 2004


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

Modified Files:
	actionmap.cpp actor.cpp animation.cpp animation.h font.cpp 
	image.cpp isomap.cpp module.mk objectmap.cpp palanim.cpp 
	rscfile.cpp scene.cpp script.cpp script.h sdebug.cpp 
	sndres.cpp sprite.cpp sthread.cpp sthread.h yslib.h 
Removed Files:
	ys_binread.cpp ys_binwrite.cpp 
Log Message:
Move from ys_binread.cpp and ys_binwrite.cpp to MemoryReadStream.
In fact there were no binary writes at all.


Index: actionmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- actionmap.cpp	3 May 2004 23:12:59 -0000	1.6
+++ actionmap.cpp	4 May 2004 03:33:03 -0000	1.7
@@ -25,8 +25,6 @@
 #include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "cvar_mod.h"
 #include "console_mod.h"
 #include "gfx_mod.h"
@@ -60,10 +58,10 @@
 	assert(ActmapModule.init);
 	assert(exmap_res != NULL);
 
-	MemoryReadStream *exmapStream = new MemoryReadStream(exmap_res, exmap_res_len);
+	MemoryReadStream *readS = new MemoryReadStream(exmap_res, exmap_res_len);
 
 	// Load exits
-	exit_ct = exmapStream->readSint16LE();
+	exit_ct = readS->readSint16LE();
 	if (exit_ct < 0) {
 		return R_FAILURE;
 	}
@@ -75,12 +73,12 @@
 	}
 
 	for (i = 0; i < exit_ct; i++) {
-		exmap_entry[i].unknown00 = exmapStream->readSint16LE();
-		exmap_entry[i].unknown02 = exmapStream->readSint16LE();
-		exmap_entry[i].exit_scene = exmapStream->readSint16LE();
-		exmap_entry[i].unknown06 = exmapStream->readSint16LE();
+		exmap_entry[i].unknown00 = readS->readSint16LE();
+		exmap_entry[i].unknown02 = readS->readSint16LE();
+		exmap_entry[i].exit_scene = readS->readSint16LE();
+		exmap_entry[i].unknown06 = readS->readSint16LE();
 
-		exmap_entry[i].pt_count = exmapStream->readSint16LE();
+		exmap_entry[i].pt_count = readS->readSint16LE();
 		if (exmap_entry[i].pt_count < 0) {
 			free(exmap_entry);
 			return R_FAILURE;
@@ -93,8 +91,8 @@
 		}
 
 		for (pt = 0; pt < exmap_entry[i].pt_count; pt++) {
-			exmap_pt_tbl[pt].x = exmapStream->readSint16LE();
-			exmap_pt_tbl[pt].y = exmapStream->readSint16LE();
+			exmap_pt_tbl[pt].x = readS->readSint16LE();
+			exmap_pt_tbl[pt].y = readS->readSint16LE();
 		}
 
 		exmap_entry[i].pt_tbl = exmap_pt_tbl;
@@ -167,8 +165,8 @@
 	int i;
 	int pt_i;
 
-	YS_IGNORE_PARAM(argc);
-	YS_IGNORE_PARAM(argv);
+	(void)(argc);
+	(void)(argv);
 
 	if (!ActmapModule.exits_loaded) {
 		return;

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- actor.cpp	3 May 2004 23:06:57 -0000	1.9
+++ actor.cpp	4 May 2004 03:33:03 -0000	1.10
@@ -670,7 +670,7 @@
 	R_printf(R_STDOUT, "Sprite resource contains %d sprite actions.\n", s_action_ct);
 	action_p = (R_ACTORACTION *)malloc(sizeof(R_ACTORACTION) * s_action_ct);
 
-	MemoryReadStream *resStream = new MemoryReadStream(res_p, res_len);
+	MemoryReadStream *readS = new MemoryReadStream(res_p, res_len);
 
 	if (action_p == NULL) {
 		R_printf(R_STDERR, "Couldn't allocate memory for sprite actions.\n");
@@ -683,8 +683,8 @@
 	for (i = 0; i < s_action_ct; i++) {
 		for (orient = 0; orient < 4; orient++) {
 			// Load all four orientations
-			action_p[i].dir[orient].frame_index = resStream->readUint16LE();
-			action_p[i].dir[orient].frame_count = resStream->readUint16LE();
+			action_p[i].dir[orient].frame_index = readS->readUint16LE();
+			action_p[i].dir[orient].frame_count = readS->readUint16LE();
 			if (action_p[i].dir[orient].frame_index > last_frame) {
 				last_frame = action_p[i].dir[orient].frame_index;
 			}
@@ -1078,7 +1078,7 @@
 
 static void CF_actor_del(int argc, char *argv[]) {
 	int id;
-
+ 
 	if (argc < 0)
 		return;
 

Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- animation.cpp	1 May 2004 23:42:22 -0000	1.4
+++ animation.cpp	4 May 2004 03:33:03 -0000	1.5
@@ -24,7 +24,6 @@
 // Background animation management module
 #include "saga.h"
 #include "reinherit.h"
-#include "yslib.h"
 
 #include "cvar_mod.h"
 #include "console_mod.h"
@@ -94,7 +93,7 @@
 	new_anim->resdata_len = anim_resdata_len;
 
 	if (GAME_GetGameType() == R_GAMETYPE_ITE) {
-		if (ANIM_GetNumFrames(anim_resdata, &new_anim->n_frames) != R_SUCCESS) {
+		if (ANIM_GetNumFrames(anim_resdata, anim_resdata_len, &new_anim->n_frames) != R_SUCCESS) {
 			R_printf(R_STDERR, "Error: Couldn't get animation frame count.\n");
 			return R_FAILURE;
 		}
@@ -107,12 +106,12 @@
 		}
 
 		for (i = 0; i < new_anim->n_frames; i++) {
-			ANIM_GetFrameOffset(anim_resdata, i + 1, &new_anim->frame_offsets[i]);
+			ANIM_GetFrameOffset(anim_resdata, anim_resdata_len, i + 1, &new_anim->frame_offsets[i]);
 		}
 	} else {
 		new_anim->cur_frame_p = anim_resdata + SAGA_FRAME_HEADER_LEN;
 		new_anim->cur_frame_len = anim_resdata_len - SAGA_FRAME_HEADER_LEN;
-		ANIM_GetNumFrames(anim_resdata, &new_anim->n_frames);
+		ANIM_GetNumFrames(anim_resdata, anim_resdata_len, &new_anim->n_frames);
 	}
 
 	// Set animation data
@@ -193,7 +192,7 @@
 	if (anim->play_flag) {
 		frame = anim->current_frame;
 		if (GAME_GetGameType() == R_GAMETYPE_ITE) {
-			result = ITE_DecodeFrame(anim->resdata, anim->frame_offsets[frame - 1], display_buf,
+			result = ITE_DecodeFrame(anim->resdata, anim->resdata_len, anim->frame_offsets[frame - 1], display_buf,
 									disp_info.logical_w * disp_info.logical_h);
 			if (result != R_SUCCESS) {
 				R_printf(R_STDERR, "ANIM_Play: Error decoding frame %u", anim->current_frame);
@@ -346,7 +345,7 @@
 // sometimes less than number present in the .nframes member of the
 // animation header. For this reason, the function attempts to find
 // the last valid frame number, which it returns via 'n_frames'
-int ANIM_GetNumFrames(const byte *anim_resource, uint16 *n_frames) {
+int ANIM_GetNumFrames(const byte *anim_resource, size_t anim_resource_len, uint16 *n_frames) {
 	R_ANIMATION_HEADER ah;
 
 	size_t offset;
@@ -354,19 +353,19 @@
 
 	int x;
 
-	const byte *read_p = anim_resource;
-
 	if (!AnimInfo.initialized) {
 		return R_FAILURE;
 	}
 
-	ah.magic = ys_read_u16_le(read_p, &read_p);
-	ah.screen_w = ys_read_u16_le(read_p, &read_p);
-	ah.screen_h = ys_read_u16_le(read_p, &read_p);
+	MemoryReadStream *readS = new MemoryReadStream(anim_resource, anim_resource_len);
 
-	ah.unknown06 = ys_read_u8(read_p, &read_p);
-	ah.unknown07 = ys_read_u8(read_p, &read_p);
-	ah.nframes = ys_read_u8(read_p, NULL);
+	ah.magic = readS->readUint16LE();
+	ah.screen_w = readS->readUint16LE();
+	ah.screen_h = readS->readUint16LE();
+
+	ah.unknown06 = readS->readByte();
+	ah.unknown07 = readS->readByte();
+	ah.nframes = readS->readByte();
 
 	if (GAME_GetGameType() == R_GAMETYPE_IHNM) {
 		*n_frames = ah.nframes;
@@ -374,7 +373,7 @@
 
 	if (ah.magic == 68) {
 		for (x = ah.nframes; x > 0; x--) {
-			if (ANIM_GetFrameOffset(anim_resource, x, &offset) != R_SUCCESS) {
+			if (ANIM_GetFrameOffset(anim_resource, anim_resource_len, x, &offset) != R_SUCCESS) {
 				return R_FAILURE;
 			}
 
@@ -391,11 +390,10 @@
 	return R_FAILURE;
 }
 
-int ITE_DecodeFrame(const byte * resdata, size_t frame_offset, byte * buf, size_t buf_len) {
+int ITE_DecodeFrame(const byte *resdata, size_t resdata_len, size_t frame_offset, byte *buf, size_t buf_len) {
 	R_ANIMATION_HEADER ah;
 	R_FRAME_HEADER fh;
 
-	const byte *read_p = resdata;
 	byte *write_p;
 
 	uint16 magic;
@@ -421,16 +419,17 @@
 		return R_FAILURE;
 	}
 
+	MemoryReadStream *readS = new MemoryReadStream(resdata, resdata_len);
 	// Read animation header
-	ah.magic = ys_read_u16_le(read_p, &read_p);
-	ah.screen_w = ys_read_u16_le(read_p, &read_p);
-	ah.screen_h = ys_read_u16_le(read_p, &read_p);
-	ah.unknown06 = ys_read_u8(read_p, &read_p);
-	ah.unknown07 = ys_read_u8(read_p, &read_p);
-	ah.nframes = ys_read_u8(read_p, &read_p);
-	ah.flags = ys_read_u8(read_p, &read_p);
-	ah.unknown10 = ys_read_u8(read_p, &read_p);
-	ah.unknown11 = ys_read_u8(read_p, &read_p);
+	ah.magic = readS->readUint16LE();
+	ah.screen_w = readS->readUint16LE();
+	ah.screen_h = readS->readUint16LE();
+	ah.unknown06 = readS->readByte();
+	ah.unknown07 = readS->readByte();
+	ah.nframes = readS->readByte();
+	ah.flags = readS->readByte();
+	ah.unknown10 = readS->readByte();
+	ah.unknown11 = readS->readByte();
 
 	screen_w = ah.screen_w;
 	screen_h = ah.screen_h;
@@ -442,10 +441,10 @@
 	}
 
 	// Read frame header
-	read_p = resdata + frame_offset;
+	readS = new MemoryReadStream(resdata + frame_offset, resdata_len - frame_offset);
 
 	// Check for frame magic byte
-	magic = ys_read_u8(read_p, &read_p);
+	magic = readS->readByte();
 	if (magic != SAGA_FRAME_HEADER_MAGIC) {
 		R_printf(R_STDERR, "ITE_DecodeFrame: Invalid frame offset.\n");
 		return R_FAILURE;
@@ -455,13 +454,13 @@
 	// endian format, but the actual RLE encoded frame data, 
 	// including the frame header, is in big endian format.
 
-	fh.x_start = ys_read_u16_be(read_p, &read_p);
-	fh.y_start = ys_read_u8(read_p, &read_p);
-	read_p++;		/* Skip pad byte */
-	fh.x_pos = ys_read_u16_be(read_p, &read_p);
-	fh.y_pos = ys_read_u16_be(read_p, &read_p);
-	fh.width = ys_read_u16_be(read_p, &read_p);
-	fh.height = ys_read_u16_be(read_p, &read_p);
+	fh.x_start = readS->readUint16BE();
+	fh.y_start = readS->readByte();
+	readS->readByte();		/* Skip pad byte */
+	fh.x_pos = readS->readUint16BE();
+	fh.y_pos = readS->readUint16BE();
+	fh.width = readS->readUint16BE();
+	fh.height = readS->readUint16BE();
 
 	x_start = fh.x_start;
 	y_start = fh.y_start;
@@ -471,36 +470,36 @@
 
 	// Begin RLE decompression to output buffer
 	do {
-		mark_byte = ys_read_u8(read_p, &read_p);
+		mark_byte = readS->readByte();
 		switch (mark_byte) {
 		case 0x10: // Long Unencoded Run
-			runcount = ys_read_s16_be(read_p, &read_p);
+			runcount = readS->readSint16BE();
 			for (i = 0; i < runcount; i++) {
-				if (*read_p != 0) {
-					*write_p = *read_p;
+				data_byte = readS->readByte();
+				if (data_byte != 0) {
+					*write_p = data_byte;
 				}
 				write_p++;
-				read_p++;
 			}
 			continue;
 			break;
 		case 0x20: // Long encoded run
-			runcount = ys_read_s16_be(read_p, &read_p);
-			data_byte = *read_p++;
+			runcount = readS->readSint16BE();
+			data_byte = readS->readByte();
 			for (i = 0; i < runcount; i++) {
 				*write_p++ = data_byte;
 			}
 			continue;
 			break;
 		case 0x2F: // End of row
-			x_vector = ys_read_s16_be(read_p, &read_p);
-			new_row = ys_read_u8(read_p, &read_p);
+			x_vector = readS->readSint16BE();
+			new_row = readS->readByte();
 			// Set write pointer to the new draw origin
 			write_p = buf + ((y_start + new_row) * screen_w) + x_start + x_vector;
 			continue;
 			break;
 		case 0x30: // Reposition command
-			x_vector = ys_read_s16_be(read_p, &read_p);
+			x_vector = readS->readSint16BE();
 			write_p += x_vector;
 			continue;
 			break;
@@ -524,7 +523,7 @@
 		case 0x80: // 1000 0000
 			// Run of compressed data
 			runcount = param_ch + 1;
-			data_byte = *read_p++;
+			data_byte = readS->readByte();
 			for (i = 0; i < runcount; i++) {
 				*write_p++ = data_byte;
 			}
@@ -534,11 +533,11 @@
 			// Uncompressed run
 			runcount = param_ch + 1;
 			for (i = 0; i < runcount; i++) {
-				if (*read_p != 0) {
-					*write_p = *read_p;
+				data_byte = readS->readByte();
+				if (data_byte != 0) {
+					*write_p = data_byte;
 				}
 				write_p++;
-				read_p++;
 			}
 			continue;
 			break;
@@ -571,8 +570,7 @@
 
 	size_t in_ch_offset;
 
-	const byte *inbuf_p = thisf_p;
-	size_t inbuf_remain = thisf_len;
+	MemoryReadStream *readS = new MemoryReadStream(thisf_p, thisf_len);
 
 	byte *outbuf_p = decode_buf;
 	byte *outbuf_endp = (decode_buf + decode_buf_len) - 1;
@@ -585,9 +583,8 @@
 	*nextf_p = NULL;
 
 	for (; cont_flag; decoded_data = 1) {
-		in_ch_offset = (size_t) (inbuf_p - thisf_p);
-		in_ch = *inbuf_p++;
-		inbuf_remain--;
+		in_ch_offset = readS->tell();
+		in_ch = readS->readByte();
 		switch (in_ch) {
 		case 0x0F: // 15: Frame header
 			{
@@ -598,20 +595,18 @@
 				int param5;
 				int param6;
 
-				if (inbuf_remain < 13) {
+				if (thisf_len - readS->tell() < 13) {
 					R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
 					return R_FAILURE;
 				}
 
-				param1 = ys_read_u16_be(inbuf_p, &inbuf_p);
-				param2 = ys_read_u16_be(inbuf_p, &inbuf_p);
-				inbuf_p++; // skip 1?
-				param3 = ys_read_u16_be(inbuf_p, &inbuf_p);
-				param4 = ys_read_u16_be(inbuf_p, &inbuf_p);
-				param5 = ys_read_u16_be(inbuf_p, &inbuf_p);
-				param6 = ys_read_u16_be(inbuf_p, &inbuf_p);
-
-				inbuf_remain -= 13;
+				param1 = readS->readUint16BE();
+				param2 = readS->readUint16BE();
+				readS->readByte(); // skip 1?
+				param3 = readS->readUint16BE();
+				param4 = readS->readUint16BE();
+				param5 = readS->readUint16BE();
+				param6 = readS->readUint16BE();
 
 				x_origin = param1;
 				y_origin = param2;
@@ -629,8 +624,8 @@
 			}
 			break;
 		case 0x10: // Long Unencoded Run
-			runcount = ys_read_s16_be(inbuf_p, &inbuf_p);
-			if (inbuf_remain < runcount) {
+			runcount = readS->readSint16BE();
+			if (thisf_len - readS->tell() < runcount) {
 				R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
 				return R_FAILURE;
 			}
@@ -640,64 +635,62 @@
 			}
 
 			for (c = 0; c < runcount; c++) {
-				if (*inbuf_p != 0) {
-					*outbuf_p = *inbuf_p;
+				data_pixel = readS->readByte();
+				if (data_pixel != 0) {
+					*outbuf_p = data_pixel;
 				}
 				outbuf_p++;
-				inbuf_p++;
 			}
 
-			inbuf_remain -= runcount;
 			outbuf_remain -= runcount;
 			continue;
 			break;
 		case 0x1F: // 31: Unusued?
-			if (inbuf_remain < 3) {
+			if (thisf_len - readS->tell() < 3) {
 				R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
 				return R_FAILURE;
 			}
 
-			inbuf_p += 3;
-			inbuf_remain -= 3;
+			readS->readByte();
+			readS->readByte();
+			readS->readByte();
 			continue;
 			break;
 		case 0x20: // Long compressed run
-			if (inbuf_remain <= 3) {
+			if (thisf_len - readS->tell() <= 3) {
 				R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
 				return R_FAILURE;
 			}
 
-			runcount = ys_read_s16_be(inbuf_p, &inbuf_p);
-			data_pixel = *inbuf_p++;
+			runcount = readS->readSint16BE();
+			data_pixel = readS->readByte();
 
 			for (c = 0; c < runcount; c++) {
 				*outbuf_p++ = data_pixel;
 			}
 
 			outbuf_remain -= runcount;
-			inbuf_remain -= 1;
 			continue;
 			break;
 
 		case 0x2F: // End of row
-			if (inbuf_remain <= 4) {
+			if (thisf_len - readS->tell() <= 4) {
 				return R_FAILURE;
 			}
 
-			x_vector = ys_read_s16_be(inbuf_p, &inbuf_p);
-			new_row = ys_read_s16_be(inbuf_p, &inbuf_p);
+			x_vector = readS->readSint16BE();
+			new_row = readS->readSint16BE();
 
 			outbuf_p = decode_buf + ((y_origin + new_row) * di.logical_w) + x_origin + x_vector;
-			inbuf_remain -= 4;
 			outbuf_remain = (outbuf_endp - outbuf_p) + 1;
 			continue;
 			break;
 		case 0x30: // Reposition command
-			if (inbuf_remain < 2) {
+			if (thisf_len - readS->tell() < 2) {
 				return R_FAILURE;
 			}
 
-			x_vector = ys_read_s16_be(inbuf_p, &inbuf_p);
+			x_vector = readS->readSint16BE();
 
 			if (((x_vector > 0) && ((size_t) x_vector > outbuf_remain)) || (-x_vector > outbuf_p - decode_buf)) {
 				R_printf(R_STDERR, "0x30: Invalid x_vector.\n");
@@ -706,15 +699,14 @@
 
 			outbuf_p += x_vector;
 			outbuf_remain -= x_vector;
-			inbuf_remain -= 2;
 			continue;
 			break;
 
 		case 0x3F:	// 68: Frame end marker
 			printf("0x3F: Frame end marker\n");
-			if (decoded_data && inbuf_remain > 0) {
-				*nextf_p = inbuf_p;
-				*nextf_len = inbuf_remain;
+			if (decoded_data && (thisf_len - readS->tell() > 0)) {
+				*nextf_p = thisf_p + readS->tell();
+				*nextf_len = thisf_len - readS->tell();
 			} else {
 				*nextf_p = NULL;
 				*nextf_len = 0;
@@ -744,15 +736,13 @@
 			break;
 		case 0x80: // Run of compressed data
 			runcount = param_ch + 1;
-			if ((outbuf_remain < runcount) || (inbuf_remain <= 1)) {
+			if ((outbuf_remain < runcount) || (thisf_len - readS->tell() <= 1)) {
 				return R_FAILURE;
 			}
 
-			data_pixel = *inbuf_p++;
-			inbuf_remain--;
+			data_pixel = readS->readByte();
 
 			for (c = 0; c < runcount; c++) {
-
 				*outbuf_p++ = data_pixel;
 			}
 
@@ -761,19 +751,18 @@
 			break;
 		case 0x40: // Uncompressed run
 			runcount = param_ch + 1;
-			if ((outbuf_remain < runcount) || (inbuf_remain < runcount)) {
+			if ((outbuf_remain < runcount) || (thisf_len - readS->tell() < runcount)) {
 				return R_FAILURE;
 			}
 
 			for (c = 0; c < runcount; c++) {
-				if (*inbuf_p != 0) {
-					*outbuf_p = *inbuf_p;
+				data_pixel = readS->readByte();
+				if (data_pixel != 0) {
+					*outbuf_p = data_pixel;
 				}
 				outbuf_p++;
-				inbuf_p++;
 			}
 
-			inbuf_remain -= runcount;
 			outbuf_remain -= runcount;
 
 			continue;
@@ -787,34 +776,35 @@
 	return R_SUCCESS;
 }
 
-int ANIM_GetFrameOffset(const byte *resdata, uint16 find_frame, size_t *frame_offset_p) {
+int ANIM_GetFrameOffset(const byte *resdata, size_t resdata_len, uint16 find_frame, size_t *frame_offset_p) {
 	R_ANIMATION_HEADER ah;
 
 	uint16 num_frames;
 	uint16 current_frame;
 
-	const byte *read_p = resdata;
-	const byte *search_ptr;
-
 	byte mark_byte;
 	uint16 control;
 	uint16 runcount;
 	uint16 magic;
 
+	int i;
+
 	if (!AnimInfo.initialized) {
 		return R_FAILURE;
 	}
 
+	MemoryReadStream *readS = new MemoryReadStream(resdata, resdata_len);
+
 	// Read animation header
-	ah.magic = ys_read_u16_le(read_p, &read_p);
-	ah.screen_w = ys_read_u16_le(read_p, &read_p);
-	ah.screen_h = ys_read_u16_le(read_p, &read_p);
-	ah.unknown06 = ys_read_u8(read_p, &read_p);
-	ah.unknown07 = ys_read_u8(read_p, &read_p);
-	ah.nframes = ys_read_u8(read_p, &read_p);
-	ah.flags = ys_read_u8(read_p, &read_p);
-	ah.unknown10 = ys_read_u8(read_p, &read_p);
-	ah.unknown11 = ys_read_u8(read_p, &read_p);
+	ah.magic = readS->readUint16LE();
+	ah.screen_w = readS->readUint16LE();
+	ah.screen_h = readS->readUint16LE();
+	ah.unknown06 = readS->readByte();
+	ah.unknown07 = readS->readByte();
+	ah.nframes = readS->readByte();
+	ah.flags = readS->readByte();
+	ah.unknown10 = readS->readByte();
+	ah.unknown11 = readS->readByte();
 
 	num_frames = ah.nframes;
 
@@ -822,42 +812,48 @@
 		return R_FAILURE;
 	}
 
-	search_ptr = read_p;
 	for (current_frame = 1; current_frame < find_frame; current_frame++) {
-		magic = ys_read_u8(search_ptr, &search_ptr);
+		magic = readS->readByte();
 		if (magic != SAGA_FRAME_HEADER_MAGIC) {
 			// Frame sync failure. Magic Number not found
 			return R_FAILURE;
 		}
 
-		search_ptr += SAGA_FRAME_HEADER_LEN;
+		// skip header
+		for (i = 0; i < SAGA_FRAME_HEADER_LEN; i++)
+			readS->readByte();
+
 		// For some strange reason, the animation header is in little
 		// endian format, but the actual RLE encoded frame data, 
 		// including the frame header, is in big endian format. */
 		do {
-			mark_byte = *search_ptr;
+			mark_byte = readS->readByte();
 			switch (mark_byte) {
 			case 0x3F: // End of frame marker
-				search_ptr++;
 				continue;
 				break;
 			case 0x30: // Reposition command
-				search_ptr += 3;
+				readS->readByte();
+				readS->readByte();
 				continue;
 				break;
 			case 0x2F: // End of row marker
-				search_ptr += 4;
+				readS->readByte();
+				readS->readByte();
+				readS->readByte();
 				continue;
 				break;
 			case 0x20: // Long compressed run marker
-				search_ptr += 4;
+				readS->readByte();
+				readS->readByte();
+				readS->readByte();
 				continue;
 				break;
 			case 0x10: // (16) 0001 0000
 				// Long Uncompressed Run
-				search_ptr++;
-				runcount = ys_read_s16_be(search_ptr, &search_ptr);
-				search_ptr += runcount;
+				runcount = readS->readSint16BE();
+				for (i = 0; i < runcount; i++)
+					readS->readByte();
 				continue;
 				break;
 			default:
@@ -869,19 +865,18 @@
 			switch (control) {
 			case 0xC0:
 				// Run of empty pixels
-				search_ptr++;
 				continue;
 				break;
 			case 0x80:
 				// Run of compressed data
-				search_ptr += 2; // Skip data byte
+				readS->readByte(); // Skip data byte
 				continue;
 				break;
 			case 0x40:
 				// Uncompressed run
-				search_ptr++;
 				runcount = (mark_byte & 0x3f) + 1;
-				search_ptr += runcount;
+				for (i = 0; i < runcount; i++)
+					readS->readByte();
 				continue;
 				break;
 			default:
@@ -892,7 +887,7 @@
 		} while (mark_byte != 63);
 	}
 
-	*frame_offset_p = (search_ptr - resdata);
+	*frame_offset_p = readS->tell();
 	return R_SUCCESS;
 }
 
@@ -901,8 +896,8 @@
 	uint16 i;
 	uint16 idx;
 
-	YS_IGNORE_PARAM(argc);
-	YS_IGNORE_PARAM(argv);
+	(void)(argc);
+	(void)(argv);
 
 	anim_ct = AnimInfo.anim_count;
 

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- animation.h	1 May 2004 06:16:57 -0000	1.4
+++ animation.h	4 May 2004 03:33:03 -0000	1.5
@@ -93,11 +93,11 @@
 	R_ANIMATION *anim_tbl[R_MAX_ANIMATIONS];
 };
 
-int ANIM_GetNumFrames(const byte *anim_resource, uint16 *n_frames);
-int ITE_DecodeFrame(const byte * anim_resource, size_t frame_offset, byte * buf, size_t buf_len);
-int IHNM_DecodeFrame(byte * decode_buf, size_t decode_buf_len, const byte * thisf_p,
-					size_t thisf_len, const byte ** nextf_p, size_t * nextf_len);
-int ANIM_GetFrameOffset(const byte * anim_resource, uint16 find_frame, size_t * frame_offset);
+int ANIM_GetNumFrames(const byte *anim_resource, size_t anim_resource_len, uint16 *n_frames);
+int ITE_DecodeFrame(const byte *anim_resource, size_t anim_resource_len, size_t frame_offset, byte *buf, size_t buf_len);
+int IHNM_DecodeFrame(byte *decode_buf, size_t decode_buf_len, const byte *thisf_p,
+					size_t thisf_len, const byte **nextf_p, size_t *nextf_len);
+int ANIM_GetFrameOffset(const byte *anim_resource, size_t anim_resource_len, uint16 find_frame, size_t *frame_offset);
 static void CF_anim_info(int argc, char *argv[]);
 
 } // End of namespace Saga

Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- font.cpp	1 May 2004 23:42:22 -0000	1.6
+++ font.cpp	4 May 2004 03:33:03 -0000	1.7
@@ -25,8 +25,6 @@
 #include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "rscfile_mod.h"
 #include "game_mod.h"
 
@@ -103,8 +101,6 @@
 	R_FONT_STYLE *normal_font;
 	byte *fontres_p;
 	size_t fontres_len;
-	size_t remain;
-	const byte *read_p;
 	int nbits;
 	int c;
 
@@ -122,8 +118,7 @@
 		FontModule.err_str = "Invalid font length.";
 	}
 
-	read_p = fontres_p;
-	remain = fontres_len;
+	MemoryReadStream *readS = new MemoryReadStream(fontres_p, fontres_len);
 
 	// Create new font structure
 	font = (R_FONT *)malloc(sizeof *font);
@@ -133,9 +128,9 @@
 	}
 
 	// Read font header
-	fh.c_height = ys_read_u16_le(read_p, &read_p);
-	fh.c_width = ys_read_u16_le(read_p, &read_p);
-	fh.row_length = ys_read_u16_le(read_p, &read_p);
+	fh.c_height = readS->readUint16LE();
+	fh.c_width = readS->readUint16LE();
+	fh.row_length = readS->readUint16LE();
 
 #if R_FONT_DBGLVL >= R_DEBUG_INFO
 	R_printf(R_STDOUT, "FONT_Load(): Reading font resource...\n");
@@ -161,23 +156,23 @@
 	normal_font->hdr.row_length = fh.row_length;
 
 	for (c = 0; c < R_FONT_CHARCOUNT; c++) {
-		normal_font->fce[c].index = ys_read_u16_le(read_p, &read_p);
+		normal_font->fce[c].index = readS->readUint16LE();
 	}
 
 	for (c = 0; c < R_FONT_CHARCOUNT; c++) {
-		nbits = normal_font->fce[c].width = ys_read_u8(read_p, &read_p);
+		nbits = normal_font->fce[c].width = readS->readByte();
 		normal_font->fce[c].byte_width = GetByteLen(nbits);
 	}
 
 	for (c = 0; c < R_FONT_CHARCOUNT; c++) {
-		normal_font->fce[c].flag = ys_read_u8(read_p, &read_p);
+		normal_font->fce[c].flag = readS->readByte();
 	}
 
 	for (c = 0; c < R_FONT_CHARCOUNT; c++) {
-		normal_font->fce[c].tracking = ys_read_u8(read_p, &read_p);
+		normal_font->fce[c].tracking = readS->readByte();
 	}
 
-	if ((read_p - fontres_p) != R_FONT_DESCSIZE) {
+	if (readS->tell() != R_FONT_DESCSIZE) {
 		R_printf(R_STDERR, "Invalid font resource size.\n");
 		return R_FAILURE;
 	}

Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/image.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- image.cpp	1 May 2004 23:42:22 -0000	1.7
+++ image.cpp	4 May 2004 03:33:03 -0000	1.8
@@ -62,17 +62,18 @@
 	size_t decode_buf_len;
 	byte *out_buf;
 	size_t out_buf_len;
-	const byte *read_p = image_data;
 
 	if (image_size <= SAGA_IMAGE_DATA_OFFSET) {
 		/* Image size is way too small */
 		return R_FAILURE;
 	}
 
-	hdr.width = ys_read_u16_le(read_p, &read_p);
-	hdr.height = ys_read_u16_le(read_p, &read_p);
-	hdr.unknown4 = ys_read_u16_le(read_p, &read_p);
-	hdr.unknown6 = ys_read_u16_le(read_p, &read_p);
+	MemoryReadStream *readS = new MemoryReadStream(image_data, image_size);
+
+	hdr.width = readS->readUint16LE();
+	hdr.height = readS->readUint16LE();
+	hdr.unknown4 = readS->readUint16LE();
+	hdr.unknown6 = readS->readUint16LE();
 
 	RLE_data_ptr = image_data + SAGA_IMAGE_DATA_OFFSET;
 	RLE_data_len = image_size - SAGA_IMAGE_DATA_OFFSET;

Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- isomap.cpp	1 May 2004 23:42:22 -0000	1.5
+++ isomap.cpp	4 May 2004 03:33:03 -0000	1.6
@@ -25,8 +25,6 @@
 #include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "game_mod.h"
 #include "gfx_mod.h"
 
@@ -49,19 +47,17 @@
 
 	uint16 i;
 
-	const byte *read_p = tileres_p;
-	size_t read_len = tileres_len;
-
 	assert((IsoModule.init) && (!IsoModule.tiles_loaded));
 	assert((tileres_p != NULL) && (tileres_len > 0));
 
-	read_p += 2;
-	first_entry.tile_offset = ys_read_u16_le(read_p, &read_p);
+	MemoryReadStream *readS = new MemoryReadStream(tileres_p, tileres_len);
+
+	readS->readUint16LE(); // skip
+	first_entry.tile_offset = readS->readUint16LE();
 
 	IsoModule.tile_ct = first_entry.tile_offset / SAGA_ISOTILE_ENTRY_LEN;
 
-	read_p = tileres_p;
-	read_len = tileres_len;
+	readS->rewind();
 
 	tile_tbl = (R_ISOTILE_ENTRY *)malloc(IsoModule.tile_ct * sizeof *tile_tbl);
 	if (tile_tbl == NULL) {
@@ -69,11 +65,11 @@
 	}
 
 	for (i = 0; i < IsoModule.tile_ct; i++) {
-		tile_tbl[i].tile_h = ys_read_u8(read_p, &read_p);
-		tile_tbl[i].unknown01 = ys_read_u8(read_p, &read_p);
-		tile_tbl[i].tile_offset = ys_read_u16_le(read_p, &read_p);
-		tile_tbl[i].unknown04 = ys_read_s16_le(read_p, &read_p);
-		tile_tbl[i].unknown06 = ys_read_s16_le(read_p, &read_p);
+		tile_tbl[i].tile_h = readS->readByte();
+		tile_tbl[i].unknown01 = readS->readByte();
+		tile_tbl[i].tile_offset = readS->readUint16LE();
+		tile_tbl[i].unknown04 = readS->readSint16LE();
+		tile_tbl[i].unknown06 = readS->readSint16LE();
 	}
 
 	IsoModule.tiles_loaded = 1;
@@ -86,8 +82,6 @@
 
 int ISOMAP_LoadMetaTileset(const byte *mtileres_p, size_t mtileres_len) {
 	R_ISO_METATILE_ENTRY *mtile_tbl;
-	const byte *read_p = mtileres_p;
-	size_t read_len = mtileres_len;
 	uint16 mtile_ct;
 	uint16 ct;
 	int i;
@@ -95,7 +89,7 @@
 	assert(IsoModule.init);
 	assert((mtileres_p != NULL) && (mtileres_len > 0));
 
-	(void)read_len;
+	MemoryReadStream *readS = new MemoryReadStream(mtileres_p, mtileres_len);
 
 	mtile_ct = mtileres_len / SAGA_METATILE_ENTRY_LEN;
 	mtile_tbl = (R_ISO_METATILE_ENTRY *)malloc(mtile_ct * sizeof *mtile_tbl);
@@ -104,13 +98,13 @@
 	}
 
 	for (ct = 0; ct < mtile_ct; ct++) {
-		mtile_tbl[ct].mtile_n = ys_read_u16_le(read_p, &read_p);
-		mtile_tbl[ct].unknown02 = ys_read_s16_le(read_p, &read_p);
-		mtile_tbl[ct].unknown04 = ys_read_s16_le(read_p, &read_p);
-		mtile_tbl[ct].unknown06 = ys_read_s16_le(read_p, &read_p);
+		mtile_tbl[ct].mtile_n = readS->readUint16LE();
+		mtile_tbl[ct].unknown02 = readS->readSint16LE();
+		mtile_tbl[ct].unknown04 = readS->readSint16LE();
+		mtile_tbl[ct].unknown06 = readS->readSint16LE();
 
 		for (i = 0; i < SAGA_METATILE_SIZE; i++) {
-			mtile_tbl[ct].tile_tbl[i] = ys_read_u16_le(read_p, &read_p);
+			mtile_tbl[ct].tile_tbl[i] = readS->readUint16LE();
 		}
 	}
 
@@ -125,16 +119,13 @@
 }
 
 int ISOMAP_LoadMetamap(const byte *mm_res_p, size_t mm_res_len) {
-	const byte *read_p = mm_res_p;
-	size_t read_len = mm_res_len;
 	int i;
 
-	(void)read_len;
-
-	IsoModule.metamap_n = ys_read_s16_le(read_p, &read_p);
+	MemoryReadStream *readS = new MemoryReadStream(mm_res_p, mm_res_len);
+	IsoModule.metamap_n = readS->readSint16LE();
 
 	for (i = 0; i < SAGA_METAMAP_SIZE; i++) {
-		IsoModule.metamap_tbl[i] = ys_read_u16_le(read_p, &read_p);
+		IsoModule.metamap_tbl[i] = readS->readUint16LE();
 	}
 
 	IsoModule.mm_res_p = mm_res_p;

Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/module.mk,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- module.mk	2 May 2004 00:00:39 -0000	1.12
+++ module.mk	4 May 2004 03:33:03 -0000	1.13
@@ -35,8 +35,6 @@
 	saga/sthread.o \
 	saga/text.o \
 	saga/transitions.o \
-	saga/ys_binread.o \
-	saga/ys_binwrite.o \
 	saga/ys_dl_list.o \
 	saga/input.o \
 	saga/timer.o \

Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- objectmap.cpp	2 May 2004 00:00:39 -0000	1.7
+++ objectmap.cpp	4 May 2004 03:33:03 -0000	1.8
@@ -21,17 +21,14 @@
  *
  */
 
-
 // Object map / Object click-area module 
 
 // Polygon Hit Test code ( HitTestPoly() ) adapted from code (C) Eric Haines
 // appearing in Graphics Gems IV, "Point in Polygon Strategies."
 // p. 24-46, code: p. 34-45
-
+#include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "cvar_mod.h"
 #include "console_mod.h"
 #include "gfx_mod.h"
@@ -79,15 +76,13 @@
 
 // Loads an object map resource ( objects ( clickareas ( points ) ) ) 
 int OBJECTMAP_Load(const byte *om_res, size_t om_res_len) {
-	const unsigned char *read_p = om_res;
-
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
 	R_POINT *point;
 
 	int i, k, m;
 
-	YS_IGNORE_PARAM(om_res_len);
+	MemoryReadStream *readS = new MemoryReadStream(om_res, om_res_len);
 
 	if (!OMInfo.initialized) {
 		R_printf(R_STDERR, "Error: Object map module not initialized!\n");
@@ -99,7 +94,7 @@
 	}
 
 	// Obtain object count N and allocate space for N objects
-	OMInfo.n_objects = ys_read_u16_le(read_p, &read_p);
+	OMInfo.n_objects = readS->readUint16LE();
 
 	OMInfo.object_maps = (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
 
@@ -111,11 +106,11 @@
 	// Load all N objects
 	for (i = 0; i < OMInfo.n_objects; i++) {
 		object_map = &OMInfo.object_maps[i];
-		object_map->unknown0 = ys_read_u8(read_p, &read_p);
-		object_map->n_clickareas = ys_read_u8(read_p, &read_p);
-		object_map->flags = ys_read_u16_le(read_p, &read_p);
-		object_map->object_num = ys_read_u16_le(read_p, &read_p);
-		object_map->script_num = ys_read_u16_le(read_p, &read_p);
+		object_map->unknown0 = readS->readByte();
+		object_map->n_clickareas = readS->readByte();
+		object_map->flags = readS->readUint16LE();
+		object_map->object_num = readS->readUint16LE();
+		object_map->script_num = readS->readUint16LE();
 		object_map->clickareas = (R_CLICKAREA *)malloc(object_map->n_clickareas * sizeof *(object_map->clickareas));
 
 		if (object_map->clickareas == NULL) {
@@ -126,7 +121,7 @@
 		// Load all clickareas for this object
 		for (k = 0; k < object_map->n_clickareas; k++) {
 			clickarea = &object_map->clickareas[k];
-			clickarea->n_points = ys_read_u16_le(read_p, &read_p);
+			clickarea->n_points = readS->readUint16LE();
 			assert(clickarea->n_points != 0);
 
 			clickarea->points = (R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
@@ -138,8 +133,8 @@
 			// Load all points for this clickarea
 			for (m = 0; m < clickarea->n_points; m++) {
 				point = &clickarea->points[m];
-				point->x = ys_read_s16_le(read_p, &read_p);
-				point->y = ys_read_s16_le(read_p, &read_p);
+				point->x = readS->readSint16LE();
+				point->y = readS->readSint16LE();
 			}
 #if R_OBJECTMAP_DEBUG >= R_DEBUG_PARANOID
 			R_printf(R_STDOUT, "OBJECTMAP_Load(): Read %d points for clickarea %d in object %d.\n",
@@ -184,21 +179,19 @@
 
 // Loads an object name list resource
 int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len) {
-	const unsigned char *read_p = onl_res;
-
 	int table_len;
 	int n_names;
 	size_t name_offset;
 
 	int i;
 
-	YS_IGNORE_PARAM(onl_res_len);
+	MemoryReadStream *readS = new MemoryReadStream(onl_res, onl_res_len);
 
 	if (OMInfo.names_loaded) {
 		OBJECTMAP_FreeNames();
 	}
 
-	table_len = ys_read_u16_le(read_p, &read_p);
+	table_len = readS->readUint16LE();
 
 	n_names = table_len / 2 - 2;
 	OMInfo.n_names = n_names;
@@ -216,7 +209,7 @@
 	}
 
 	for (i = 0; i < n_names; i++) {
-		name_offset = ys_read_u16_le(read_p, &read_p);
+		name_offset = readS->readUint16LE();
 		OMInfo.names[i] = (const char *)(onl_res + name_offset);
 
 #if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
@@ -446,8 +439,8 @@
 static void CF_object_info(int argc, char *argv[]) {
 	int i;
 
-	YS_IGNORE_PARAM(argc);
-	YS_IGNORE_PARAM(argv);
+	(void)(argc);
+	(void)(argv);
 
 	if (!OMInfo.initialized) {
 		return;

Index: palanim.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/palanim.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- palanim.cpp	2 May 2004 00:00:39 -0000	1.6
+++ palanim.cpp	4 May 2004 03:33:03 -0000	1.7
@@ -25,8 +25,6 @@
 #include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "events_mod.h"
 #include "game_mod.h"
 
@@ -38,13 +36,10 @@
 static PALANIM_DATA PAnimData;
 
 int PALANIM_Load(const byte *resdata, size_t resdata_len) {
-	const byte *read_p = resdata;
 	void *test_p;
 
 	uint16 i;
 
-	YS_IGNORE_PARAM(resdata_len);
-
 	if (PAnimData.loaded) {
 		PALANIM_Free();
 	}
@@ -53,11 +48,13 @@
 		return R_FAILURE;
 	}
 
+	MemoryReadStream *readS = new MemoryReadStream(resdata, resdata_len);
+
 	if (GAME_GetGameType() == R_GAMETYPE_IHNM) {
 		return R_SUCCESS;
 	}
 
-	PAnimData.entry_count = ys_read_u16_le(read_p, &read_p);
+	PAnimData.entry_count = readS->readUint16LE();
 
 	R_printf(R_STDOUT, "PALANIM_Load(): Loading %d PALANIM entries.\n", PAnimData.entry_count);
 
@@ -74,8 +71,8 @@
 		int pal_count;
 		int p, c;
 
-		color_count = ys_read_u16_le(read_p, &read_p);
-		pal_count = ys_read_u16_le(read_p, &read_p);
+		color_count = readS->readUint16LE();
+		pal_count = readS->readUint16LE();
 
 		PAnimData.entries[i].pal_count = pal_count;
 		PAnimData.entries[i].color_count = color_count;
@@ -105,13 +102,13 @@
 		PAnimData.entries[i].colors = (R_COLOR *)test_p;
 
 		for (p = 0; p < pal_count; p++) {
-			PAnimData.entries[i].pal_index[p] = (byte) ys_read_u8(read_p, &read_p);
+			PAnimData.entries[i].pal_index[p] = readS->readByte();
 		}
 
 		for (c = 0; c < color_count; c++) {
-			PAnimData.entries[i].colors[c].red = (byte) ys_read_u8(read_p, &read_p);
-			PAnimData.entries[i].colors[c].green = (byte) ys_read_u8(read_p, &read_p);
-			PAnimData.entries[i].colors[c].blue = (byte) ys_read_u8(read_p, &read_p);
+			PAnimData.entries[i].colors[c].red = readS->readByte();
+			PAnimData.entries[i].colors[c].green = readS->readByte();
+			PAnimData.entries[i].colors[c].blue = readS->readByte();
 		}
 	}
 

Index: rscfile.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/rscfile.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rscfile.cpp	1 May 2004 13:19:15 -0000	1.4
+++ rscfile.cpp	4 May 2004 03:33:03 -0000	1.5
@@ -22,11 +22,9 @@
  */
 
 // RSC Resource file management module
-
+#include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "rscfile_mod.h"
 #include "rscfile.h"
 
@@ -105,10 +103,6 @@
 
 	R_RSCFILE_RESOURCE *rsc_restbl;
 
-	const byte *read_p;
-
-	read_p = tblinfo_buf;
-
 	if (rsc->rc_file.size() < RSC_MIN_FILESIZE) {
 		return R_FAILURE;
 	}
@@ -120,8 +114,10 @@
 		return R_FAILURE;
 	}
 
-	res_tbl_offset = ys_read_u32_le(read_p, &read_p);
-	res_tbl_ct = ys_read_u32_le(read_p, NULL);
+	MemoryReadStream *readS = new MemoryReadStream(tblinfo_buf, RSC_TABLEINFO_SIZE);
+
+	res_tbl_offset = readS->readUint32LE();
+	res_tbl_ct = readS->readUint32LE();
 
 	// Check for sane table offset
 	if (res_tbl_offset != rsc->rc_file.size() - RSC_TABLEINFO_SIZE - RSC_TABLEENTRY_SIZE * res_tbl_ct) {
@@ -150,11 +146,11 @@
 		return R_FAILURE;
 	}
 
-	read_p = tbl_buf;
+	readS = new MemoryReadStream(tbl_buf, tbl_len);
 
 	for (i = 0; i < res_tbl_ct; i++) {
-		rsc_restbl[i].res_offset = ys_read_u32_le(read_p, &read_p);
-		rsc_restbl[i].res_size = ys_read_u32_le(read_p, &read_p);
+		rsc_restbl[i].res_offset = readS->readUint32LE();
+		rsc_restbl[i].res_size = readS->readUint32LE();
 		if ((rsc_restbl[i].res_offset > rsc->rc_file.size()) || (rsc_restbl[i].res_size > rsc->rc_file.size())) {
 			free(tbl_buf);
 			free(rsc_restbl);

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- scene.cpp	1 May 2004 23:42:22 -0000	1.7
+++ scene.cpp	4 May 2004 03:33:03 -0000	1.8
@@ -62,7 +62,6 @@
 	R_GAME_SCENEDESC gs_desc;
 	byte *scene_lut_p;
 	size_t scene_lut_len;
-	const byte *read_p;
 	int result;
 	int i;
 
@@ -98,10 +97,10 @@
 		return R_MEM;
 	}
 
-	read_p = scene_lut_p;
+	MemoryReadStream *readS = new MemoryReadStream(scene_lut_p, scene_lut_len);
 
 	for (i = 0; i < SceneModule.scene_max; i++) {
-		SceneModule.scene_lut[i] = ys_read_u16_le(read_p, &read_p);
+		SceneModule.scene_lut[i] = readS->readUint16LE();
 	}
 
 	free(scene_lut_p);
@@ -496,7 +495,6 @@
 int LoadSceneDescriptor(uint32 res_number) {
 	byte *scene_desc_data;
 	size_t scene_desc_len;
-	const byte *read_p;
 	int result;
 
 	result = RSC_LoadResource(SceneModule.scene_ctxt, res_number, &scene_desc_data, &scene_desc_len);
@@ -510,16 +508,16 @@
 		return R_FAILURE;
 	}
 
-	read_p = scene_desc_data;
+	MemoryReadStream *readS = new MemoryReadStream(scene_desc_data, scene_desc_len);
 
-	SceneModule.desc.unknown0 = ys_read_u16_le(read_p, &read_p);
-	SceneModule.desc.res_list_rn = ys_read_u16_le(read_p, &read_p);
-	SceneModule.desc.end_slope = ys_read_u16_le(read_p, &read_p);
-	SceneModule.desc.begin_slope = ys_read_u16_le(read_p, &read_p);
-	SceneModule.desc.script_num = ys_read_u16_le(read_p, &read_p);
-	SceneModule.desc.scene_scriptnum = ys_read_u16_le(read_p, &read_p);
-	SceneModule.desc.start_scriptnum = ys_read_u16_le(read_p, &read_p);
-	SceneModule.desc.music_rn = ys_read_s16_le(read_p, &read_p);
+	SceneModule.desc.unknown0 = readS->readUint16LE();
+	SceneModule.desc.res_list_rn = readS->readUint16LE();
+	SceneModule.desc.end_slope = readS->readUint16LE();
+	SceneModule.desc.begin_slope = readS->readUint16LE();
+	SceneModule.desc.script_num = readS->readUint16LE();
+	SceneModule.desc.scene_scriptnum = readS->readUint16LE();
+	SceneModule.desc.start_scriptnum = readS->readUint16LE();
+	SceneModule.desc.music_rn = readS->readSint16LE();
 
 	RSC_FreeResource(scene_desc_data);
 
@@ -529,7 +527,6 @@
 int LoadSceneResourceList(uint32 reslist_rn) {
 	byte *resource_list;
 	size_t resource_list_len;
-	const byte *read_p;
 	int result;
 	int i;
 
@@ -540,7 +537,7 @@
 		return R_FAILURE;
 	}
 
-	read_p = resource_list;
+	MemoryReadStream *readS = new MemoryReadStream(resource_list, resource_list_len);
 
 	// Allocate memory for scene resource list 
 	SceneModule.reslist_entries = resource_list_len / SAGA_RESLIST_ENTRY_LEN;
@@ -557,8 +554,8 @@
 	R_printf(R_STDOUT, "Loading scene resource list...\n");
 
 	for (i = 0; i < SceneModule.reslist_entries; i++) {
-		SceneModule.reslist[i].res_number = ys_read_u16_le(read_p, &read_p);
-		SceneModule.reslist[i].res_type = ys_read_u16_le(read_p, &read_p);
+		SceneModule.reslist[i].res_number = readS->readUint16LE();
+		SceneModule.reslist[i].res_type = readS->readUint16LE();
 	}
 
 	RSC_FreeResource(resource_list);

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- script.cpp	1 May 2004 23:42:22 -0000	1.5
+++ script.cpp	4 May 2004 03:33:03 -0000	1.6
@@ -56,10 +56,9 @@
 	R_RSCFILE_CONTEXT *s_lut_ctxt;
 	byte *rsc_ptr;
 	size_t rsc_len;
-	const byte *read_ptr;
-	const byte *read_ptr2;
+	int prevTell;
 	int result;
-	int i;
+	int i, j;
 
 	R_printf(R_STDOUT, "Initializing scripting subsystem.\n");
 	// Load script resource file context
@@ -103,14 +102,15 @@
 	}
 
 	// Convert LUT resource to logical LUT
-	read_ptr = rsc_ptr;
+	MemoryReadStream *readS = new MemoryReadStream(rsc_ptr, rsc_len);
 	for (i = 0; i < ScriptModule.script_lut_max; i++) {
-		read_ptr2 = read_ptr;
-		ScriptModule.script_lut[i].script_rn = ys_read_u16_le(read_ptr2, &read_ptr2);
-		ScriptModule.script_lut[i].diag_list_rn = ys_read_u16_le(read_ptr2, &read_ptr2);
-		ScriptModule.script_lut[i].voice_lut_rn = ys_read_u16_le(read_ptr2, &read_ptr2);
+		prevTell = readS->tell();
+		ScriptModule.script_lut[i].script_rn = readS->readUint16LE();
+		ScriptModule.script_lut[i].diag_list_rn = readS->readUint16LE();
+		ScriptModule.script_lut[i].voice_lut_rn = readS->readUint16LE();
 		// Skip the unused portion of the structure
-		read_ptr += ScriptModule.script_lut_entrylen;
+		for (j = readS->tell(); j < prevTell + ScriptModule.script_lut_entrylen; j++)
+			readS->readByte();
 	}
 
 	RSC_FreeResource(rsc_ptr);
@@ -320,7 +320,6 @@
 // Reads the entrypoint table from a script bytecode resource in memory. 
 // Returns NULL on failure.
 R_SCRIPT_BYTECODE *SCRIPT_LoadBytecode(byte *bytecode_p, size_t bytecode_len) {
-	const byte *read_p = bytecode_p;
 	R_PROC_TBLENTRY *bc_ep_tbl = NULL;
 	R_SCRIPT_BYTECODE *bc_new_data = NULL;
 
@@ -330,11 +329,12 @@
 
 	R_printf(R_STDOUT, "Loading script bytecode...\n");
 
+	MemoryReadStream *readS = new MemoryReadStream(bytecode_p, bytecode_len);
+
 	// The first two uint32 values are the number of entrypoints, and the
 	// offset to the entrypoint table, respectively.
-
-	n_entrypoints = ys_read_u32_le(read_p, &read_p);
-	ep_tbl_offset = ys_read_u32_le(read_p, &read_p);
+	n_entrypoints = readS->readUint32LE();
+	ep_tbl_offset = readS->readUint32LE();
 
 	// Check that the entrypoint table offset is valid.
 	if ((bytecode_len - ep_tbl_offset) < (n_entrypoints * R_SCRIPT_TBLENTRY_LEN)) {
@@ -365,14 +365,15 @@
 
 	// Read in the entrypoint table
 
-	read_p = bytecode_p + ep_tbl_offset;
+	while (readS->tell() < ep_tbl_offset)
+		readS->readByte();
 
 	for (i = 0; i < n_entrypoints; i++) {
 		// First uint16 is the offset of the entrypoint name from the start
 		// of the bytecode resource, second uint16 is the offset of the 
 		// bytecode itself for said entrypoint
-		bc_ep_tbl[i].name_offset = ys_read_u16_le(read_p, &read_p);
-		bc_ep_tbl[i].offset = ys_read_u16_le(read_p, &read_p);
+		bc_ep_tbl[i].name_offset = readS->readUint16LE();
+		bc_ep_tbl[i].offset = readS->readUint16LE();
 
 		// Perform a simple range check on offset values
 		if ((bc_ep_tbl[i].name_offset > bytecode_len) || (bc_ep_tbl[i].offset > bytecode_len)) {
@@ -396,7 +397,6 @@
 // Reads a logical dialogue list from a dialogue list resource in memory.
 // Returns NULL on failure.
 R_DIALOGUE_LIST *SCRIPT_LoadDialogue(const byte *dialogue_p, size_t dialogue_len) {
-	const byte *read_p = dialogue_p;
 	R_DIALOGUE_LIST *dialogue_list;
 	uint16 n_dialogue;
 	uint16 i;
@@ -410,8 +410,10 @@
 		return NULL;
 	}
 
+	MemoryReadStream *readS = new MemoryReadStream(dialogue_p, dialogue_len);
+
 	// First uint16 is the offset of the first string
-	offset = ys_read_u16_le(read_p, &read_p);
+	offset = readS->readUint16LE();
 	if (offset > dialogue_len) {
 		R_printf(R_STDERR, "Error, invalid string offset.\n");
 		return NULL;
@@ -437,9 +439,9 @@
 	}
 
 	// Read in tables from dialogue list resource
-	read_p = dialogue_p;
+	readS->rewind();
 	for (i = 0; i < n_dialogue; i++) {
-		offset = ys_read_u16_le(read_p, &read_p);
+		offset = readS->readUint16LE();
 		if (offset > dialogue_len) {
 			R_printf(R_STDERR, "Error, invalid string offset.\n");
 			free(dialogue_list->str);
@@ -457,8 +459,6 @@
 // Reads a logical voice LUT from a voice LUT resource in memory.
 // Returns NULL on failure.
 R_VOICE_LUT *SCRIPT_LoadVoiceLUT(const byte *voicelut_p, size_t voicelut_len, R_SCRIPTDATA *script) {
-	const byte *read_p = voicelut_p;
-
 	R_VOICE_LUT *voice_lut;
 
 	uint16 n_voices;
@@ -481,9 +481,10 @@
 		return NULL;
 	}
 
-	for (i = 0; i < n_voices; i++) {
+	MemoryReadStream *readS = new MemoryReadStream(voicelut_p, voicelut_len);
 
-		voice_lut->voices[i] = ys_read_u16_le(read_p, &read_p);
+	for (i = 0; i < n_voices; i++) {
+		voice_lut->voices[i] = readS->readUint16LE();
 	}
 
 	return voice_lut;

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- script.h	1 May 2004 14:05:10 -0000	1.4
+++ script.h	4 May 2004 03:33:03 -0000	1.5
@@ -28,6 +28,7 @@
 
 #include "sstack.h"
 #include "sdata.h"
+#include "yslib.h"
 
 namespace Saga {
 

Index: sdebug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sdebug.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sdebug.cpp	1 May 2004 14:34:00 -0000	1.3
+++ sdebug.cpp	4 May 2004 03:33:03 -0000	1.4
@@ -22,11 +22,9 @@
  */
 
 // Scripting module simple thread debugging support
-
+#include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "actor_mod.h"
 #include "console_mod.h"
 #include "text_mod.h"
@@ -43,8 +41,6 @@
 
 int SDEBUG_PrintInstr(R_SCRIPT_THREAD *thread) {
 	R_TEXTLIST_ENTRY tl_e;
-	const byte *start_p;
-	const byte *read_p;
 	char tmp_buf[80] = { 0 };
 	static char disp_buf[SD_DISPLAY_LEN] = { 0 };
 	int in_char;
@@ -71,9 +67,13 @@
 	tl_e.string = disp_buf;
 	tl_e.display = 1;
 
-	read_p = ScriptModule.current_script->bytecode->bytecode_p + thread->i_offset;
-	start_p = read_p;
-	in_char = ys_read_u8(read_p, &read_p);
+	// XXX
+	MemoryReadStream *readS = 
+		new MemoryReadStream(ScriptModule.current_script->bytecode->bytecode_p 
+							 + thread->i_offset, 
+							 ScriptModule.current_script->bytecode->bytecode_len 
+							 - thread->i_offset);
+	in_char = readS->readByte();
 	sprintf(tmp_buf, "%04lX | %02X | ", thread->i_offset, in_char);
 	strncat(disp_buf, tmp_buf, SD_DISPLAY_LEN);
 
@@ -104,7 +104,7 @@
 			int param;
 
 			SD_ADDTXT("PSHD | ");
-			param = ys_read_u16_le(read_p, &read_p);
+			param = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X", param);
 			SD_ADDTXT(tmp_buf);
 /*
@@ -123,7 +123,7 @@
 			int param;
 
 			SD_ADDTXT("PUSH | ");
-			param = ys_read_u16_le(read_p, &read_p);
+			param = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X", param);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -135,8 +135,8 @@
 			int param2;
 
 			SD_ADDTXT("TSTF | ");
-			param1 = *read_p++;
-			param2 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readByte();
+			param2 = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X %04X", param1, param2);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -148,8 +148,8 @@
 			int param2;
 
 			SD_ADDTXT("GETW | ");
-			param1 = *read_p++;
-			param2 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readByte();
+			param2 = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X %04X", param1, param2);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -161,8 +161,8 @@
 			int param2;
 
 			SD_ADDTXT("MODF | ");
-			param1 = *read_p++;
-			param2 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readByte();
+			param2 = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X %04X", param1, param2);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -174,8 +174,8 @@
 			int param2;
 
 			SD_ADDTXT("PUTW | ");
-			param1 = *read_p++;
-			param2 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readByte();
+			param2 = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X %04X", param1, param2);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -187,8 +187,8 @@
 			int param2;
 
 			SD_ADDTXT("MDFP | ");
-			param1 = *read_p++;
-			param2 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readByte();
+			param2 = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X %04X", param1, param2);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -200,8 +200,8 @@
 			int param2;
 
 			SD_ADDTXT("PTWP | ");
-			param1 = *read_p++;
-			param2 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readByte();
+			param2 = readS->readUint16LE();
 
 			sprintf(tmp_buf, "%02X %04X", param1, param2);
 			SD_ADDTXT(tmp_buf);
@@ -215,9 +215,9 @@
 			int param3;
 
 			SD_ADDTXT("GOSB | ");
-			param1 = *read_p++;
-			param2 = *read_p++;
-			param3 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readByte();
+			param2 = readS->readByte();
+			param3 = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X %02X %04X", param1, param2, param3);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -230,10 +230,10 @@
 			int param;
 
 			SD_ADDTXT("CALL | ");
-			func_num = *read_p++;
+			func_num = readS->readByte();
 			sprintf(tmp_buf, "%02X ", func_num);
 			SD_ADDTXT(tmp_buf);
-			param = ys_read_u16_le(read_p, &read_p);
+			param = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X ", param);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -244,7 +244,7 @@
 			int param;
 
 			SD_ADDTXT("ENTR | ");
-			param = ys_read_u16_le(read_p, &read_p);
+			param = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X ", param);
 			SD_ADDTXT(tmp_buf);
 /*
@@ -270,7 +270,7 @@
 			int param1;
 
 			SD_ADDTXT("JMP  | ");
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X", param1);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -281,7 +281,7 @@
 			int param1;
 
 			SD_ADDTXT("JNZP | ");
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X", param1);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -292,7 +292,7 @@
 			int param1;
 
 			SD_ADDTXT("JZP  | ");
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X", param1);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -302,7 +302,7 @@
 		{
 			int param1;
 			SD_ADDTXT("JNZ  | ");
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X", param1);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -314,7 +314,7 @@
 			int param1;
 
 			SD_ADDTXT("JZ   | ");
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X", param1);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -327,15 +327,15 @@
 			int default_jmp;
 
 			SD_ADDTXT("SWCH | ");
-			n_switch = ys_read_u16_le(read_p, &read_p);
+			n_switch = readS->readUint16LE();
 			sprintf(tmp_buf, "%02X\n", n_switch);
 			SD_ADDTXT(tmp_buf);
 			for (i = 0; i < n_switch; i++) {
-				switch_num = ys_read_u16_le(read_p, &read_p);
-				switch_jmp = ys_read_u16_le(read_p, &read_p);
+				switch_num = readS->readUint16LE();
+				switch_jmp = readS->readUint16LE();
 				// printf( R_TAB "CASE %04X, %04X\n", switch_num, switch_jmp);
 			}
-			default_jmp = ys_read_u16_le(read_p, &read_p);
+			default_jmp = readS->readUint16LE();
 			//printf( R_TAB "DEF %04X", default_jmp);
 		}
 		break;
@@ -348,14 +348,14 @@
 
 			SD_ADDTXT("RJMP | ");
 			// Ignored?
-			ys_read_u16_le(read_p, &read_p);
-			n_switch2 = ys_read_u16_le(read_p, &read_p);
+			readS->readUint16LE();
+			n_switch2 = readS->readUint16LE();
 			sprintf(tmp_buf, "%04X", n_switch2);
 			SD_ADDTXT(tmp_buf);
 			for (i = 0; i < n_switch2; i++) {
 				//printf("\n");
-				switch_num = ys_read_u16_le(read_p, &read_p);
-				switch_jmp = ys_read_u16_le(read_p, &read_p);
+				switch_num = readS->readUint16LE();
+				switch_jmp = readS->readUint16LE();
 				//printf( R_TAB "WEIGHT %04X, %04X", switch_num, switch_jmp);
 			}
 		}
@@ -371,23 +371,23 @@
 		break;
 	case 0x28:
 		SD_ADDTXT("??? ");
-		read_p++;
-		ys_read_u16_le(read_p, &read_p);
+		readS->readByte();
+		readS->readUint16LE();
 		break;
 	case 0x29:
 		SD_ADDTXT("??? ");
-		read_p++;
-		ys_read_u16_le(read_p, &read_p);
+		readS->readByte();
+		readS->readUint16LE();
 		break;
 	case 0x2A:
 		SD_ADDTXT("??? ");
-		read_p++;
-		ys_read_u16_le(read_p, &read_p);
+		readS->readByte();
+		readS->readUint16LE();
 		break;
 	case 0x2B:
 		SD_ADDTXT("??? ");
-		read_p++;
-		ys_read_u16_le(read_p, &read_p);
+		readS->readByte();
+		readS->readUint16LE();
 		break;
 		// Addition
 	case 0x2C:
@@ -464,11 +464,11 @@
 			int param2;
 
 			SD_ADDTXT("DLGP | ");
-			n_voices = *read_p++;
-			param1 = ys_read_u16_le(read_p, &read_p);
-			param2 = *read_p++;
+			n_voices = readS->readByte();
+			param1 = readS->readUint16LE();
+			param2 = readS->readByte();
 			// ignored ?
-			ys_read_u16_le(read_p, &read_p);
+			readS->readUint16LE();
 			sprintf(tmp_buf, "%02X %04X %02X", n_voices, param1, param2);
 			SD_ADDTXT(tmp_buf);
 		}
@@ -486,12 +486,12 @@
 			int param3;
 
 			SD_ADDTXT("DLGO | ");
-			param1 = *read_p++;
-			param2 = *read_p++;
+			param1 = readS->readByte();
+			param2 = readS->readByte();
 			sprintf(tmp_buf, "%02X %02X ", param1, param2);
 			SD_ADDTXT(tmp_buf);
 			if (param2 > 0) {
-				param3 = ys_read_u16_le(read_p, &read_p);
+				param3 = readS->readUint16LE();
 				sprintf(tmp_buf, "%04X", param3);
 				SD_ADDTXT(tmp_buf);
 			}
@@ -504,9 +504,9 @@
 			int param3;
 
 			SD_ADDTXT("JMPS | ");
-			param1 = ys_read_u16_le(read_p, &read_p);
-			param2 = ys_read_u16_le(read_p, &read_p);
-			param3 = *read_p++;
+			param1 = readS->readUint16LE();
+			param2 = readS->readUint16LE();
+			param3 = readS->readByte();
 			sprintf(tmp_buf, "%04X %04X %02X", param1, param2, param3);
 			SD_ADDTXT(tmp_buf);
 		}

Index: sndres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- sndres.cpp	1 May 2004 19:41:47 -0000	1.11
+++ sndres.cpp	4 May 2004 03:33:03 -0000	1.12
@@ -26,8 +26,6 @@
 #include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "game_mod.h"
 #include "rscfile_mod.h"
 
@@ -124,58 +122,51 @@
 	R_VOC_BLOCK1 voc_b1;
 
 	long byte_rate;
+	size_t i;
 
-	const byte *read_p;
-	uint16 read_len;
-
-	read_p = snd_res;
-	read_len = snd_res_len;
-
-	if (read_len < R_VOC_HEADER_BLOCK_LEN) {
+	if (snd_res_len < R_VOC_HEADER_BLOCK_LEN) {
 		return R_FAILURE;
 	}
 
-	memcpy(voc_hb.ft_desc, read_p, R_VOC_FILE_DESC_LEN);
-	read_p += R_VOC_FILE_DESC_LEN;
-	read_len -= R_VOC_FILE_DESC_LEN;
+	MemoryReadStream *readS = new MemoryReadStream(snd_res, snd_res_len);
+
+	for (i = 0; i < R_VOC_FILE_DESC_LEN; i++)
+		voc_hb.ft_desc[i] = readS->readByte();
 
 	if (memcmp(voc_hb.ft_desc, R_VOC_FILE_DESC, R_VOC_FILE_DESC_LEN) != 0) {
 		/* Voc file desc string not found */
 		return R_FAILURE;
 	}
 
-	voc_hb.db_offset = ys_read_u16_le(read_p, &read_p);
-	voc_hb.voc_version = ys_read_u16_le(read_p, &read_p);
-	voc_hb.voc_fileid = ys_read_u16_le(read_p, &read_p);
+	voc_hb.db_offset = readS->readUint16LE();
+	voc_hb.voc_version = readS->readUint16LE();
+	voc_hb.voc_fileid = readS->readUint16LE();
 
-	if (read_len < voc_hb.db_offset + R_VOC_GENBLOCK_LEN) {
+	if (snd_res_len - readS->tell() < voc_hb.db_offset + R_VOC_GENBLOCK_LEN) {
 		return R_FAILURE;
 	}
 
-	read_p = snd_res + voc_hb.db_offset;
-	read_len = snd_res_len - voc_hb.db_offset;
+	while (readS->tell() < voc_hb.db_offset)
+		readS->readByte();
 
 	for (;;) {
 		/* Read generic block header */
-		if (read_len < R_VOC_GENBLOCK_LEN) {
+		if (snd_res_len - readS->tell() < R_VOC_GENBLOCK_LEN) {
 			return R_FAILURE;
 		}
 
-		voc_gb.block_id = ys_read_u8(read_p, &read_p);
+		voc_gb.block_id = readS->readByte();
 		if (voc_gb.block_id == 0) {
 			return R_FAILURE;
 		}
 
-		voc_gb.block_len = ys_read_u24_le(read_p, &read_p);
-
-		read_len -= R_VOC_GENBLOCK_LEN;
+		voc_gb.block_len = readS->readUint24LE();
 
 		/* Process block */
 		switch (voc_gb.block_id) {
 		case 1:	/* Sound data block */
-			voc_b1.time_constant = ys_read_u8(read_p, &read_p);
-			voc_b1.pack_method = ys_read_u8(read_p, &read_p);
-			read_len -= 2;
+			voc_b1.time_constant = readS->readByte();
+			voc_b1.pack_method = readS->readByte();
 
 			if (voc_b1.pack_method != 0) {
 				debug(0, "Packed VOC files not supported");
@@ -191,15 +182,15 @@
 			snd_buf_i->res_data = snd_res;
 			snd_buf_i->res_len = snd_res_len;
 
-			snd_buf_i->s_buf = read_p;
-			snd_buf_i->s_buf_len = read_len - 1;	/* -1 for end block */
+			snd_buf_i->s_buf = snd_res + readS->tell();
+			snd_buf_i->s_buf_len = snd_res_len - readS->tell() - 1;	/* -1 for end block */
 
 			snd_buf_i->s_signed = 0;
 			return R_SUCCESS;
 			break;
 		default:
-			read_p += voc_gb.block_len;
-			read_len -= voc_gb.block_len;
+			for (i = 0; i < voc_gb.block_len; i++)
+				readS->readByte();
 			break;
 		}
 	}

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sprite.cpp	1 May 2004 23:42:22 -0000	1.6
+++ sprite.cpp	4 May 2004 03:33:03 -0000	1.7
@@ -25,8 +25,6 @@
 #include "saga.h"
 #include "reinherit.h"
 
-#include "yslib.h"
-
 #include "game_mod.h"
 #include "gfx_mod.h"
 #include "scene_mod.h"
@@ -85,7 +83,6 @@
 	R_SPRITELIST *new_slist;
 	byte *spritelist_data;
 	size_t spritelist_len;
-	const byte *read_p;
 	uint16 sprite_count;
 	uint16 i;
 
@@ -98,9 +95,9 @@
 		return R_FAILURE;
 	}
 
-	read_p = spritelist_data;
+	MemoryReadStream *readS = new MemoryReadStream(spritelist_data, spritelist_len);
 
-	sprite_count = ys_read_u16_le(read_p, &read_p);
+	sprite_count = readS->readUint16LE();
 
 	new_slist->sprite_count = sprite_count;
 
@@ -112,7 +109,7 @@
 
 	for (i = 0; i < sprite_count; i++) {
 		new_slist->offset_list[i].data_idx = 0;
-		new_slist->offset_list[i].offset = ys_read_u16_le(read_p, &read_p);
+		new_slist->offset_list[i].offset = readS->readUint16LE();
 	}
 
 	new_slist->slist_rn = resource_num;
@@ -127,7 +124,6 @@
 int SPRITE_AppendList(int resource_num, R_SPRITELIST *spritelist) {
 	byte *spritelist_data;
 	size_t spritelist_len;
-	const byte *read_p;
 	void *test_p;
 	uint16 old_sprite_count;
 	uint16 new_sprite_count;
@@ -142,9 +138,9 @@
 		return R_FAILURE;
 	}
 
-	read_p = spritelist_data;
+	MemoryReadStream *readS = new MemoryReadStream(spritelist_data, spritelist_len);
 
-	sprite_count = ys_read_u16_le(read_p, &read_p);
+	sprite_count = readS->readUint16LE();
 
 	old_sprite_count = spritelist->sprite_count;
 	new_sprite_count = spritelist->sprite_count + sprite_count;
@@ -161,7 +157,7 @@
 
 	for (i = old_sprite_count; i < spritelist->sprite_count; i++) {
 		spritelist->offset_list[i].data_idx = spritelist->append_count;
-		spritelist->offset_list[i].offset = ys_read_u16_le(read_p, &read_p);
+		spritelist->offset_list[i].offset = readS->readUint16LE();
 	}
 
 	spritelist->sprite_data[spritelist->append_count] = spritelist_data;
@@ -192,7 +188,6 @@
 	int offset_idx;
 	byte *sprite_p;
 	const byte *sprite_data_p;
-	const byte *read_p;
 	int i, j;
 	byte *buf_row_p;
 	byte *src_row_p;
@@ -213,15 +208,15 @@
 	sprite_p = sprite_list->sprite_data[offset_idx];
 	sprite_p += offset;
 
-	read_p = (byte *) sprite_p;
+	MemoryReadStream *readS = new MemoryReadStream(sprite_p, 5);
 
-	x_align = ys_read_s8(read_p, &read_p);
-	y_align = ys_read_s8(read_p, &read_p);
+	x_align = readS->readSByte();
+	y_align = readS->readSByte();
 
-	s_width = ys_read_u8(read_p, &read_p);
-	s_height = ys_read_u8(read_p, &read_p);
+	s_width = readS->readByte();
+	s_height = readS->readByte();
 
-	sprite_data_p = read_p;
+	sprite_data_p = sprite_p + readS->tell();
 
 	spr_x += x_align;
 	spr_y += y_align;
@@ -269,7 +264,6 @@
 	int offset_idx;
 	byte *sprite_p;
 	const byte *sprite_data_p;
-	const byte *read_p;
 	int i;
 	int x, y;
 	byte *dst_row_p;
@@ -322,17 +316,17 @@
 	sprite_p = sprite_list->sprite_data[offset_idx];
 	sprite_p += offset;
 
-	read_p = sprite_p;
+	MemoryReadStream *readS = new MemoryReadStream(sprite_p, 5);
 
 	// Read sprite dimensions -- should probably cache this stuff in 
 	// sprite list
-	x_align = ys_read_s8(read_p, &read_p);
-	y_align = ys_read_s8(read_p, &read_p);
+	x_align = readS->readSByte();
+	y_align = readS->readSByte();
 
-	s_width = ys_read_u8(read_p, &read_p);
-	s_height = ys_read_u8(read_p, &read_p);
+	s_width = readS->readByte();
+	s_height = readS->readByte();
 
-	sprite_data_p = read_p;
+	sprite_data_p = sprite_p + readS->tell();
 
 	// Create actor Z occlusion LUT
 	SCENE_GetZInfo(&zinfo);

Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sthread.cpp	1 May 2004 19:41:47 -0000	1.5
+++ sthread.cpp	4 May 2004 03:33:03 -0000	1.6
@@ -139,6 +139,11 @@
 	return (unsigned long)(read_p - (unsigned char *)ScriptModule.current_script->bytecode->bytecode_p);
 }
 
+size_t GetReadLen(R_SCRIPT_THREAD *thread) {
+	return ScriptModule.current_script->bytecode->bytecode_len - thread->i_offset;
+}
+
+
 int STHREAD_HoldSem(R_SEMAPHORE *sem) {
 	if (sem == NULL) {
 		return R_FAILURE;
@@ -172,7 +177,6 @@
 
 int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
 	int instr_count;
-	const byte *read_p;
 	uint32 saved_offset;
 	SDataWord_T param1;
 	SDataWord_T param2;
@@ -219,9 +223,9 @@
 #if 0
 		R_printf(R_STDOUT, "Executing thread offset: %lu", thread->i_offset);
 #endif
-		read_p = GetReadPtr(thread);
+		MemoryReadStream *readS = new MemoryReadStream(GetReadPtr(thread), GetReadLen(thread));
 
-		in_char = ys_read_u8(read_p, &read_p);
+		in_char = readS->readByte();
 
 		switch (in_char) {
 			// Align (ALGN)
@@ -248,12 +252,12 @@
 			break;
 			// Push word (PUSH)
 		case 0x06:
-			param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+			param1 = (SDataWord_T)readS->readUint16LE();
 			SSTACK_Push(thread->stack, param1);
 			break;
 			// Push word (PSHD) (dialogue string index)
 		case 0x08:
-			param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+			param1 = (SDataWord_T)readS->readUint16LE();
 			SSTACK_Push(thread->stack, param1);
 			break;
 
@@ -261,22 +265,22 @@
 
 			// Test flag (TSTF)
 		case 0x0B:
-			n_buf = *read_p++;
-			param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+			n_buf = readS->readByte();
+			param1 = (SDataWord_T)readS->readUint16LE();
 			SDATA_GetBit(n_buf, param1, &bitstate);
 			SSTACK_Push(thread->stack, bitstate);
 			break;
 			// Get word (GETW)
 		case 0x0C:
-			n_buf = *read_p++;
-			param1 = ys_read_u16_le(read_p, &read_p);
+			n_buf = readS->readByte();
+			param1 = readS->readUint16LE();
 			SDATA_GetWord(n_buf, param1, &data);
 			SSTACK_Push(thread->stack, data);
 			break;
 			// Modify flag (MODF)
 		case 0x0F:
-			n_buf = *read_p++;
-			param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+			n_buf = readS->readByte();
+			param1 = (SDataWord_T)readS->readUint16LE();
 			bitstate = SDATA_ReadWordU(param1);
 			SSTACK_Top(thread->stack, &data);
 			if (bitstate) {
@@ -287,15 +291,15 @@
 			break;
 			// Put word (PUTW)
 		case 0x10:
-			n_buf = *read_p++;
-			param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+			n_buf = readS->readByte();
+			param1 = (SDataWord_T)readS->readUint16LE();
 			SSTACK_Top(thread->stack, &data);
 			SDATA_PutWord(n_buf, param1, data);
 			break;
 			// Modify flag and pop (MDFP)
 		case 0x13:
-			n_buf = *read_p++;
-			param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+			n_buf = readS->readByte();
+			param1 = (SDataWord_T)readS->readUint16LE();
 			SSTACK_Pop(thread->stack, &param1);
 			bitstate = SDATA_ReadWordU(param1);
 			if (bitstate) {
@@ -306,8 +310,8 @@
 			break;
 			// Put word and pop (PTWP)
 		case 0x14:
-			n_buf = *read_p++;
-			param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+			n_buf = readS->readByte();
+			param1 = (SDataWord_T)readS->readUint16LE();
 			SSTACK_Top(thread->stack, &data);
 			SDATA_PutWord(n_buf, param1, data);
 			break;
@@ -320,10 +324,10 @@
 				int temp;
 				int temp2;
 
-				temp = *read_p++;
-				temp2 = *read_p++;
-				param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
-				data = GetReadOffset(read_p);
+				temp = readS->readByte();
+				temp2 = readS->readByte();
+				param1 = (SDataWord_T)readS->readUint16LE();
+				data = readS->tell();
 				//SSTACK_Push(thread->stack, (SDataWord_T)temp);
 				SSTACK_Push(thread->stack, data);
 				thread->i_offset = (unsigned long)param1;
@@ -338,8 +342,8 @@
 				int FIXME_SHADOWED_result;
 				SFunc_T sfunc;
 
-				n_args = ys_read_u8(read_p, &read_p);
-				func_num = ys_read_u16_le(read_p, &read_p);
+				n_args = readS->readByte();
+				func_num = readS->readUint16LE();
 				if (func_num >= R_SFUNC_NUM) {
 					CON_Print(S_ERROR_PREFIX "Invalid script function number: (%X)\n", func_num);
 					thread->executing = 0;
@@ -364,7 +368,7 @@
 			break;
 			// (ENTR) Enter the dragon
 		case 0x1A:
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			break;
 			// (?) Unknown
 		case 0x1B:
@@ -385,12 +389,12 @@
 
 			// (JMP): Unconditional jump
 		case 0x1D:
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			thread->i_offset = (unsigned long)param1;
 			break;
 			// (JNZP): Jump if nonzero + POP
 		case 0x1E:
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			SSTACK_Pop(thread->stack, &data);
 			if (data) {
 				thread->i_offset = (unsigned long)param1;
@@ -398,7 +402,7 @@
 			break;
 			// (JZP): Jump if zero + POP
 		case 0x1F:
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			SSTACK_Pop(thread->stack, &data);
 			if (!data) {
 				thread->i_offset = (unsigned long)param1;
@@ -406,7 +410,7 @@
 			break;
 			// (JNZ): Jump if nonzero
 		case 0x20:
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			SSTACK_Top(thread->stack, &data);
 			if (data) {
 				thread->i_offset = (unsigned long)param1;
@@ -414,7 +418,7 @@
 			break;
 			// (JZ): Jump if zero
 		case 0x21:
-			param1 = ys_read_u16_le(read_p, &read_p);
+			param1 = readS->readUint16LE();
 			SSTACK_Top(thread->stack, &data);
 			if (!data) {
 				thread->i_offset = (unsigned long)param1;
@@ -423,9 +427,9 @@
 			// (JMPR): Relative jump
 		case 0x57:
 			// ignored?
-			ys_read_u16_le(read_p, &read_p);
-			ys_read_u16_le(read_p, &read_p);
-			iparam1 = (long)*read_p++;
+			readS->readUint16LE();
+			readS->readUint16LE();
+			iparam1 = (long)readS->readByte();
 			thread->i_offset += iparam1;
 			break;
 			// (SWCH): Switch
@@ -438,10 +442,10 @@
 				int case_found = 0;
 
 				SSTACK_Pop(thread->stack, &data);
-				n_switch = ys_read_u16_le(read_p, &read_p);
+				n_switch = readS->readUint16LE();
 				for (i = 0; i < n_switch; i++) {
-					switch_num = ys_read_u16_le(read_p, &read_p);
-					switch_jmp = ys_read_u16_le(read_p, &read_p);
+					switch_num = readS->readUint16LE();
+					switch_jmp = readS->readUint16LE();
 					// Found the specified case
 					if (data == (SDataWord_T) switch_num) {
 						thread->i_offset = switch_jmp;
@@ -452,7 +456,7 @@
 
 				// Jump to default case
 				if (!case_found) {
-					default_jmp = ys_read_u16_le(read_p, &read_p);
+					default_jmp = readS->readUint16LE();
 					thread->i_offset = default_jmp;
 				}
 			}
@@ -467,11 +471,11 @@
 				int branch_found = 0;
 
 				// Ignored?
-				ys_read_u16_le(read_p, &read_p);
-				n_branch = ys_read_u16_le(read_p, &read_p);
+				readS->readUint16LE();
+				n_branch = readS->readUint16LE();
 				for (i = 0; i < n_branch; i++) {
-					branch_wt = ys_read_u16_le(read_p, &read_p);
-					branch_jmp = ys_read_u16_le(read_p, &read_p);
+					branch_wt = readS->readUint16LE();
+					branch_jmp = readS->readUint16LE();
 					if (rand_sel == i) {
 						thread->i_offset = branch_jmp;
 						branch_found = 1;
@@ -509,29 +513,29 @@
 		case 0x28:
 			unhandled = 1;
 			printf("??? ");
-			read_p++;
-			ys_read_u16_le(read_p, &read_p);
+			readS->readByte();
+			readS->readUint16LE();
 			break;
 			// (?)
 		case 0x29:
 			unhandled = 1;
 			printf("??? ");
-			read_p++;
-			ys_read_u16_le(read_p, &read_p);
+			readS->readByte();
+			readS->readUint16LE();
 			break;
 			// (?)
 		case 0x2A:
 			unhandled = 1;
 			printf("??? ");
-			read_p++;
-			ys_read_u16_le(read_p, &read_p);
+			readS->readByte();
+			readS->readUint16LE();
 			break;
 			// (?)
 		case 0x2B:
 			unhandled = 1;
 			printf("??? ");
-			read_p++;
-			ys_read_u16_le(read_p, &read_p);
+			readS->readByte();
+			readS->readUint16LE();
 			break;
 
 // ARITHMETIC INSTRUCTIONS    
@@ -714,11 +718,11 @@
 				int a_index;
 				int voice_rn;
 
-				n_voices = *read_p++;
-				param1 = (SDataWord_T) ys_read_u16_le(read_p, &read_p);
+				n_voices = readS->readByte();
+				param1 = (SDataWord_T) readS->readUint16LE();
 				// ignored ?
-				*read_p++;
-				ys_read_u16_le(read_p, &read_p);
+				readS->readByte();
+				readS->readUint16LE();
 
 				a_index = ACTOR_GetActorIndex(param1);
 				if (a_index < 0) {
@@ -752,12 +756,12 @@
 				int FIXME_SHADOWED_param3;
 
 				printf("DLGO | ");
-				FIXME_SHADOWED_param1 = *read_p++;
-				FIXME_SHADOWED_param2 = *read_p++;
+				FIXME_SHADOWED_param1 = readS->readByte();
+				FIXME_SHADOWED_param2 = readS->readByte();
 				printf("%02X %02X ", FIXME_SHADOWED_param1, FIXME_SHADOWED_param2);
 
 				if (FIXME_SHADOWED_param2 > 0) {
-					FIXME_SHADOWED_param3 = ys_read_u16_le(read_p, &read_p);
+					FIXME_SHADOWED_param3 = readS->readUint16LE();
 					printf("%04X", FIXME_SHADOWED_param3);
 				}
 			}
@@ -774,7 +778,7 @@
 
 		// Set instruction offset only if a previous instruction didn't branch
 		if (saved_offset == thread->i_offset) {
-			thread->i_offset = GetReadOffset(read_p);
+			thread->i_offset = readS->tell();
 		}
 		if (unhandled) {
 			CON_Print(S_ERROR_PREFIX "%X: Unhandled opcode.\n", thread->i_offset);

Index: sthread.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sthread.h	1 May 2004 16:15:55 -0000	1.3
+++ sthread.h	4 May 2004 03:33:03 -0000	1.4
@@ -55,6 +55,7 @@
 int STHREAD_Run(R_SCRIPT_THREAD *thread, int instr_limit, int msec);
 unsigned long GetReadOffset(const byte *read_p);
 unsigned char *GetReadPtr(R_SCRIPT_THREAD *thread);
+size_t GetReadLen(R_SCRIPT_THREAD *thread);
 int SDEBUG_PrintInstr(R_SCRIPT_THREAD *thread);
 
 }				// End of namespace Saga

Index: yslib.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/yslib.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- yslib.h	1 May 2004 16:15:55 -0000	1.5
+++ yslib.h	4 May 2004 03:33:03 -0000	1.6
@@ -47,42 +47,6 @@
 
 //#define YS_ASSUME_2S_COMP
 
-// Read a 4CC ( Four characater code )
-void ys_read_4cc(char *fourcc, const unsigned char *data_p, const unsigned char **data_pp);
-
-// Read 8 bit unsigned integer
-unsigned int ys_read_u8(const unsigned char *, const unsigned char **);
-
-// Read 8 bit signed integer
-int ys_read_s8(const unsigned char *, const unsigned char **);
-
-// Read 16 bit unsigned integer, big-endian
-unsigned int ys_read_u16_be(const unsigned char *, const unsigned char **);
-
-// Read 16 bit unsigned integer, little-endian
-unsigned int ys_read_u16_le(const unsigned char *, const unsigned char **);
-
-// Read 16 bit signed integer, 2's complement, big-endian
-int ys_read_s16_be(const unsigned char *, const unsigned char **);
-
-// Read 16 bit signed integer, 2's complement, little-endian
-int ys_read_s16_le(const unsigned char *, const unsigned char **);
-
-// Read 24 bit unsigned integer, little-endian
-unsigned long ys_read_u24_le(const unsigned char *, const unsigned char **);
-
-// Read 32 bit unsigned integer, big-endian
-unsigned long ys_read_u32_be(const unsigned char *, const unsigned char **);
-
-// Read 32 bit unsigned integer, little-endian
-unsigned long ys_read_u32_le(const unsigned char *, const unsigned char **);
-
-// Write 16 bit unsigned integer, big-endian
-void ys_write_u16_be(unsigned int, unsigned char *, unsigned char **);
-
-// Write 32 bit unsigned integer, big-endian
-void ys_write_u32_be(unsigned long, unsigned char *, unsigned char **);
-
 // Shared declarations for list modules
 enum YS_WALK_DIRECTIONS {
 	YS_WALK_BACKWARD = 0,

--- ys_binread.cpp DELETED ---

--- ys_binwrite.cpp DELETED ---





More information about the Scummvm-git-logs mailing list