about summary refs log tree commit diff
path: root/pkgs/games/gog/factorio
Commit message (Collapse)AuthorAgeFilesLines
* factorio: Fix patcher to work with Radare2 5.xaszlig2021-04-141-2/+10
| | | | | | | | | | | | | | | Version 5.0.0 of Radare2 introduced a few changes in symbol naming, which causes our patcher to fail because it's unable to find the "/usr/share/factorio" string and the getSystemWriteData() method. The upstream change[1] in question for example now uses underscores for certain characters in the symbol/comment name, so for us to be backwards-compatible I added a check against the major version of Radare2 to determine whether we should add underscores when needed. [1]: https://github.com/radareorg/radare2/commit/aaa930ab261a31e58b1257df06db02481cd3bd55 Signed-off-by: aszlig <aszlig@nix.build>
* games: Add Factorioaszlig2020-12-303-0/+694
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>