SetRes - companion app to launch scummvm at lower screen resolution

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

Post Reply
AndyHazz
Posts: 9
Joined: Sat Mar 11, 2023 7:39 pm

SetRes - companion app to launch scummvm at lower screen resolution

Post by AndyHazz »

My laptop has a high DPI native resolution and potato GPU, so by default ScummVM runs with laggy cursor/low framerate and spins up the fans as soon as the GUI opens.

This app makes ScummVM run in a fullscreen potato-friendly resolution you specify (e.g. 1920x1080), and returns to your previous resolution when ScummVM is closed. Much easier than manually changing screen resolution back and forth.

It'll take the target application and screen resolution as command arguments, so it could be used for anything really, not just ScummVM.

Posted here for anyone else who might find it useful: https://github.com/AndyHazz/SetRes/releases

Disclaimer, ChatGPT wrote this for me, I can't code C++ :roll:
It took a few attempts but the end result appears to work well, and the code appears to be fairly simple for anyone who might want to check it out.
AndyHazz
Posts: 9
Joined: Sat Mar 11, 2023 7:39 pm

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by AndyHazz »

Readme updated with some better examples, and SetRes.exe updated to not require any extra/missing DLLs, and allow extra commands to be passed to ScummVM (e.g. launch fullscreen or launch into a specific game) - https://github.com/AndyHazz/SetRes
User avatar
Raziel
ScummVM Porter
Posts: 1539
Joined: Tue Oct 25, 2005 8:27 am
Location: a dying planet
Contact:

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by Raziel »

Tell ChatGPT to make it portable and add endian awareness/support and I'll be impressed ;-)
AndyHazz
Posts: 9
Joined: Sat Mar 11, 2023 7:39 pm

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by AndyHazz »

Raziel wrote: Fri Mar 17, 2023 1:14 am Tell ChatGPT to make it portable and add endian awareness/support and I'll be impressed ;-)
Well, I guess you're joking but I asked and it spat out some new code with this summary:
Sure, here is some C++ code that should meet the updated spec. It uses the Windows API to change the screen resolution, run the target app, and restore the original screen resolution when the target app exits. It also uses Unicode strings to avoid issues with non-ASCII characters, and includes endian awareness for portability
.. though I've no idea what endian awareness is myself so I can't really verify that it has done what it says :roll:
The new code has some bugs too, it doesn't properly switch the resolution back after ScummVM exits, but what I had previously works well enough for me so I'll leave it there for now!
User avatar
criezy
ScummVM Developer
Posts: 955
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by criezy »

It uses the Windows API
I guess ChatGPT does not have the same definition for portability as we do. :D

Maybe it used that meaning: https://en.wikipedia.org/wiki/Portable_application
While I think Raziel meant that one: https://en.wikipedia.org/wiki/Software_portability

Regarding the "endian awareness" request from Raziel, I guess this was indeed written as a jest since it isn't relevant/needed in this case (that is mostly an issue for multi-platform applications that read or write binary files; like ScummVM). I would actually have been impressed if ChatGPT had told you that.
User avatar
rootfather
ScummVM Lead
Posts: 182
Joined: Tue Mar 31, 2015 11:59 am
Location: Germany
Contact:

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by rootfather »

AndyHazz wrote: Wed Mar 15, 2023 8:01 pm Disclaimer, ChatGPT wrote this for me, I can't code C++ :roll:
It took a few attempts but the end result appears to work well, and the code appears to be fairly simple for anyone who might want to check it out.
Just out of curiosity: Was this done with GPT-3 (e.g. the default version on chat.openai.com) or with GPT-4, which is available via the OpenAI Plus program?
User avatar
Raziel
ScummVM Porter
Posts: 1539
Joined: Tue Oct 25, 2005 8:27 am
Location: a dying planet
Contact:

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by Raziel »

Yeah sorry, I didn't want to waste anybodies time...it was meant as a joke ;-)
AndyHazz
Posts: 9
Joined: Sat Mar 11, 2023 7:39 pm

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by AndyHazz »

rootfather wrote: Fri Mar 17, 2023 8:19 pm
AndyHazz wrote: Wed Mar 15, 2023 8:01 pm Disclaimer, ChatGPT wrote this for me, I can't code C++ :roll:
It took a few attempts but the end result appears to work well, and the code appears to be fairly simple for anyone who might want to check it out.
Just out of curiosity: Was this done with GPT-3 (e.g. the default version on chat.openai.com) or with GPT-4, which is available via the OpenAI Plus program?
Just the default/free version on chat.openai.com.

It's been fun throwing random changes to the spec (thanks Raziel :lol:), and seeing all the ways it tries to adapt the code. It even took me through setting up Visual Studio and setting up the project, as I'd never done that before.

Just a prompt like this is enough to get it started:
Let's write some code - The app should be called SetRes, and made using C++. It should accept 3 command line options. The path to a target app which may include spaces and optional flags (e.g. "C:\Program Files\ScummVM\scummvm.exe -f") a target screen resolution width (e.g. 1280) and height (e.g. 720). SetRes will run the target app. Then, change to the target screen resolution. When the target app is closed, restore the original display resolution. An example command to run the app would be:
SetRes.exe "C:\Program Files\ScummVM\scummvm.exe -f" 1280 720
.. but there will be compilation errors, and bugs, so you keep giving it feedback or revising the spec until it works. I've had more luck with bits of JavaScript as I have a better sense of what's possible. C++ is way outside my comfort zone :oops:
lwc
Posts: 70
Joined: Mon Nov 27, 2006 10:11 am

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by lwc »

AndyHazz wrote: Fri Mar 17, 2023 11:08 pm
rootfather wrote: Fri Mar 17, 2023 8:19 pm
AndyHazz wrote: Wed Mar 15, 2023 8:01 pm Disclaimer, ChatGPT wrote this for me, I can't code C++ :roll:
It took a few attempts but the end result appears to work well, and the code appears to be fairly simple for anyone who might want to check it out.
Just out of curiosity: Was this done with GPT-3 (e.g. the default version on chat.openai.com) or with GPT-4, which is available via the OpenAI Plus program?
Just the default/free version on chat.openai.com.
FYI, GPT-4 is also available for free by using Bing Chat instead of ChatGPT. As of a few days ago, it doesn't even require registration, just using Windows' built-in Edge browser (in non InPrivate mode) through Bing Chat's website or just through the browser itself by clicking the "Discovery" button.

If you know some programming and like to be able to tweak the auto code and compile it to an actual EXE program (which you can put as a GitHub release), I recommend try the freeware AutoIt instead of C++. It can also be used to generate a GUIs (including dual GUI/non GUI programs). Last but not least, everything it does is portable by nature (including, if you choose so, the editor/compiler itself), unless of course you use it to install a driver, etc.

I've used it for for various like minded programs, such as launching another program at a lower volume (for programs that lack volume control), clean up leftovers left by other programs after they terminate, generating GUI frontends for console programs, etc.
AndyHazz
Posts: 9
Joined: Sat Mar 11, 2023 7:39 pm

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by AndyHazz »

lwc wrote: Sat May 06, 2023 4:02 pm FYI, GPT-4 is also available for free by using Bing Chat instead of ChatGPT. As of a few days ago, it doesn't even require registration, just using Windows' built-in Edge browser (in non InPrivate mode) through Bing Chat's website or just through the browser itself by clicking the "Discovery" button.

If you know some programming and like to be able to tweak the auto code and compile it to an actual EXE program (which you can put as a GitHub release), I recommend try the freeware AutoIt instead of C++. It can also be used to generate a GUIs (including dual GUI/non GUI programs). Last but not least, everything it does is portable by nature (including, if you choose so, the editor/compiler itself), unless of course you use it to install a driver, etc.

I've used it for for various like minded programs, such as launching another program at a lower volume (for programs that lack volume control), clean up leftovers left by other programs after they terminate, generating GUI frontends for console programs, etc.
AutoIt looks fun, I might have a play with that, but simulating keystrokes to automate changing screen resolution sounds a bit fragile? I expect I could get something that worked for me but anybody with a different os version would probably find it fails ...

I did compile the c++ code into an exe, it even has an icon :) It's inside the zip you can download from the release page in github: https://github.com/AndyHazz/SetRes/releases/latest - I think it works really well for this limited use case. Instructions are on the repo landing page: https://github.com/AndyHazz/SetRes

I did try asking GPT-4 but the results were pretty similar, it was just faster at responding. I also tried asking Bard (since they recently enabled code generation) and had less success, it would just ignore some of the spec and didn't handle everything properly, maybe I could get it to work if I spent more time on prompt engineering.
lwc
Posts: 70
Joined: Mon Nov 27, 2006 10:11 am

Re: SetRes - companion app to launch scummvm at lower screen resolution

Post by lwc »

AndyHazz wrote: Tue May 09, 2023 4:42 pm AutoIt looks fun, I might have a play with that, but simulating keystrokes to automate changing screen resolution sounds a bit fragile?
I didn't say use it for that. I meant it's a quick and friendly way to prepare any kind of Windows program.
Post Reply