Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ namespace config {
}
} // namespace dd

alt_gamepad_numbering_t alt_gamepad_numbering {
{}, // alt_gamepad_numbering_mutex
{}, // sDeviceNames
true, // bFirstTimeControllerAllocation
true, // bFirstTimeParsing
true, // bFirstTimeFeedbackQueues
};

video_t video {
false, // headless_mode
true, // limit_framerate
Expand Down Expand Up @@ -572,6 +580,9 @@ namespace config {
true, // native pen/touch support
false, // enable input only mode
true, // forward_rumble
false, // alt_controller enable
4, // alt_controller_count
"strict", // alt_controller_mode
};

sunshine_t sunshine {
Expand Down Expand Up @@ -1280,6 +1291,9 @@ namespace config {
bool_f(vars, "high_resolution_scrolling", input.high_resolution_scrolling);
bool_f(vars, "native_pen_touch", input.native_pen_touch);
bool_f(vars, "enable_input_only_mode", input.enable_input_only_mode);
bool_f(vars, "enable_alt_controller_numbering_mode", input.enable_alt_controller_numbering_mode);
int_between_f(vars, "alt_controller_count", input.alt_controller_count, {1, 16}); // CORRESPONDS TO MAX_GAMEPADS = 16 in common.h on /src/platform/common.h
string_restricted_f(vars, "alt_controller_mode", input.alt_controller_mode, {"strict"sv, "shared"sv,"bothcontrollermodes"sv});

bool_f(vars, "hide_tray_controls", sunshine.hide_tray_controls);
bool_f(vars, "enable_pairing", sunshine.enable_pairing);
Expand Down Expand Up @@ -1521,4 +1535,10 @@ namespace config {

return 0;
}

// Alternate Controller placeholder for feedback queues
// Use alt_gamepad_numbering_mutex to access this element
// This will not work in the config.h file where the other alternate controller placeholder variables are because platf::feedback_queue_t is not defined and adding the "platform/common.h" in the config.h context will cause many files which include config.h to fail.
std::vector<platf::feedback_queue_t> placeholder_feedback_queues { platf::MAX_GAMEPADS };
std::vector< struct config::sDeviceNameOrder > VectorAlternateGamepadParameters;
} // namespace config
32 changes: 31 additions & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <mutex>

// local includes
#include "nvenc/nvenc_config.h"
Expand Down Expand Up @@ -212,6 +213,10 @@ namespace config {

bool enable_input_only_mode;
bool forward_rumble;
// Alternate Controller Numbering Mode
bool enable_alt_controller_numbering_mode;
int alt_controller_count;
std::string alt_controller_mode;
};

namespace flag {
Expand Down Expand Up @@ -285,7 +290,32 @@ namespace config {
std::vector<prep_cmd_t> state_cmds;
std::vector<server_cmd_t> server_cmds;
};


// Alternate Controller Numbering Mode

struct sDeviceNameOrder {
std::string sDeviceName;
std::string sOrder;
std::vector < int > vOrder;
std::string sShared;
std::vector < int > vShared;
std::string sJitterJoysticks;
std::vector < int > vJitterJoysticks;
std::string sSwapJoysticks;
std::vector < int > vSwapJoysticks;
std::string sUuid;
};

struct alt_gamepad_numbering_t {
std::recursive_mutex alt_gamepad_numbering_mutex;
std::vector< std::string > sDeviceNames;
volatile bool bFirstTimeControllerAllocation { true };
volatile bool bFirstTimeParsing { true };
volatile bool bFirstTimeFeedbackQueues { true };
};

extern std::vector< struct config::sDeviceNameOrder > VectorAlternateGamepadParameters;
extern alt_gamepad_numbering_t alt_gamepad_numbering;
extern video_t video;
extern audio_t audio;
extern stream_t stream;
Expand Down
13 changes: 12 additions & 1 deletion src/confighttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,9 @@ namespace confighttp {
#ifdef _WIN32
output_tree["platform"] = "windows";
#endif
output_tree["alt_controller_count"] = config::input.alt_controller_count;
output_tree["enable_alt_controller_numbering_mode"] = config::input.enable_alt_controller_numbering_mode;
output_tree["alt_controller_mode"] = config::input.alt_controller_mode;
output_tree["status"] = true;
send_response(response, output_tree);
}
Expand Down Expand Up @@ -908,6 +911,10 @@ namespace confighttp {
std::string uuid = input_tree.value("uuid", "");
std::string name = input_tree.value("name", "");
std::string display_mode = input_tree.value("display_mode", "");
std::string controller_list_numbers = input_tree.value("controller_list_numbers","");
std::string controller_list_shared = input_tree.value("controller_list_shared","");
std::string controller_list_jitter_joysticks = input_tree.value("controller_list_jitter_joysticks","");
std::string controller_list_swap_joysticks = input_tree.value("controller_list_swap_joysticks","");
bool enable_legacy_ordering = input_tree.value("enable_legacy_ordering", true);
bool allow_client_commands = input_tree.value("allow_client_commands", true);
bool always_use_virtual_display = input_tree.value("always_use_virtual_display", false);
Expand All @@ -923,7 +930,11 @@ namespace confighttp {
perm,
enable_legacy_ordering,
allow_client_commands,
always_use_virtual_display
always_use_virtual_display,
controller_list_numbers,
controller_list_shared,
controller_list_jitter_joysticks,
controller_list_swap_joysticks
);
send_response(response, output_tree);
} catch (std::exception &e) {
Expand Down
4 changes: 4 additions & 0 deletions src/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ namespace crypto {
bool enable_legacy_ordering;
bool allow_client_commands;
bool always_use_virtual_display;
std::string controller_list_numbers;
std::string controller_list_shared;
std::string controller_list_jitter_joysticks;
std::string controller_list_swap_joysticks;
};

using p_named_cert_t = std::shared_ptr<named_cert_t>;
Expand Down
Loading