From 85c02b835234424a2e1e7ac26bf8c3f47d48e090 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 7 Apr 2016 04:03:04 -0700 Subject: [PATCH] cleanup --- .gitignore | 10 +++++++--- patch/.gitignore | 2 -- patch/mm-bq | 5 ----- z64dump.py | 1 - z64yaz0.c | 19 +++++++++---------- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 9b5e51b..4962b99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ * - Copy* -cm oot save.lua -cm mm save.lua -__pycache__/* +*.7z *.State +*.bin +*.exe +*.z64 +__pycache__/* +cm mm save.lua +cm oot save.lua diff --git a/patch/.gitignore b/patch/.gitignore index 418961f..fb3bee8 100644 --- a/patch/.gitignore +++ b/patch/.gitignore @@ -1,5 +1,3 @@ -*.z64 -*.bin patchme lips entrances.asm diff --git a/patch/mm-bq b/patch/mm-bq index 540cc9f..27b4994 100755 --- a/patch/mm-bq +++ b/patch/mm-bq @@ -37,16 +37,11 @@ comp() { rm patchme/"$1" } -#if ! [ -d "$extracted" ]; then if [ $fast -eq 0 ] || [ ! -d patchme ]; then [ -d patchme ] && rm -r patchme (cd ..; ./z64dump.py -c "$rom") mv ../"$sha1" patchme fi -#if [ $fast -eq 0 ]; then -# [ -d patchme ] && rm -r patchme -# cp -r "$extracted" patchme -#fi unc "$code" diff --git a/z64dump.py b/z64dump.py index fbad068..bd6413b 100755 --- a/z64dump.py +++ b/z64dump.py @@ -256,7 +256,6 @@ def create_rom(d, compress=False): if compressed: pe = align(start_p + size_p) ve = vs + int.from_bytes(data[4:8], 'big') - #ve = vs + len(Yaz0.decode(data)) else: pe = 0 ve = vs + size_v diff --git a/z64yaz0.c b/z64yaz0.c index 0514abe..80d7d8c 100644 --- a/z64yaz0.c +++ b/z64yaz0.c @@ -131,9 +131,6 @@ static int encodeYaz0(u8 *src, u8 *dst, int srcSize) // write eight codes if (validBitCount == 8) { - //fwrite(&currCodeByte, 1, 1, dstFile); - //fwrite(buf, 1, bufPos, dstFile); - dst[dstPos++] = currCodeByte; for (int j = 0; j < bufPos; j++) dst[dstPos++] = buf[j]; @@ -145,9 +142,6 @@ static int encodeYaz0(u8 *src, u8 *dst, int srcSize) } if (validBitCount > 0) { - //fwrite(&currCodeByte, 1, 1, dstFile); - //fwrite(buf, 1, bufPos, dstFile); - dst[dstPos++] = currCodeByte; for (int j = 0; j < bufPos; j++) dst[dstPos++] = buf[j]; @@ -175,7 +169,7 @@ void decompress(u8 *src, u8 *dst, int uncompressedSize) validBitCount = 8; } - if((currCodeByte & 0x80) != 0) { + if ((currCodeByte & 0x80) != 0) { // straight copy dst[dstPlace] = src[srcPlace]; dstPlace++; @@ -190,11 +184,12 @@ void decompress(u8 *src, u8 *dst, int uncompressedSize) u32 copySource = dstPlace - (dist + 1); u32 numBytes = byte1 >> 4; - if(numBytes == 0) { + if (numBytes == 0) { numBytes = src[srcPlace] + 0x12; srcPlace++; - } else + } else { numBytes += 2; + } // copy run int i; @@ -211,12 +206,16 @@ void decompress(u8 *src, u8 *dst, int uncompressedSize) } } - int main(int argc, char *argv[]) { for (int i = 1; i < argc; i++) { FILE *f = fopen(argv[i], "rb"); + if (f == NULL) { + perror(argv[1]); + exit(1); + } + fseek(f, 0, SEEK_END); long size = ftell(f); fseek(f, 0, SEEK_SET);