zyxel-revert/compress.c

30 lines
594 B
C
Raw Permalink Normal View History

2007-04-29 19:08:12 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "lzsc.h"
#include "filedata.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
/*
2007-05-01 20:43:03 +02:00
* $ compress <rom-0-base> <plain-config>
2007-04-30 15:20:09 +02:00
*/
int main(int argc, char *argv[])
2007-04-29 19:08:12 +02:00
{
2007-04-30 15:20:09 +02:00
struct romfile *rom = get_romfile(argv[1], "autoexec.net");
2007-04-29 19:08:12 +02:00
2007-04-30 15:20:09 +02:00
struct filedata *config = get_filedata(argv[2]);
rom->size = lzs_pack(config->data, config->size, rom->data + 0xC, 0x1000);
2007-05-01 20:43:35 +02:00
rom->size += 0xC;
2007-04-29 19:08:12 +02:00
2007-05-01 20:43:03 +02:00
char outname[64];
strncpy(outname, argv[2], sizeof(outname));
strcat(outname, ".comp");
put_romfile(outname, rom);
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;
}