JustChap
New Member
Hi there!
I'm working on integrating OBS into a NodeJS application via Node's native addons API and, while I can get it working in a test environment, I'm having some trouble when packaging it with the application. C/C++ development is very new to me, so please forgive any simple mistakes :)
My issue revolves around the directory structures that OBS.dll seems to expect. OBS seems to attempt to load some DLLs and .effect files in a predefined location relative to the CWD and I'm looking to override this behaviour.
Here's how I'm roughly trying to structure the application:
-----
App root
So the Node app starts at index.js, where OBSBinding.node is imported and utilised. OBSBinding exposes the libOBS stuff to Node, allowing me to call obs_startup(), obs_reset_video() and all that. Unfortunately in this setup OBS gives me some import errors
If I move libobs-d3d11.dll into the App root (right next to index.js), that error goes away and I move a little further through the startup:
To fix this error, I looked at the directory structure for the OBS studio release and replicated that. Problem is, that means I have to place a bunch of .effect files two directories above the App's root directory. So the structure would look like this
----
- data
When I use this layout, the app works perfectly and I'm able to launch OBS and initialise the video and audio systems as expected. Great! But this structure is clearly very inconvenient, both because of the .effect files being outside of the app's directory and libobs-d3d11.dll (and I assume other dlls if I use more OBS features?) being laid out flat in the App root. I don't think I can change the CWD passed to OBS.dll, so I'm not able to just bury the required structure within App root subfolders.
Is there a way I can change where OBS looks for these files? Ideally so that I can structure the application in the way I outlined earlier.
I couldn't seem to find any description of this behaviour in the OBS docs so I'm not sure exactly where I should be setting this option. Or, if there isn't an easy config built in to OBS, I suppose I could modify the source code to manually fit my structure if someone could point me in the right direction.
Any ideas welcome, thanks in advance!
I'm working on integrating OBS into a NodeJS application via Node's native addons API and, while I can get it working in a test environment, I'm having some trouble when packaging it with the application. C/C++ development is very new to me, so please forgive any simple mistakes :)
My issue revolves around the directory structures that OBS.dll seems to expect. OBS seems to attempt to load some DLLs and .effect files in a predefined location relative to the CWD and I'm looking to override this behaviour.
Here's how I'm roughly trying to structure the application:
-----
App root
- obs
- data
- libobs
(the .effect files...)
- bin
obs.dll
libobs-d3d11.dll
(other dlls...)
OBSBinding.node
index.ts <-- Entry point
-----So the Node app starts at index.js, where OBSBinding.node is imported and utilised. OBSBinding exposes the libOBS stuff to Node, allowing me to call obs_startup(), obs_reset_video() and all that. Unfortunately in this setup OBS gives me some import errors
info: LoadLibrary failed for 'libobs-d3d11': The specified module could not be found.
If I move libobs-d3d11.dll into the App root (right next to index.js), that error goes away and I move a little further through the startup:
Code:
info: CPU Name: Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
info: CPU Speed: 2400MHz
info: Physical Cores: 4, Logical Cores: 8
info: Physical Memory: 7897MB Total, 955MB Free
info: Windows Version: 10.0 Build 18362 (release: 1903; revision: 900; 64-bit)
info: Running as administrator: false
info: Aero is Enabled (Aero is always on for windows 8 and above)
info: Windows 10 Gaming Features:
info: Game DVR: On
info: Sec. Software Status:
info: Windows Defender Antivirus: enabled (AV)
info: Windows Firewall: enabled (FW)
info: ---------------------------------
info: Initializing D3D11...
info: Available Video Adapters:
info: Adapter 0: Intel(R) UHD Graphics 630
info: Dedicated VRAM: 134217728
info: Shared VRAM: 4140423168
info: PCI ID: 8086:3e9b
info: Driver Version: 26.20.100.7985
info: output 0: pos={0, 0}, size={1920, 1080}, attached=true, refresh=59, name=DELL S2340L
info: output 1: pos={-1920, 0}, size={1536, 864}, attached=true, refresh=60, name=
info: Adapter 1: NVIDIA GeForce GTX 1650
info: Dedicated VRAM: 4156555264
info: Shared VRAM: 4140423168
info: PCI ID: 10de:1f91
info: Driver Version: 26.21.14.4274
info: Loading up D3D11 on adapter Intel(R) UHD Graphics 630 (0)
info: D3D11 loaded successfully, feature level used: b000
info: DXGI increase maximum frame latency success
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
debug: gs_effect_create_from_file: Null 'file' parameter
info: Freeing OBS context data
To fix this error, I looked at the directory structure for the OBS studio release and replicated that. Problem is, that means I have to place a bunch of .effect files two directories above the App's root directory. So the structure would look like this
----
- data
- libobs
area.effect
bicubic_scale.effect
(the other .effect files...)
- App parent folder- App root
index.ts <-- Entry point
libobs-d3d11.dll
----When I use this layout, the app works perfectly and I'm able to launch OBS and initialise the video and audio systems as expected. Great! But this structure is clearly very inconvenient, both because of the .effect files being outside of the app's directory and libobs-d3d11.dll (and I assume other dlls if I use more OBS features?) being laid out flat in the App root. I don't think I can change the CWD passed to OBS.dll, so I'm not able to just bury the required structure within App root subfolders.
Is there a way I can change where OBS looks for these files? Ideally so that I can structure the application in the way I outlined earlier.
I couldn't seem to find any description of this behaviour in the OBS docs so I'm not sure exactly where I should be setting this option. Or, if there isn't an easy config built in to OBS, I suppose I could modify the source code to manually fit my structure if someone could point me in the right direction.
Any ideas welcome, thanks in advance!