LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Games
User Name
Password
Linux - Games This forum is for all discussion relating to gaming in Linux.

Notices


Reply
  Search this Thread
Old 06-21-2020, 08:33 PM   #1
Krackerjak1
LQ Newbie
 
Registered: Jun 2020
Posts: 11

Rep: Reputation: Disabled
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
 
Old 06-22-2020, 01:08 PM   #2
demifiend
LQ Newbie
 
Registered: Aug 2019
Location: USA
Distribution: Slackware
Posts: 17

Rep: Reputation: Disabled
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?
 
Old 06-22-2020, 05:31 PM   #3
Krackerjak1
LQ Newbie
 
Registered: Jun 2020
Posts: 11

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-22-2020, 06:54 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,241

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
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.

Last edited by dugan; 06-22-2020 at 07:00 PM.
 
Old 06-22-2020, 08:50 PM   #5
Krackerjak1
LQ Newbie
 
Registered: Jun 2020
Posts: 11

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-23-2020, 02:10 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Krackerjak1 View Post
The desktop will not resize without sudo
Then something is seriously wrong with your system.
 
Old 06-23-2020, 08:40 AM   #7
Krackerjak1
LQ Newbie
 
Registered: Jun 2020
Posts: 11

Original Poster
Rep: Reputation: Disabled
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.

Last edited by Krackerjak1; 06-23-2020 at 08:42 AM.
 
Old 06-23-2020, 04:13 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,997

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
https://linuxhint.com/wait_command_linux/ maybe???

Last edited by jefro; 06-23-2020 at 04:14 PM.
 
Old 06-23-2020, 07:33 PM   #9
Krackerjak1
LQ Newbie
 
Registered: Jun 2020
Posts: 11

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-23-2020, 08:52 PM   #10
Krackerjak1
LQ Newbie
 
Registered: Jun 2020
Posts: 11

Original Poster
Rep: Reputation: Disabled
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
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Monitor screen resolution in ubuntu desktop10.4 will revert back to 900 * 600 mansour Linux - Newbie 8 10-16-2011 08:24 PM
How do i change to super user then revert back to ordinary user ,using shell script? wrapster Solaris / OpenSolaris 6 03-18-2009 03:37 AM
Cannot revert back to optimal resolution DirkDiggler Linux - Desktop 4 06-03-2007 11:29 AM
GL-117 - game would not start after resolution change seafish_69 Linux - Games 1 06-22-2006 07:40 AM
HELP! How Do I Revert back to Windohs - errasing Linux from a HD electronixx Linux - General 3 12-02-2002 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Games

All times are GMT -5. The time now is 05:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration