1+ /* ***********************************************************************************************
2+ * SwiftlyS2 is a scripting framework for Source2-based games.
3+ * Copyright (C) 2025 Swiftly Solution SRL via Sava Andrei-Sebastian and it's contributors (samyycX)
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
17+ ************************************************************************************************/
18+
19+ #include < scripting/scripting.h>
20+ #include < api/interfaces/manager.h>
21+
22+ uint8_t Bridge_Core_PluginManualLoadState ()
23+ {
24+ static auto config = g_ifaceService.FetchInterface <IConfiguration>(CONFIGURATION_INTERFACE_VERSION);
25+ if (bool * b = std::get_if<bool >(&config->GetValue (" core.ManualLoadPlugins" )))
26+ {
27+ return *b ? 1 : 0 ;
28+ }
29+ return 0 ;
30+ }
31+
32+ int Bridge_Core_PluginLoadOrder (char * out)
33+ {
34+ static auto config = g_ifaceService.FetchInterface <IConfiguration>(CONFIGURATION_INTERFACE_VERSION);
35+ if (std::string* vec = std::get_if<std::string>(&config->GetValue (" core.PluginLoadOrder" )))
36+ {
37+ if (out != nullptr ) strcpy (out, vec->c_str ());
38+ return static_cast <int >(vec->size ());
39+ }
40+ return 0 ;
41+ }
42+
43+ DEFINE_NATIVE (" Core.PluginManualLoadState" , Bridge_Core_PluginManualLoadState);
44+ DEFINE_NATIVE (" Core.PluginLoadOrder" , Bridge_Core_PluginLoadOrder);
0 commit comments