Skip to content

Commit 12115a8

Browse files
author
loki
committed
Merge branch 'master' of github.com:loki-47-6F-64/sunshine
2 parents df5daa0 + 8ea9d34 commit 12115a8

File tree

2 files changed

+185
-117
lines changed

2 files changed

+185
-117
lines changed

README.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# Introduction
2+
Sunshine is a Gamestream host for Moonlight
3+
4+
- [Building](README.md#building)
5+
- [Credits](README.md#credits)
6+
7+
# Building
8+
- [Linux](README.md#linux)
9+
- [Windows](README.md#windows-10)
10+
11+
## Linux
12+
13+
### Requirements:
14+
Ubuntu 19.10:
15+
16+
sudo apt install cmake libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev
17+
18+
### Compilation:
19+
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules`
20+
- `cd sunshine && mkdir build && cd build`
21+
- `cmake ..`
22+
- `make`: It is suggested to use the `-j C#` flags with this command, `C#` being the number of cores your PC has
23+
24+
25+
### Setup:
26+
sunshine needs access to uinput to create mouse and gamepad events:
27+
- Add user to group 'input': "usermod -a -G input username
28+
- Create a file: "/etc/udev/rules.d/85-sunshine-input.rules"
29+
- The contents of the file is as follows:
30+
KERNEL=="uinput", GROUP="input", mode="0660"
31+
- assets/sunshine.conf is an example configuration file. Modify it as you see fit and use it by running: "sunshine path/to/sunshine.conf"
32+
- path/to/build/dir/sunshine.service is used to start sunshine in the background:
33+
- `cp sunshine.service $HOME/.config/systemd/user/`
34+
- Modify $HOME/.config/systemd/user/sunshine.conf to point to the sunshine executable
35+
- `systemctl --user start sunshine`
36+
37+
- assets/apps.json is an [example](README.md#application-list) of a list of applications that are started just before running a stream
38+
39+
### Trouleshooting:
40+
* If you get "Could not create Sunshine Gamepad: Permission Denied", ensure you are part of the group "input":
41+
* groups
42+
* If Sunshine sends audio from the microphone instead of the speaker, try the following steps:
43+
* pacmd list-sources | grep "name:"
44+
* Copy the name to the configuration option "audio_sink"
45+
* restart sunshine
46+
47+
48+
49+
## Windows 10
50+
51+
### Requirements:
52+
53+
MSYS2 : mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-boost
54+
55+
### Compilation:
56+
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules`
57+
- `cd sunshine && mkdir build && cd build`
58+
- `cmake -G"Unix Makefiles" ..`
59+
- `make`
60+
61+
### Setup:
62+
- **OPTIONAL** Gamepad support: Download and run 'ViGEmBus_Setup_1.16.116.exe' from [https://github.com/ViGEm/ViGEmBus/releases]
63+
64+
### Static build
65+
#### Requirements:
66+
MSYS2 : mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-boost git-lfs
67+
68+
#### Compilation:
69+
- `git lfs install`
70+
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules`
71+
- `cd sunshine && mkdir build && cd build`
72+
- `cmake -DSUNSHINE_STANDALONE=ON -DSUNSHINE_ASSETS_DIR=assets -G"Unix Makefiles" ..`
73+
- `make`
74+
75+
76+
77+
# Common
78+
79+
## Usage:
80+
- run "sunshine path/to/sunshine.conf"
81+
- In Moonlight: Add PC manually
82+
- When Moonlight request you insert the correct pin on sunshine, either:
83+
- `wget xxx.xxx.xxx.xxx:47989/pin/####`
84+
- Type in the URL bar of your browser: `xxx.xxx.xxx.xxx:47989/pin/####`
85+
- The x's are the IP of your instance, `####` is the pin
86+
- Click on one of the Applications listed
87+
- Have fun :)
88+
89+
90+
## Note:
91+
- The Windows key is not passed through by Moonlight, therefore Sunshine maps Right-Alt key to the Windows key
92+
- If you set Video Bitrate to 0.5Mb/s:
93+
- Sunshine will use CRF or QP to controll the quality of the stream. (See example configuration file for more details)
94+
- This is less CPU intensive and it has lower average bandwith requirements compared to manually setting bitrate to acceptable quality
95+
- However, it has higher peak bitrates, forcing Sunshine to drop entire frames when streaming 1080P due to their size.
96+
- When this happens, the video portion of the stream appears to be frozen.
97+
- This is rare enough that using this for the desktop environment is tolerable (in my opinion), however for gaming not so much.
98+
99+
100+
## Credits:
101+
- [Simple-Web-Server](https://gitlab.com/eidheim/Simple-Web-Server)
102+
- [Moonlight](https://github.com/moonlight-stream)
103+
- [Looking-Glass](https://github.com/gnif/LookingGlass) (For showing me how to properly capture frames on Windows, saving me a lot of time :)
104+
105+
## Application List:
106+
- You can use Environment variables in place of values
107+
- $(HOME) will be replaced by the value of $HOME
108+
- $$ will be replaced by $ --> $$(HOME) will be replaced by $(HOME)
109+
- env: Adds or overwrites Environment variables for the commands/applications run by Sunshine.
110+
- "Variable name":"Variable value"
111+
- apps: The list of applications
112+
- Example:
113+
```json
114+
{
115+
"name":"An App",
116+
"cmd":"command to open app",
117+
"prep-cmd":[
118+
{
119+
"do":"somecommand",
120+
"undo":"undothatcommand"
121+
}
122+
]
123+
}
124+
```
125+
- name: Self explanatory
126+
- output <optional>: The file where the output of the command is stored
127+
- If it is not specified, the output is ignored
128+
- prep-cmd: A list of commands to be run before/after the application
129+
- If any of the prep-commands fail, starting the application is aborted
130+
- do: Run before the application
131+
- If it fails, all 'undo' commands of the previously succeeded 'do' commands are run
132+
- undo <optional>: Run after the application has terminated
133+
- This should not fail considering it is supposed to undo the 'do' commands.
134+
- If it fails, Sunshine is terminated
135+
- cmd <optional>: The main application
136+
- If not specified, a processs is started that sleeps indefinitely
137+
138+
1. When an application is started, if there is an application already running, it will be terminated.
139+
2. When the application has been shutdown, the stream shuts down as well.
140+
3. In addition to the apps listed, one app "Desktop" is hardcoded into Sunshine. It does not start an application, instead it simply starts a stream.
141+
142+
Linux
143+
```json
144+
{
145+
"env":{
146+
"DISPLAY":":0",
147+
"DRI_PRIME":"1",
148+
"XAUTHORITY":"$(HOME)/.Xauthority",
149+
"PATH":"$(PATH):$(HOME)/.local/bin"
150+
},
151+
"apps":[
152+
{
153+
"name":"Low Res Desktop",
154+
"prep-cmd":[
155+
{ "do":"xrandr --output HDMI-1 --mode 1920x1080", "undo":"xrandr --output HDMI-1 --mode 1920x1200" }
156+
]
157+
},
158+
{
159+
"name":"Steam BigPicture",
160+
161+
"output":"steam.txt",
162+
"cmd":"steam -bigpicture",
163+
"prep-cmd":[]
164+
}
165+
]
166+
}
167+
```
168+
Windows
169+
```json
170+
{
171+
"env":{
172+
"PATH":"$(PATH);C:\\Program Files (x86)\\Steam"
173+
},
174+
"apps":[
175+
{
176+
"name":"Steam BigPicture",
177+
178+
"output":"steam.txt",
179+
"prep-cmd":[
180+
{"do":"steam \"steam://open/bigpicture\""}
181+
]
182+
}
183+
]
184+
}
185+
```

README.txt

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)