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?
Best Answer
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.
Pictures about "How to quickly restart a game after a crash/freeze on Wine(Linux)?"



What do I do if my game freezes?
Press Ctrl + Alt + Del to open the Windows Task Manager. If the Task Manager can open, highlight the program that is not responding and choose End Task, which should unfreeze the computer. It could still take ten to twenty seconds for the unresponsive program to be terminated after choosing End Task.How do I close a game that is not responding?
Try Closing With Alt + F4 First It's particularly useful if your mouse stops responding for a while when the program freezes.Why does my game keep not responding?
Game files can become corrupted or altered if you have malware or are running a game modification on your device. If your game is freezing or not responding, uninstalling and reinstalling it will remove and replace the files that run the game.Why do Xbox games freeze?
If the game installation is incomplete or gets corrupted, the Xbox One game may freeze or crash to the dashboard during the gameplay. In this case, you just need to remove the problematic game from your system and then reinstall it.How to Fix Steam Games Crashing on Startup - [Tutorial]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: cottonbro, cottonbro, SHVETS production, Anna Shvets