Companion patches for the Steam Workshop mod Farm area (exe patch) for Workers & Resources: Soviet Republic.
The Workshop mod adds a script that shows, for any farm, the exact total field area and the actual expected harvest tonnage (using each field's real fertility). The game's scripting API doesn't expose those two values, so the script needs one of the patches below to read them. Without a patch the mod still runs — it just reports 0 for area and fertility.
Everything here is plain, readable source. No binaries, no installers.
Both patches redirect values inside the routine that copies building data to
the script API (Buildings.GetDataByIndex). They change what a script sees;
the game's own simulation values are untouched.
Patch 1 — area (4 bytes changed)
The script member fMineQualityOfSource (mine deposit quality — always 0 for
fields) is re-sourced to the field's stored area:
find (unique): 8B 89 F8 0D 00 00 89 08 mov ecx,[rcx+0xDF8] ; mov [rax],ecx
write: 8B 89 30 0E 00 00 89 08 mov ecx,[rcx+0xE30] ; mov [rax],ecx
After it, fMineQualityOfSource = field area × 100 (e.g. 4.37 ha reads as 437).
Side effect: the swap applies to every building type, so a script reading a
real mine's deposit quality gets a wrong value while patched. The farm
script doesn't use mine quality; revert if some other script of yours does.
Patch 2 — fertility (16-byte detour + 71-byte code cave)
The script member fCurrentProduction (always 0 for fields) is filled, for
FIELD buildings only, by calling the game's own internal GetFieldFertility
function — the same one the harvest simulation uses. The 16-byte fill sequence
48 8B 8C 24 98 00 00 00 8B 89 DC 0D 00 00 89 08
is detoured to a small cave (placed in unused zero-padding of the code
section) that checks the building type, calls the getter for fields, and
leaves every other building's genuine value alone. After it,
fCurrentProduction = fertility fraction for fields (1.0 = 100%, capped at
2.0 = 200%). The annotated assembly of the cave is in farm_patches.py.
All sites are located by byte signature, never by hardcoded file offsets, and each command verifies the bytes before writing. On a game build the signatures don't match exactly once, the tools change nothing and say so.
farm_patches_ce.lua applies the same two patches to the running game's
memory only. Your SOVIET64.exe file stays byte-for-byte vanilla; everything
evaporates when the game exits.
- Start the game. Start Cheat Engine (7.x).
- Attach CE to
SOVIET64.exe, open Memory View → Tools → Lua Engine. - Paste the whole contents of
farm_patches_ce.lua, press Execute. - In game: open a farm window and run the mod's script.
Re-run after every game launch. Manual controls after loading: farm_apply(),
farm_restore(), farm_status().
farm_patches.py applies the patches to the exe file, so they survive
until the next game update / Steam Verify. Requires Python 3, nothing else.
Copy farm_patches.py into the game folder (next to SOVIET64.exe — on
Steam: right-click the game → Manage → Browse local files). Then, with the
game closed:
python farm_patches.py status # report: vanilla / patched, per patch
python farm_patches.py apply # apply both (or: apply area / apply fert)
python farm_patches.py restore # back to vanilla bytes
If you'd rather not run anyone's code: open SOVIET64.exe in any hex editor,
search for the byte sequence 8B 89 F8 0D 00 00 89 08 (it occurs exactly
once), change the F8 0D to 30 0E, save. That is the area patch. The
fertility patch builds a code cave with computed jump offsets, which isn't
practical by hand — use option A or B for it (with only the area patch the
script shows the exact area, but the Actual harvest line reads 0).
- Option A reverts itself on game exit (or
farm_restore()live). - Option B:
python farm_patches.py restore. Restore is as paranoid as apply: it only rewrites bytes it has positively identified as its own — the area operand at its verified signature site, and the fertility cave only after matching its complete 71-byte layout AND finding the detour jump that targets it. If it can't make that positive match, it refuses and changes nothing (Steam Verify below always remains the way out). Other exe patches you may have applied are never touched, in either direction. - Always available: Steam → game properties → Installed Files → Verify
integrity of game files resets
SOVIET64.exeto factory state, wiping any file patch. (Consequently: re-apply after every game update or Verify.)
Signature-scanned against the current Steam build. After a game update the patches either still apply (signatures survived) or refuse loudly and do nothing — they cannot half-apply. If they refuse, open an issue with your game version and the tool's output.
| File | What it is |
|---|---|
farm_patches.py |
File patcher: status / apply / restore for both patches |
farm_patches_ce.lua |
Cheat Engine Lua: same patches, RAM-only |
mod/farm_area_exact.txt |
Reference copy of the Workshop mod's Pyrois script |
These tools modify (option B) or hot-patch (option A) your local game for single-player convenience. Reversible at any time as described above. Provided as is, without warranty of any kind — see LICENSE (MIT). Not affiliated with 3Division or the game's publisher.