mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-11-15 02:30:15 +01:00
Implemented codes list reading for mod loader (#315)
This commit is contained in:
1 parent
39272b7975
commit
54aacf9a1f
4 files changed
+50
-12
No files matched your search
@@ -5,7 +5,9 @@
|
||||
#include <cpu/guest_stack_var.h>
|
||||
#include <kernel/function.h>
|
||||
#include <kernel/heap.h>
|
||||
#include <user/config.h>
|
||||
#include <user/paths.h>
|
||||
#include <os/logger.h>
|
||||
#include <os/process.h>
|
||||
#include <xxHashMap.h>
|
||||
|
||||
@@ -208,6 +210,42 @@ void ModLoader::Init()
|
||||
if (!mod.includeDirs.empty())
|
||||
g_mods.emplace_back(std::move(mod));
|
||||
}
|
||||
|
||||
auto codeCount = modsDbIni.get<size_t>("Codes", "CodeCount", 0);
|
||||
|
||||
if (codeCount)
|
||||
{
|
||||
std::vector<std::string> codes{};
|
||||
|
||||
for (size_t i = 0; i < codeCount; i++)
|
||||
{
|
||||
auto name = modsDbIni.getString("Codes", fmt::format("Code{}", i), "");
|
||||
|
||||
if (name.empty())
|
||||
continue;
|
||||
|
||||
codes.push_back(name);
|
||||
}
|
||||
|
||||
for (auto& def : g_configDefinitions)
|
||||
{
|
||||
if (!def->IsHidden() || def->GetSection() != "Codes")
|
||||
continue;
|
||||
|
||||
/* NOTE: this is inefficient, but it happens
|
||||
once on boot for a handful of codes at release
|
||||
and is temporary until we support real code mods. */
|
||||
for (size_t i = 0; i < codes.size(); i++)
|
||||
{
|
||||
if (def->GetName() == codes[i])
|
||||
{
|
||||
LOGFN("Loaded code: {}", codes[i]);
|
||||
*(bool*)def->GetValue() = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr uint32_t LZX_SIGNATURE = 0xFF512EE;
|
||||
|
||||
Reference in new issue
Block a user