跳到正文
原文
Hacker News · 首页· davikr·· 2026-10-11AI 评分38

开发者分享用 AI agent 反编译第一人称射击游戏的方法

500B tokens later: Letting AI agents decompile a first-person shooter

AI 导读

开发者 davikr 分享用 AI agent 反编译第一人称射击游戏的方法:Agent A 为每个函数编写语义等价的代码和测试,交由 harness 在虚拟机中运行原函数与提交函数比对,仅当对 RAM 的读写序列一致且对原函数达到完整的行与分支覆盖时才接受。他认为除明确需要字节级一致的场景外,这种高层反编译比追求指令顺序、寄存器分配完全一致快得多,且产出更易读。

正文

Unless you explicitly need byte-matching decompilation, there are significantly faster ways to produce a decompilation/C which is functionally equivalent. I need to post about this. What's been working for me is that for every function, Agent A is tasked with writing some code which is semantically equivalent to the original assembly, but not necessarily exactly the same. Agent A also writes tests. Agent A submits the implementation of the function and tests to the harness for it to judge. The harness runs both the original function and the submitted function in a virtual machine/simulator/emulator (the tests define function inputs and starting state). The harness will only accept the implementation if 1) the read/write sequence to RAM is identical to the original function's, and 2) there must be complete line and branch coverage of the original function being decompiled.

I've found this to be robust for decompiling games, while giving the agents enough freedom to write code that is readable and not waste a ton of time making sure e.g. instruction ordering, register assignments, etc. are all exactly the same. For me, having byte-matching decompilation is only one way to produce a decompilation I know is faithful to the original. This "high-level decompilation" process I just described is something agents can do much more quickly.

来源:Hacker News · 首页 · news.ycombinator.com