Skip to content

Commit

Permalink
VSTPlugin-win.cpp: Add Support for various other types of plugins
Browse files Browse the repository at this point in the history
See Github Issue obsproject#11 about plugins where OBS doesn't show an interface. Fixed.
  • Loading branch information
c3r1c3 committed Jan 27, 2017
1 parent 4f61448 commit 32d87dd
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions win/VSTPlugin-win.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*****************************************************************************
Copyright (C) 2016-2017 by Colin Edwards.
Additional Code Copyright (C) 2016-2017 by c3r1c3 <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -28,15 +29,29 @@ AEffect* VSTPlugin::loadEffect() {
dllHandle = LoadLibraryW(wpath);
bfree(wpath);
if(dllHandle == nullptr) {
printf("Failed trying to load VST from '%s', error %d\n",
pluginPath, GetLastError());
if (errorCode == ERROR_BAD_EXE_FORMAT) {
printf("Could not open library, wrong architecture.");
} else {
printf("Failed trying to load VST from '%s', error %d\n",
pluginPath, GetLastError());
}
return nullptr;
}

vstPluginMain mainEntryPoint =
(vstPluginMain)GetProcAddress(dllHandle, "VSTPluginMain");

if (!mainEntryPoint) {
if (mainEntryPoint == nullptr) {
mainEntryPoint =
(vstPluginMain)GetProcAddress(libraryHandle, "VstPluginMain()");
}

if (mainEntryPoint == nullptr) {
mainEntryPoint = (vstPluginMain)GetProcAddress(libraryHandle, "main");
}

if (mainEntryPoint == nullptr) {
printf("Couldn't get a pointer to plugin's main()");
return nullptr;
}

Expand Down

0 comments on commit 32d87dd

Please sign in to comment.