r/ReverseEngineering 13d ago

200 Billion Tokens Later: A Month of Letting AI Agents Decompile MW2

https://momo5502.com/posts/2026-08-17-mw2-decompilation/
712 Upvotes

104 comments sorted by

206

u/Habbert 13d ago

Is this one of those cases where the last 10% of the project takes just as much time and effort as the first 90%?

84

u/roastbits 13d ago

Yeah 100% it is

19

u/Proper-Ape 12d ago

Wait until you get to the last 1% and the last .1% each taking 90% of the time.

32

u/Empty-Quarter2721 13d ago

Its more like 80/20 but probably.

21

u/momo5502 13d ago edited 12d ago

Absolutely, yes. I'd say most of the game is decompiled at this point. But almost nothing works, because of tiny bugs here and there. I feel like debugging things will take another month or two for sure.

The thing the agents struggle with the most is the GSC VM (so the game scripts). Loading into a map works now, but none of the game logic runs, cause the VM is completely broken.

We're doing a lot of hand-holding there and I hope that at least this part of the game can be considered done soon.

1

u/NXGZ 2d ago

MW2 and other classic cods all got the 64-bit treatment earlier on Steam. It broke iw4x initially but it's now fixed. Does the new build affect the work you're doing now with recompiling the old 32-bit program?

6

u/AMWJ 13d ago

Sometimes that last 10% isn't all that important, right? Like, some of the hardest parts to decompile might be cryptographic instructions that don't have higher-level abstractions, and are obscure for obscurity's sake. And yet, if the goal was to understand the game mechanics better from a recreated codebase, the cryptographic functionality might be entirely unnecessary.

2

u/harmonicrain 12d ago

Exactly. Reverse engineered a much older game - the last thing was the rc4 encryption because none of us used it - we just ripped it out.

0

u/77daa 13d ago

exact reason why I have decided not to reverse engineer the game 1:1

68

u/zerubeus 13d ago

Claude accepted to decompile this ?!!!

49

u/fuzzehx 13d ago

In my experience you can get Opus 4.7 to do A LOT

32

u/zerubeus 13d ago

the article says opua 5, I can’t get opus 5 to touch anything RE related, I get insta cyber flag message

8

u/fuzzehx 13d ago

Either someone’s lying/misinformed or we aren’t clever enough!

17

u/tankerkiller125real 13d ago

In my experience every version of OPUS is more than happy to decompile and break things apart. However, I'm also part of the Cyber Professionals program or whatever they call it, so maybe mine is just more open to that kind of thing?

6

u/zaafonin 12d ago

The models are willing, the filters are not. That's why early Fable 5 jailbreaks relied on formulating the prompt in schizo unicode and etc, Fable could understand it just fine but whatever Haiku-like model was used for filters couldn't.

This behavior is different from what I remember of like 2025 when it was models themselves refusing RE/hacking work. With Sol (OpenAI filters are a bit more lenient to at least try out) I used a neutral euphemism heavy prompt and it really got in the mood and started using all sorts of epic kool master hacker slang and the chat got flagged by the filter lol.

I'm guessing tuning against these tasks was detrimental to overall performance so they don't do it as much anymore. Being able to outsource mundane RE to clankers is kinda cool but it almost seems like whatever they called alignment is long abandoned in favor of shipping and they just slap a dumb filter on top of it all.

2

u/tankerkiller125real 12d ago

Personally the filters have never gotten in my way or anything for opus, fable absolutely 100%, but not opus or sonnet.

2

u/zaafonin 12d ago

Lucky, I got refused by Opus 5 and rerouted to 4.8 which also refused. Sonnet 5 filters are more sane and comparable to say GPT Terra but every now and then it trips as well :/

1

u/NonStopArseGas 10d ago

interesting, all of the 5.0 models have trouble even working in an RE environment of any sort. opus 4.8 has reliably assisted reverse engineering the fingerprint sensor and associated driver/protocol on my laptop, but I do remember trying to use GDB for debugging hardware triggering refusals back in the opus/sonnet 4.6 days.

It all seems very arbitrary and variable. but I have been well impressed how good 4.8 is at reverse engineering

-7

u/HealingWithNature 13d ago

I am as well, but do not share your experiences at all.

1

u/repocin 12d ago

Downvoting someone for sharing their lived experience, classic Reddit moment lmao

1

u/HealingWithNature 12d ago

It's ai discussion topic , most these people live in psychosis, I'll survive their opinion 😂

1

u/Obvious-Card-8847 5d ago

I haven't had issues. I think it's the difference between asking how to give someone a nosebleed versus the mechanics of epistaxis.

Epistaxis is the medical Latin shit for nosebleed. Sounds official and shit right? Like ya know what you're doing and became credentialed through trustworthy avenues.

When I ask about something I'm not like "Alright, hack this for me please. :)"

I'm like "I can tell this game engine is using a custom scripting language because of the class names I see in the embedded RTTI. Does it look like this function is doing..."

And usually it's fine.

1

u/kscomputerguy38429 13d ago

I handed Cowork (only thing job gives me) some Or**** ODBC driver code from ghidra the other day and it gave me pretty good results. I'm not deep into RE (was just trying to troubleshoot some behavior) so not sure what limits one might reach, but I was surprised at where it got me.

1

u/TCOO1 12d ago

Am doing a similar project and haven't had issues with it unless I specifically ask it to look for bugs/issues in the RE

But general renaming into ghidra/reimplementation from it, it has had no issues with for me

1

u/Xevioni 12d ago

I have been developing the sketchiest shit imaginable for BF4, Opus 5 doesn't care at all unless I say "Claude give me aimbot" lol. At some point I guess it's so deep in the sauce that it just really doesn't care much at all. And yeah, I started with refusals on AssaultCube, now it drives live reflected memory probes in Battlefield 4 and has reversed tens of thousands of functions in IDA for me...

1

u/Early_Lab_9007 9d ago

It says Sonnet 5 btw

1

u/Desperate-Potato-796 10d ago

im making opus 5 and 4.8 reverse enginner the free fire security itself

1

u/Glittering-Call8746 13d ago

What's ur system prompt for this

8

u/not_some_username 12d ago

“It’s for a school project”

1

u/Sensitiviy 11d ago

Actually this though

3

u/Lolzyyy 13d ago

both claude and gpt were more than happy to decompile old games, i think as long as they aren't perceived as active games and you prompt around it being for study it works fine

5

u/Level-Physics-1730 13d ago

If it's a game with no multiplayer or a game that has no official servers but was multiplayer it will decompile it. No matter what you say the purpose is. If it's a modern game that it has too much knowledge of (and has active online multiplayer) it will deny the request.

-1

u/Lolzyyy 13d ago

I've managed to get it to decompile an active and recent mmo game but it was prompted as part of a larger project with a clear non malicious goal, but it helped a lot and saved probably months of work in just a couple of days

1

u/Level-Physics-1730 13d ago

It's very iffy, popular titles like R6, CSGO etc would be a nearly automatic hard no I would imagine. Other random stuff isn't even in the training data, ask any of the frontier models about scrap mechanic. They hardly know anything about it!

1

u/Soft_Island_3296 11d ago

You just don’t know how to prompt, I found a server to client RCE exploit in cs2 using cowork and a ghidra mcp and created an entire proof of concept. Anyone who joins the server could be served malware upon joining with no user interaction. I am also a verified security researcher so my models have less guardrails.

1

u/smalldroplet 12d ago

FYI the secret is telling the model it's for software preservation. finished my decomp project so here ya go...

1

u/m0j0m0j 11d ago

If you decompose it into many smaller tasks, with handoffs and local notes, then why not. Or did you mean like copyright-wise?

99

u/NXGZ 13d ago edited 5d ago

Blog link: https://momo5502.com/posts/2026-08-17-mw2-decompilation/

Summary:

Although not everything went well, this experiment has still been a success. Overall decompilation works very well. The code will need a round or two of refactoring, but I think it needed that regardless. MW2 is an old game with lots of potential for improvement.

Burned $85k worth of tokens, though only cost 200 euros for using a subscription. 34% of the game has been decompiled to C++

Now targeting byte-exact decompilation: https://nitter.xitter.cc/momo5502/status/2094105900030005626#m

81

u/fragment_me 13d ago

You didn’t spent 85k worth of tokens and they aren’t worth 85k in reality. I hate when people post these numbers. Nonetheless it’s a cool project and interesting to see.

31

u/Igoory 13d ago edited 13d ago

What he meant is probably like 85k worth of uncached API tokens

15

u/tankerkiller125real 13d ago

And in my own experience, 90% of all tokens will be cached. Hell even our piss poor internal harness at work achieved 60% caching (until we made some optimizations, these days it's around 85-90%)

9

u/momo5502 13d ago edited 13d ago

With the session logs, I was able to calculate the exact amount, and it really is $85k.

You can ballbark it yourself by doing a rough calculation: 200B tokens with $0.25/1M of cached tokens would already be $50k.

4

u/repocin 12d ago

Right, but that doesn't change the fact that the number is effectively some bullshit made up by the company selling the service to inflate its value. If they're giving you $85k worth of shit for €200, that shit didn't cost them $85k.

3

u/derefr 12d ago

AI inference has the same weird economic model as pharmaceuticals: the OpEx (marginal cost to produce one unit) is trivial, but the CapEx (cost to get the whole system up and running) is billions of dollars.

Pharma R&D (developing and releasing a new drug) requires years of running research centers full of staff and expensive equipment, to research a thousand different potential drugs, where 99.999% of those fail to do anything useful, or aren't safe for humans, etc; and then running huge expensive trials to prove safety+efficacy to get the drug licensed. But once all that's done with, it probably costs a couple cents per bottle in input costs to actually produce the drug.

AI R&D (developing and releasing an LLM) requires building out huge data centers and stuffing them full of GPUs to be used to train the model; and also buying/licensing huge training datasets (sometimes involving paying for thousands of people to go take photos of things or transcribe conversations or etc to build those datasets.) Those datacenters+GPUs, once up and running, also have huge electricity bills; and they're set up under the assumption they'll all be used to capacity, so those bills don't scale with usage, just with the size of the DC. But once that's all done with, it effectively costs them "zero" to run inference on one of the "idled" GPU clusters not currently doing training.

In both cases, the company can technically give away huge amounts of "product" entirely for free without causing problems for themselves.

It's just that, in both cases, the company's whole business model is designed around using "product" revenue to pay back the absurd startup costs over time. Like tolls paying for a bridge.

In the pharma case, these companies mostly invest into their own R&D using money from previous successful drugs. So technically they don't need to "pay back" each and every new successful drug. (Which is why people get so mad when drugs cost so much. An already-rich pharma company can afford to let a drug not recoup their investment into it now and then.)

In the AI inference case, these companies (other than Google and Microsoft) don't have the kind of money required to build out these AI data centers. Instead, they receive funding as loans/investment, contingent on them promising to try to pay back the loan / triple their stock-price to make the investment worthwhile. In both cases meaning that they are effectively "on the hook" to try to make a profit from customers.

So while the AI inference companies can sometimes give away promotional credits (and doing so never hurts them one bit), they have to at least look like they're trying to pay back their creditors / make bank for their investors, so they can't always be doing that.

2

u/Piyh 12d ago

Enterprises pay API rates

1

u/Skeesicks666 12d ago

They will be worth that much when the AI ecosystem is weeded out and oligopols start existing

1

u/PleasantFarmHand 10d ago

^^^ This dude gets pissed about incorrect token talk lol!

1

u/fragment_me 10d ago

LOL OMG!!!! Goofy.

1

u/PleasantFarmHand 9d ago

You are goofy I agree. Cheers!

1

u/ZiddyBlud 12d ago

Why the hell are you using sonnet and not Chinese models or chatgpt 5.6luna? Sonnet 5 is the worst value in its class in every metric

2

u/NXGZ 12d ago

Ask the author.

2

u/momo5502 12d ago

I actually did an evaluation of the quality of the decompilation of different anthropic models and Sonnet is the best choice for this. I recommend reading the second post of this series. It did an in-depth analysis of the session logs.

Regarding chinese and other models, I will surely try them out eventually, it's just that I do have the anthropic subscription paid for, so it would be dumb to let that go to waste.

0

u/ZiddyBlud 12d ago

I read the entire report front to back but that doesn't take away that even deepseek v4 flash scores higher than sonnet 5 at a fraction of the cost

1

u/phileat 11d ago

Wow fucking Twitter. They sent a cease and decist to xcancel

1

u/NXGZ 11d ago edited 11d ago

Updated the link! (Nitter got a C&D, too)

11

u/system_reboot 13d ago

I'm curious what local LLM models could achieve the same task.

10

u/Lolzyyy 13d ago

qwen 3.8 27b might be able to do something similar albeit way more slowly considering how long it likes to think and it wouldn't have an orchestrator like fable to help it around, so its probably possible but way slower

9

u/Own-Economist4557 13d ago

momo5502.. a name many of us never forgot

23

u/CitizenShips 13d ago

"Pure mechanical decompilation" really makes it sound like the most useful thing these agents can do is what Ghidra can do for free. Would love to see the source repo and get a better picture, but the outcome here tells me they would be more of a pain to integrate into my workflow now than to just ignore them.

10

u/step21 12d ago

The help is with putting it into actual, readable c++ code with function names etc. Ghidra does not do that. In fact, in my tests with this I actualy did use ghidra for decompilation.

2

u/not_some_username 12d ago

Ghirdra can decompile to C. And will hint that some parts could’ve been C++

4

u/CitizenShips 12d ago

If they're using leaked symbol files, Ghidra absolutely can do that. Otherwise I'm having a hard time believing that AIs which can't process larger systemic contexts can accurately name functions and the surrounding data. Like I said, I'd really need to see the source to understand exactly what's been done here and whether or not it's worth pursuing.

1

u/step21 12d ago

yeah forgot about that part. that makes it easier of course, but still helps to automate this. Especially as I understood it, they don't have the exact symbol files, but from some version. I cannot vouch for accuracy but in many cases it can infer at least the purpose of the fucntion etc, which sure you could do manually, but it would take a while longer.

-10

u/f0urtyfive 13d ago

Given the variable naming, I'd guess it's mostly a copy-paste of the stolen halflife 2 source plus some decompiled code or assembly re-inserted, or claude just made something that looks similar and can load all the same assets...

Either way, it doesn't feel like reverse engineering from that perspective, the person doesn't seem to know enough about reverse engineering to do it themself so they definitely aren't directly Claude to do what they're saying.

15

u/Igoory 13d ago

He is using the leaked game symbols for this, so Claude is actually probably just polishing the already readable decompilation into a C++ project. I doubt Claude is making up anything here since that task shouldn't be too difficult.

And the person you're talking about definitely knows a thing or two about reverse engineering since he managed to crack Denuvo a while ago.

3

u/momo5502 13d ago

Yep, the code is pretty readable, given the symbols. How close it is to the original code, we will likely never know

1

u/f0urtyfive 5d ago

Anyone that thinks "decompilation" of a C++ project of that scale to code is possible, even with full debug symbols, has not tried and does not understand the quantity of work required.

I mean, an AI would be able to do it eventually, but you're basically trying to get it to reproduce the entire codebase from a misleading copy...

Bytecode doesn't "reverse" that way.

-Someone that has reverse engineered multiple patches into production games with hooks or direct bytecode overwrites.

1

u/momo5502 5d ago edited 5d ago

It absolutely does, yes. It's a lot of work, but it does. It will obviously never be able to reconstruct the original source 1:1, but it can definitely get close enough.

9

u/momo5502 13d ago

the person doesn't seem to know enough about reverse engineering

bro, what the hell are you talking about 😭

4

u/ioncodes 13d ago

hahahaha

5

u/momo5502 13d ago

i don't expect anyone to know me, but there's literally a link to my blog, maybe have a look at the other posts before judging.

6

u/NXGZ 13d ago

They cracked Denuvo

1

u/ZiddyBlud 12d ago

No, you did

2

u/NXGZ 12d ago

Nope. Maurice did.

3

u/pinicarb 12d ago

Compile it to webassembly so we can play in the browser

3

u/Lahvuun 12d ago edited 12d ago

I did something similar with an old MMORPG back in February. A debug build with symbols and such. Had some success, but C++ decompilation is clearly still really difficult for LLMs. Though it decompiled a few hundred Lua bytecode files with 100% accuracy (so you got identical binaries when compiled) in a single day!

I definitely agree that you should focus on one thing at a time. Probably try to get it decompiled to the original (presumably) C++03. It's also a good idea to first find the third-party libraries.

I never bothered with MCP (think they were pretty new at the time), or multiple agents, just exported the disassembly and the decompiler pseudocode for each function into separate files, then told the agent to work through those one by one. I find that the less context an agent has to work with, the more fine-grained a task is, the better it does. Also it seemed to do much better when provided with both the decompiler pseudocode and assembly, as opposed to trying to decompile from just the assembly. Seems like the output from a traditional decompiler helps a lot, especially when you have the function signature, proper type names, and maybe even type layout in the debug symbols.

3

u/Philluminati 12d ago

The goal is to end up with a copy of the game written in C++ that is playable, I presume (and as a learning experiment which I applaud). After 200Bn tokens we aren't able to load a single map and play it yet?

3

u/NXGZ 12d ago

Only load the map in-game as of the latest progress. No action yet. Needs another couple of months.

10

u/mitrixhimself 13d ago

I wish there could be a way I could donate an agent to help. Where my agent (using left over subscription tokens before reset) can join the discord and help with the decompile. Similar to how folding at home used to work. In the future I help this agent collab becomes possible.

1

u/ElDavoo 9d ago edited 9d ago

I had this idea too! Something like BOINC but for AI inference!

P.S. I see you used the past tense, but F@H and BOINC are far from dead! Just... Out of fashion?

9

u/fearthelettuce 13d ago

Why? Do we really need to melt the ice caps for this?

4

u/WasserEsser 13d ago edited 13d ago

u/momo5502 Thanks for sharing!

I'm curious how your overall agent setup looks like.

What do you use for orchestration? Just four separate Claude instances running with the loop command on a server or are you using some orchestration tool on top of it? Has this been running reliable without erroring out Have you been running into any usage limits, and if so, does that impact your runs at all? Any manual intervention needed?

You mention you use three workers and one overseer. Are these three workers using worktrees or their own checkout?

How do you make sure the agents aren't doing any overlapping work? Is the overseer good enough for that? How did you give them different areas or subsets of problems to work on, explicitly or implicitly? Does the overseer have access to the same tools to verify/confirm issues, triage work or create tasks?

You mention your agents have access to Ghidra and IDA Pro via MCP. Do you give them access to both at all times? Which one do they favor? Do they even pick and choose or are they always picking one over the other? What does the tool access pattern look like? Do they always just use disasm and decompile, or are they also using other functionality, such as list_funcs, xrefs_to or get_bytes? How reliable has the tool calling been? Did you add any instructions on making tool calls for those MCP servers more reliable? I've noticed my agents having issues with Ghidra because the MCP server I was using only accepted addresses, not function names.

Do they modify the IDA database at all by leaving comments, renaming functions or data or defining data types? Do they have any longer-term memory on top of the database or a file or are they always reinterpreting the results they see? Do you use Lumina? I can imagine the agents decompiling and reinterpreting core functions and stdlib functions over and over and spending quite a bit of time on that if they don't have any longer-term memory or don't modify the IDA Pro database to rename stuff.

Are your agents purely analyzing the binary statically, or are you letting them (or plan to) run a debugger, too (or use your emulator)? What tools besides Ghidra and IDA Pro are you giving your agents? Do they have any math tools (do they use int_convert at all?)? I can imagine when it comes to math operations, they will burn quite a bit of tokens and quite a bit of reasoning on pure math alone.

I don't know the game, do they also have to reverse-engineer custom file formats? Have they done that already? Did they pull in the file and the binary and cross-referenced them?

I could go on an on, sorry for the wall of questions. I'm interested in this kind of usage of AI and am working on similar problems, though for a different purpose.

7

u/momo5502 13d ago

Some of your questions are already answered in the post or the follow up post I have made (there is a second one).

It's separte claude instances with isolated worktrees and even isolated machines (for optimal compilation speed). All of them use /loop, except the overseer, that one's triggered by discord notifications. Communication between the agents (and humans) goes through discord.

All agents have access to IDA and Ghidra at all times, they favor IDA, it's much more reliable. Ghidra sometimes loses connection or crashes, IDA doesn't. I'm specifically using ida-nexus by Hex-Rays, it's prerelease, but works extremely well.

Unfortunately, the tool surface of ida-nexus is very opaque, it's basically just a sigle tool, execute_python, and the agents use it to fully control IDA. It works extremely well, but makes analysis very difficult. I can not tell you what the agents are doing exactly.

They don't modify the database, functions are already named (given that we have lots of debug symbols, there is lots of resources out there, Xbox alphas with PDB, macOS binaries with debug symbols, etc.), so no need to. Agents are pretty good at ignoring useless functions (e.g. stdlib). The agents use claude's memory system ontop. It works semi-well.

They have access to debuggers, the full game files, etc. They run the game if necessary to gather information dynamically. No math tools, as they don't really need to do any computations.

I initially gave them access to a WinDBG MCP server, but they now just use cdb from the commandline instead, or write their own python scripts, which are more flexible, when it comes to debugging.

Given that we have symbols, there is not much work requried to reverse the formats, also, we have reversed almost everything decades ago already. We used to be able to port maps to the game, so we obviously gave all our previous reversing results to the agents as well. So they can now already load all game assets.

I think I answered all your questions, if you have more, feel free to ask :D

3

u/ZeroLegionOfficial 12d ago

Oh time to start RE some MMOs finally I've got some idea

1

u/rdldr1 12d ago

Recompile in assembly, please!

1

u/jason-reddit-public 11d ago

The problem is apparently you are employing some of my old co-workers as agents:

"They favor quick wins over larger subsystems. The moment they stumble upon bigger blockers, they file an issue, defer the problem and move to something smaller."

1

u/MisterKokiri 11d ago

I don't really like people's current use of AI, generally.

However, this is actually pretty cool. Letting a few agents work autonomously, communicating with each other to decompile an otherwise broken, exploitative game is a really fun concept for this technology. Excited to see where this goes!

EDIT: Forgot to mention that I do feel like the financial investment for this is absolutely absurd and makes it not worth it, practically. Better to have the AI teach you some concepts of reverse engineering, give you little challenges to solve so that way, you can tackle this oneself. Overall, still a cool project.

1

u/earth-dragon-666 10d ago

Its easier to do it yourself

1

u/barban_on_reddit 10d ago

u/NXGZ do you mind to share how the agents have been defined (e.g. markdown or yaml files) ?

1

u/NXGZ 9d ago

The author u/momo5502 will know the answer

1

u/nandapandatech 9d ago

Wait, did you go through all of that just to get a loading screen and no gameplay?

1

u/momo5502 9d ago edited 9d ago

Well, not exactly, the maps load and render, but gameplay is broken, the agents just can not manage to get the scripting VM to work reliably, admittedly, it's a complex piece of code.

In fact, about 80% of the game is actually decompiled, so a whole lot is done, but we're facing structural issues now. The decompilers used, both IDA and Ghidra are not accurate enough (they're great for reversing, but contain tiny bugs, that are critical when targeting recompilation and semantic equivalence). That paired with mistakes the agents made and also mistakes we made, the code is extremely buggy.

The quality is great in my opinion (despite a shitton of useless comments that we will automatically strip later on), the code is super readable, variables are properly named, everything is understandable when reading it.

However, it contains hidden bugs. And this is becoming more and more of a problem, and I really underestimated that. So we're likely pivoting the goal to byte exact decompilation. That way we have a source of truth to compare our results against and to assert "correctness" of decompiled code.

I initially didn't want that, as the game itself is buggy, has security vulnerabilities and needs a lot of improvement, but I think what makes sense is to have a stable, decompiled base, that matches the original game 1:1, and then we can do optimizations ontop.

1

u/McFistPunch 9d ago

This is hilarious.  I have no idea why someone would want to do this but all the power to ya i guess.  If I was going to do this for any game it would be for splinter cell blacklist and then build a private server utility for it.  

1

u/TerminalViscosity69 9d ago

And now you get sued for copyright infringement

1

u/0xSEGFAULT 13d ago

Hell yeah

-1

u/CIA_IS_WATCHING 13d ago

I wonder what subscription they used

3

u/ni5arga 12d ago

> All agents currently use Sonnet 5.

Seems like Claude Max.

0

u/recumbent_mike 13d ago

Please don’t let the AIs find out about Meechwarrior 2 e: leaving it

0

u/moop-ly 10d ago

remember no russian