The Main Flow
The main flow is a simple part of wemod-launcher. wemod-launcher, at its core, is just a fancy argument parser. Here is the main flow of the script:
- The script makes a Python venv.
- It checks for updates.
- It checks if running inside a Flatpak.
- If any of 1-3 are true, rerun in the venv / outside of the Flatpak.
- Then we are at the main execution block at the bottom.
- There we run function run().
- There we get all args.
- Find the Proton tool.
- We now know where Proton is in the args.
- Behind the Proton tool argument, the next argument is a verb and the game (or if external runner, just the game).
- We make sure that the prefix is set up — that is probably the most complex task, it’s not relevant after WeMod is installed. The explanation of that is here: Docs: The Launcher Installs Wemod.
- We create a file named early.tmp that gets deleted after 60 secs, so we can detect if the game has closed too fast. This is then used in the bat file (docs on next line).
- We change the args to run the bat instead of the game and add the game exe behind the bat. So the game exe path is sent to the bat as an argument. The info on the bat file is here: Docs: The BAT Start File.
- We run the bat with the wine tool (Proton in Steam) and send in the game and the game args.
- The bat starts the game that is sent in, as well as WeMod.
- At this point the bat finished executing.
- All we do now is bring up a simple troubleshooter, that can do common things, that help to fix the problem that WeMod is not getting started.
- After the troubleshooter is done we exit the wemod-launcher script.