Exploration of the SimCity 4 Network Command System
This system is the network counterpart to the Lua Test Script system, it allows commands to be sent to the game as HTTP or TCP packets. Both systems were likely used for automation and testing during the game's development.
Commands
SC4 has a system that allows different parts of the code to register commands that other code can call. Many of these commands appear to be internal development items, but the commands also include most if not all of the base game's keyboard shortcuts.
The sc4-game-command-documentation repository contains work in progress documentation for the base game's commands.
Using the Network Command System
Using the SimCity 4 network game command system requires two steps.
Enabling the Network Game Command System
By default, the network game command system is disabled. It must be manually enabled by the user with a command line argument.
Start the game with -NetCommandGenerator:enabled as a command line argument.
NOTE:
The game can accept connections from other computers if allowed by firewall rules. You may want to block incoming network connections for the SimCity 4 executable.
Sending Commands
Once the game is in the region or city view, you can send TCP or HTTP POST requests to 127.0.0.1 on port 50020 to .
For example, if the game is in city view sending the GetCityName request would return the name of the loaded city and a status number. Responses for HTTP and TCP requests are included below, the difference between them is that in TCP mode the game sends the response without any extra formatting.
HTTP Response
Command:
GetCityName
Result:
"Big City Tutorial" 0
TCP Response
"Big City Tutorial" 0
The 0 after the city name is an integer status value that some commands include. If a command returns multiple values, the values will be delimited by spaces.
The game only supports one active connection at a time.
WARNING:
There is the possibility that sending commands could cause issues like making the game lock up or crash.
Example Client
My Network Game Command repository implements an example C# client that communicates with the game.
Search Memory Across All Open Programs
Is there a way in the GUI to search for integer/string references across all open programs in Ghidra 12.1?
I am working on reverse engineering a game that uses integer message codes to communicate between components that are located in different DLLs, and running Search Memory in each individual program is tedious.
There may also be scripting solution to this, but I didn't see anything obvious when looking through the script manager. Launching a script isn't as convenient as having the option in the Search Memory UI, so I am considering opening a feature request on GitHub.