1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-04 13:39:03 -08:00
This commit is contained in:
Connor Olding 2016-04-07 04:03:04 -07:00
parent 4c05e280c8
commit 85c02b8352
5 changed files with 16 additions and 21 deletions

10
.gitignore vendored
View file

@ -1,5 +1,9 @@
* - Copy* * - Copy*
cm oot save.lua *.7z
cm mm save.lua
__pycache__/*
*.State *.State
*.bin
*.exe
*.z64
__pycache__/*
cm mm save.lua
cm oot save.lua

2
patch/.gitignore vendored
View file

@ -1,5 +1,3 @@
*.z64
*.bin
patchme patchme
lips lips
entrances.asm entrances.asm

View file

@ -37,16 +37,11 @@ comp() {
rm patchme/"$1" rm patchme/"$1"
} }
#if ! [ -d "$extracted" ]; then
if [ $fast -eq 0 ] || [ ! -d patchme ]; then if [ $fast -eq 0 ] || [ ! -d patchme ]; then
[ -d patchme ] && rm -r patchme [ -d patchme ] && rm -r patchme
(cd ..; ./z64dump.py -c "$rom") (cd ..; ./z64dump.py -c "$rom")
mv ../"$sha1" patchme mv ../"$sha1" patchme
fi fi
#if [ $fast -eq 0 ]; then
# [ -d patchme ] && rm -r patchme
# cp -r "$extracted" patchme
#fi
unc "$code" unc "$code"

View file

@ -256,7 +256,6 @@ def create_rom(d, compress=False):
if compressed: if compressed:
pe = align(start_p + size_p) pe = align(start_p + size_p)
ve = vs + int.from_bytes(data[4:8], 'big') ve = vs + int.from_bytes(data[4:8], 'big')
#ve = vs + len(Yaz0.decode(data))
else: else:
pe = 0 pe = 0
ve = vs + size_v ve = vs + size_v

View file

@ -131,9 +131,6 @@ static int encodeYaz0(u8 *src, u8 *dst, int srcSize)
// write eight codes // write eight codes
if (validBitCount == 8) { if (validBitCount == 8) {
//fwrite(&currCodeByte, 1, 1, dstFile);
//fwrite(buf, 1, bufPos, dstFile);
dst[dstPos++] = currCodeByte; dst[dstPos++] = currCodeByte;
for (int j = 0; j < bufPos; j++) for (int j = 0; j < bufPos; j++)
dst[dstPos++] = buf[j]; dst[dstPos++] = buf[j];
@ -145,9 +142,6 @@ static int encodeYaz0(u8 *src, u8 *dst, int srcSize)
} }
if (validBitCount > 0) { if (validBitCount > 0) {
//fwrite(&currCodeByte, 1, 1, dstFile);
//fwrite(buf, 1, bufPos, dstFile);
dst[dstPos++] = currCodeByte; dst[dstPos++] = currCodeByte;
for (int j = 0; j < bufPos; j++) for (int j = 0; j < bufPos; j++)
dst[dstPos++] = buf[j]; dst[dstPos++] = buf[j];
@ -175,7 +169,7 @@ void decompress(u8 *src, u8 *dst, int uncompressedSize)
validBitCount = 8; validBitCount = 8;
} }
if((currCodeByte & 0x80) != 0) { if ((currCodeByte & 0x80) != 0) {
// straight copy // straight copy
dst[dstPlace] = src[srcPlace]; dst[dstPlace] = src[srcPlace];
dstPlace++; dstPlace++;
@ -190,11 +184,12 @@ void decompress(u8 *src, u8 *dst, int uncompressedSize)
u32 copySource = dstPlace - (dist + 1); u32 copySource = dstPlace - (dist + 1);
u32 numBytes = byte1 >> 4; u32 numBytes = byte1 >> 4;
if(numBytes == 0) { if (numBytes == 0) {
numBytes = src[srcPlace] + 0x12; numBytes = src[srcPlace] + 0x12;
srcPlace++; srcPlace++;
} else } else {
numBytes += 2; numBytes += 2;
}
// copy run // copy run
int i; int i;
@ -211,12 +206,16 @@ void decompress(u8 *src, u8 *dst, int uncompressedSize)
} }
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
FILE *f = fopen(argv[i], "rb"); FILE *f = fopen(argv[i], "rb");
if (f == NULL) {
perror(argv[1]);
exit(1);
}
fseek(f, 0, SEEK_END); fseek(f, 0, SEEK_END);
long size = ftell(f); long size = ftell(f);
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);