diff options
author | aszlig <aszlig@nix.build> | 2020-12-28 09:30:45 +0100 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2020-12-30 16:37:54 +0100 |
commit | 2c24ba1d864d98d4c2c3a50501a41b61b43f854a (patch) | |
tree | 3b7346ea52c84a34cc66fb94ed97c25c6a0e4ba5 /modules/hardware/rtl8192cu | |
parent | 4f91df5db28a67fda6eca81ae9be7e580e637f98 (diff) |
games: Add Factorio
This has been laying around since a few weeks but instead of just using a simple shell script wrapper (which I had in the first place), I decided to directly patch the binary during rC3. The main reason why I went this route was because in the long run we want to have a generic implementation we can use to patch all sorts of games, similar to what we have with monogame-patcher. So the way the *current* patcher roughly works is by allocating an area called "compost", which is then used as some kind of abstraction for allocating code and data to be used for the references/logic that we need to patch. The latter involves patching XDG_DATA_HOME into the game and changing the "/usr/share/factorio" path to use the ones within the store path ($out/share/factorio). Fortunately, Factorio already assumes that everything within /usr/share/factorio (or our path for that matter) is read-only, so we don't need to add extra code/conditions specifically to handle that. Patching both cases is made possible by patching a third location (get_executable_name), which tries to get the current executable path via several methods (using /proc/self/exe, running "ps", ...) at runtime, which in our case is really unnecessary and a perfect opportunity to replace the function logic by the hardcoded path and using the rest of the function for our compost area. While patching might sound straigtforward, I actually introduced two little (but hard to debug) bugs, where I'm very grateful to all those folks (you know who you are) at rC3 who were actually following along and provided helpful input. In the long term, the goal is to rewrite the patcher with more elaborate type information (eg. right now function/opcode information is raw JSON) and generalise it enough that we can use it to get rid of a few other wrappers. Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'modules/hardware/rtl8192cu')
0 files changed, 0 insertions, 0 deletions