From: Michael Gernoth Date: Sat, 31 Jan 2009 00:12:30 +0000 (+0100) Subject: everything needed implemented, but it's broken. probably fn_5993c is wrong X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/e4a6d4c303eedbf9069821cc38b498f044c95600 everything needed implemented, but it's broken. probably fn_5993c is wrong --- diff --git a/rsb-lz.c b/rsb-lz.c index 4dc9ba6..ddd9a53 100644 --- a/rsb-lz.c +++ b/rsb-lz.c @@ -436,9 +436,9 @@ void fn_59578(unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned fprintf(stderr,"%s\n", __func__); } -void fn_59788() +void fn_59788(const char *fname) { - fprintf(stderr,"error extracting...\n"); + fprintf(stderr,"%s: error extracting...\n", fname); exit(1); } @@ -449,12 +449,6 @@ struct s_59b78 { unsigned char x; /* 9 */ }; -unsigned int fn_59848(struct s_59b78 *data) -{ - fprintf(stderr,"%s\n", __func__); - return 0; -} - unsigned int fn_597c8(struct s_59b78 *r6_data) { unsigned char *r0; @@ -467,7 +461,7 @@ unsigned int fn_597c8(struct s_59b78 *r6_data) r1 = r6_data->stop; if (r1 < r0) - fn_59788(); + fn_59788(__func__); r5 = *r0; r0++; @@ -476,6 +470,34 @@ unsigned int fn_597c8(struct s_59b78 *r6_data) return r5; } +unsigned int fn_59848(struct s_59b78 *r6_data) +{ + unsigned int r1; + unsigned int r2; + unsigned int r5; + + r1 = r6_data->y; + if (r1 == 0x80) { + r6_data->x = fn_597c8(r6_data); + } + r1 = r6_data->y; + r2 = r6_data->x; + r1 = r1 & r2; + r5 = r1 & 0xff; + + r1 = r6_data->y; + r1 = r1 >> 1; + r6_data->y = r1; + if (r1 == 0) + r1 = 0x80; + + r6_data->y = r1; + if (r5 == 0) + return 0; + + return 1; +} + unsigned int fn_598b4(struct s_59b78 *r11_data, unsigned int r10_arg2) { unsigned int r1; @@ -522,8 +544,10 @@ void fn_5980c(unsigned int arg1, unsigned int mem[]) r1 = (unsigned char*)mem[0]; r2 = (unsigned char*)mem[1]; - if (r1 >= r2) - fn_59788(); + if (r1 > r2) { + printf("r1: 0x%08x, r2: 0x%08x\n", (unsigned int)r1, (unsigned int)r2); + fn_59788(__func__); + } *r1 = arg1 & 0xff; @@ -546,6 +570,7 @@ void fn_5993c(struct s_59b78 *data, unsigned int mem[]) do { do { r2 = fn_59848(data); + printf("r2: 0x%x\n", r2); if (r2 == 0) break; @@ -645,14 +670,15 @@ void extract_lz_file(unsigned char *buf, unsigned char *name) fn_59560(0x1005); if (*((unsigned int*)r11) != LZ_MAGIC) - fn_59788(); + fn_59788(__func__); + r3 = r11 + 4; r5 = *((unsigned int*)r3); printf(", Length: %d\n", r5); r3 = r7 + r5; if (r3 > r10) - fn_59788(); + fn_59788(__func__); struct1.start = r11 + 8; struct1.stop = r5 + r11; @@ -668,7 +694,7 @@ void extract_lz_file(unsigned char *buf, unsigned char *name) r5 = *((unsigned int*)r3); if (crc_check_59684(r7, r5, 0x46335053) != 0) - fn_59788(); + fn_59788(__func__); fn_59508();