diff options
| -rw-r--r-- | scumm/sound.cpp | 3 | ||||
| -rw-r--r-- | simon/res.cpp | 8 | ||||
| -rw-r--r-- | simon/simon.cpp | 27 | 
3 files changed, 9 insertions, 29 deletions
| diff --git a/scumm/sound.cpp b/scumm/sound.cpp index fc5fcca168..2d8a065d72 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1300,8 +1300,7 @@ int Sound::getCachedTrack(int track) {  	mad_frame_finish(&frame);  	mad_stream_finish(&stream);  	// Get file size -	file->seek(0, SEEK_END); -	_mp3_size[current_index] = file->pos(); +	_mp3_size[current_index] = file->size();  	_mp3_tracks[current_index] = file;  	return current_index; diff --git a/simon/res.cpp b/simon/res.cpp index 705504c2a4..ad66db8895 100644 --- a/simon/res.cpp +++ b/simon/res.cpp @@ -123,13 +123,11 @@ bool SimonState::loadGamePcFile(const char *filename)  	if (in->isOpen() == false)  		return false; -	in->seek(0, SEEK_END); -	file_size = in->pos(); +	file_size = in->size();  	_tbl_list = (byte *)malloc(file_size);  	if (_tbl_list == NULL)  		error("Out of memory for strip table list"); -	in->seek(0, SEEK_SET);  	in->read(_tbl_list, file_size);  	in->close(); @@ -143,12 +141,10 @@ bool SimonState::loadGamePcFile(const char *filename)  	if (in->isOpen() == false)  		return false; -	in->seek(0, SEEK_END); -	file_size = in->pos(); +	file_size = in->size();  	_stripped_txt_mem = (byte *)malloc(file_size);  	if (_stripped_txt_mem == NULL)  		error("Out of memory for strip text list"); -	in->seek(0, SEEK_SET);  	in->read(_stripped_txt_mem, file_size);  	in->close(); diff --git a/simon/simon.cpp b/simon/simon.cpp index fc5a7906d5..be02131988 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -869,9 +869,7 @@ uint SimonState::loadTextFile_simon1(const char *filename, byte *dst)  	if (fo.isOpen() == false)  		error("loadTextFile: Cannot open '%s'", filename); -	fo.seek(0, SEEK_END); -	size = fo.pos(); -	fo.seek(0, SEEK_SET); +	size = fo.size();  	if (fo.read(dst, size) != size)  		error("loadTextFile: fread failed"); @@ -1421,15 +1419,12 @@ void SimonState::loadIconFile()  	if (in.isOpen() == false)  		error("Cannot open icon.dat"); -	in.seek(0, SEEK_END); -	size = in.pos(); +	size = in.size();  	_icon_file_ptr = (byte *)malloc(size);  	if (_icon_file_ptr == NULL)  		error("Out of icon memory"); -	in.seek(0, SEEK_SET); -  	in.read(_icon_file_ptr, size);  	in.close();  } @@ -3276,10 +3271,7 @@ void SimonState::readSfxFile(const char *filename)  			return;  		} -		in.seek(0, SEEK_END); -		size = in.pos(); - -		in.seek(0, SEEK_SET); +		size = in.size();  		/* stop all sounds */  		_mixer->stopAll(); @@ -4036,9 +4028,7 @@ void SimonState::read_vga_from_datfile_1(uint vga_id)  			return;  		} -		in.seek(0, SEEK_END); -		size = in.pos(); -		in.seek(0, SEEK_SET); +		size = in.size();  		if (in.read(_vga_buffer_pointers[11].vgaFile2, size) != size)  			error("read_vga_from_datfile_1: read failed"); @@ -4066,9 +4056,7 @@ byte *SimonState::read_vga_from_datfile_2(uint id)  		if (in.isOpen() == false)  			error("read_vga_from_datfile_2: cannot open %s", buf); -		in.seek(0, SEEK_END); -		size = in.pos(); -		in.seek(0, SEEK_SET); +		size = in.size();  		dst = setup_vga_destination(size); @@ -4880,10 +4868,7 @@ void SimonState::playMusic(uint music)  	/* FIXME: not properly implemented */  	if (_game & GAME_WIN) { -		int32 offset = _game_offsets_ptr[gss->MUSIC_INDEX_BASE + music]; -		if (_game & GAME_SIMON2) -			offset--; -		_game_file->seek(offset, SEEK_SET); +		_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);  		File *f = _game_file;  		midi.read_all_songs(f);  	} else { | 
