diff --git a/PROTOCOL.md b/PROTOCOL.md
index cfc079d8..1ba6b801 100644
--- a/PROTOCOL.md
+++ b/PROTOCOL.md
@@ -105,7 +105,8 @@ Returns the latest version of the plugin and the API.
__Request fields__ : none
__Response__ : always OK, with these additional fields :
- **"version"** (double) : OBSRemote API version. Fixed to 1.1 for retrocompatibility.
-- **"obs-websocket-version"** (string) : obs-websocket version
+- **"obs-websocket-version"** (string) : obs-websocket version string
+- **"obs-studio-version"** (string) : OBS Studio version string
#### "GetAuthRequired"
Tells the client if authentication is required. If it is, authentication parameters "challenge" and "salt" are passed in the response fields (see "Authentication").
diff --git a/Utils.cpp b/Utils.cpp
index a788e626..7e910dad 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -148,3 +148,18 @@ obs_data_t* Utils::GetSceneData(obs_source *source) {
obs_data_array_release(scene_items);
return sceneData;
}
+
+const char* Utils::OBSVersionString() {
+ uint32_t version = obs_get_version();
+
+ uint8_t major, minor, patch;
+ major = (version >> 24) & 0xFF;
+ minor = (version >> 16) & 0xFF;
+ patch = version & 0xFF;
+
+ size_t string_size = sizeof(char) * 12;
+ char *result = (char*)bmalloc(string_size);
+ sprintf_s(result, string_size, "%d.%d.%d", major, minor, patch);
+
+ return result;
+}
diff --git a/Utils.h b/Utils.h
index 776d135b..e42aa521 100644
--- a/Utils.h
+++ b/Utils.h
@@ -19,6 +19,7 @@ with this program. If not, see
#ifndef UTILS_H
#define UTILS_H
+#include
#include
#include
@@ -32,6 +33,8 @@ class Utils
static obs_data_array_t* GetScenes();
static obs_data_t* GetSceneData(obs_source *source);
+
+ static const char* Utils::OBSVersionString();
};
#endif // UTILS_H
\ No newline at end of file
diff --git a/WSRequestHandler.cpp b/WSRequestHandler.cpp
index ee9f32e0..26c65fa2 100644
--- a/WSRequestHandler.cpp
+++ b/WSRequestHandler.cpp
@@ -138,14 +138,17 @@ void WSRequestHandler::SendErrorResponse(const char *errorMessage)
void WSRequestHandler::HandleGetVersion(WSRequestHandler *owner)
{
+ const char* obs_version = Utils::OBSVersionString();
+
obs_data_t *data = obs_data_create();
obs_data_set_double(data, "version", 1.1);
obs_data_set_string(data, "obs-websocket-version", OBS_WEBSOCKET_VERSION);
- //obs_data_set_string(data, "obs-studio-version", OBS_VERSION); // Wrong
+ obs_data_set_string(data, "obs-studio-version", obs_version);
owner->SendOKResponse(data);
obs_data_release(data);
+ bfree((void*)obs_version);
}
void WSRequestHandler::HandleGetAuthRequired(WSRequestHandler *owner)