diff options
-rw-r--r-- | csrc/mkf_asm.asm | 46 | ||||
-rw-r--r-- | csrc/mkf_asm_data.c | 27 |
2 files changed, 41 insertions, 32 deletions
diff --git a/csrc/mkf_asm.asm b/csrc/mkf_asm.asm index edf2b28..05a0154 100644 --- a/csrc/mkf_asm.asm +++ b/csrc/mkf_asm.asm @@ -7,6 +7,7 @@ extern gtables extern cfcn_45511b extern cfcn_004550cc extern cfcn_00455109 +extern cfcn_004551bb fcn_00455040: push ebp @@ -15,7 +16,7 @@ push ebx push ecx push esi push edi -sub esp, 4 +sub esp, 8 mov esi, data_483630 mov edi, gtables mov ecx, 0x463 ; 1123 @@ -26,7 +27,17 @@ xor edx, edx L0: -call fcn_004551bb +mov [esp+4], ebx +mov [esp], ecx +lea eax, [esp+4] +push eax +lea eax, [esp+4] +push eax +push esi +call cfcn_004551bb +add esp, 12 +mov ecx, [esp] +mov ebx, [esp+4] or bh, bh jne L1 @@ -66,39 +77,10 @@ pop esi mov ecx, ebp jmp L0 L2: -add esp, 4 +add esp, 8 pop edi pop esi pop ecx pop ebx pop ebp ret - - -fcn_004551bb: -mov ebx, 0x500 ; 1280 -L11: -mov bx, word [ebx + gtables + 1284] ; [0x484cc0:2]=0 -cmp bx, 0x502 ; 1282 -jae L10 -bt dword [esi], ecx -inc ecx -jae L11 -add bx, 2 -jmp L11 -L10: -sub ebx, 0x502 -push ebx -push ecx -push edi - -push ebx -call cfcn_00455109 -add esp, 4 - -pop edi -pop ecx -pop ebx -shr bx, 1 - -ret diff --git a/csrc/mkf_asm_data.c b/csrc/mkf_asm_data.c index 3f7a463..95b4364 100644 --- a/csrc/mkf_asm_data.c +++ b/csrc/mkf_asm_data.c @@ -1,5 +1,6 @@ #include <stdint.h> #include <stdlib.h> +#include <string.h> const uint8_t table_483430[256] = { 0x3f, 0x0b, 0x17, 0x03, 0x2f, 0x0a, 0x16, 0x00, 0x2e, 0x09, @@ -601,3 +602,29 @@ void cfcn_00455109(uint32_t ebx) } cfcn_45511b(ebx); } + +void cfcn_004551bb(uint16_t *esi, uint32_t *ecx, uint32_t *ebx) +{ + uint16_t bx = 0x500; + + while (1) { + bx = gtables.tab2[bx / 2]; + + if (bx >= 0x502) + break; + + uint32_t _ecx = *ecx; + uint16_t cf = esi[_ecx / 16] & (1 << (_ecx % 16)); + + (*ecx)++; + + if (cf) { + bx += 2; + } + } + + bx -= 0x502; + cfcn_00455109(bx); + bx >>= 1; + *ebx = bx; +} |