File size: 1,852 Bytes
5ac6c6e
 
 
 
 
f3db0f3
 
 
 
 
 
 
5ac6c6e
 
 
 
 
f3db0f3
5ac6c6e
 
 
 
 
f3db0f3
5ac6c6e
 
f3db0f3
 
5ac6c6e
 
f3db0f3
5ac6c6e
f3db0f3
 
5ac6c6e
 
 
 
f3db0f3
5ac6c6e
f3db0f3
 
5ac6c6e
f3db0f3
5ac6c6e
f3db0f3
 
5ac6c6e
f3db0f3
5ac6c6e
f3db0f3
 
5ac6c6e
 
 
 
 
f3db0f3
 
5ac6c6e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <juce_audio_processors/juce_audio_processors.h>
#include <juce_gui_basics/juce_gui_basics.h>
#include <juce_events/juce_events.h>

#include "HelperPluginHost.h"

// PluginBridgeHelper — TEST MODE ONLY
// Spawned by PluginBridge to test if a plugin can load safely.
// If the plugin crashes, only this process dies. Ableton survives.
//
// Usage: PluginBridgeHelper --test "/path/to/plugin.vst3"
// Exit code 0 = safe, exit code 1 = failed to load, crash = unsafe

class HelperApplication : public juce::JUCEApplication
{
public:
    const juce::String getApplicationName() override { return "PluginBridgeHelper"; }
    const juce::String getApplicationVersion() override { return "0.3.0"; }

    void initialise(const juce::String& commandLine) override
    {
        auto args = juce::StringArray::fromTokens(commandLine, " ", "\"");

        juce::String pluginPath;
        for (int i = 0; i < args.size() - 1; ++i)
        {
            if (args[i] == "--test")
                pluginPath = args[i + 1];
        }

        if (pluginPath.isEmpty())
        {
            DBG("HelperApplication: Usage: --test \"/path/to/plugin.vst3\"");
            setApplicationReturnValue(1);
            quit();
            return;
        }

        DBG("HelperApplication: Testing plugin: " + pluginPath);

        HelperPluginHost host;
        bool success = host.testLoad(pluginPath);

        if (success)
        {
            DBG("HelperApplication: Plugin loaded successfully — SAFE");
            setApplicationReturnValue(0);
        }
        else
        {
            DBG("HelperApplication: Plugin failed to load — UNSAFE");
            setApplicationReturnValue(1);
        }

        quit();
    }

    void shutdown() override {}
    void systemRequestedQuit() override { quit(); }
};

START_JUCE_APPLICATION(HelperApplication)