Merge branch 'master' into cuda

This commit is contained in:
loki-47-6F-64
2021-09-14 15:09:21 +02:00
5 changed files with 63 additions and 60 deletions
+4 -2
View File
@@ -79,9 +79,11 @@ It's necessary to allow Sunshine to use KMS
- `groups $USER` - `groups $USER`
- If Sunshine sends audio from the microphone instead of the speaker, try the following steps: - If Sunshine sends audio from the microphone instead of the speaker, try the following steps:
1. `$ pacmd list-sources | grep "name:"` or `$ pactl info | grep Source` if running pipewire. 1. Check whether you're using Pulseaudio or Pipewire
- Pulseaudio: Use `pacmd list-sources | grep "name:"`
- Pipewire: Use `pactl info | grep Source`. In some causes you'd need to use the `sink` device. Try `pactl info | grep Sink`, if _Source_ doesn't work.
2. Copy the name to the configuration option "audio_sink" 2. Copy the name to the configuration option "audio_sink"
3. restart sunshine 3. Restart sunshine
- If you get "Error: Failed to create client: Daemon not running", ensure that your avahi-daemon is running: - If you get "Error: Failed to create client: Daemon not running", ensure that your avahi-daemon is running:
- `systemctl status avahi-daemon` - `systemctl status avahi-daemon`
+53 -53
View File
@@ -155,44 +155,6 @@ inline int apply_shortcut(short keyCode) {
return 0; return 0;
} }
/**
* Update flags for keyboard shortcut combo's
*/
inline void update_shortcutFlags(int *flags, short keyCode, bool release) {
switch(keyCode) {
case VKEY_SHIFT:
case VKEY_LSHIFT:
case VKEY_RSHIFT:
if(release) {
*flags &= ~input_t::SHIFT;
}
else {
*flags |= input_t::SHIFT;
}
break;
case VKEY_CONTROL:
case VKEY_LCONTROL:
case VKEY_RCONTROL:
if(release) {
*flags &= ~input_t::CTRL;
}
else {
*flags |= input_t::CTRL;
}
break;
case VKEY_MENU:
case VKEY_LMENU:
case VKEY_RMENU:
if(release) {
*flags &= ~input_t::ALT;
}
else {
*flags |= input_t::ALT;
}
break;
}
}
void print(PNV_REL_MOUSE_MOVE_PACKET packet) { void print(PNV_REL_MOUSE_MOVE_PACKET packet) {
BOOST_LOG(debug) BOOST_LOG(debug)
<< "--begin relative mouse move packet--"sv << std::endl << "--begin relative mouse move packet--"sv << std::endl
@@ -396,18 +358,6 @@ void passthrough(std::shared_ptr<input_t> &input, PNV_MOUSE_BUTTON_PACKET packet
platf::button_mouse(platf_input, button, release); platf::button_mouse(platf_input, button, release);
} }
void repeat_key(short key_code) {
// If key no longer pressed, stop repeating
if(!key_press[key_code]) {
key_press_repeat_id = nullptr;
return;
}
platf::keyboard(platf_input, key_code, false);
key_press_repeat_id = task_pool.pushDelayed(repeat_key, config::input.key_repeat_period, key_code).task_id;
}
short map_keycode(short keycode) { short map_keycode(short keycode) {
auto it = config::input.keybindings.find(keycode); auto it = config::input.keybindings.find(keycode);
if(it != std::end(config::input.keybindings)) { if(it != std::end(config::input.keybindings)) {
@@ -417,6 +367,56 @@ short map_keycode(short keycode) {
return keycode; return keycode;
} }
/**
* Update flags for keyboard shortcut combo's
*/
inline void update_shortcutFlags(int *flags, short keyCode, bool release) {
switch(keyCode) {
case VKEY_SHIFT:
case VKEY_LSHIFT:
case VKEY_RSHIFT:
if(release) {
*flags &= ~input_t::SHIFT;
}
else {
*flags |= input_t::SHIFT;
}
break;
case VKEY_CONTROL:
case VKEY_LCONTROL:
case VKEY_RCONTROL:
if(release) {
*flags &= ~input_t::CTRL;
}
else {
*flags |= input_t::CTRL;
}
break;
case VKEY_MENU:
case VKEY_LMENU:
case VKEY_RMENU:
if(release) {
*flags &= ~input_t::ALT;
}
else {
*flags |= input_t::ALT;
}
break;
}
}
void repeat_key(short key_code) {
// If key no longer pressed, stop repeating
if(!key_press[key_code]) {
key_press_repeat_id = nullptr;
return;
}
platf::keyboard(platf_input, map_keycode(key_code), false);
key_press_repeat_id = task_pool.pushDelayed(repeat_key, config::input.key_repeat_period, key_code).task_id;
}
void passthrough(std::shared_ptr<input_t> &input, PNV_KEYBOARD_PACKET packet) { void passthrough(std::shared_ptr<input_t> &input, PNV_KEYBOARD_PACKET packet) {
auto constexpr BUTTON_RELEASED = 0x04; auto constexpr BUTTON_RELEASED = 0x04;
@@ -452,7 +452,7 @@ void passthrough(std::shared_ptr<input_t> &input, PNV_KEYBOARD_PACKET packet) {
pressed = !release; pressed = !release;
update_shortcutFlags(&input->shortcutFlags, keyCode, release); update_shortcutFlags(&input->shortcutFlags, map_keycode(keyCode), release);
platf::keyboard(platf_input, map_keycode(keyCode), release); platf::keyboard(platf_input, map_keycode(keyCode), release);
} }
@@ -460,7 +460,7 @@ void passthrough(PNV_SCROLL_PACKET packet) {
platf::scroll(platf_input, util::endian::big(packet->scrollAmt1)); platf::scroll(platf_input, util::endian::big(packet->scrollAmt1));
} }
int updateGamepads(std::vector<gamepad_t> &gamepads, std::int16_t old_state, std::int16_t new_state, platf::rumble_queue_t rumble_queue) { int updateGamepads(std::vector<gamepad_t> &gamepads, std::int16_t old_state, std::int16_t new_state, const platf::rumble_queue_t &rumble_queue) {
auto xorGamepadMask = old_state ^ new_state; auto xorGamepadMask = old_state ^ new_state;
if(!xorGamepadMask) { if(!xorGamepadMask) {
return 0; return 0;
@@ -486,7 +486,7 @@ int updateGamepads(std::vector<gamepad_t> &gamepads, std::int16_t old_state, std
return -1; return -1;
} }
if(platf::alloc_gamepad(platf_input, id, std::move(rumble_queue))) { if(platf::alloc_gamepad(platf_input, id, rumble_queue)) {
free_id(gamepadMask, id); free_id(gamepadMask, id);
// allocating a gamepad failed: solution: ignore gamepads // allocating a gamepad failed: solution: ignore gamepads
// The implementations of platf::alloc_gamepad already has logging // The implementations of platf::alloc_gamepad already has logging
+1 -1
View File
@@ -290,7 +290,7 @@ void scroll(input_t &input, int distance);
void keyboard(input_t &input, uint16_t modcode, bool release); void keyboard(input_t &input, uint16_t modcode, bool release);
void gamepad(input_t &input, int nr, const gamepad_state_t &gamepad_state); void gamepad(input_t &input, int nr, const gamepad_state_t &gamepad_state);
int alloc_gamepad(input_t &input, int nr, rumble_queue_t &&rumble_queue); int alloc_gamepad(input_t &input, int nr, rumble_queue_t rumble_queue);
void free_gamepad(input_t &input, int nr); void free_gamepad(input_t &input, int nr);
#define SERVICE_NAME "Sunshine" #define SERVICE_NAME "Sunshine"
+4 -3
View File
@@ -51,8 +51,8 @@ struct keycode_t {
constexpr auto UNKNOWN = 0; constexpr auto UNKNOWN = 0;
static constexpr std::array<keycode_t, 0xDF> init_keycodes() { static constexpr std::array<keycode_t, 0xE3> init_keycodes() {
std::array<keycode_t, 0xDF> keycodes {}; std::array<keycode_t, 0xE3> keycodes {};
#define __CONVERT(wincode, linuxcode, scancode) \ #define __CONVERT(wincode, linuxcode, scancode) \
static_assert(wincode < keycodes.size(), "Keycode doesn't fit into keycode array"); \ static_assert(wincode < keycodes.size(), "Keycode doesn't fit into keycode array"); \
@@ -182,6 +182,7 @@ static constexpr std::array<keycode_t, 0xDF> init_keycodes() {
__CONVERT(0xDC /* VKEY_OEM_5 */, KEY_BACKSLASH, 0x70031); __CONVERT(0xDC /* VKEY_OEM_5 */, KEY_BACKSLASH, 0x70031);
__CONVERT(0xDD /* VKEY_OEM_6 */, KEY_RIGHTBRACE, 0x70030); __CONVERT(0xDD /* VKEY_OEM_6 */, KEY_RIGHTBRACE, 0x70030);
__CONVERT(0xDE /* VKEY_OEM_7 */, KEY_APOSTROPHE, 0x70034); __CONVERT(0xDE /* VKEY_OEM_7 */, KEY_APOSTROPHE, 0x70034);
__CONVERT(0xE2 /* VKEY_NON_US_BACKSLASH */, KEY_102ND, 0x70064);
#undef __CONVERT #undef __CONVERT
return keycodes; return keycodes;
@@ -985,7 +986,7 @@ void keyboard(input_t &input, uint16_t modcode, bool release) {
keycode.pressed = 1; keycode.pressed = 1;
} }
int alloc_gamepad(input_t &input, int nr, rumble_queue_t &&rumble_queue) { int alloc_gamepad(input_t &input, int nr, rumble_queue_t rumble_queue) {
return ((input_raw_t *)input.get())->alloc_gamepad(nr, std::move(rumble_queue)); return ((input_raw_t *)input.get())->alloc_gamepad(nr, std::move(rumble_queue));
} }
+1 -1
View File
@@ -326,7 +326,7 @@ void keyboard(input_t &input, uint16_t modcode, bool release) {
send_input(i); send_input(i);
} }
int alloc_gamepad(input_t &input, int nr, rumble_queue_t &&rumble_queue) { int alloc_gamepad(input_t &input, int nr, rumble_queue_t rumble_queue) {
if(!input) { if(!input) {
return 0; return 0;
} }