#include #include #include #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)