re_behaviour: the emulator check for given functions of a worktree

This commit is contained in:
KeelrLeek committed 2026-10-05 16:54:58 -05:00
1 parent 0d764799a7
commit 5211cee9c4
3 files changed
+49 -3

No files matched your search

+14
View File
@@ -539,6 +539,20 @@ def re_match_program(targets: str = "", decomp: str | None = None) -> dict:
raise ToolError(str(error)) from None
@mcp.tool()
def re_behaviour(targets: str, decomp: str | None = None) -> list:
"""The emulator check: run the game's own machine code and your compiled C of each function (up to 30
addresses; decomp = your worktree) from the same registers, stack and memory, 12 trials each, and compare the
result, every memory write, the calls made and their arguments. verdict 'same' means it behaves like the game;
'differs' gives the first divergence in words (e.g. 'returns 1 vs 0', 'original writes 0x86BAC0=5, ours 4');
'weak' means no trial ran to the end in both. Use it before submitting anything that does not byte-match."""
try:
from .reverse import behaviour_check
return behaviour_check(harbor().project.reverse, targets, decomp)
except (HarborError, projects.ProjectError) as error:
raise ToolError(str(error)) from None
@mcp.tool()
def re_similar(target: str, k: int = 10, min_score: float = 0.7) -> dict:
"""Functions whose instructions look like this one (normalized: addresses blanked, registers and small