]> git.zerfleddert.de Git - rsbs2/commitdiff
cleanup some structs
authorMichael Gernoth <michael@gernoth.net>
Mon, 2 Feb 2009 21:47:53 +0000 (22:47 +0100)
committerMichael Gernoth <michael@gernoth.net>
Mon, 2 Feb 2009 21:47:53 +0000 (22:47 +0100)
rsb-lz.c

index c68ac8daf672b9ab8fc3cb2c62db98f833c294d8..0e86bca7ccacc53464e23a4a5f0ed07202407301 100644 (file)
--- a/rsb-lz.c
+++ b/rsb-lz.c
@@ -434,14 +434,19 @@ void fn_59788(const char *fname)
        exit(1);
 }
 
-struct s_59b78 {
+struct data_in_s {
        unsigned char *start; /* 0 */
        unsigned char *stop; /* 4 */
-       unsigned char y; /* 8 */
+       unsigned char bit; /* 8 */
        unsigned char x; /* 9 */
 };
 
-unsigned char fn_597c8(struct s_59b78 *r6_data)
+struct data_out_s {
+       unsigned char *pos;
+       unsigned char *end;
+};
+
+unsigned char fn_597c8(struct data_in_s *r6_data)
 {
        unsigned char *r0;
        unsigned char *r1;
@@ -462,27 +467,27 @@ unsigned char fn_597c8(struct s_59b78 *r6_data)
        return r5;
 }
 
-unsigned int fn_59848(struct s_59b78 *r6_data)
+unsigned int fn_59848(struct data_in_s *r6_data)
 {
        unsigned char r1;
        unsigned char r2;
        unsigned int r5;
 
-       r1 = r6_data->y;
+       r1 = r6_data->bit;
        if (r1 == 0x80) {
                r6_data->x = fn_597c8(r6_data);
        }
-       r1 = r6_data->y;
+       r1 = r6_data->bit;
        r2 = r6_data->x;
        r1 = r1 & r2;
        r5 = r1 & 0xff;
 
-       r1 = r6_data->y;
+       r1 = r6_data->bit;
        r1 = r1 >> 1;
-       r6_data->y = r1;
+       r6_data->bit = r1;
        if (r1 == 0) {
                r1 = 0x80;
-               r6_data->y = r1;
+               r6_data->bit = r1;
        }
 
        if (r5 == 0)
@@ -491,7 +496,7 @@ unsigned int fn_59848(struct s_59b78 *r6_data)
        return 1;
 }
 
-unsigned int fn_598b4(struct s_59b78 *r11_data, unsigned int r10_arg2)
+unsigned int fn_598b4(struct data_in_s *r11_data, unsigned int r10_arg2)
 {
        unsigned int r1;
        unsigned int r2;
@@ -503,12 +508,12 @@ unsigned int fn_598b4(struct s_59b78 *r11_data, unsigned int r10_arg2)
 
        r7 = 0;
        while (r6 != 0) {
-               r1 = r11_data->y;
+               r1 = r11_data->bit;
                if (r1 == 0x80) {
                        r1 = fn_597c8(r11_data);
                        r11_data->x = r1;
                }
-               r1 = r11_data->y;
+               r1 = r11_data->bit;
                r2 = r11_data->x;
                r1 = r1 & r2;
                if (r1 != 0)
@@ -516,26 +521,26 @@ unsigned int fn_598b4(struct s_59b78 *r11_data, unsigned int r10_arg2)
 
                r6 = r6 >> 1;
 
-               r2 = r11_data->y;
+               r2 = r11_data->bit;
                r2 = r2 >> 1;
-               r11_data->y = r2;
+               r11_data->bit = r2;
 
-               r1 = r11_data->y;
+               r1 = r11_data->bit;
                if(r1 == 0) {
-                       r11_data->y = 0x80;
+                       r11_data->bit = 0x80;
                }
        }
 
        return r7;
 }
 
-void fn_5980c(unsigned int arg1, unsigned int mem[])
+void fn_5980c(unsigned int arg1, struct data_out_s *data_out)
 {
        unsigned char *r1;
        unsigned char *r2;
 
-       r1 = (unsigned char*)mem[0];
-       r2 = (unsigned char*)mem[1];
+       r1 = data_out->pos;
+       r2 = data_out->end;
 
        if (r1 > r2) {
                printf("r1: 0x%08x, r2: 0x%08x\n", (unsigned int)r1, (unsigned int)r2);
@@ -545,10 +550,10 @@ void fn_5980c(unsigned int arg1, unsigned int mem[])
        *r1 = arg1 & 0xff;
 
        r1++;
-       mem[0] = (unsigned int)r1;
+       data_out->pos = r1;
 }
 
-void fn_5993c(struct s_59b78 *r10_data, unsigned int r13_mem[])
+void lz_expand(struct data_in_s *r10_data, struct data_out_s *data_out)
 {
        unsigned int r5;
        unsigned int r2;
@@ -569,7 +574,7 @@ void fn_5993c(struct s_59b78 *r10_data, unsigned int r13_mem[])
                        r2 = fn_598b4(r10_data, 8) & 0xff;
                        r4 = r2;
 
-                       fn_5980c(r4, r13_mem);
+                       fn_5980c(r4, data_out);
                        arr_59b64[r5] = r4 & 0xff;
                        r2 = r5 + 1;
                        r2 = r2 << 22;
@@ -589,7 +594,7 @@ void fn_5993c(struct s_59b78 *r10_data, unsigned int r13_mem[])
                        r2 = r2 << 22;
                        r2 = r2 >> 22;
                        r4 = arr_59b64[r2];
-                       fn_5980c(r4, r13_mem);
+                       fn_5980c(r4, data_out);
                        arr_59b64[r5] = r4;
                        r2 = r5 + 1;
                        r2 = r2 << 22;
@@ -641,8 +646,8 @@ void extract_lz_file(unsigned char *buf, unsigned char *name)
        unsigned char *r7 = NULL; /* Arg1, mem start */
        unsigned char *r10 = NULL; /* Arg2, mem end */
        unsigned char *r11 = buf; /* Arg3 */
-       struct s_59b78 struct1;
-       unsigned int arr_59b7c[1024];
+       struct data_in_s data_in;
+       struct data_out_s data_out;
 
        if (*((unsigned int*)r11) != LZ_MAGIC)
                fn_59788(__func__);
@@ -662,15 +667,15 @@ void extract_lz_file(unsigned char *buf, unsigned char *name)
        if (r3 > r10)
                fn_59788(__func__);
        
-       struct1.start = r11 + 8;
-       struct1.stop = r5 + r11;
-       struct1.x = 0;
-       struct1.y = 0x80;
+       data_in.start = r11 + 8;
+       data_in.stop = r5 + r11;
+       data_in.x = 0;
+       data_in.bit = 0x80;
 
-       arr_59b7c[0] = (unsigned int)r7;
-       arr_59b7c[1] = (unsigned int)(r5 + r7);
+       data_out.pos = r7;
+       data_out.end = r7 + r5;
 
-       fn_5993c(&struct1, arr_59b7c);
+       lz_expand(&data_in, &data_out);
 
 #if 0
        /* This seems to still be completely broken */
Impressum, Datenschutz