Plugins: Schedule plugins before game thread.

This commit is contained in:
Unknown W. Brackets 2020-08-28 01:05:02 -07:00
parent 2f4945aad8
commit ac7522b0dd
5 changed files with 26 additions and 16 deletions

View file

@ -41,7 +41,7 @@ struct PluginInfo {
PluginType type;
std::string filename;
int version;
int memory;
uint32_t memory;
};
static PluginInfo ReadPluginIni(const std::string &subdir, IniFile &ini) {
@ -162,17 +162,18 @@ void Init() {
}
}
void Load() {
bool Load() {
bool started = false;
for (const std::string &filename : prxPlugins) {
std::string error_string = "";
SceUID module = KernelLoadModule(filename, &error_string);
if (!error_string.empty()) {
ERROR_LOG(SYSTEM, "Unable to load plugin %s: %s", filename.c_str(), error_string.c_str());
return;
continue;
}
if (module < 0) {
ERROR_LOG(SYSTEM, "Unable to load plugin %s: %08x", filename.c_str(), module);
return;
continue;
}
int ret = KernelStartModule(module, 0, 0, 0, nullptr, nullptr);
@ -181,7 +182,10 @@ void Load() {
}
INFO_LOG(SYSTEM, "Loaded plugin: %s", filename.c_str());
started = true;
}
return started;
}
void Unload() {