zyxel-revert/decompress.c

29 lines
561 B
C
Raw Normal View History

2007-04-29 19:08:12 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "lzsd.h"
2007-04-30 15:20:09 +02:00
#include "romfile.h"
2007-04-29 19:08:12 +02:00
2007-04-30 15:20:09 +02:00
/*
* $ decompress <rom-0-file>
*/
2007-04-29 19:08:12 +02:00
int main(int argc, char *argv[])
{
2007-04-30 15:20:09 +02:00
struct romfile *rom = get_romfile(argv[1], "autoexec.net");
struct filedata *config = alloc_filedata(65536);
config->size = lzs_unpack(rom->data + 0xC, rom->size - 0xC, config->data, config->size);
2007-04-29 19:08:12 +02:00
char outname[64];
strncpy(outname, argv[1], sizeof(outname));
2007-04-30 16:35:22 +02:00
strcat(outname, ".decomp");
2007-04-29 19:08:12 +02:00
2007-04-30 15:20:09 +02:00
put_filedata(outname, config);
2007-04-29 19:08:12 +02:00
2007-04-30 15:20:09 +02:00
free(config);
free(rom);
2007-04-29 19:08:12 +02:00
return 0;
}