From 0385aaa96b4d2dc779b539f22b913ae3143c4c2b Mon Sep 17 00:00:00 2001 From: n-a-c-h <> Date: Thu, 18 Dec 2003 00:18:14 +0000 Subject: [PATCH] Fixed unzipping ROMs that are 6MB with a header. --- zsnes/src/initc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/zsnes/src/initc.c b/zsnes/src/initc.c index 4e705adb..a96c3063 100755 --- a/zsnes/src/initc.c +++ b/zsnes/src/initc.c @@ -390,7 +390,7 @@ void loadFile() struct stat stat_results; stat(ZOpenFileName, &stat_results); - if (stat_results.st_size <= maxromspace+512-curromspace) + if ((unsigned int)stat_results.st_size <= maxromspace+512-curromspace) { FILE *fp = 0; fp = fopen(ZOpenFileName, "rb"); @@ -434,7 +434,7 @@ void loadGZipFile() size |= fgetc(fp) << 24; fclose(fp); - if (size > maxromspace+512) { return; } + if ((unsigned int)size > maxromspace+512) { return; } //Open GZip file for decompression GZipFile = gzopen(ZOpenFileName, "rb"); @@ -512,7 +512,8 @@ void loadZipFile() } //Check for valid ROM based on size - if ((fileSize < maxromspace+512) && fileSize > LargestGoodFile) + if (((unsigned int)fileSize <= maxromspace+512) && + (fileSize > LargestGoodFile)) { strcpy(ourFile, cFileName); LargestGoodFile = fileSize; @@ -1011,9 +1012,9 @@ extern unsigned char per2exec; void Setper2exec() { - opexec268 = opexec268*(per2exec*0.01); - opexec358 = opexec358*(per2exec*0.01); - opexec268cph = opexec268cph*(per2exec*0.01); - opexec358cph = opexec358cph*(per2exec*0.01); + opexec268 = (unsigned char)(opexec268*(per2exec*0.01)); + opexec358 = (unsigned char)(opexec358*(per2exec*0.01)); + opexec268cph = (unsigned char)(opexec268cph*(per2exec*0.01)); + opexec358cph = (unsigned char)(opexec358cph*(per2exec*0.01)); }