gerstrong / Commander-Genius

Modern Interpreter for the Commander Keen (Vorticon Dreams and Galaxy) and also Cosmos Cosmic Adventure games. This is a mirror repo: The main gitlab repository is at: https://gitlab.com/Dringgstein/Commander-Genius
http://clonekeenplus.sourceforge.net/
Other
192 stars 36 forks source link

Issues when switching screen resolution #360

Open madmodder123 opened 4 years ago

madmodder123 commented 4 years ago

Raspberry Pi 4 with RetroPie 4.6.4 Commander Genius v2.4.5 built from source (although this issue has been here for awhile now)

If you set the game up in 1080p, quit out of the program, and then switch your resolution to 720p, the next time you launch Commander Genius you will only see a black screen due to the program trying to draw at a higher resolution than your monitor is displaying. If we could get some command line parameters to adjust program's the screen resolution that would solve this problem pretty easy, or develop an internal solution.

Here's my workaround in the meantime:

I wrote a bash script that is automatically launched before the game that grabs the screen resolution being used and then edits the cgenius.cfg file to have the proper resolution (I only switch between 720p and 1080p, but it wouldn't be hard to adjust the regex for other resolutions).

#!/usr/bin/env bash

OUTPUT="/opt/retropie/configs/ports/cgenius/cgenius.cfg"

screen_width=$(tvservice -s | grep -m 1 -o '[0-9][0-9][0-9]\+x[0-9][0-9][0-9]\+' | grep -m 1 -o '[0-9][0-9][0-9]\+x' | grep -m 1 -o '[0-9][0-9][0-9]\+')
screen_height=$(tvservice -s | grep -m 1 -o '[0-9][0-9][0-9]\+x[0-9][0-9][0-9]\+' | grep -m 1 -o 'x[0-9][0-9][0-9]\+' | grep -m 1 -o '[0-9][0-9][0-9]\+')

if [ "$screen_height" -ge "900" ]; then
    sudo sed -i 's/width = 1280/width = 1920/g' $OUTPUT
    sudo sed -i 's/height = 720/height = 1080/g' $OUTPUT
else
    sudo sed -i 's/width = 1920/width = 1280/g' $OUTPUT
    sudo sed -i 's/height = 1080/height = 720/g' $OUTPUT
fi

Thanks for all your work :)

gerstrong commented 4 years ago

Hi, you are welcome. Can you send me a log? Also be sure you really used the latest CG version, the one from the master branch. Regarding resolutions I have been fixing a lot black related issues in the last.

madmodder123 commented 4 years ago

Hi, you are welcome. Can you send me a log? Also be sure you really used the latest CG version, the one from the master branch. Regarding resolutions I have been fixing a lot black related issues in the last.

Here's the log: runcommand.log So here is what I observed:

Setup - Raspberry Pi set to 720p, cgenius set to 1080p fullscreen,

with OpenGL = false Same behavior I listed in my original post. with OpenGL = true UI will actually load, but will only show maybe 30% of the bottom right of the UI

snapshot

As a side note there seems to be an issue with OpenGL automatically being toggled off sometimes when you go into the Display/Video menus and back out (even if you don't change anything)

gerstrong commented 1 year ago

Sorry for the very late reply. It has been difficult to keep up with these bugs. I am reworking the resolution setup code. I'll get back to this when I have news. Apologies from my side.

alonroz commented 2 months ago

Having a similar issue on a 640x480 device. Resolution is fine on first load, but from the 2nd time I run the game, it resets itself to 1080p, no matter what settings I set in the game or launcher. Only erasing the cfg file works to fix the issue, which is a bother to do every time I run the game. I've even tried setting the cfg file to read-only, but somehow it still resets to 1080p.

gerstrong commented 2 months ago

Thanks for your Feedback, can you hint which version on which OS you used? Also commit id and post of the CGLog.html would be useful for further investigation.

alonroz commented 2 months ago

Thanks for your Feedback, can you hint which version on which OS you used? Also commit id and post of the CGLog.html would be useful for further investigation.

Device: Anbernic RG35XX SP OS: muOS v2405 Beans (https://muos.dev/release/plush/2405) Commander Genius is run via PortMaster (https://portmaster.games/detail.html?name=commander.genius&devices=)

I'll try to find the log in the device later today, will post if able to export it.