Skip to content

Instantly share code, notes, and snippets.

@AquariusPower
Last active January 29, 2021 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AquariusPower/cc7d4a3b2cc442101d7b4dc315ad425d to your computer and use it in GitHub Desktop.
Save AquariusPower/cc7d4a3b2cc442101d7b4dc315ad425d to your computer and use it in GitHub Desktop.
How to quickly restart a game after a crash/freeze on Wine(Linux)?
Some games takes a long time merely to reach the Main menu.
After a crash, in the middle of a fight, what you least want is to wait a huge reload time.
So, after the crash, we would have to wait for the game initialization + the savegame loading times...
How to overcome this boredom?
---
First prepare a new wineprefix properly:
```
# lets say WINEPREFIX="$HOME/CoolGame"
# Inside the WINEPREFIX for some specific game, I created a new folder like:
mkdir "$HOME/CoolGame/_NewInstance_"
ln -s "$HOME/CoolGame/drive_c" "$HOME/CoolGame/_NewInstance_/drive_c"
cp "$HOME/CoolGame/"*.reg "$HOME/CoolGame/_NewInstance_/"
```
Now, run it like (btw, each must be on the right path for the executable, so use `cd` first):
1st:
`WINEPREFIX="$HOME/CoolGame/" wine64 CoolGame.exe #1st store its pid on nGamePID1st`
2nd:
`(sleep 120;pkill -SIGSTOP -fen CoolGame.exe)&WINEPREFIX="$HOME/CoolGame/_NewInstance_/" wine64 CoolGame.exe #2nd store pid on nGamePID2nd`
You must know how long it takes to reach the main menu, that is what `sleep 120` is for.
Now, the 2nd instance will load til about it is on the main menu, and it will be Stopped (being stopped will let it be moved also to the swap file if needed).
The 1st instance will let you play it normally.
As soon the 1st crashes or freezes/bugs(SIGTERM;sleep 10;SIGKILL), run this:
`(sleep 120;pkill -SIGSTOP -fen CoolGame.exe)&WINEPREFIX="$HOME/CoolGame/" wine64 CoolGame.exe #1st`
It will prepare the 1st again, for when/if the 2nd crashes. You can put it in an endless loop too.
Now, you can promptly continue the 2nd instance with `kill -SIGCONT $nGamePID2nd`, it will already be almost on the main menu, and you just have to load your last savegame.
This works with offline games. No idea about online ones tho, neither if this can be done on windows/mac.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment