| 130 | static bool setupDone = setup(); |
| 131 | |
| 132 | static bool setup() |
| 133 | { |
| 134 | proc_handler_t *ph = obs_get_proc_handler(); |
| 135 | assert(ph != NULL); |
| 136 | |
| 137 | proc_handler_add(ph, registerScriptActionDeclString.c_str(), |
| 138 | &ScriptHandler::RegisterScriptAction, nullptr); |
| 139 | proc_handler_add(ph, deregisterScriptActionDeclString.c_str(), |
| 140 | &ScriptHandler::DeregisterScriptAction, nullptr); |
| 141 | proc_handler_add(ph, registerScriptConditionDeclString.c_str(), |
| 142 | &ScriptHandler::RegisterScriptCondition, nullptr); |
| 143 | proc_handler_add(ph, deregisterScriptConditionDeclString.c_str(), |
| 144 | &ScriptHandler::DeregisterScriptCondition, nullptr); |
| 145 | proc_handler_add(ph, getVariableValueDeclString.c_str(), |
| 146 | &ScriptHandler::GetVariableValue, nullptr); |
| 147 | proc_handler_add(ph, setVariableValueDeclString.c_str(), |
| 148 | &ScriptHandler::SetVariableValue, nullptr); |
| 149 | proc_handler_add(ph, registerTempVarDeclString.c_str(), |
| 150 | &ScriptHandler::RegisterTempVar, nullptr); |
| 151 | proc_handler_add(ph, deregisterAllTempVarsDeclString.c_str(), |
| 152 | &ScriptHandler::DeregisterAllTempVars, nullptr); |
| 153 | proc_handler_add(ph, setTempVarValueDeclString.c_str(), |
| 154 | &ScriptHandler::SetTempVarValue, nullptr); |
| 155 | proc_handler_add(ph, getRunningStatusDeclString.c_str(), |
| 156 | &ScriptHandler::GetRunningStatus, nullptr); |
| 157 | |
| 158 | auto sh = obs_get_signal_handler(); |
| 159 | signal_handler_add(sh, stopSignalDeclString.c_str()); |
| 160 | signal_handler_add(sh, startSignalDeclString.c_str()); |
| 161 | signal_handler_add(sh, resetIntervalDeclString.c_str()); |
| 162 | |
| 163 | static constexpr auto triggerSignal = [](const std::string_view &name) { |
| 164 | auto sh = obs_get_signal_handler(); |
| 165 | struct calldata data; |
| 166 | calldata_init(&data); |
| 167 | signal_handler_signal(sh, name.data(), &data); |
| 168 | calldata_free(&data); |
| 169 | }; |
| 170 | |
| 171 | AddIntervalResetStep([]() { triggerSignal(resetIntervalSignalName); }); |
| 172 | AddStartStep([]() { triggerSignal(startSignalName); }); |
| 173 | AddStopStep([]() { triggerSignal(stopSignalName); }); |
| 174 | return true; |
| 175 | } |
| 176 | |
| 177 | static void replaceProblematicChars(std::string &string) |
| 178 | { |
no test coverage detected