#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, private juce::Timer { public: const juce::String getApplicationName() override { return "PluginBridgeHelper"; } const juce::String getApplicationVersion() override { return "0.3.0"; } void initialise(const juce::String& commandLine) override { // Parse --test flag. Everything after --test is the path (may contain spaces). auto testFlagPos = commandLine.indexOf("--test"); if (testFlagPos < 0) { DBG("HelperApplication: Usage: --test \"/path/to/plugin.vst3\""); setApplicationReturnValue(1); quit(); return; } // Extract path: skip "--test " (7 chars), trim quotes pluginPath = commandLine.substring(testFlagPos + 7).trim().unquoted(); if (pluginPath.isEmpty()) { DBG("HelperApplication: No plugin path provided"); setApplicationReturnValue(1); quit(); return; } DBG("HelperApplication: Testing plugin: " + pluginPath); // Start test on a timer so the message loop is running // (some plugins need it for VST3 validation) startTimer(100); } void timerCallback() override { stopTimer(); 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(); } private: juce::String pluginPath; }; START_JUCE_APPLICATION(HelperApplication)