MCPcopy Create free account
hub / github.com/crosire/reshade / load_addons

Method load_addons

source/addon_manager.cpp:144–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142static unsigned long s_reference_count = 0;
143
144void reshade::load_addons()
145{
146 // Only load add-ons the first time a reference is added
147 if (InterlockedIncrement(&s_reference_count) != 1)
148 return;
149
150 ini_file &config = global_config();
151
152 addon_all_loaded = true;
153
154 std::vector<std::string> disabled_addons;
155 config.get("ADDON", "DisabledAddons", disabled_addons);
156
157#if RESHADE_VERBOSE_LOG
158 log::message(log::level::info, "Loading built-in add-ons ...");
159#endif
160
161#if 1
162 { addon_info &info = addon_loaded_info.emplace_back();
163 info.name = "Generic Depth";
164 info.description = "Automatic depth buffer detection that works in the majority of games.";
165 info.file = g_reshade_dll_path.filename().u8string();
166 info.author = "crosire";
167 info.external = false;
168
169 if (std::find(disabled_addons.cbegin(), disabled_addons.cend(), info.name) == disabled_addons.cend())
170 {
171 info.handle = g_module_handle;
172
173 register_addon_depth();
174 }
175 }
176 { addon_info &info = addon_loaded_info.emplace_back();
177 info.name = "Effect Runtime Sync";
178 info.description = "Adds preset synchronization between different effect runtime instances, e.g. to have changes in a desktop window reflect in VR.";
179 info.file = g_reshade_dll_path.filename().u8string();
180 info.author = "crosire";
181 info.external = false;
182
183 if (std::find(disabled_addons.cbegin(), disabled_addons.cend(), info.name) == disabled_addons.cend())
184 {
185 info.handle = g_module_handle;
186
187 register_addon_effect_runtime_sync();
188 }
189 }
190#endif
191
192 // Initialize any add-ons that were registered externally
193 const std::vector<addon_info> loaded_info_copy = addon_loaded_info;
194 for (const addon_info &info : loaded_info_copy)
195 {
196 if (info.handle == nullptr || info.handle == g_module_handle)
197 continue; // Skip disabled and built-in add-ons
198
199 assert(info.external);
200
201 log::message(log::level::info, "Loading externally registered add-on \"%s\" ...", info.name.c_str());

Callers

nothing calls this directly

Calls 4

messageFunction · 0.85
register_addon_depthFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected