Moehammered / switch-remote-play

Let the switch remotely play PC games (similar to steam link or remote play)
GNU General Public License v3.0
301 stars 14 forks source link

change resolution back when stream stops #46

Open lemonhole opened 2 years ago

lemonhole commented 2 years ago

change resolution back when stream stops without closing the window app. so you can always have app running in the background.

ps: many thanks to you, Moehammered, such a nice app

Moehammered commented 2 years ago

Hi mate. Thanks for the kind words.

The app already does what you're asking. When you disconnect the stream, the application will restore the monitor's resolution to what it was before the stream connected.

Could you tell me what you're doing to make the resolution not change?

lemonhole commented 2 years ago

usually i just close the app on the switch with home button and resolution on the pc stays at 720p. i tried to close the app on the switch with holding plus button – i get "received kill signal" message but resolution also stays at 720p. it changes back to 1080p only when i close the window on the pc

Moehammered commented 2 years ago

I just tested it and the resolution returns to normal upon disconnect. The only way the resolution would stay the same is if resolution changing failed for some reason or if the resolution was the same before stream connection. A small overview of what it does:

In the config.ini file, if you have Log Importance Threshold=Low; then once the stream disconnects you should see:

Received kill signal
2022.01.03_13-18-19
Making sure to kill stream...

2022.01.03_13-18-19
Terminating the FFMPEG process

Stream stopped

Resetting resolution

Restoring audio mute state

Restoring console window

Can you please test the following for me:

  1. Make sure your monitor's resolution is set to 1080p
  2. In the Switch application, set the Desktop Resolution to 1280x720
  3. Start the stream and wait a moment
  4. Disconnect the stream from the Switch
  5. The PC monitor should return to 1080p

Let me know how that goes. Thanks.

lemonhole commented 2 years ago

decided to make a short video, here's the link to google photos: https://photos.app.goo.gl/DNbrzGPBqp6Z1cpi9

Moehammered commented 2 years ago

@lemonhole thanks for the video. I see it isn't working properly for you.

Can you please do the following:

  1. For the PC app, modify the config.ini file to have Log Importance Threshold=Low;
  2. For the Switch, launch switch remote play and attempt to connect then disconnect (don't use applet mode please)
  3. Please post the console log output here for me so I can take a look

Thanks

lemonhole commented 2 years ago

@Moehammered ok, made another video just to make sure that i do everything right: https://photos.app.goo.gl/JxDHS8aJVfQwVY4r9

to be short – log stopped at "looking for active network interfaces" (same as the program itself). the program access is allowed by the firewall but it doesn't go any further.

btw – the sound unmutes when i stop the stream from the switch

lemonhole commented 2 years ago

@Moehammered thanks for all your help and sorry for being that annoying, it's not much of an issue here in fact. we can just stop this discussion if it burdens you or something, it's not a big deal

Moehammered commented 2 years ago

@lemonhole Thank you very much for the second video. It's very helpful to see. That is very strange. I wonder why the program is behaving this way? I will make a special debugging version of the PC application and attach it to a comment here. Would you mind testing it for me? It will include extra logging information to check resolution settings and functions.

P.S. You're not being annoying. I appreciate the effort of trying to help me figure out the issue. If you didn't report it, then I'd never know about it. If I didn't know about it, I can't fix it. And if I can't fix it, then other users will share the same issue. So don't worry please. Thanks for the effort. I'm not burdened. :)

Moehammered commented 2 years ago

switch-remote-play-host_resolution_test.zip

@lemonhole Can you please try using this version I've attached? Unzip the files and place them in the folder where you're using switch remote play. Override all files.

It will now say when it is resetting the resolution:

Can you please try running the stream for 10 seconds, then disconnect, and then examine the log file? Please attach the log text file here so I can check what's going on.

Thanks. Hope we can get to the bottom of this. 👍

lemonhole commented 2 years ago

@Moehammered sadly nothing has changed and the log file is just empty.

i've managed to find a scenario when resolution changes back automatically -- i played loop hero (in fullscreen) from my steam library and when i stopped stream from the switch, it worked (tried both closing with holding plus button and pressing home button and closing app on the switch). the log file is empty with test app version and the same as before with the old one (stopped at looking for active network interfaces).

i played dicey dungeons in windowed mode before (because fullscreen just freezes the stream). so i tried to play "into the breach" (which works fine in fullscreen) but resolution doesn't change back

lemonhole commented 2 years ago

here's the log from the non test version. idk is there any problem with that but monitor resolution (1536 x 864) confuses me

Switch Remote Play Host (^.^)/ (PC Application version - 1.0.0)

---- Monitor ---- Printing active display devices found...

Wide viewing angle & High density FlexView Display 1920x1080 (\.\DISPLAY11\Monitor0) Number: 0 Primary: Yes -- Location -- (x,y): 0, 0 -- Resolution -- (width x height): 1536 x 864 Monitor ID: MONITOR\LEN4094{4d36e96e-e325-11ce-bfc1-08002be10318}\0003 Monitor Key: \Registry\Machine\System\CurrentControlSet\Control\Class{4d36e96e-e325-11ce-bfc1-08002be10318}\0003 Monitor System Name: \.\DISPLAY11

Display Adapter Info
    Adapter: Intel(R) Iris(R) Xe Graphics
    Adapter Key: \Registry\Machine\System\CurrentControlSet\Control\Video\{17E27242-D37A-11EB-A9B4-806E6F6E6963}\0000

---- Network ---- Looking for active network interfaces...

Moehammered commented 2 years ago

Alright I have an idea what might be going wrong. Can you please try using the test version I provided you one more time? If it doesn't work then please use the release version. Can you please try setting your desktop scaling to 100% and see if it works correctly? You pointed out that the monitor resolution is reported as (1536 x 864) and this is because of scaling. 1536 x 864 is the effective resolution when scaled at 125%. So when attempting to change back to 1536 x 864 windows says the resolution is invalid. It wants 1920 x 1080, then Windows will rescale 1920 x 1080 to become 1536 x 864. windows-res-scale

srp-configuration-setup

Please attach the output either via text copy and paste or a screenshot here please. Thanks. :)

lemonhole commented 2 years ago

@Moehammered that worked! with 100% scaling it works just fine. there's no log file. and here's the screenshot: qwe

sorry, i haven't mentioned it before but every time i close the app window on the pc there are lines (can't catch them with printscreen): cleaning up in event handler terminating video and process terminating broadcast listener terminating command receiver connection failed to accept connection: 10004