View Single Post
Neobeo

JCF Member

Joined: Sep 2002

Posts: 409

Neobeo is an asset to this forumNeobeo is an asset to this forum

Feb 14, 2007, 06:41 PM
Neobeo is offline
Reply With Quote
There are 4 data streams, and the sizes you are reading from (offset 254) actually refer to the 4th one. What you want to read, or are reading, is the first data stream, so you need the sizes for that. I would suggest you read the first 262 bytes into a STRUCT of some sort, but if not you can always try the following amendments (marked in red):

Code:
if (fseek(file, (long int) 230, SEEK_SET) != 0) {
	perror("Error setting the position for reading");
	return 1;
  }
  
  if (fread(&compsize, 4, 1, file) == 0) {
	perror("Could not read the size of the input stream");
	return 1;
  };
  inputstream = malloc (compsize);
  if (inputstream == NULL) {
	perror("Could not allocate memory for the input stream");
	return 1;
  };
  
  if (fread(&uncompsize, 4, 1, file) == 0) {
	perror("Could not read the size of the output stream");
	return 1;
  }

fseek(file, 24, SEEK_CUR);
And I'll hopefully be releasing my classes soon, if I don't get lazy for some reason or another.
__________________
<TABLE border=1><TR><TD>Facts:
Jazz Sprite Dynamite (JSD)
Tileset Extractor
Neobeo's Firetruck

</TD><TD>Myths:
Jazz Creation Station Plus (JCS+) - 10%
Coming soon - a dedicated server! - 25%
Jazz Sprite Dynamite v2 (JSDv2) - 2%
Another generic single-player level - 0%
</TD></TR></TABLE>