exelix11 / SysDVR

Stream switch games to your PC via USB or network
GNU General Public License v2.0
1.51k stars 90 forks source link

Building the Client from Source #324

Open a-huk opened 1 week ago

a-huk commented 1 week ago

Hello,

I would like to make a PR to improve the video ouput, applying some shaders. I am not very familiar with dotnet. I created a short demo in python, where I get the video stream from USB, display it, and apply some shaders with mpv. I would now like to make the changes so that said shader is applied in the client. I made some changes to Player.cs. I run dotnet build in the Client dir, no errors. But I would like to build the full sysdvr client with those changes. From the manual build steps in the wiki, sysdvr client seems to be already built. is is just a simple case of running dotnet build on the root of the repo on windows?

Sorry for the amateur question, but I really would like to learn a bit and make the changes.

exelix11 commented 1 week ago

Yes you just need to run dotnet build or dotnet run to have a binary for you platform. On windows you will need to manually add the binary dlls in the release folder for it to load. See the github actions build steps.

Can you paste here a demo of the shaders you want to implement ? This sounds interesting.

I'm not sure mpv shader are applicable here though.

a-huk commented 1 week ago

So basilly it would be like glsl shader such as the ones from Anime4k, which would allow for upscaling. The reason for me was that 720p on the switch lite is not great, so even upscaled (with it's cons) 1080p would be an improvement. Ofc you can go beyong 1080p, eg 4K for regular docked switch. Tested it on a TV and it basically is like if you put glasses on.

I have attached two example pictures (upscaled vs regular) from my Python demo, and I was only using some low-end shaders. Try them on https://www.diffchecker.com/image-compare/, they have the cool slider which allows you to see the difference.

I have started work on it today, but it's a big mess getting SDL2 and OpenGL to work together to apply the shaders to get it on the client. At least I wass able to confirm that there is opengl support. Ideally I would just apply them to the stream and stream that again to be displayed. I am not sure of the latency overhead. But the goal is to add an option with e.g. 4 presets (1080p-fast, 1080p-heavy, 4K-fast, 4K-heavy) (depends on your hadware and so on). And of course implement the glsl filters. Of course, what shaders to use is debatable, but getting those ones to work would be cool.

I don't want to dump this on you, but I think it could be a really cool addition to the project. So if you have any advice or comments, please feel free. mpv-shot0001 mpv-shot0002

exelix11 commented 1 week ago

I see one major blocker. SDL uses whatever rendering it supports on the host OS, currently on windows sysdvr uses directx, on mac metal and opengl on linux and android. Getting this to work on all platforms may not work, especially metal since it's likely going to be the most different one.