LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Games (https://www.linuxquestions.org/questions/linux-games-33/)
-   -   I would like my desktop resolution to revert back after closing game from script (https://www.linuxquestions.org/questions/linux-games-33/i-would-like-my-desktop-resolution-to-revert-back-after-closing-game-from-script-4175677439/)

Krackerjak1 06-21-2020 08:33 PM

I would like my desktop resolution to revert back after closing game from script
 
Hello. I am trying to write a script to start my game by changing desktop resolution then when i am finished playing and close the game the desktop will revert back to the previous resolution. Here is what I have and it works as far as getting the game up and running but Ineed it to revert back to 1400x900

----------------------------------------

#!/bin/bash
eject /dev/sr0
cdemu load 0 "/media/dell/My Book/ISO Games and Software/RCT_1_2.ISO"
sudo xrandr --size 640x480
env WINEPREFIX="/home/dell/.wine" wine C:\\windows\\command\\start.exe /Unix /home/dell/.wine/drive_c/users/dell/Start\ Menu/Programs/Hasbro\ Interactive/RollerCoaster\ Tycoon/RollerCoaster\ Tycoon.lnk

-----------------------------------------

What can I add to revert back when rct.exe exits

demifiend 06-22-2020 01:08 PM

Have you tried making "sudo xrandr --size 1400x900" the last line of your script? It shouldn't execute until wine exits.

Also, have you tried using xrandr without sudo?

Krackerjak1 06-22-2020 05:31 PM

Thank you for answering. Yes I tried both of those suggestions. The desktop will not resize without sudo and adding the resize line at the end just executes even before the game fully starts.

dugan 06-22-2020 06:54 PM

Have you tried running the game with dgVoodoo2? That should eliminate the need to set the desktop resolution before starting the game.

I can tell you that dgVoodoo2 and DXVK worked really well together with The Longest Journey.

Krackerjak1 06-22-2020 08:50 PM

I have used dgvoodoo2 in windows for different games but never in linux. Ill give it a try. Ya I wouldnt need the resolution change if the game would go full screen. My other win 95 and 98 games that I used the wrapper for all work under wine without the wrapper but Rollercoaster Tycoon didn't need the wrapper in Windows it worked perfect. But not in wine. I am using Mint LMDE 4. I guess I'll have to try it.

ondoho 06-23-2020 02:10 AM

Quote:

Originally Posted by Krackerjak1 (Post 6137064)
The desktop will not resize without sudo

Then something is seriously wrong with your system.

Krackerjak1 06-23-2020 08:40 AM

ondoho Thank you for the comment about "sudo xrandr --size 640x480". When I was first making the script it would not resize without sudo. So when you informed me there might be a problem with my system I figured I would try again and this time it works without sudo. However the game still runs the last line "xrandr --size 1400x900" before the game fully starts and I would like it to run upon exit of the game.

jefro 06-23-2020 04:13 PM

https://linuxhint.com/wait_command_linux/ maybe???

Krackerjak1 06-23-2020 07:33 PM

Thanks for the suggestion. I have played with the wait command and read tutorials but can not figure it out. The tutorials lose me. Maybe someone that understands it can look at my script above and show me the line i need.

Krackerjak1 06-23-2020 08:52 PM

Ok. I decided to fool around with the wait command again.
This is what I came up with.


-------------------------

#!/bin/bash
eject /dev/sr1
cdemu load 0 "/media/dell/My Book/ISO Games and Software/RCT_1_2.ISO"
xrandr --size 640x480
wine "/home/dell/.wine/drive_c/Program Files/Hasbro Interactive/RollerCoaster Tycoon/rct.exe" &
wait $!
xrandr --size 1400x900


-------------------------

Works good. I believe the reason it wasn't working before was the way I was starting the game. I used the same command as the wine launcher and just put it into the script. The problem is there is a Program used in that line called start.exe and I believe the wait command was waiting for start.exe. However start.exe is only used for a moment to start rct.exe. So I played around with another way to start rct.exe and the above works great with the wait command.

Thanks for the comments
Try Try Again


All times are GMT -5. The time now is 01:44 AM.