WIP: Temporary V35 Retail build #5
@@ -95,13 +95,25 @@ jobs:
|
|||||||
print("legacy MPQ gate repair verified")
|
print("legacy MPQ gate repair verified")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
- name: Verify Outline Lua ABI and native wrappers
|
- name: Verify Outline registration + Lua ABI
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
python3 - <<'PY'
|
python3 - <<'PY'
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
src = Path("src/outline/outline.zig").read_text()
|
|
||||||
|
main = Path("src/main.zig").read_text()
|
||||||
|
outline = Path("src/outline/outline.zig").read_text()
|
||||||
|
|
||||||
|
for required in (
|
||||||
|
'noinline fn registerFunction',
|
||||||
|
'0x704120',
|
||||||
|
'"{ecx}" (@intFromPtr(name))',
|
||||||
|
'"{edx}" (func_addr)',
|
||||||
|
):
|
||||||
|
if required not in main:
|
||||||
|
raise SystemExit(f"Missing explicit FrameScript registration ABI piece: {required}")
|
||||||
|
|
||||||
for required in (
|
for required in (
|
||||||
'luaGetTopNative',
|
'luaGetTopNative',
|
||||||
'luaIsStringNative',
|
'luaIsStringNative',
|
||||||
@@ -112,9 +124,10 @@ jobs:
|
|||||||
'0x6F39F0',
|
'0x6F39F0',
|
||||||
'callconv(.{ .x86_thiscall = .{} })',
|
'callconv(.{ .x86_thiscall = .{} })',
|
||||||
):
|
):
|
||||||
if required not in src:
|
if required not in outline:
|
||||||
raise SystemExit(f"Missing Outline ABI/native wrapper piece: {required}")
|
raise SystemExit(f"Missing Outline callback/native wrapper ABI piece: {required}")
|
||||||
print("outline.dll source: ECX callback ABI + native x86 register wrappers present")
|
|
||||||
|
print("source: FrameScript registration uses ECX/EDX; Outline callback receives L in ECX")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
objdump -d -Mintel zig-out/variants/outline.dll > /tmp/outline.disasm
|
objdump -d -Mintel zig-out/variants/outline.dll > /tmp/outline.disasm
|
||||||
@@ -124,42 +137,51 @@ jobs:
|
|||||||
|
|
||||||
lines = Path("/tmp/outline.disasm").read_text(errors="replace").splitlines()
|
lines = Path("/tmp/outline.disasm").read_text(errors="replace").splitlines()
|
||||||
|
|
||||||
# registerFunction("OutlineCommand", &outlineCommand) compiles near a
|
reg_block = None
|
||||||
# mov eax,0x704120 followed by push <callback>; push <name>; call eax.
|
|
||||||
callback = None
|
|
||||||
for i, line in enumerate(lines):
|
for i, line in enumerate(lines):
|
||||||
if re.search(r"mov\s+eax,0x0*704120\b", line, re.I):
|
if re.search(r"mov\s+eax,0x0*704120\b", line, re.I):
|
||||||
pushes = []
|
block = lines[max(0, i - 8):i + 4]
|
||||||
for nxt in lines[i + 1:i + 8]:
|
text = "\n".join(block)
|
||||||
m = re.search(r"\bpush\s+0x([0-9a-f]+)\b", nxt, re.I)
|
# The helper must explicitly prepare both fastcall registers
|
||||||
if m:
|
# before calling FrameScript_RegisterFunction.
|
||||||
pushes.append(int(m.group(1), 16))
|
if (re.search(r"mov\s+ecx,", text, re.I)
|
||||||
if len(pushes) >= 2:
|
and re.search(r"mov\s+edx,", text, re.I)
|
||||||
callback = pushes[0]
|
and re.search(r"call\s+eax\b", text, re.I)):
|
||||||
|
reg_block = text
|
||||||
break
|
break
|
||||||
|
|
||||||
if callback is None:
|
if reg_block is None:
|
||||||
raise SystemExit("Could not resolve OutlineCommand callback address from registration code")
|
raise SystemExit("BAD ABI: no FrameScript_RegisterFunction call with ECX=name and EDX=func found")
|
||||||
|
|
||||||
start = None
|
print("FrameScript_RegisterFunction machine code:")
|
||||||
addr_re = re.compile(rf"^\s*{callback:x}:\s", re.I)
|
print(reg_block)
|
||||||
|
|
||||||
|
# Regression guard for the exact broken V7/V8 codegen:
|
||||||
|
# mov eax,0x704120
|
||||||
|
# push callback
|
||||||
|
# push name
|
||||||
|
# call eax
|
||||||
for i, line in enumerate(lines):
|
for i, line in enumerate(lines):
|
||||||
if addr_re.search(line):
|
if re.search(r"mov\s+eax,0x0*704120\b", line, re.I):
|
||||||
start = i
|
after = "\n".join(lines[i:i + 5])
|
||||||
break
|
if len(re.findall(r"\bpush\s+", after, re.I)) >= 2:
|
||||||
if start is None:
|
raise SystemExit("BAD ABI: FrameScript registration still passes name/func on the stack")
|
||||||
raise SystemExit(f"Could not find callback body at 0x{callback:X}")
|
|
||||||
|
|
||||||
block = "\n".join(lines[start:start + 14])
|
# OutlineCommand must capture the Lua state from ECX. Search function
|
||||||
print(f"OutlineCommand callback @ 0x{callback:X}")
|
# prologues for the characteristic saved-ESI form and reject the old
|
||||||
print(block)
|
# [ebp+8] capture used by the cdecl experiment.
|
||||||
|
good_callback = False
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
if re.search(r"push\s+ebp\b", line, re.I):
|
||||||
|
block = "\n".join(lines[i:i + 12])
|
||||||
|
if re.search(r"mov\s+esi,ecx\b", block, re.I):
|
||||||
|
good_callback = True
|
||||||
|
break
|
||||||
|
|
||||||
if not re.search(r"mov\s+esi,ecx\b", block, re.I):
|
if not good_callback:
|
||||||
raise SystemExit("BAD ABI: OutlineCommand does not capture Lua state from ECX")
|
raise SystemExit("BAD ABI: no callback body captures Lua state from ECX")
|
||||||
if re.search(r"mov\s+esi,(?:DWORD PTR )?\[ebp\+0x8\]", block, re.I):
|
|
||||||
raise SystemExit("BAD ABI: OutlineCommand still reads Lua state from [ebp+8]")
|
|
||||||
|
|
||||||
print("outline.dll machine code: Lua state is captured from ECX")
|
print("outline.dll machine code: registration and callback ABIs verified")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
- name: Stage package
|
- name: Stage package
|
||||||
@@ -180,7 +202,7 @@ jobs:
|
|||||||
cat > package/README_TEST.txt <<'EOF'
|
cat > package/README_TEST.txt <<'EOF'
|
||||||
WeirdUtils Safe Standalone Core Test V8
|
WeirdUtils Safe Standalone Core Test V8
|
||||||
|
|
||||||
This build receives OutlineCommand's Lua state from ECX (x86 thiscall ABI) and keeps the native x86 register wrappers for WoW Lua calls.
|
This build fixes both x86 ABIs: FrameScript_RegisterFunction gets name in ECX + callback in EDX, and OutlineCommand receives the Lua state in ECX. WoW Lua API calls stay on explicit native register wrappers.
|
||||||
|
|
||||||
outline.dll
|
outline.dll
|
||||||
- Keeps only the Player_LoadScriptFunctions hook required to register OutlineCommand.
|
- Keeps only the Player_LoadScriptFunctions hook required to register OutlineCommand.
|
||||||
|
|||||||
Reference in New Issue
Block a user