summaryrefslogtreecommitdiff
path: root/csrc
diff options
context:
space:
mode:
Diffstat (limited to 'csrc')
-rw-r--r--csrc/mkf_asm.asm30
-rw-r--r--csrc/mkf_asm_data.c21
2 files changed, 23 insertions, 28 deletions
diff --git a/csrc/mkf_asm.asm b/csrc/mkf_asm.asm
index 50019ac..494077b 100644
--- a/csrc/mkf_asm.asm
+++ b/csrc/mkf_asm.asm
@@ -5,6 +5,7 @@ extern table_483530
extern data_483630
extern gtables
extern cfcn_45511b
+extern cfcn_004550cc
fcn_00455040:
push ebp
@@ -104,7 +105,7 @@ cmp word [gtables + 1280], 0x8000
jne L20_1
push ebx
-call fcn_004550cc
+call cfcn_004550cc
pop ebx
L20_1:
@@ -114,30 +115,3 @@ call cfcn_45511b
add esp, 4
ret
-
-fcn_004550cc:
-
-mov edx, 0x141
-xor ebp, ebp
-xor ecx, ecx
-L30:
-mov cx, word [ebp + gtables + 3848]
-test word [ecx + gtables], 1
-je L31
-
-push ebp
-call cfcn_45511b
-add esp, 4
-
-L31:
-add ebp, 2
-dec edx
-jne L30
-xor ebx, ebx
-L32:
-shr word [ebx + gtables], 1
-add ebx, 2
-cmp ebx, 0x502 ; 1282
-jb L32
-
-ret
diff --git a/csrc/mkf_asm_data.c b/csrc/mkf_asm_data.c
index b01dd42..3a4457b 100644
--- a/csrc/mkf_asm_data.c
+++ b/csrc/mkf_asm_data.c
@@ -1,4 +1,5 @@
#include <stdint.h>
+#include <stdlib.h>
const uint8_t table_483430[256] = {
0x3f, 0x0b, 0x17, 0x03, 0x2f, 0x0a, 0x16, 0x00, 0x2e, 0x09,
@@ -572,3 +573,23 @@ void cfcn_45511b(uint32_t ebx)
ebx = gtables.tab3[ebx / 2];
} while (ebx);
}
+
+void cfcn_004550cc()
+{
+ uint16_t cx;
+ size_t ebp = 0;
+ int edx = 0x141;
+ do {
+ cx = gtables.tab4[ebp/2]; /* 0x4856c4 + 0x141 * 2 = 0x485946 */
+ /* assert((cx % 2) == 0) */
+ if (gtables.tab1[cx/2] & 1) {
+ cfcn_45511b(ebp);
+ }
+ ebp += 2;
+ edx--;
+ } while(edx);
+ for (size_t i = 0; i < 0x502; i += 2) {
+ gtables.tab1[i/2] >>= 1;
+ }
+ return;
+}