commit 5d656f43c7fa66db213a9c33a8d029d44ac7d255
parent 44b20dcaf931a1426d56ccb332ebd07b7e423a1b
Author: anon <anon@example.com>
Date: Sat, 17 Oct 2026 02:08:22 +0000
Simplify terrain corner queries and retain WASM symbols
Diffstat:
2 files changed, 101 insertions(+), 391 deletions(-)
diff --git a/src/Makefile.wasm b/src/Makefile.wasm
@@ -15,7 +15,7 @@ all: build/wasm/web/game.js build/wasm/web/game.wasm build/wasm/web/index.html
build/wasm/web/game.js build/wasm/web/game.wasm &: $(OBJECTS) runtime/browser_network.js runtime/browser_host.js runtime/browser_audio.js ../local/wasm/deps/lib/libsndfile.a ../local/wasm/deps/lib/libmp3lame.a Makefile.wasm
@mkdir -p $(@D)
- $(CC) $(CFLAGS) $(PORT_FLAGS) $(OBJECTS) ../local/wasm/deps/lib/libsndfile.a ../local/wasm/deps/lib/libmp3lame.a -sUSE_MPG123=1 -sWASMFS -sPROXY_TO_PTHREAD -sPTHREAD_POOL_SIZE=8 -sALLOW_BLOCKING_ON_MAIN_THREAD=0 -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sOFFSCREENCANVAS_SUPPORT -sJSPI -sALLOW_MEMORY_GROWTH -sINITIAL_MEMORY=268435456 -sSTACK_SIZE=8388608 --js-library runtime/browser_network.js --js-library runtime/browser_host.js --js-library runtime/browser_audio.js -o build/wasm/web/game.js
+ $(CC) $(CFLAGS) $(PORT_FLAGS) $(OBJECTS) ../local/wasm/deps/lib/libsndfile.a ../local/wasm/deps/lib/libmp3lame.a -sUSE_MPG123=1 -sWASMFS -sPROXY_TO_PTHREAD -sPTHREAD_POOL_SIZE=8 -sALLOW_BLOCKING_ON_MAIN_THREAD=0 -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sOFFSCREENCANVAS_SUPPORT -sJSPI -sALLOW_MEMORY_GROWTH -sINITIAL_MEMORY=268435456 -sSTACK_SIZE=8388608 --js-library runtime/browser_network.js --js-library runtime/browser_host.js --js-library runtime/browser_audio.js --emit-symbol-map -o build/wasm/web/game.js
build/wasm/web/index.html: browser/index.html
@mkdir -p $(@D)
diff --git a/src/game/llr.dll/lifted-0021.c b/src/game/llr.dll/lifted-0021.c
@@ -7707,399 +7707,109 @@ L_38038348:
RECOMP_REGS_OUT();
}
-void sub_38038370(void) {
- int _fpu_cmp = 0;
- uint32_t _cf = 0;
- int _df = 1;
- uint32_t _flag_k = FK_NONE;
- uint32_t _flag_a = 0, _flag_b = 0;
- uint32_t _itail_tgt = 0;
- double height;
+void sub_38038370(void)
+{
+ uint32_t _cf = 0, _flag_k = FK_NONE, _flag_a = 0, _flag_b = 0;
RECOMP_REGS_LOCALS
RECOMP_ENTER(0x38038370u);
-
-L_38038370:
- PUSH32(esp, ebp); /* 0x38038370: push ebp */
- ebp = esp; /* 0x38038371: mov ebp, esp */
- _flag_a = (uint32_t)(esp); _flag_b = (uint32_t)(8);
- _cf = (uint32_t)CMP_B(_flag_a, _flag_b);
- esp = esp - 8; /* 0x38038373: sub esp, 8 */
- _flag_k = FK_CMP;
- PUSH32(esp, ebx); /* 0x38038376: push ebx */
- PUSH32(esp, esi); /* 0x38038377: push esi */
- esi = ecx; /* 0x38038378: mov esi, ecx */
- eax = MEM32(esi + 0xC); /* 0x3803837A: mov eax, dword ptr [esi + 0xc] */
- /* llr.dll!n3Tilemap_t::GetTileCornerPoints: preserve x87 spill rounding. */
- {
- double spacing = *(float *)ADDR(eax + 0x8264);
- eax = MEM32(ebp + 0x10);
- float near_x = (float)((double)(int32_t)MEM32(ebp + 8) * spacing);
- PUSH32(esp, edi);
- *(float *)ADDR(ebp - 4) = near_x;
- double near_z = (double)(int32_t)MEM32(ebp + 12) * spacing;
- *(float *)ADDR(eax) = *(float *)ADDR(ebp - 4);
- *(float *)ADDR(eax + 8) = (float)near_z;
-
- eax = MEM32(ebp + 0x14);
- double far_x = (double)*(float *)ADDR(ebp - 4) + spacing;
- *(float *)ADDR(eax) = (float)far_x;
- *(float *)ADDR(eax + 8) = (float)near_z;
- eax = MEM32(ebp + 0x18);
- *(float *)ADDR(eax) = (float)far_x;
- double far_z = spacing + near_z;
- *(float *)ADDR(eax + 8) = (float)far_z;
- eax = MEM32(ebp + 0x1c);
- *(float *)ADDR(eax) = *(float *)ADDR(ebp - 4);
- *(float *)ADDR(eax + 8) = (float)far_z;
-
- /* Four temporary stack slots are consumed; live lower slots survive. */
- memset(_st + 4, 0, 4 * sizeof(*_st));
- memset(g_st_i64 + 4, 0, 4 * sizeof(*g_st_i64));
+ uint32_t stack = esp, tilemap = ecx;
+ uint32_t saved_ebx = ebx, saved_esi = esi, saved_edi = edi, saved_ebp = ebp;
+ uint32_t data = MEM32(tilemap + 12);
+ uint32_t x = MEM32(stack + 4), z = MEM32(stack + 8);
+ uint32_t corners[4] = {MEM32(stack + 12), MEM32(stack + 16),
+ MEM32(stack + 20), MEM32(stack + 24)};
+
+ /* llr.dll!n3Tilemap_t::GetTileCornerPoints keeps the near-X float spill. */
+ double spacing = *(float *)ADDR(data + 0x8264);
+ float near_x = (float)((double)(int32_t)x * spacing);
+ double near_z = (double)(int32_t)z * spacing;
+ double far_x = (double)near_x + spacing;
+ double far_z = spacing + near_z;
+ *(float *)ADDR(corners[0]) = near_x;
+ *(float *)ADDR(corners[0] + 8) = (float)near_z;
+ *(float *)ADDR(corners[1]) = (float)far_x;
+ *(float *)ADDR(corners[1] + 8) = (float)near_z;
+ *(float *)ADDR(corners[2]) = (float)far_x;
+ *(float *)ADDR(corners[2] + 8) = (float)far_z;
+ *(float *)ADDR(corners[3]) = near_x;
+ *(float *)ADDR(corners[3] + 8) = (float)far_z;
+ memset(_st + 4, 0, 4 * sizeof(*_st));
+ memset(g_st_i64 + 4, 0, 4 * sizeof(*g_st_i64));
+
+ if (!MEM32(data + 0x18)) {
+ /* Outdoor corners use clamped far indices and the ground-data imports. */
+ uint32_t far_ix = x + 1, far_iz = z + 1;
+ uint32_t max_x = MEM32(data + 0x825c) - 1;
+ uint32_t max_z = MEM32(data + 0x8260) - 1;
+ if ((int32_t)far_ix >= (int32_t)max_x) far_ix = max_x;
+ if ((int32_t)far_iz >= (int32_t)max_z) far_iz = max_z;
+ uint32_t ix[4] = {x, far_ix, far_ix, x};
+ uint32_t iz[4] = {z, z, far_iz, far_iz};
+ for (unsigned i = 0; i < 4; ++i) {
+ data = MEM32(tilemap + 12);
+ uint32_t ground = MEM32(data + 0x8258);
+ double scale = *(float *)ADDR(data + 0x1c);
+ if (!(i & 1)) {
+ unsigned full_height = MEM8(ground + 0x29);
+ unsigned shift = MEM32(ground + 0x3c) & 31;
+ uint32_t mask = MEM32(ground + 0x40);
+ PUSH32(esp, iz[i] & mask);
+ PUSH32(esp, ix[i] & mask);
+ PUSH32(esp, (uint32_t)((int32_t)iz[i] >> shift));
+ PUSH32(esp, (uint32_t)((int32_t)ix[i] >> shift));
+ ecx = ground;
+ RECOMP_ICALL(MEM32(0x3804E24C));
+ RECOMP_FLAGS_IN();
+ PUSH32(esp, eax);
+ ecx = ground;
+ RECOMP_ICALL(MEM32(0x3804E248));
+ RECOMP_FLAGS_IN();
+ if (!full_height) eax = (eax >> 8) & 255;
+ scale = *(float *)ADDR(MEM32(tilemap + 12) + 0x1c);
+ } else {
+ PUSH32(esp, iz[i]);
+ PUSH32(esp, ix[i]);
+ ecx = ground;
+ RECOMP_ICALL(MEM32(0x3804E244));
+ RECOMP_FLAGS_IN();
+ }
+ eax &= 0xffff;
+ *(float *)ADDR(corners[i] + 4) = (float)((double)eax * scale);
+ _st[7] = 0;
+ g_st_i64[7] = 0;
+ }
+ ecx = corners[3];
+ uint32_t parity = (~z ^ x) & 255;
+ SET_LO8(eax, parity & 1);
+ _flag_a = parity << 24;
+ _flag_b = 1u << 24;
+ _flag_k = FK_NARROW(FK_TEST, 24);
+ _cf = 0;
+ } else {
+ /* Dungeon corner heights are bytes in a contiguous tile grid. */
+ uint32_t near_ix = x - 1, near_iz = z - 1;
+ if ((int32_t)near_ix <= 0) near_ix = 0;
+ if ((int32_t)near_iz <= 0) near_iz = 0;
+ uint32_t ix[4] = {near_ix, x, x, near_ix};
+ uint32_t iz[4] = {near_iz, near_iz, z, z};
+ for (unsigned i = 0; i < 4; ++i) {
+ data = MEM32(tilemap + 12);
+ double scale = *(float *)ADDR(data + 0x1c);
+ uint32_t index = MEM32(data + 0x825c) * iz[i] + ix[i];
+ eax = MEM32(data + 0x228);
+ ecx = MEM8(eax + index);
+ *(float *)ADDR(corners[i] + 4) = (float)((double)ecx * scale);
+ }
+ edx = corners[3];
+ SET_LO8(eax, 1);
+ _flag_a = _flag_b = _cf = 0;
+ _flag_k = FK_TEST;
}
- RECOMP_ICALL(0x38039DC0u); /* 0x380383C2: call 0x38039dc0 */ /* not lifted */
- RECOMP_FLAGS_IN();
- /* test LO8(eax), LO8(eax) */ /* 0x380383C7: test al, al */
- _flag_a = (uint32_t)(LO8(eax)) << 24; _flag_b = (uint32_t)(LO8(eax)) << 24;
- _cf = 0;
- _flag_k = FK_NARROW(FK_TEST, 24);
- if (TEST_Z(_flag_a, _flag_b)) goto L_3803856C; /* 0x380383C9: je 0x3803856c */
-L_380383CF:
- ecx = esi; /* 0x380383CF: mov ecx, esi */
- RECOMP_ICALL(0x38039DA0u); /* 0x380383D1: call 0x38039da0 */ /* not lifted */
- RECOMP_FLAGS_IN();
- ecx = MEM32(ebp + 0x8); /* 0x380383D6: mov ecx, dword ptr [ebp + 8] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(1);
- eax = eax - 1; /* 0x380383D9: dec eax */
- _flag_k = FK_DEC;
- _flag_a = (uint32_t)(ecx); _flag_b = (uint32_t)(1);
- ecx = ecx + 1; /* 0x380383DA: inc ecx */
- _flag_k = FK_INC;
- /* cmp ecx, eax */ /* 0x380383DB: cmp ecx, eax */
- _flag_a = (uint32_t)(ecx); _flag_b = (uint32_t)(eax);
- _cf = (uint32_t)CMP_B(_flag_a, _flag_b);
- _flag_k = FK_CMP;
- MEM32(ebp + (-0x4)) = ecx; /* 0x380383DD: mov dword ptr [ebp - 4], ecx */
- if (CMP_L(_flag_a, _flag_b)) goto L_380383E5; /* 0x380383E0: jl 0x380383e5 */
-L_380383E2:
- MEM32(ebp + (-0x4)) = eax; /* 0x380383E2: mov dword ptr [ebp - 4], eax */
-L_380383E5:
- ecx = esi; /* 0x380383E5: mov ecx, esi */
- RECOMP_ICALL(0x38039DB0u); /* 0x380383E7: call 0x38039db0 */ /* not lifted */
- RECOMP_FLAGS_IN();
- ebx = MEM32(ebp + 0xC); /* 0x380383EC: mov ebx, dword ptr [ebp + 0xc] */
- ecx = ebx + 0x1; /* 0x380383EF: lea ecx, [ebx + 1] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(1);
- eax = eax - 1; /* 0x380383F2: dec eax */
- _flag_k = FK_DEC;
- /* cmp ecx, eax */ /* 0x380383F3: cmp ecx, eax */
- _flag_a = (uint32_t)(ecx); _flag_b = (uint32_t)(eax);
- _cf = (uint32_t)CMP_B(_flag_a, _flag_b);
- _flag_k = FK_CMP;
- MEM32(ebp + 0xC) = ecx; /* 0x380383F5: mov dword ptr [ebp + 0xc], ecx */
- if (CMP_L(_flag_a, _flag_b)) goto L_380383FD; /* 0x380383F8: jl 0x380383fd */
-L_380383FA:
- MEM32(ebp + 0xC) = eax; /* 0x380383FA: mov dword ptr [ebp + 0xc], eax */
-L_380383FD:
- edx = MEM32(esi + 0xC); /* 0x380383FD: mov edx, dword ptr [esi + 0xc] */
- edi = MEM32(edx + 0x8258); /* 0x38038400: mov edi, dword ptr [edx + 0x8258] */
- SET_LO8(eax, MEM8(edi + 0x29)); /* 0x38038406: mov al, byte ptr [edi + 0x29] */
- ecx = MEM32(edi + 0x3C); /* 0x38038409: mov ecx, dword ptr [edi + 0x3c] */
- /* test LO8(eax), LO8(eax) */ /* 0x3803840C: test al, al */
- _flag_a = (uint32_t)(LO8(eax)) << 24; _flag_b = (uint32_t)(LO8(eax)) << 24;
- _cf = 0;
- _flag_k = FK_NARROW(FK_TEST, 24);
- eax = MEM32(edi + 0x40); /* 0x3803840E: mov eax, dword ptr [edi + 0x40] */
- edx = eax; /* 0x38038411: mov edx, eax */
- if (TEST_Z(_flag_a, _flag_b)) goto L_38038439; /* 0x38038413: je 0x38038439 */
-L_38038415:
- _flag_a = (uint32_t)(edx); _flag_b = (uint32_t)(ebx);
- edx = edx & ebx; /* 0x38038415: and edx, ebx */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, edx); /* 0x38038417: push edx */
- edx = MEM32(ebp + 0x8); /* 0x38038418: mov edx, dword ptr [ebp + 8] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(edx);
- eax = eax & edx; /* 0x3803841B: and eax, edx */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, eax); /* 0x3803841D: push eax */
- eax = ebx; /* 0x3803841E: mov eax, ebx */
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((eax) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((eax) >> 31) & 1u)); /* 0x38038420: sar eax, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- eax = (uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31));
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((edx) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((edx) >> 31) & 1u)); /* 0x38038422: sar edx, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- edx = (uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31));
- ecx = edi; /* 0x38038424: mov ecx, edi */
- PUSH32(esp, eax); /* 0x38038426: push eax */
- PUSH32(esp, edx); /* 0x38038427: push edx */
- RECOMP_ICALL(MEM32(0x3804E24C)); /* 0x38038428: call dword ptr [0x3804e24c] */
- RECOMP_FLAGS_IN();
- PUSH32(esp, eax); /* 0x3803842E: push eax */
- ecx = edi; /* 0x3803842F: mov ecx, edi */
- RECOMP_ICALL(MEM32(0x3804E248)); /* 0x38038431: call dword ptr [0x3804e248] */
- RECOMP_FLAGS_IN();
- goto L_38038461; /* 0x38038437: jmp 0x38038461 */
-L_38038439:
- _flag_a = (uint32_t)(edx); _flag_b = (uint32_t)(ebx);
- edx = edx & ebx; /* 0x38038439: and edx, ebx */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, edx); /* 0x3803843B: push edx */
- edx = MEM32(ebp + 0x8); /* 0x3803843C: mov edx, dword ptr [ebp + 8] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(edx);
- eax = eax & edx; /* 0x3803843F: and eax, edx */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, eax); /* 0x38038441: push eax */
- eax = ebx; /* 0x38038442: mov eax, ebx */
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((eax) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((eax) >> 31) & 1u)); /* 0x38038444: sar eax, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- eax = (uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31));
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((edx) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((edx) >> 31) & 1u)); /* 0x38038446: sar edx, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- edx = (uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31));
- ecx = edi; /* 0x38038448: mov ecx, edi */
- PUSH32(esp, eax); /* 0x3803844A: push eax */
- PUSH32(esp, edx); /* 0x3803844B: push edx */
- RECOMP_ICALL(MEM32(0x3804E24C)); /* 0x3803844C: call dword ptr [0x3804e24c] */
- RECOMP_FLAGS_IN();
- PUSH32(esp, eax); /* 0x38038452: push eax */
- ecx = edi; /* 0x38038453: mov ecx, edi */
- RECOMP_ICALL(MEM32(0x3804E248)); /* 0x38038455: call dword ptr [0x3804e248] */
- RECOMP_FLAGS_IN();
- _flag_a = (uint32_t)(0); _flag_b = (uint32_t)(0);
- ecx = 0; /* 0x3803845B: xor ecx, ecx */
- _cf = 0;
- _flag_k = FK_TEST;
- SET_LO8(ecx, HI8(eax)); /* 0x3803845D: mov cl, ah */
- eax = ecx; /* 0x3803845F: mov eax, ecx */
-L_38038461:
- edx = MEM32(esi + 0xC); /* 0x38038461: mov edx, dword ptr [esi + 0xc] */
- height = *(float *)ADDR(edx + 0x1C); /* 0x38038464: fld dword ptr [edx + 0x1c] */
- edx = MEM32(ebp + (-0x4)); /* 0x38038467: mov edx, dword ptr [ebp - 4] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(0xFFFFu);
- eax = eax & 0xFFFFu; /* 0x3803846A: and eax, 0xffff */
- _cf = 0;
- _flag_k = FK_TEST;
- MEM32(ebp + (-0x8)) = eax; /* 0x3803846F: mov dword ptr [ebp - 8], eax */
- height *= (double)(int32_t)MEM32(ebp - 8); /* 0x38038472: fimul dword ptr [ebp - 8] */
- eax = MEM32(ebp + 0x10); /* 0x38038475: mov eax, dword ptr [ebp + 0x10] */
- PUSH32(esp, ebx); /* 0x38038478: push ebx */
- PUSH32(esp, edx); /* 0x38038479: push edx */
- { float _v = (float)height; _st[7] = 0; g_st_i64[7] = 0; *(float*)ADDR(eax + 0x4) = _v; } /* 0x3803847A: fstp dword ptr [eax + 4] */
- eax = MEM32(esi + 0xC); /* 0x3803847D: mov eax, dword ptr [esi + 0xc] */
- ecx = MEM32(eax + 0x1C); /* 0x38038480: mov ecx, dword ptr [eax + 0x1c] */
- MEM32(ebp + (-0x8)) = ecx; /* 0x38038483: mov dword ptr [ebp - 8], ecx */
- ecx = MEM32(eax + 0x8258); /* 0x38038486: mov ecx, dword ptr [eax + 0x8258] */
- RECOMP_ICALL(MEM32(0x3804E244)); /* 0x3803848C: call dword ptr [0x3804e244] */
- RECOMP_FLAGS_IN();
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(0xFFFFu);
- eax = eax & 0xFFFFu; /* 0x38038492: and eax, 0xffff */
- _cf = 0;
- _flag_k = FK_TEST;
- MEM32(ebp + 0x10) = eax; /* 0x38038497: mov dword ptr [ebp + 0x10], eax */
- height = (double)(int32_t)MEM32(ebp + 0x10); /* 0x3803849A: fild dword ptr [ebp + 0x10] */
- eax = MEM32(ebp + 0x14); /* 0x3803849D: mov eax, dword ptr [ebp + 0x14] */
- height *= (double)*(float *)ADDR(ebp - 8); /* 0x380384A0: fmul dword ptr [ebp - 8] */
- { float _v = (float)height; _st[7] = 0; g_st_i64[7] = 0; *(float*)ADDR(eax + 0x4) = _v; } /* 0x380384A3: fstp dword ptr [eax + 4] */
- ecx = MEM32(esi + 0xC); /* 0x380384A6: mov ecx, dword ptr [esi + 0xc] */
- edi = MEM32(ecx + 0x8258); /* 0x380384A9: mov edi, dword ptr [ecx + 0x8258] */
- SET_LO8(eax, MEM8(edi + 0x29)); /* 0x380384AF: mov al, byte ptr [edi + 0x29] */
- ecx = MEM32(edi + 0x3C); /* 0x380384B2: mov ecx, dword ptr [edi + 0x3c] */
- /* test LO8(eax), LO8(eax) */ /* 0x380384B5: test al, al */
- _flag_a = (uint32_t)(LO8(eax)) << 24; _flag_b = (uint32_t)(LO8(eax)) << 24;
- _cf = 0;
- _flag_k = FK_NARROW(FK_TEST, 24);
- eax = MEM32(edi + 0x40); /* 0x380384B7: mov eax, dword ptr [edi + 0x40] */
- edx = eax; /* 0x380384BA: mov edx, eax */
- if (TEST_Z(_flag_a, _flag_b)) goto L_380384E4; /* 0x380384BC: je 0x380384e4 */
-L_380384BE:
- _flag_a = (uint32_t)(edx); _flag_b = (uint32_t)(MEM32(ebp + 0xC));
- edx = edx & MEM32(ebp + 0xC); /* 0x380384BE: and edx, dword ptr [ebp + 0xc] */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, edx); /* 0x380384C1: push edx */
- edx = MEM32(ebp + (-0x4)); /* 0x380384C2: mov edx, dword ptr [ebp - 4] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(edx);
- eax = eax & edx; /* 0x380384C5: and eax, edx */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, eax); /* 0x380384C7: push eax */
- eax = MEM32(ebp + 0xC); /* 0x380384C8: mov eax, dword ptr [ebp + 0xc] */
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((eax) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((eax) >> 31) & 1u)); /* 0x380384CB: sar eax, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- eax = (uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31));
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((edx) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((edx) >> 31) & 1u)); /* 0x380384CD: sar edx, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- edx = (uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31));
- ecx = edi; /* 0x380384CF: mov ecx, edi */
- PUSH32(esp, eax); /* 0x380384D1: push eax */
- PUSH32(esp, edx); /* 0x380384D2: push edx */
- RECOMP_ICALL(MEM32(0x3804E24C)); /* 0x380384D3: call dword ptr [0x3804e24c] */
- RECOMP_FLAGS_IN();
- PUSH32(esp, eax); /* 0x380384D9: push eax */
- ecx = edi; /* 0x380384DA: mov ecx, edi */
- RECOMP_ICALL(MEM32(0x3804E248)); /* 0x380384DC: call dword ptr [0x3804e248] */
- RECOMP_FLAGS_IN();
- goto L_38038511; /* 0x380384E2: jmp 0x38038511 */
-L_380384E4:
- _flag_a = (uint32_t)(edx); _flag_b = (uint32_t)(MEM32(ebp + 0xC));
- edx = edx & MEM32(ebp + 0xC); /* 0x380384E4: and edx, dword ptr [ebp + 0xc] */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, edx); /* 0x380384E7: push edx */
- edx = MEM32(ebp + (-0x4)); /* 0x380384E8: mov edx, dword ptr [ebp - 4] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(edx);
- eax = eax & edx; /* 0x380384EB: and eax, edx */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, eax); /* 0x380384ED: push eax */
- eax = MEM32(ebp + 0xC); /* 0x380384EE: mov eax, dword ptr [ebp + 0xc] */
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((eax) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((eax) >> 31) & 1u)); /* 0x380384F1: sar eax, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- eax = (uint32_t)((int32_t)eax >> ((LO8(ecx)) & 31));
- ecx = MEM32(edi + 0x3C); /* 0x380384F3: mov ecx, dword ptr [edi + 0x3c] */
- if (((LO8(ecx)) & 31)) _cf = ((((LO8(ecx)) & 31)) <= 32 ? (((edx) >> ((((LO8(ecx)) & 31)) - 1)) & 1u) : (((edx) >> 31) & 1u)); /* 0x380384F6: sar edx, cl */
- if (((LO8(ecx)) & 31)) { _flag_a = recomp_flags_pack(((uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31))), _cf, 0, 0); _flag_b = 0; _flag_k = FK_EFLAGS; }
- edx = (uint32_t)((int32_t)edx >> ((LO8(ecx)) & 31));
- ecx = edi; /* 0x380384F8: mov ecx, edi */
- PUSH32(esp, eax); /* 0x380384FA: push eax */
- PUSH32(esp, edx); /* 0x380384FB: push edx */
- RECOMP_ICALL(MEM32(0x3804E24C)); /* 0x380384FC: call dword ptr [0x3804e24c] */
- RECOMP_FLAGS_IN();
- PUSH32(esp, eax); /* 0x38038502: push eax */
- ecx = edi; /* 0x38038503: mov ecx, edi */
- RECOMP_ICALL(MEM32(0x3804E248)); /* 0x38038505: call dword ptr [0x3804e248] */
- RECOMP_FLAGS_IN();
- _flag_a = (uint32_t)(0); _flag_b = (uint32_t)(0);
- ecx = 0; /* 0x3803850B: xor ecx, ecx */
- _cf = 0;
- _flag_k = FK_TEST;
- SET_LO8(ecx, HI8(eax)); /* 0x3803850D: mov cl, ah */
- eax = ecx; /* 0x3803850F: mov eax, ecx */
-L_38038511:
- edx = MEM32(esi + 0xC); /* 0x38038511: mov edx, dword ptr [esi + 0xc] */
- height = *(float *)ADDR(edx + 0x1C); /* 0x38038514: fld dword ptr [edx + 0x1c] */
- edx = MEM32(ebp + 0xC); /* 0x38038517: mov edx, dword ptr [ebp + 0xc] */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(0xFFFFu);
- eax = eax & 0xFFFFu; /* 0x3803851A: and eax, 0xffff */
- _cf = 0;
- _flag_k = FK_TEST;
- MEM32(ebp + 0x10) = eax; /* 0x3803851F: mov dword ptr [ebp + 0x10], eax */
- height *= (double)(int32_t)MEM32(ebp + 0x10); /* 0x38038522: fimul dword ptr [ebp + 0x10] */
- eax = MEM32(ebp + 0x18); /* 0x38038525: mov eax, dword ptr [ebp + 0x18] */
- PUSH32(esp, edx); /* 0x38038528: push edx */
- { float _v = (float)height; _st[7] = 0; g_st_i64[7] = 0; *(float*)ADDR(eax + 0x4) = _v; } /* 0x38038529: fstp dword ptr [eax + 4] */
- esi = MEM32(esi + 0xC); /* 0x3803852C: mov esi, dword ptr [esi + 0xc] */
- ecx = MEM32(esi + 0x1C); /* 0x3803852F: mov ecx, dword ptr [esi + 0x1c] */
- eax = MEM32(ebp + 0x8); /* 0x38038532: mov eax, dword ptr [ebp + 8] */
- MEM32(ebp + 0x10) = ecx; /* 0x38038535: mov dword ptr [ebp + 0x10], ecx */
- ecx = MEM32(esi + 0x8258); /* 0x38038538: mov ecx, dword ptr [esi + 0x8258] */
- PUSH32(esp, eax); /* 0x3803853E: push eax */
- RECOMP_ICALL(MEM32(0x3804E244)); /* 0x3803853F: call dword ptr [0x3804e244] */
- RECOMP_FLAGS_IN();
- ecx = MEM32(ebp + 0x1C); /* 0x38038545: mov ecx, dword ptr [ebp + 0x1c] */
- SET_LO8(ebx, ~LO8(ebx)); /* 0x38038548: not bl */
- edi = POP32_VAL(esp); /* 0x3803854A: pop edi */
- esi = POP32_VAL(esp); /* 0x3803854B: pop esi */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(0xFFFFu);
- eax = eax & 0xFFFFu; /* 0x3803854C: and eax, 0xffff */
- _cf = 0;
- _flag_k = FK_TEST;
- MEM32(ebp + 0xC) = eax; /* 0x38038551: mov dword ptr [ebp + 0xc], eax */
- height = (double)(int32_t)MEM32(ebp + 0xC); /* 0x38038554: fild dword ptr [ebp + 0xc] */
- height *= (double)*(float *)ADDR(ebp + 0x10); /* 0x38038557: fmul dword ptr [ebp + 0x10] */
- { float _v = (float)height; _st[7] = 0; g_st_i64[7] = 0; *(float*)ADDR(ecx + 0x4) = _v; } /* 0x3803855A: fstp dword ptr [ecx + 4] */
- _flag_a = (uint32_t)((LO8(ebx) ^ MEM8(ebp + 0x8))) << 24; _flag_b = (uint32_t)((LO8(ebx) ^ MEM8(ebp + 0x8))) << 24;
- SET_LO8(ebx, LO8(ebx) ^ MEM8(ebp + 0x8)); /* 0x3803855D: xor bl, byte ptr [ebp + 8] */
- _cf = 0;
- _flag_k = FK_NARROW(FK_TEST, 24);
- _flag_a = (uint32_t)(LO8(ebx)) << 24; _flag_b = (uint32_t)(1) << 24;
- SET_LO8(ebx, LO8(ebx) & 1); /* 0x38038560: and bl, 1 */
- _cf = 0;
- _flag_k = FK_NARROW(FK_TEST, 24);
- SET_LO8(eax, LO8(ebx)); /* 0x38038563: mov al, bl */
- ebx = POP32_VAL(esp); /* 0x38038565: pop ebx */
- esp = ebp; /* 0x38038566: mov esp, ebp */
- ebp = POP32_VAL(esp); /* 0x38038568: pop ebp */
- RECOMP_FLAGS_OUT(); esp += 28; { RECOMP_REGS_OUT(); return; } /* 0x38038569: ret 0x18 */
-L_3803856C:
- edi = MEM32(ebp + 0x8); /* 0x3803856C: mov edi, dword ptr [ebp + 8] */
- edx = MEM32(ebp + 0xC); /* 0x3803856F: mov edx, dword ptr [ebp + 0xc] */
- _flag_a = (uint32_t)(0); _flag_b = (uint32_t)(0);
- ebx = 0; /* 0x38038572: xor ebx, ebx */
- _cf = 0;
- _flag_k = FK_TEST;
- eax = edi + (-0x1); /* 0x38038574: lea eax, [edi - 1] */
- /* test eax, eax */ /* 0x38038577: test eax, eax */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(eax);
- _cf = 0;
- _flag_k = FK_TEST;
- SET_LO8(ebx, (TEST_LE(_flag_a, _flag_b)) ? 1 : 0); /* 0x38038579: setle bl */
- _flag_a = (uint32_t)(0); _flag_b = (uint32_t)(0);
- ecx = 0; /* 0x3803857C: xor ecx, ecx */
- _cf = 0;
- _flag_k = FK_TEST;
- _flag_a = (uint32_t)(ebx); _flag_b = (uint32_t)(1);
- ebx = ebx - 1; /* 0x3803857E: dec ebx */
- _flag_k = FK_DEC;
- _flag_a = (uint32_t)(ebx); _flag_b = (uint32_t)(eax);
- ebx = ebx & eax; /* 0x3803857F: and ebx, eax */
- _cf = 0;
- _flag_k = FK_TEST;
- eax = edx + (-0x1); /* 0x38038581: lea eax, [edx - 1] */
- /* test eax, eax */ /* 0x38038584: test eax, eax */
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(eax);
- _cf = 0;
- _flag_k = FK_TEST;
- SET_LO8(ecx, (TEST_LE(_flag_a, _flag_b)) ? 1 : 0); /* 0x38038586: setle cl */
- _flag_a = (uint32_t)(ecx); _flag_b = (uint32_t)(1);
- ecx = ecx - 1; /* 0x38038589: dec ecx */
- _flag_k = FK_DEC;
- _flag_a = (uint32_t)(eax); _flag_b = (uint32_t)(ecx);
- eax = eax & ecx; /* 0x3803858A: and eax, ecx */
- _cf = 0;
- _flag_k = FK_TEST;
- PUSH32(esp, eax); /* 0x3803858C: push eax */
- PUSH32(esp, ebx); /* 0x3803858D: push ebx */
- ecx = esi; /* 0x3803858E: mov ecx, esi */
- MEM32(ebp + 0x8) = eax; /* 0x38038590: mov dword ptr [ebp + 8], eax */
- RECOMP_ICALL(0x38039EC0u); /* 0x38038593: call 0x38039ec0 */ /* not lifted */
- RECOMP_FLAGS_IN();
- eax = MEM32(ebp + 0x8); /* 0x38038598: mov eax, dword ptr [ebp + 8] */
- edx = MEM32(ebp + 0x10); /* 0x3803859B: mov edx, dword ptr [ebp + 0x10] */
- PUSH32(esp, eax); /* 0x3803859E: push eax */
- { float _v = (float)fp_pop(); *(float*)ADDR(edx + 0x4) = _v; } /* 0x3803859F: fstp dword ptr [edx + 4] */
- PUSH32(esp, edi); /* 0x380385A2: push edi */
- ecx = esi; /* 0x380385A3: mov ecx, esi */
- RECOMP_ICALL(0x38039EC0u); /* 0x380385A5: call 0x38039ec0 */ /* not lifted */
- RECOMP_FLAGS_IN();
- edx = MEM32(ebp + 0xC); /* 0x380385AA: mov edx, dword ptr [ebp + 0xc] */
- ecx = MEM32(ebp + 0x14); /* 0x380385AD: mov ecx, dword ptr [ebp + 0x14] */
- PUSH32(esp, edx); /* 0x380385B0: push edx */
- { float _v = (float)fp_pop(); *(float*)ADDR(ecx + 0x4) = _v; } /* 0x380385B1: fstp dword ptr [ecx + 4] */
- PUSH32(esp, edi); /* 0x380385B4: push edi */
- ecx = esi; /* 0x380385B5: mov ecx, esi */
- RECOMP_ICALL(0x38039EC0u); /* 0x380385B7: call 0x38039ec0 */ /* not lifted */
- RECOMP_FLAGS_IN();
- ecx = MEM32(ebp + 0xC); /* 0x380385BC: mov ecx, dword ptr [ebp + 0xc] */
- eax = MEM32(ebp + 0x18); /* 0x380385BF: mov eax, dword ptr [ebp + 0x18] */
- PUSH32(esp, ecx); /* 0x380385C2: push ecx */
- { float _v = (float)fp_pop(); *(float*)ADDR(eax + 0x4) = _v; } /* 0x380385C3: fstp dword ptr [eax + 4] */
- PUSH32(esp, ebx); /* 0x380385C6: push ebx */
- ecx = esi; /* 0x380385C7: mov ecx, esi */
- RECOMP_ICALL(0x38039EC0u); /* 0x380385C9: call 0x38039ec0 */ /* not lifted */
- RECOMP_FLAGS_IN();
- edx = MEM32(ebp + 0x1C); /* 0x380385CE: mov edx, dword ptr [ebp + 0x1c] */
- edi = POP32_VAL(esp); /* 0x380385D1: pop edi */
- { float _v = (float)fp_pop(); *(float*)ADDR(edx + 0x4) = _v; } /* 0x380385D2: fstp dword ptr [edx + 4] */
- esi = POP32_VAL(esp); /* 0x380385D5: pop esi */
- SET_LO8(eax, 1); /* 0x380385D6: mov al, 1 */
- ebx = POP32_VAL(esp); /* 0x380385D8: pop ebx */
- esp = ebp; /* 0x380385D9: mov esp, ebp */
- ebp = POP32_VAL(esp); /* 0x380385DB: pop ebp */
- RECOMP_FLAGS_OUT(); esp += 28; { RECOMP_REGS_OUT(); return; } /* 0x380385DC: ret 0x18 */
+
+ /* Return the guest bool and preserve the thiscall callee-saved registers. */
+ ebx = saved_ebx; esi = saved_esi; edi = saved_edi; ebp = saved_ebp;
+ esp = stack + 28;
+ RECOMP_FLAGS_OUT();
RECOMP_REGS_OUT();
}