]> git.zerfleddert.de Git - rsbs2/commitdiff
extracting works now correctly :-)
authorMichael Gernoth <michael@gernoth.net>
Sat, 31 Jan 2009 01:50:07 +0000 (02:50 +0100)
committerMichael Gernoth <michael@gernoth.net>
Sat, 31 Jan 2009 01:50:07 +0000 (02:50 +0100)
but the checksum-function is still broken...

Makefile
rsb-lz.c

index 6fbd0b79605d8497478f4e7e5cea4691f9a8ab44..cac4a663e628159d2c478e83e5961efa1431c1b0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,6 @@ rsb-crc.o: rsb-crc.c rsb-crc.h
 rsb-lz.o: rsb-lz.c rsb-lz.h
 
 clean:
 rsb-lz.o: rsb-lz.c rsb-lz.h
 
 clean:
-       rm -f firmware firmware.o rsb-crc.o
+       rm -f firmware firmware.o rsb-crc.o rsb-lz.o
 
 .PHONY: all clean
 
 .PHONY: all clean
index ddd9a53ce0aa884cadbfc094a8a7d44876f98b9a..f5a84fa55832020cead7d92285c8e0502c12d46f 100644 (file)
--- a/rsb-lz.c
+++ b/rsb-lz.c
  * 59b80:      46335053        undefined
  */
 
  * 59b80:      46335053        undefined
  */
 
-void fn_59560(unsigned int arg1)
-{
-       fprintf(stderr,"%s\n", __func__);
-}
-
-void fn_59578(unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4)
-{
-       fprintf(stderr,"%s\n", __func__);
-}
+static unsigned char *outbuf = NULL;
 
 void fn_59788(const char *fname)
 {
        fprintf(stderr,"%s: error extracting...\n", fname);
 
 void fn_59788(const char *fname)
 {
        fprintf(stderr,"%s: error extracting...\n", fname);
+       fprintf(stderr,"outbuf at: %p\n", outbuf);
+       fprintf(stderr,"%s\n", outbuf);
        exit(1);
 }
 
        exit(1);
 }
 
@@ -449,7 +443,7 @@ struct s_59b78 {
        unsigned char x; /* 9 */
 };
 
        unsigned char x; /* 9 */
 };
 
-unsigned int fn_597c8(struct s_59b78 *r6_data)
+unsigned char fn_597c8(struct s_59b78 *r6_data)
 {
        unsigned char *r0;
        unsigned char *r1;
 {
        unsigned char *r0;
        unsigned char *r1;
@@ -472,8 +466,8 @@ unsigned int fn_597c8(struct s_59b78 *r6_data)
 
 unsigned int fn_59848(struct s_59b78 *r6_data)
 {
 
 unsigned int fn_59848(struct s_59b78 *r6_data)
 {
-       unsigned int r1;
-       unsigned int r2;
+       unsigned char r1;
+       unsigned char r2;
        unsigned int r5;
 
        r1 = r6_data->y;
        unsigned int r5;
 
        r1 = r6_data->y;
@@ -488,10 +482,11 @@ unsigned int fn_59848(struct s_59b78 *r6_data)
        r1 = r6_data->y;
        r1 = r1 >> 1;
        r6_data->y = r1;
        r1 = r6_data->y;
        r1 = r1 >> 1;
        r6_data->y = r1;
-       if (r1 == 0)
+       if (r1 == 0) {
                r1 = 0x80;
                r1 = 0x80;
-       
-       r6_data->y = r1;
+               r6_data->y = r1;
+       }
+
        if (r5 == 0)
                return 0;
 
        if (r5 == 0)
                return 0;
 
@@ -509,12 +504,12 @@ unsigned int fn_598b4(struct s_59b78 *r11_data, unsigned int r10_arg2)
        r6 = 1 << r1;
 
        r7 = 0;
        r6 = 1 << r1;
 
        r7 = 0;
-       do {
+       while (r6 != 0) {
                r1 = r11_data->y;
                if (r1 == 0x80) {
                        r1 = fn_597c8(r11_data);
                r1 = r11_data->y;
                if (r1 == 0x80) {
                        r1 = fn_597c8(r11_data);
+                       r11_data->x = r1;
                }
                }
-               r11_data->x = r1;
                r1 = r11_data->y;
                r2 = r11_data->x;
                r1 = r1 & r2;
                r1 = r11_data->y;
                r2 = r11_data->x;
                r1 = r1 & r2;
@@ -531,7 +526,7 @@ unsigned int fn_598b4(struct s_59b78 *r11_data, unsigned int r10_arg2)
                if(r1 == 0) {
                        r11_data->y = 0x80;
                }
                if(r1 == 0) {
                        r11_data->y = 0x80;
                }
-       } while (r6 != 0);
+       }
 
        return r7;
 }
 
        return r7;
 }
@@ -555,57 +550,56 @@ void fn_5980c(unsigned int arg1, unsigned int mem[])
        mem[0] = (unsigned int)r1;
 }
 
        mem[0] = (unsigned int)r1;
 }
 
-void fn_5993c(struct s_59b78 *data, unsigned int mem[])
+void fn_5993c(struct s_59b78 *r10_data, unsigned int r13_mem[])
 {
        unsigned int r5;
        unsigned int r2;
 {
        unsigned int r5;
        unsigned int r2;
-       unsigned int r4;
+       unsigned char r4;
        unsigned int r6;
        unsigned int r7;
        unsigned int r11;
        unsigned int r6;
        unsigned int r7;
        unsigned int r11;
-       unsigned char arr_59b64[1024];
+       unsigned char arr_59b64[2048];
 
        r5 = 1;
 
 
        r5 = 1;
 
-       do {
-               do {
-                       r2 = fn_59848(data);
-                       printf("r2: 0x%x\n", r2);
+       while (1) {
+               while (1) {
+                       r2 = fn_59848(r10_data);
                        if (r2 == 0)
                                break;
 
                        if (r2 == 0)
                                break;
 
-                       r2 = fn_598b4(data, 8) & 0xff;
+                       r2 = fn_598b4(r10_data, 8) & 0xff;
                        r4 = r2;
 
                        r4 = r2;
 
-                       fn_5980c(r4, mem);
+                       fn_5980c(r4, r13_mem);
                        arr_59b64[r5] = r4 & 0xff;
                        r2 = r5 + 1;
                        r2 = r2 << 22;
                        r2 = r2 >> 22;
                        r5 = r2;
                        arr_59b64[r5] = r4 & 0xff;
                        r2 = r5 + 1;
                        r2 = r2 << 22;
                        r2 = r2 >> 22;
                        r5 = r2;
-               } while(1);
+               }
 
 
-               r11 = fn_598b4(data, 0x0a);
+               r11 = fn_598b4(r10_data, 0x0a);
                if(r11 == 0)
                        return;
 
                if(r11 == 0)
                        return;
 
-               r2 = fn_598b4(data, 0x04);
+               r2 = fn_598b4(r10_data, 0x04);
                r7 = r2 + 1;
                r6 = 0;
                r7 = r2 + 1;
                r6 = 0;
-               do {
+               while (r6 <= r7) {
                        r2 = r6 + r11;
                        r2 = r2 << 22;
                        r2 = r2 >> 22;
                        r4 = arr_59b64[r2];
                        r2 = r6 + r11;
                        r2 = r2 << 22;
                        r2 = r2 >> 22;
                        r4 = arr_59b64[r2];
-                       fn_5980c(r4, mem);
-                       arr_59b64[r5] = r4 & 0xff;
+                       fn_5980c(r4, r13_mem);
+                       arr_59b64[r5] = r4;
                        r2 = r5 + 1;
                        r2 = r2 << 22;
                        r2 = r2 >> 22;
                        r5 = r2;
                        r6++;
                        r2 = r5 + 1;
                        r2 = r2 << 22;
                        r2 = r2 >> 22;
                        r5 = r2;
                        r6++;
-               } while(r6 <= r7);
-       } while(1);
+               }
+       }
 }
 
 unsigned int crc_check_59684(unsigned char *arg1, unsigned int arg2, unsigned int magic)
 }
 
 unsigned int crc_check_59684(unsigned char *arg1, unsigned int arg2, unsigned int magic)
@@ -655,26 +649,23 @@ void extract_lz_file(unsigned char *buf, unsigned char *name)
        struct s_59b78 struct1;
        unsigned int arr_59b7c[1024];
 
        struct s_59b78 struct1;
        unsigned int arr_59b7c[1024];
 
-       r7 = malloc(1024*1024*1024);
-       r10 = r7 + (1024*1024*1024);
+       r7 = malloc(4*1024*1024);
+       r10 = r7 + (4*1024*1024);
 
        if (r7 == NULL) {
                perror("malloc");
                exit(1);
        }
 
 
        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);
+       bzero(r7, 4*1024*1024);
+       outbuf = r7;
 
        if (*((unsigned int*)r11) != LZ_MAGIC)
                fn_59788(__func__);
 
        r3 = r11 + 4;
        r5 = *((unsigned int*)r3);
 
        if (*((unsigned int*)r11) != LZ_MAGIC)
                fn_59788(__func__);
 
        r3 = r11 + 4;
        r5 = *((unsigned int*)r3);
-       printf(", Length: %d\n", r5);
+       printf(", length: %d\n", r5);
 
        r3 = r7 + r5;
        if (r3 > r10)
 
        r3 = r7 + r5;
        if (r3 > r10)
@@ -715,6 +706,8 @@ void search_lz_sections(unsigned char *fw, int len)
                        j--;
                        while (j > fw) {
                                if (*j == 0x00) {
                        j--;
                        while (j > fw) {
                                if (*j == 0x00) {
+                                       if (strncmp("/web", (char*)(j+1), 4))
+                                               break;
                                        printf("%s", j+1);
                                        extract_lz_file(fw + i, j+1);
                                        break;
                                        printf("%s", j+1);
                                        extract_lz_file(fw + i, j+1);
                                        break;
Impressum, Datenschutz