mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Implemented codes list reading for mod loader (#315)
This commit is contained in:
parent
39272b7975
commit
54aacf9a1f
4 changed files with 50 additions and 12 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ static class FrontendListener : public SDLEventListener
|
|||
public:
|
||||
bool OnSDLEvent(SDL_Event* event) override
|
||||
{
|
||||
if (!Config::HUDToggleHotkey || OptionsMenu::s_isVisible)
|
||||
if (!Config::HUDToggleKey || OptionsMenu::s_isVisible)
|
||||
return false;
|
||||
|
||||
switch (event->type)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ void PostUnleashMidAsmHook(PPCRegister& r30)
|
|||
|
||||
void SetXButtonHomingMidAsmHook(PPCRegister& r30)
|
||||
{
|
||||
r30.u32 = Config::HomingAttackOnBoost;
|
||||
r30.u32 = !Config::HomingAttackOnJump;
|
||||
}
|
||||
|
||||
// SWA::Player::CEvilSonicContext
|
||||
|
|
|
|||
|
|
@ -98,15 +98,15 @@ CONFIG_DEFINE_LOCALISED("Video", bool, XboxColorCorrection, false);
|
|||
CONFIG_DEFINE_ENUM_LOCALISED("Video", ECutsceneAspectRatio, CutsceneAspectRatio, ECutsceneAspectRatio::Original);
|
||||
CONFIG_DEFINE_ENUM_LOCALISED("Video", EUIAlignmentMode, UIAlignmentMode, EUIAlignmentMode::Edge);
|
||||
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, AllowCancellingUnleash, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, DisableAutoSaveWarning, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, DisableDLCIcon, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, DisableDWMRoundedCorners, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, FixUnleashOutOfControlDrain, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, HomingAttackOnBoost, true);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, HUDToggleHotkey, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, SaveScoreAtCheckpoints, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, SkipIntroLogos, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, UseOfficialTitleOnTitleBar, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, AllowCancellingUnleash, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableAutoSaveWarning, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDLCIcon, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDWMRoundedCorners, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, FixUnleashOutOfControlDrain, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, HomingAttackOnJump, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, HUDToggleKey, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, SaveScoreAtCheckpoints, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, SkipIntroLogos, false);
|
||||
CONFIG_DEFINE_HIDDEN("Codes", bool, UseOfficialTitleOnTitleBar, false);
|
||||
|
||||
CONFIG_DEFINE("Update", time_t, LastChecked, 0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue