mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
overlay: OBS control window via WebSocket API (#773)
## Link to GitHub Issue or related Pull Request, if one exists n/a ## Description of change Adds an overlay window widget for controlling OBS over WebSocket. Add new lines to the FPS widget that shows recording / streaming timers. Show notifications for major state changes (stream started/stopped, recording started/paused/resumed/stopped) ## Testing
This commit is contained in:
@@ -102,6 +102,7 @@
|
||||
#include "overlay/notifications.h"
|
||||
#include "overlay/windows/patch_manager.h"
|
||||
#include "overlay/windows/iidx_seg.h"
|
||||
#include "overlay/windows/obs.h"
|
||||
#include "rawinput/rawinput.h"
|
||||
#include "rawinput/touch.h"
|
||||
#include "reader/reader.h"
|
||||
@@ -1437,6 +1438,26 @@ int main_implementation(int argc, char *argv[]) {
|
||||
cfg::CONFIGURATOR_FORCE_SOFTWARE_RENDER = true;
|
||||
}
|
||||
|
||||
// OBS WebSocket overlay settings
|
||||
if (options[launcher::Options::OBSWebSocketEnabled].value_bool()) {
|
||||
overlay::windows::OBS_CONTROL_ENABLED = true;
|
||||
}
|
||||
if (options[launcher::Options::OBSWebSocketHost].is_active()) {
|
||||
overlay::windows::OBS_CONTROL_HOST = options[launcher::Options::OBSWebSocketHost].value_text();
|
||||
}
|
||||
if (options[launcher::Options::OBSWebSocketPort].is_active()) {
|
||||
const auto obs_port = options[launcher::Options::OBSWebSocketPort].value_uint32();
|
||||
if (obs_port > 0 && obs_port <= 65535) {
|
||||
overlay::windows::OBS_CONTROL_PORT = static_cast<uint16_t>(obs_port);
|
||||
}
|
||||
}
|
||||
if (options[launcher::Options::OBSWebSocketPassword].is_active()) {
|
||||
overlay::windows::OBS_CONTROL_PASSWORD = options[launcher::Options::OBSWebSocketPassword].value_text();
|
||||
}
|
||||
if (options[launcher::Options::OBSWebSocketDebug].value_bool()) {
|
||||
overlay::windows::OBS_CONTROL_DEBUG = true;
|
||||
}
|
||||
|
||||
// API debugging
|
||||
if (api_debug && !cfg::CONFIGURATOR_STANDALONE) {
|
||||
API_CONTROLLER = std::make_unique<api::Controller>(api_port, api_pass, api_pretty);
|
||||
|
||||
@@ -52,6 +52,7 @@ static const std::vector<std::string> CATEGORY_ORDER_NETWORK = {
|
||||
static const std::vector<std::string> CATEGORY_ORDER_OVERLAY = {
|
||||
"General Overlay",
|
||||
"Game Overlay",
|
||||
"OBS Control",
|
||||
};
|
||||
|
||||
static const std::vector<std::string> CATEGORY_ORDER_ADVANCED = {
|
||||
@@ -3201,6 +3202,51 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
||||
.type = OptionType::Bool,
|
||||
.category = "Development",
|
||||
},
|
||||
{
|
||||
// OBSWebSocketEnabled
|
||||
.title = "OBS WebSocket Enable",
|
||||
.name = "obsenable",
|
||||
.desc = "Enables the in-game OBS Control overlay and its connection to the OBS Studio "
|
||||
"obs-websocket (v5) server.",
|
||||
.type = OptionType::Bool,
|
||||
.category = "OBS Control",
|
||||
},
|
||||
{
|
||||
// OBSWebSocketHost
|
||||
.title = "OBS WebSocket Host",
|
||||
.name = "obshost",
|
||||
.desc = "Host name or IP address of the OBS Studio obs-websocket (v5) server used by "
|
||||
"the in-game OBS Control overlay. Defaults to 127.0.0.1 when left empty.",
|
||||
.type = OptionType::Text,
|
||||
.category = "OBS Control",
|
||||
},
|
||||
{
|
||||
// OBSWebSocketPort
|
||||
.title = "OBS WebSocket Port",
|
||||
.name = "obsport",
|
||||
.desc = "Port of the OBS Studio obs-websocket (v5) server. Defaults to 4455 when left empty.",
|
||||
.type = OptionType::Integer,
|
||||
.category = "OBS Control",
|
||||
},
|
||||
{
|
||||
// OBSWebSocketPassword
|
||||
.title = "OBS WebSocket Password",
|
||||
.name = "obspass",
|
||||
.desc = "Password for the OBS Studio obs-websocket (v5) server. Leave empty if "
|
||||
"authentication is disabled in OBS.",
|
||||
.type = OptionType::Text,
|
||||
.category = "OBS Control",
|
||||
.sensitive = true,
|
||||
},
|
||||
{
|
||||
// OBSWebSocketDebug
|
||||
.title = "OBS WebSocket Debug",
|
||||
.name = "obsdebug",
|
||||
.desc = "Writes the OBS WebSocket client's internal connection diagnostics to the log. "
|
||||
"Only enable this when troubleshooting connection problems.",
|
||||
.type = OptionType::Bool,
|
||||
.category = "OBS Control",
|
||||
},
|
||||
};
|
||||
|
||||
const std::vector<std::string> &launcher::get_categories(Options::OptionsCategory category) {
|
||||
|
||||
@@ -305,7 +305,12 @@ namespace launcher {
|
||||
DisableHighResTimer,
|
||||
EnableICMPHook,
|
||||
AutoElevate,
|
||||
CfgForceSoftwareRender
|
||||
CfgForceSoftwareRender,
|
||||
OBSWebSocketEnabled,
|
||||
OBSWebSocketHost,
|
||||
OBSWebSocketPort,
|
||||
OBSWebSocketPassword,
|
||||
OBSWebSocketDebug
|
||||
};
|
||||
|
||||
enum class OptionsCategory {
|
||||
|
||||
Reference in New Issue
Block a user