You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Fix most gzip things *EXCEPT THE ACTUAL DECOMPRESSION*
AYY LMAO
This commit is contained in:
1
tools/.gitignore
vendored
1
tools/.gitignore
vendored
@@ -3,6 +3,7 @@
|
||||
/armips
|
||||
/bfsize
|
||||
/extract_data_for_mio
|
||||
/filesizer
|
||||
/mio0
|
||||
/n64cksum
|
||||
/n64graphics
|
||||
|
||||
@@ -7,7 +7,7 @@ CC := gcc
|
||||
CXX := g++
|
||||
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -O2 -s
|
||||
LDFLAGS := -lm
|
||||
ALL_PROGRAMS := armips bfsize n64graphics n64graphics_ci mio0 slienc n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
|
||||
ALL_PROGRAMS := armips bfsize filesizer n64graphics n64graphics_ci mio0 slienc n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
|
||||
LIBAUDIOFILE := audiofile/libaudiofile.a
|
||||
|
||||
# Only build armips from tools if it is not found on the system
|
||||
@@ -21,6 +21,8 @@ default: all
|
||||
|
||||
bfsize_SOURCES := bfsize.c
|
||||
|
||||
filesizer_SOURCES := filesizer.c
|
||||
|
||||
n64graphics_SOURCES := n64graphics.c utils.c
|
||||
n64graphics_CFLAGS := -DN64GRAPHICS_STANDALONE
|
||||
|
||||
|
||||
62
tools/filesizer.c
Normal file
62
tools/filesizer.c
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
FILE *fptr;
|
||||
FILE *fptr2;
|
||||
int insize;
|
||||
int cmpsize;
|
||||
unsigned char *bz;
|
||||
|
||||
void writeint4(int val)
|
||||
{
|
||||
fputc((val & 0x00ff000000) >> 24, fptr2);
|
||||
fputc((val & 0x0000ff0000) >> 16, fptr2);
|
||||
fputc((val & 0x000000ff00) >> 8, fptr2);
|
||||
fputc((val & 0x00000000ff) >> 0, fptr2);
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
char src[999];
|
||||
char dest[999];
|
||||
|
||||
if( argc < 3 ) {
|
||||
printf("Two arguments expected.\n");
|
||||
printf("Filesizer\n");
|
||||
printf("Usage: [infile] [outfile]\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
strcpy(src, argv[1]);
|
||||
strcpy(dest, argv[2]);
|
||||
|
||||
if ((fptr = fopen(src, "rb")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "FILE OPEN ERROR![%s]\n", src);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((fptr2 = fopen(argv[2], "r+")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "FILE APPEND ERROR![%s]\n", dest);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fseek(fptr, 0, SEEK_END);
|
||||
fseek(fptr2, 0, SEEK_END);
|
||||
insize = ftell(fptr);
|
||||
writeint4(0);
|
||||
cmpsize = ftell(fptr2);
|
||||
int numZeros = 0x10 - (cmpsize % 0x10);
|
||||
for(int i = 0; i < numZeros; i++)
|
||||
{
|
||||
fputc(0, fptr2);
|
||||
}
|
||||
fseek(fptr2, -0x4, SEEK_END);
|
||||
writeint4(insize);
|
||||
fclose(fptr);
|
||||
fclose(fptr2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user