Using LLMs to Rebuild Legacy Software: A Practical Engineering Case Study
This article examines how large language models can support the reconstruction of old, undocumented software, using a classic desktop real-time strategy game as an example. It covers how to define engineering boundaries before writing code, analyze undocumented legacy file formats, handle open-source license review, structure work into verifiable phases, manage commit quality, and build an effective feedback loop between developers and the model. The piece also outlines which decisions—legal judgment, architecture trade-offs, acceptance testing, security review, and requirement prioritization—must remain with human engineers.
I. “Practical Application” Means More Than Generating a Few Code Snippets
Discussions about LLM coding ability often stay at a simple level: generate an API endpoint, complete a function, fix a syntax error. These scenarios have value, but they don’t demonstrate what a model can do in complex engineering work.
A more representative case is using an LLM to help rebuild old software that hasn’t been maintained in years.
Projects like this usually share several traits:
- The original source code is incomplete or no longer available.
- File formats, communication protocols, and resource structures lack formal documentation.
- The code contains many legacy magic numbers and platform-specific logic.
- The project is large enough that manual reimplementation would take a long time.
- The goal isn’t to copy the interface, but to restore core functionality, data compatibility, and runtime behavior.
In this kind of work, an LLM’s value isn’t “creating a complete product from nothing.” It’s helping developers quickly build understanding, break down tasks, generate experimental code, analyze error logs, and keep a complex project moving forward.
In other words, the model acts more like an engineering assistant that can read material, write sample code, run verification, and summarize findings at high speed—not an unsupervised development team.
II. Case Background: Rebuilding a Classic Program With No Source Code
Consider a classic real-time strategy game that originally ran on an early desktop operating system. Its source code is no longer available, but users still want to run it on modern systems and gradually restore the following capabilities:
- Reading the original resource files
- Loading maps, units, buildings, and audio data
- Reproducing the basic interface
- Supporting single-player combat
- Maintaining compatibility with old save files
- Eventually supporting LAN or internet multiplayer
Since the original implementation can’t be used directly, the project can’t proceed by “modifying old source code.” It has to be redesigned around observable, public behavior.
This creates a classic black-box compatibility problem:
- What is the input?
- What is the output?
- How is the data organized?
- How does state change?
- How do user actions affect outcomes?
- How do different modules exchange information?
The LLM is best suited here for “inferring structure from observed behavior”—for example, proposing possible format layouts based on file headers, byte distributions, resource indexes, and runtime logs, then generating a parser to test those hypotheses.
It’s worth emphasizing that reverse engineering must respect legal, licensing, and intellectual property boundaries. The sound approach is to study public documentation, analyze your own data, observe program behavior, and write an independent implementation—not to copy protected source code directly, bypass technical protection measures, or incorporate code and assets without proper authorization.
III. Phase One: Establish Engineering Boundaries Before Generating Code
A common mistake is asking the model to “rewrite the entire application” right at the start. This instruction sounds clear but lacks a verifiable target, and the model tends to produce large amounts of contradictory code.
A more reliable approach is to split the project into layers first.
1. Data Layer
Handles resource files, map files, save files, audio, video, and configuration data.
Goals include:
- Identifying file types
- Reading file headers
- Parsing version numbers
- Building indexes
- Validating lengths and offsets
- Providing a unified data access interface
2. Simulation Layer
Handles internal application or game state—unit positions, resource counts, building status, mission progress, and rule evaluation.
This layer should stay decoupled from the interface as much as possible. Otherwise, replacing the rendering system or adding tests later becomes very difficult.
3. Presentation Layer
Handles windows, menus, graphics, animation, input, and audio playback.
Early implementations don’t need to fully replicate the original look. A debug interface is enough to verify that data is loading correctly.
4. Network Layer
Multiplayer synchronization should only be considered once single-player logic is stable. Adding networking too early makes every simulation bug look like a communication problem.
5. Tooling
Includes resource viewers, format dump tools, diff tools, automated test tools, and build scripts.
In practice, tooling often matters more than the core feature set. Without tools, developers are stuck relying on manual inspection. With tools, the model gets stable, structured feedback to work from.
IV. Phase Two: Analyzing Legacy File Formats
The most time-consuming part of working with old software usually isn’t the interface—it’s the undocumented data formats.
For example, a resource file might contain:
File headerVersion infoResource countIndex tableCompressed dataChecksum fieldPadding region
This structure looks simple on the surface, but real-world projects run into problems like:
- Field lengths that change between versions
- Offsets stored in different byte orders
- Fields that only exist for certain resource types
- Undocumented checksum data at the end of the file
- Alignment padding between data blocks
- Compression using nonstandard parameters
- Corrupted files that don’t return a clear error code
LLMs can help with three types of work here.
Type 1: Generating Probing Tools
For example, reading byte ranges and tallying repeated patterns, candidate offsets, and length distributions:
Read the fileIdentify possible file headersIterate over candidate index positionsCheck whether offsets fall within file boundsAttempt to read resource blocksOutput structured analysis results
Type 2: Proposing Format Hypotheses
Based on multiple samples, the model can suggest:
- Which fields hold fixed values
- Which fields might be counters
- Which numbers correspond to file offsets
- Which regions might be compressed
- Which fields relate to resource names or types
These hypotheses can’t be treated as conclusions. They need to be validated against more samples and edge cases.
Type 3: Iterating Quickly From Failures
When a parser hits an out-of-bounds read, an unexpected length, or corrupted resource data, the developer can hand the error log, input sample, and current hypothesis to the model, ask it to analyze the failure, and propose a narrowly scoped fix.
The most important rule here: change one hypothesis at a time.
If you change byte order, field length, and compression logic all at once, even if the program ends up running, you won’t know which change actually fixed it.
V. License Review: LLM-Generated Code Still Needs Human Sign-Off
While working on old formats, developers will often come across existing open-source implementations. These can offer valuable insight, but whether you can use them isn’t just a matter of “does the code run.”
At minimum, check the following:
- License type
- Whether commercial use is allowed
- Whether modifications must be published
- Whether static linking is permitted
- Whether copyright notices must be retained
- Whether there are additional terms
- Whether the license is compatible with the project’s target license
If the project wants to keep a permissive license, pulling in components with licensing conflicts can create problems later at release time.
Safer practices include:
- Only reading public documentation and format specifications
- Referencing algorithmic ideas but implementing them independently
- Keeping clear provenance records for key modules
- Having different people handle analysis and coding separately, to reduce the risk of direct copying
- Running a dedicated license audit before release
LLMs may “remember” common algorithms and magic constants, but memorization doesn’t equal licensing compliance. Generated code still needs human review, especially for compression, encoding/decoding, encryption, and protocol implementations.
VI. Phase Three: A Staged Plan Instead of a One-Shot Delivery
For a complex rebuild, a roughly two-week sprint works well, as long as each day has a verifiable goal.
Day 1: Project Setup
Set up the directory structure, build scripts, logging, error handling, and a minimal runnable program.
Day 2: File Probing
Implement file type detection, hex dumping, basic validation, and sample management.
Day 3: Resource Indexing
Read resource counts, names, offsets, and lengths, and generate a visual report.
Day 4: Core Resource Loading
Prioritize the most critical image, map, or configuration data, and set aside edge-case formats for now.
Day 5: Debug Interface
Build a resource browser so the developer can inspect parsed results directly instead of relying only on logs.
Days 6–7: Basic Simulation
Implement a minimal state machine—unit creation, movement, collision, and simple rule evaluation.
Days 8–10: Interface and Input
Wire up windowing, mouse, keyboard, menus, and basic rendering.
Days 11–12: Save Files and Error Handling
Implement state saving and loading, corrupted file detection, and error recovery.
Day 13: Regression Testing
Prepare a fixed set of samples and run automated validation on every commit.
Day 14: Milestone Demo
Produce a runnable build that can start up, load resources, perform basic actions, and output logs.
The value of this kind of plan isn’t guaranteeing full feature completion in two weeks. It’s preventing the project from falling into an endless cycle of “just keep adding code.” Each phase should produce observable results.
VII. A High Commit Rate Doesn’t Mean High-Quality Development
When an LLM is involved in development, it can generate a large number of commits in a short time. But commit count alone doesn’t reflect project progress.
What actually matters:
- Does the commit add a verifiable feature?
- Is there a corresponding test?
- Are design decisions clearly documented?
- Does it introduce duplicate code?
- Does it expand the set of unresolved issues?
- Can you roll back to a stable version?
It helps to tag each commit with a clear type, for example:
format: format parsingruntime: runtime logicrender: rendering and UItest: testsdocs: documentationrefactor: refactoring
Commit messages should also cover three things:
- What changed
- Why it changed
- How it was verified
If the model generates hundreds of changes in a day, no one can review every line manually. The focus should be on public interfaces, core algorithms, error handling, license risk, and test results—not blindly trying to review every line of code.
VIII. The Most Valuable Feedback Loop With an LLM
An effective collaboration loop typically looks like this:
Define a small goal↓Model generates implementation and tests↓Automated build and run↓Collect logs, screenshots, and failing samples↓Model analyzes the error↓Human confirms the scope of the fix↓Commit and preserve a rollback point
The key isn’t “letting the model run free.” It’s continuously feeding the model high-quality context.
For example, instead of saying “the parser doesn’t work, please fix it,” provide:
- Input file size
- Hex dump of the file header
- Current parsing result
- Expected result
- Error stack trace
- The most recent successful sample
- The current hypothesis
The more structured the context, the easier it is for the model to locate the problem.
IX. What Still Can’t Be Handed Off to the Model
Even with strong code generation ability, the following responsibilities still belong to humans:
1. Legal Judgment
The model can summarize license terms, but it can’t substitute for professional legal advice.
2. Architecture Trade-offs
The model can offer multiple options, but the final choice depends on team capability, maintenance cost, and release goals.
3. Acceptance Testing
Compiling doesn’t mean correct, and running doesn’t mean compatible. Core behavior needs acceptance criteria designed by humans.
4. Security Review
Code that handles file parsing, network communication, or script execution can carry risks of out-of-bounds access, denial of service, or arbitrary code execution.
5. Requirement Prioritization
The model is good at completing tasks, but it doesn’t necessarily know which features matter most to users. The project owner needs to control scope and avoid burning time on low-value details.
X. Conclusion: The Real Use Case Is an Engineering Efficiency Multiplier
The realistic outcome of using an LLM to help rebuild old software isn’t a miraculous full recreation in a short time. It’s a meaningful reduction in exploration cost:
- Faster to form file format hypotheses
- Faster to generate experimental tools
- Faster to locate parsing errors
- Faster to fill in tests and documentation
- Faster to complete the glue work between modules
- Easier to turn scattered findings into reusable engineering assets
But it can’t eliminate the inherent complexity of reverse engineering, compatibility validation, or license review.
So judging whether an LLM is truly capable shouldn’t come down to whether it can generate one impressive snippet of code. It matters more whether it can keep making progress in an uncertain, undocumented, tightly constrained engineering environment—accepting test feedback, correcting errors, retaining context, and respecting boundaries.
For developers, the most reusable lesson here is: break big problems into small experiments, tie every conclusion to evidence, and run every change through a process you can roll back. That’s what turns an LLM from a tool that only answers questions into a technical collaborator capable of participating in a complex software lifecycle.
