diff --git a/js/module.d.ts b/js/module.d.ts index 1a88aa5dd..a3baefb30 100644 --- a/js/module.d.ts +++ b/js/module.d.ts @@ -660,7 +660,7 @@ export interface IAudioFactory { reset(info: IAudioInfo): boolean; getGlobal(): IAudio; } -export interface IModuleFactory { +export interface IModuleFactory extends IFactoryTypes { open(binPath: string, dataPath: string): IModule; loadAll(): void; addPath(path: string, dataPath: string): void; diff --git a/js/module.ts b/js/module.ts index 429f9a5de..37125b6cf 100644 --- a/js/module.ts +++ b/js/module.ts @@ -1493,7 +1493,7 @@ export interface IAudioFactory { } -export interface IModuleFactory { +export interface IModuleFactory extends IFactoryTypes { open(binPath: string, dataPath: string): IModule; loadAll(): void; addPath(path: string, dataPath: string): void; diff --git a/obs-studio-client/source/main.cpp b/obs-studio-client/source/main.cpp index 9d3a87d1c..d212befbd 100644 --- a/obs-studio-client/source/main.cpp +++ b/obs-studio-client/source/main.cpp @@ -29,6 +29,7 @@ #include "transition.hpp" #include "video.hpp" #include "volmeter.hpp" +#include "module.hpp" extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 1; @@ -47,6 +48,7 @@ void main(v8::Local exports, v8::Local module, void* priv osn::Fader::Register(exports); osn::VolMeter::Register(exports); osn::Video::Register(exports); + osn::Module::Register(exports); while (initializerFunctions.size() > 0) { initializerFunctions.front()(exports); diff --git a/obs-studio-client/source/module.cpp b/obs-studio-client/source/module.cpp index 1ae6913fe..eceea32cc 100644 --- a/obs-studio-client/source/module.cpp +++ b/obs-studio-client/source/module.cpp @@ -35,7 +35,6 @@ Nan::Persistent osn::Module::prototype = Nan::Persistent(); - fnctemplate->Inherit(Nan::New(osn::Module::prototype)); fnctemplate->InstanceTemplate()->SetInternalFieldCount(1); fnctemplate->SetClassName(Nan::New("Module").ToLocalChecked()); @@ -60,7 +59,7 @@ Nan::NAN_METHOD_RETURN_TYPE osn::Module::Open(Nan::NAN_METHOD_ARGS_TYPE info) ASSERT_INFO_LENGTH(info, 2); ASSERT_GET_VALUE(info[0], bin_path); - ASSERT_GET_VALUE(info[0], data_path); + ASSERT_GET_VALUE(info[1], data_path); auto conn = GetConnection(); if (!conn) diff --git a/obs-studio-server/source/main.cpp b/obs-studio-server/source/main.cpp index 11d1a707e..14081a31f 100644 --- a/obs-studio-server/source/main.cpp +++ b/obs-studio-server/source/main.cpp @@ -41,6 +41,7 @@ #include "osn-transition.hpp" #include "osn-video.hpp" #include "osn-volmeter.hpp" +#include "osn-module.hpp" extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 1; @@ -169,6 +170,7 @@ int main(int argc, char* argv[]) osn::VolMeter::Register(myServer); osn::Properties::Register(myServer); osn::Video::Register(myServer); + osn::Module::Reigster(myServer); OBS_API::Register(myServer); OBS_content::Register(myServer); OBS_service::Register(myServer); diff --git a/obs-studio-server/source/nodeobs_api.cpp b/obs-studio-server/source/nodeobs_api.cpp index 8079e4fbd..5f3ff57dd 100644 --- a/obs-studio-server/source/nodeobs_api.cpp +++ b/obs-studio-server/source/nodeobs_api.cpp @@ -435,8 +435,8 @@ void OBS_API::OBS_API_initAPI( * 3. getenv(OBS_DATA_PATH) + /libobs <- Can be set anywhere * on the cli, in the frontend, or the backend. */ obs_add_data_path((g_moduleDirectory + "/libobs/data/libobs/").c_str()); - slobs_plugin = appdata_path.substr(0, appdata_path.size() - 14); - slobs_plugin.append("/slobs-plugin"); + slobs_plugin = appdata_path.substr(0, appdata_path.size() - 13); + slobs_plugin.append("/slobs-plugins"); obs_add_data_path((slobs_plugin + "/data/").c_str()); std::vector userData = std::vector(1024); @@ -821,7 +821,7 @@ void OBS_API::openAllModules(void) { OBS_service::resetVideoContext(NULL); - std::string plugins_paths[] = {g_moduleDirectory + "/obs-plugins/64bit", g_moduleDirectory + "/obs-plugins", slobs_plugin + "/obs-plugins"}; + std::string plugins_paths[] = {g_moduleDirectory + "/obs-plugins/64bit", g_moduleDirectory + "/obs-plugins", slobs_plugin + "/obs-plugins/64bit"}; std::string plugins_data_paths[] = { g_moduleDirectory + "/data/obs-plugins", plugins_data_paths[0], slobs_plugin + "/data/obs-plugins"}; diff --git a/obs-studio-server/source/osn-module.cpp b/obs-studio-server/source/osn-module.cpp index acbc8023e..631faa517 100644 --- a/obs-studio-server/source/osn-module.cpp +++ b/obs-studio-server/source/osn-module.cpp @@ -19,7 +19,7 @@ #include "error.hpp" #include "shared.hpp" -void osn::Module::Reigster(ipc::server&) +void osn::Module::Reigster(ipc::server& srv) { std::shared_ptr cls = std::make_shared("Module"); @@ -41,6 +41,8 @@ void osn::Module::Reigster(ipc::server&) std::make_shared("GetDataPath", std::vector{ipc::type::UInt64}, GetDataPath)); cls->register_function( std::make_shared("GetDataPath", std::vector{ipc::type::UInt64}, GetDataPath)); + + srv.register_collection(cls); } void osn::Module::Open(void* data, const int64_t id, const std::vector& args, std::vector& rval) diff --git a/obs-studio-server/source/osn-module.hpp b/obs-studio-server/source/osn-module.hpp index 98659f84b..027615b3b 100644 --- a/obs-studio-server/source/osn-module.hpp +++ b/obs-studio-server/source/osn-module.hpp @@ -24,6 +24,9 @@ namespace osn { class Module { + public: + static void Reigster(ipc::server&); + public: class Manager : public utility::unique_object_manager { @@ -41,8 +44,6 @@ namespace osn static Manager& GetInstance(); }; - public: - static void Reigster(ipc::server&); // Functions static void