X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/9083693311cfae1ba2f233cb651daaab0e9b4b20..14ff7444fbe0e46226b640411372a5895db4fd74:/rsb-lz.c diff --git a/rsb-lz.c b/rsb-lz.c index 4960fc0..e3ce091 100644 --- a/rsb-lz.c +++ b/rsb-lz.c @@ -1,4 +1,8 @@ #include +#include +#include +#include +#include #include "rsb-lz.h" /* TODO: IMPLEMET THIS! */ @@ -421,6 +425,87 @@ * 59b80: 46335053 undefined */ +void fn_59560(unsigned int arg1) +{ +} + +void fn_59578(unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4) +{ +} + +void fn_59788() +{ + fprintf(stderr,"error extracting...\n"); + exit(1); +} + +struct s_59b78 { + unsigned char *start; + unsigned char *stop; + unsigned char y; /* 8 */ + unsigned char x; /* 9 */ +}; + +void fn_5993c(struct s_59b78 *data, unsigned int mem[]) +{ +} + +void extract_lz_file(unsigned char *buf, unsigned char *name) +{ + unsigned int r0; + unsigned int r1; + unsigned int r2; + unsigned char *r3; + unsigned int r4; + unsigned int r5; + unsigned int r6; + unsigned char *r7 = NULL; /* Arg1, mem start */ + unsigned int r8; + unsigned int r9; + unsigned char *r10 = NULL; /* Arg2, mem end */ + unsigned char *r11 = buf; /* Arg3 */ + unsigned int r12; + unsigned int r13; + struct s_59b78 struct1; + unsigned int arr_59b7c[1024]; + + r7 = malloc(1024*1024*1024); + r10 = r7 + (1024*1024*1024); + + if (r7 == NULL) { + perror("malloc"); + exit(1); + } + + fn_59578(0, 0, 0x3f, 0x33); + fn_59578(4, 0x10000000, 0x33, 0x366); + fn_59578(5, 0x14000000, 0x1b, 0x733); + fn_59578(7, 0xc0000000, 0x3b, 0x33); + fn_59560(0x1005); + + if (*((unsigned int*)r11) != LZ_MAGIC) + fn_59788(); + r3 = r11 + 4; + r5 = *((unsigned int*)r3); + printf(", Length: %d\n", r5); + + r3 = r7 + r5; + if (r3 > r10) + fn_59788(); + + struct1.start = r11 + 8; + struct1.stop = r5 + r11; + struct1.x = 0; + struct1.y = 0x80; + + arr_59b7c[0] = (unsigned int)r7; + arr_59b7c[1] = (unsigned int)(r5 + r7); + + fn_5993c(&struct1, arr_59b7c); + + free(r7); +} + void search_lz_sections(unsigned char *fw, int len) { int i; @@ -436,6 +521,7 @@ void search_lz_sections(unsigned char *fw, int len) while (j > fw) { if (*j == 0x00) { printf("%s", j+1); + extract_lz_file(fw + i, j+1); break; } j--;