]> cvs.zerfleddert.de Git - rsbs2/blobdiff - rsb-lz.c
fn_5980c implemented
[rsbs2] / rsb-lz.c
index e3ce0914d4fbbce6fe721d63f4c9350c710a21bc..ed0c81396c97e60bf848c8a53409b976d4656cd0 100644 (file)
--- a/rsb-lz.c
+++ b/rsb-lz.c
@@ -3,6 +3,7 @@
 #include <strings.h>
 #include <string.h>
 #include <errno.h>
 #include <strings.h>
 #include <string.h>
 #include <errno.h>
+#include "rsb-crc.h"
 #include "rsb-lz.h"
 
 /* TODO: IMPLEMET THIS! */
 #include "rsb-lz.h"
 
 /* TODO: IMPLEMET THIS! */
@@ -446,26 +447,128 @@ struct s_59b78 {
        unsigned char x; /* 9 */
 };
 
        unsigned char x; /* 9 */
 };
 
+unsigned int fn_59848(struct s_59b78 *data)
+{
+       return 0;
+}
+
+unsigned int fn_598b4(struct s_59b78 *data, unsigned int arg2)
+{
+       return 0;
+}
+
+void fn_5980c(unsigned int arg1, unsigned int mem[])
+{
+       unsigned char *r1;
+       unsigned char *r2;
+
+       r1 = (unsigned char*)mem[0];
+       r2 = (unsigned char*)mem[1];
+
+       if (r1 >= r2)
+               fn_59788();
+
+       *r1 = arg1 & 0xff;
+
+       r1++;
+       mem[0] = (unsigned int)r1;
+}
+
 void fn_5993c(struct s_59b78 *data, unsigned int mem[])
 void fn_5993c(struct s_59b78 *data, unsigned int mem[])
+{
+       unsigned int r5;
+       unsigned int r2;
+       unsigned int r4;
+       unsigned int r6;
+       unsigned int r7;
+       unsigned int r11;
+       unsigned char arr_59b64[1024];
+
+       r5 = 1;
+
+       do {
+               do {
+                       r2 = fn_59848(data);
+                       if (r2 == 0)
+                               break;
+
+                       r2 = fn_598b4(data, 8) & 0xff;
+                       r4 = r2;
+
+                       fn_5980c(r4, mem);
+                       arr_59b64[r5] = r4 & 0xff;
+                       r2 = r5 + 1;
+                       r2 = r2 << 22;
+                       r2 = r2 >> 22;
+                       r5 = r2;
+               } while(1);
+
+               r11 = fn_598b4(data, 0x0a);
+               if(r11 == 0)
+                       return;
+
+               r2 = fn_598b4(data, 0x04);
+               r7 = r2 + 1;
+               r6 = 0;
+               do {
+                       r2 = r6 + r11;
+                       r2 = r2 << 22;
+                       r2 = r2 >> 22;
+                       r4 = arr_59b64[r2];
+                       fn_5980c(r4, mem);
+                       arr_59b64[r5] = r4 & 0xff;
+                       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 r3;
+       unsigned int r4;
+       unsigned int r5;
+
+#if 0
+       if (r0 < 0xc0000000)
+               return 1;
+#endif
+
+       r4 = *((unsigned int*)arg1 + 0x20);
+       r5 = *((unsigned int*)arg1 + 0x24);
+
+       if (r5 != magic)
+               return 2;
+       
+       if (arg2 >= r4)
+               r5 = 0;
+       else
+               return 3;
+
+       r5 = ~rsb_crc(~0x00, arg1, r4);
+       r3 = *((unsigned int*)(arg1 + r4));
+       printf("Checksums: 0x%02x <-> 0x%02x\n", r5, r3);
+
+       if (r3 == r5)
+               return 0;
+
+       return 4;
+}
+
+void fn_59508()
 {
 }
 
 void extract_lz_file(unsigned char *buf, unsigned char *name)
 {
 {
 }
 
 void extract_lz_file(unsigned char *buf, unsigned char *name)
 {
-       unsigned int r0;
-       unsigned int r1;
-       unsigned int r2;
        unsigned char *r3;
        unsigned char *r3;
-       unsigned int r4;
        unsigned int r5;
        unsigned int r5;
-       unsigned int r6;
        unsigned char *r7 = NULL; /* Arg1, mem start */
        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 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];
 
        struct s_59b78 struct1;
        unsigned int arr_59b7c[1024];
 
@@ -503,6 +606,14 @@ void extract_lz_file(unsigned char *buf, unsigned char *name)
 
        fn_5993c(&struct1, arr_59b7c);
 
 
        fn_5993c(&struct1, arr_59b7c);
 
+       r3 = r7 + 0x20;
+       r5 = *((unsigned int*)r3);
+
+       if (crc_check_59684(r7, r5, 0x46335053) != 0)
+               fn_59788();
+       
+       fn_59508();
+
        free(r7);
 }
 
        free(r7);
 }
 
Impressum, Datenschutz