2022-03-21 21:52:44 -04:00
|
|
|
|
#include "GameSettings.h"
|
|
|
|
|
|
|
|
|
|
// Audio
|
|
|
|
|
#include <PR/ultra64/sptask.h>
|
|
|
|
|
#include <PR/ultra64/pi.h>
|
|
|
|
|
#include <PR/ultra64/message.h>
|
|
|
|
|
#include <PR/ultra64/types.h>
|
|
|
|
|
|
|
|
|
|
#include "ConfigFile.h"
|
|
|
|
|
#include "Cvar.h"
|
|
|
|
|
#include "GlobalCtx2.h"
|
|
|
|
|
#include "SohImGuiImpl.h"
|
|
|
|
|
#include "stox.h"
|
|
|
|
|
#include "../../soh/include/z64audio.h"
|
|
|
|
|
#include <string>
|
|
|
|
|
#include "SohHooks.h"
|
|
|
|
|
|
2022-04-26 19:50:24 -04:00
|
|
|
|
#include "Window.h"
|
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
|
#define ABS(var) var < 0 ? -(var) : var
|
|
|
|
|
|
|
|
|
|
using namespace Ship;
|
|
|
|
|
|
|
|
|
|
namespace Game {
|
|
|
|
|
|
|
|
|
|
bool DeSyncAudio = false;
|
|
|
|
|
SoHConfigType Settings;
|
|
|
|
|
const std::string ConfSection = DEBUG_SECTION;
|
|
|
|
|
const std::string AudioSection = AUDIO_SECTION;
|
|
|
|
|
const std::string ControllerSection = CONTROLLER_SECTION;
|
|
|
|
|
const std::string EnhancementSection = ENHANCEMENTS_SECTION;
|
2022-04-26 18:33:18 -04:00
|
|
|
|
const std::string CosmeticsSection = COSMETICS_SECTION;
|
2022-03-27 21:18:05 -04:00
|
|
|
|
const std::string CheatSection = CHEATS_SECTION;
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
|
void UpdateAudio() {
|
|
|
|
|
Audio_SetGameVolume(SEQ_BGM_MAIN, Settings.audio.music_main);
|
|
|
|
|
Audio_SetGameVolume(SEQ_BGM_SUB, Settings.audio.music_sub);
|
|
|
|
|
Audio_SetGameVolume(SEQ_FANFARE, Settings.audio.fanfare);
|
|
|
|
|
Audio_SetGameVolume(SEQ_SFX, Settings.audio.sfx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadSettings() {
|
|
|
|
|
|
|
|
|
|
const std::shared_ptr<ConfigFile> pConf = GlobalCtx2::GetInstance()->GetConfig();
|
|
|
|
|
ConfigFile& Conf = *pConf;
|
|
|
|
|
|
|
|
|
|
// Debug
|
|
|
|
|
SohImGui::console->opened = stob(Conf[ConfSection]["console"]);
|
|
|
|
|
Settings.debug.menu_bar = stob(Conf[ConfSection]["menu_bar"]);
|
|
|
|
|
Settings.debug.soh = stob(Conf[ConfSection]["soh_debug"]);
|
|
|
|
|
|
|
|
|
|
Settings.debug.n64mode = stob(Conf[ConfSection]["n64_mode"]);
|
|
|
|
|
|
|
|
|
|
// Enhancements
|
2022-04-21 18:38:56 -04:00
|
|
|
|
Settings.enhancements.skip_text = stob(Conf[EnhancementSection]["skip_text"]);
|
|
|
|
|
CVar_SetS32("gSkipText", Settings.enhancements.skip_text);
|
|
|
|
|
|
|
|
|
|
Settings.enhancements.text_speed = Ship::stoi(Conf[EnhancementSection]["text_speed"]);
|
|
|
|
|
CVar_SetS32("gTextSpeed", Settings.enhancements.text_speed);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gPauseLiveLink", Settings.enhancements.animated_pause_menu);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
2022-04-21 18:33:05 -04:00
|
|
|
|
Settings.enhancements.dynamic_wallet_icon = stob(Conf[EnhancementSection]["dynamic_wallet_icon"]);
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gDynamicWalletIcon", Settings.enhancements.dynamic_wallet_icon);
|
2022-04-21 18:33:05 -04:00
|
|
|
|
|
2022-03-31 18:32:32 -04:00
|
|
|
|
Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]);
|
2022-04-10 18:19:26 -04:00
|
|
|
|
CVar_SetS32("gMinimalUI", Settings.enhancements.minimal_ui);
|
2022-03-31 18:32:32 -04:00
|
|
|
|
|
2022-04-21 18:40:22 -04:00
|
|
|
|
Settings.enhancements.visualagony = stob(Conf[EnhancementSection]["visualagony"]);
|
|
|
|
|
CVar_SetS32("gVisualAgony", Settings.enhancements.visualagony);
|
|
|
|
|
|
2022-04-17 11:26:49 -04:00
|
|
|
|
Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]);
|
|
|
|
|
CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood);
|
2022-04-26 18:36:28 -04:00
|
|
|
|
|
|
|
|
|
Settings.enhancements.uniform_lr = stob(Conf[EnhancementSection]["uniform_lr"]);
|
|
|
|
|
//CVar_SetS32("gUniformLR", Settings.enhancements.uniform_lr);
|
|
|
|
|
CVar_SetS32("gUniformLR", 1);
|
2022-04-17 11:26:49 -04:00
|
|
|
|
|
2022-04-24 10:50:41 -04:00
|
|
|
|
Settings.enhancements.newdrops = stob(Conf[EnhancementSection]["newdrops"]);
|
|
|
|
|
CVar_SetS32("gNewDrops", Settings.enhancements.newdrops);
|
|
|
|
|
|
2022-03-27 21:18:05 -04:00
|
|
|
|
// Audio
|
2022-03-21 21:52:44 -04:00
|
|
|
|
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetFloat("gGameMasterVolume", Settings.audio.master);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.audio.music_main = Ship::stof(Conf[AudioSection]["music_main"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetFloat("gMainMusicVolume", Settings.audio.music_main);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.audio.music_sub = Ship::stof(Conf[AudioSection]["music_sub"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetFloat("gSubMusicVolume", Settings.audio.music_sub);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.audio.sfx = Ship::stof(Conf[AudioSection]["sfx"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetFloat("gSFXMusicVolume", Settings.audio.sfx);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.audio.fanfare = Ship::stof(Conf[AudioSection]["fanfare"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetFloat("gFanfareVolume", Settings.audio.fanfare);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
2022-03-27 21:18:05 -04:00
|
|
|
|
// Controllers
|
2022-04-26 19:50:24 -04:00
|
|
|
|
Settings.controller.rumble_enabled = Ship::stof(Conf[ControllerSection]["rumble_enabled"]);
|
|
|
|
|
CVar_SetS32("gRumbleEnabled", Settings.controller.rumble_enabled);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.controller.input_scale = Ship::stof(Conf[ControllerSection]["input_scale"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetFloat("gInputScale", Settings.controller.input_scale);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
|
|
|
|
Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gInputEnabled", Settings.controller.input_enabled);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
//Tunics
|
|
|
|
|
Settings.cosmetic.tunic_kokiri_red = (Conf[CosmeticsSection]["tunic_kokiri_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_red"]) : Settings.cosmetic.tunic_kokiri_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Kokiri_Red", Settings.cosmetic.tunic_kokiri_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.tunic_kokiri_green = (Conf[CosmeticsSection]["tunic_kokiri_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_green"]) : Settings.cosmetic.tunic_kokiri_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Kokiri_Green", Settings.cosmetic.tunic_kokiri_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.tunic_kokiri_blue = (Conf[CosmeticsSection]["tunic_kokiri_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_blue"]) : Settings.cosmetic.tunic_kokiri_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Kokiri_Blue", Settings.cosmetic.tunic_kokiri_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
|
|
|
|
Settings.cosmetic.tunic_goron_red = (Conf[CosmeticsSection]["tunic_goron_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_red"]) : Settings.cosmetic.tunic_goron_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Goron_Red", Settings.cosmetic.tunic_goron_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.tunic_goron_green = (Conf[CosmeticsSection]["tunic_goron_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_green"]) : Settings.cosmetic.tunic_goron_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Goron_Green", Settings.cosmetic.tunic_goron_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.tunic_goron_blue = (Conf[CosmeticsSection]["tunic_goron_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_blue"]) : Settings.cosmetic.tunic_goron_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Goron_Blue", Settings.cosmetic.tunic_goron_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
|
|
|
|
Settings.cosmetic.tunic_zora_red = (Conf[CosmeticsSection]["tunic_zora_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_red"]) : Settings.cosmetic.tunic_zora_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Zora_Red", Settings.cosmetic.tunic_zora_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.tunic_zora_green = (Conf[CosmeticsSection]["tunic_zora_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_green"]) : Settings.cosmetic.tunic_zora_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Zora_Green", Settings.cosmetic.tunic_zora_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.tunic_zora_blue = (Conf[CosmeticsSection]["tunic_zora_blue"] != "" ) ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_blue"]) : Settings.cosmetic.tunic_zora_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gTunic_Zora_Blue", Settings.cosmetic.tunic_zora_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
//Navi
|
|
|
|
|
Settings.cosmetic.navi_idle_inner_red = (Conf[CosmeticsSection]["navi_idle_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_inner_red"]) : Settings.cosmetic.navi_idle_inner_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Idle_Inner_Red", Settings.cosmetic.navi_idle_inner_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_idle_inner_green = (Conf[CosmeticsSection]["navi_idle_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_inner_green"]) : Settings.cosmetic.navi_idle_inner_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Idle_Inner_Green", Settings.cosmetic.navi_idle_inner_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_idle_inner_blue = (Conf[CosmeticsSection]["navi_idle_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_inner_blue"]) : Settings.cosmetic.navi_idle_inner_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Idle_Inner_Blue", Settings.cosmetic.navi_idle_inner_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_idle_outer_red = (Conf[CosmeticsSection]["navi_idle_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_outer_red"]) : Settings.cosmetic.navi_idle_outer_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Idle_Outer_Red", Settings.cosmetic.navi_idle_outer_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_idle_outer_green = (Conf[CosmeticsSection]["navi_idle_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_outer_green"]) : Settings.cosmetic.navi_idle_outer_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Idle_Outer_Green", Settings.cosmetic.navi_idle_outer_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_idle_outer_blue = (Conf[CosmeticsSection]["navi_idle_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_idle_outer_blue"]) : Settings.cosmetic.navi_idle_outer_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Idle_Outer_Blue", Settings.cosmetic.navi_idle_outer_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
|
|
|
|
Settings.cosmetic.navi_npc_inner_red = (Conf[CosmeticsSection]["navi_npc_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_inner_red"]) : Settings.cosmetic.navi_npc_inner_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_NPC_Inner_Red", Settings.cosmetic.navi_npc_inner_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_npc_inner_green = (Conf[CosmeticsSection]["navi_npc_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_inner_green"]) : Settings.cosmetic.navi_npc_inner_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_NPC_Inner_Green", Settings.cosmetic.navi_npc_inner_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_npc_inner_blue = (Conf[CosmeticsSection]["navi_npc_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_inner_blue"]) : Settings.cosmetic.navi_npc_inner_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_NPC_Inner_Blue", Settings.cosmetic.navi_npc_inner_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_npc_outer_red = (Conf[CosmeticsSection]["navi_npc_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_outer_red"]) : Settings.cosmetic.navi_npc_outer_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_NPC_Outer_Red", Settings.cosmetic.navi_npc_outer_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_npc_outer_green = (Conf[CosmeticsSection]["navi_npc_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_outer_green"]) : Settings.cosmetic.navi_npc_outer_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_NPC_Outer_Green", Settings.cosmetic.navi_npc_outer_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_npc_outer_blue = (Conf[CosmeticsSection]["navi_npc_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_npc_outer_blue"]) : Settings.cosmetic.navi_npc_outer_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_NPC_Outer_Blue", Settings.cosmetic.navi_npc_outer_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
|
|
|
|
Settings.cosmetic.navi_enemy_inner_red = (Conf[CosmeticsSection]["navi_enemy_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_inner_red"]) : Settings.cosmetic.navi_enemy_inner_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Enemy_Inner_Red", Settings.cosmetic.navi_enemy_inner_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_enemy_inner_green = (Conf[CosmeticsSection]["navi_enemy_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_inner_green"]) : Settings.cosmetic.navi_enemy_inner_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Enemy_Inner_Green", Settings.cosmetic.navi_enemy_inner_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_enemy_inner_blue = (Conf[CosmeticsSection]["navi_enemy_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_inner_blue"]) : Settings.cosmetic.navi_enemy_inner_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Enemy_Inner_Blue", Settings.cosmetic.navi_enemy_inner_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_enemy_outer_red = (Conf[CosmeticsSection]["navi_enemy_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_outer_red"]) : Settings.cosmetic.navi_enemy_outer_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Enemy_Outer_Red", Settings.cosmetic.navi_enemy_outer_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_enemy_outer_green = (Conf[CosmeticsSection]["navi_enemy_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_outer_green"]) : Settings.cosmetic.navi_enemy_outer_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Enemy_Outer_Green", Settings.cosmetic.navi_enemy_outer_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_enemy_outer_blue = (Conf[CosmeticsSection]["navi_enemy_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_enemy_outer_blue"]) : Settings.cosmetic.navi_enemy_outer_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Enemy_Outer_Blue", Settings.cosmetic.navi_enemy_outer_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
|
|
|
|
Settings.cosmetic.navi_prop_inner_red = (Conf[CosmeticsSection]["navi_prop_inner_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_inner_red"]) : Settings.cosmetic.navi_prop_inner_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Prop_Inner_Red", Settings.cosmetic.navi_prop_inner_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_prop_inner_green = (Conf[CosmeticsSection]["navi_prop_inner_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_inner_green"]) : Settings.cosmetic.navi_prop_inner_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Prop_Inner_Green", Settings.cosmetic.navi_prop_inner_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_prop_inner_blue = (Conf[CosmeticsSection]["navi_prop_inner_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_inner_blue"]) : Settings.cosmetic.navi_prop_inner_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Prop_Inner_Blue", Settings.cosmetic.navi_prop_inner_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_prop_outer_red = (Conf[CosmeticsSection]["navi_prop_outer_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_outer_red"]) : Settings.cosmetic.navi_prop_outer_red;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Prop_Outer_Red", Settings.cosmetic.navi_prop_outer_red);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_prop_outer_green = (Conf[CosmeticsSection]["navi_prop_outer_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_outer_green"]) : Settings.cosmetic.navi_prop_outer_green;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Prop_Outer_Green", Settings.cosmetic.navi_prop_outer_green);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
Settings.cosmetic.navi_prop_outer_blue = (Conf[CosmeticsSection]["navi_prop_outer_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["navi_prop_outer_blue"]) : Settings.cosmetic.navi_prop_outer_blue;
|
2022-04-26 19:50:24 -04:00
|
|
|
|
CVar_SetS32("gNavi_Prop_Outer_Blue", Settings.cosmetic.navi_prop_outer_blue);
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gInputEnabled", Settings.controller.input_enabled);
|
2022-04-10 18:19:26 -04:00
|
|
|
|
|
|
|
|
|
Settings.controller.dpad_pause_name = stob(Conf[ControllerSection]["dpad_pause_name"]);
|
|
|
|
|
CVar_SetS32("gDpadPauseName", Settings.controller.dpad_pause_name);
|
2022-04-11 17:06:55 -04:00
|
|
|
|
|
|
|
|
|
Settings.controller.dpad_ocarina_text = stob(Conf[ControllerSection]["dpad_ocarina_text"]);
|
|
|
|
|
CVar_SetS32("gDpadOcarinaText", Settings.controller.dpad_ocarina_text);
|
2022-04-12 21:38:08 -04:00
|
|
|
|
|
|
|
|
|
Settings.controller.dpad_shop = stob(Conf[ControllerSection]["dpad_shop"]);
|
|
|
|
|
CVar_SetS32("gDpadShop", Settings.controller.dpad_shop);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
// Cheats
|
|
|
|
|
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gDebugEnabled", Settings.cheats.debug_mode);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
Settings.cheats.infinite_money = stob(Conf[CheatSection]["infinite_money"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gInfiniteMoney", Settings.cheats.infinite_money);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
Settings.cheats.infinite_health = stob(Conf[CheatSection]["infinite_health"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gInfiniteHealth", Settings.cheats.infinite_health);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
Settings.cheats.infinite_ammo = stob(Conf[CheatSection]["infinite_ammo"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gInfiniteAmmo", Settings.cheats.infinite_ammo);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gInfiniteMagic", Settings.cheats.infinite_magic);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
2022-04-21 18:39:39 -04:00
|
|
|
|
Settings.cheats.infinite_nayru = stob(Conf[CheatSection]["infinite_nayru"]);
|
|
|
|
|
CVar_SetS32("gInfiniteNayru", Settings.cheats.infinite_nayru);
|
|
|
|
|
|
2022-03-27 21:18:05 -04:00
|
|
|
|
Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gNoClip", Settings.cheats.no_clip);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
Settings.cheats.climb_everything = stob(Conf[CheatSection]["climb_everything"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gClimbEverything", Settings.cheats.climb_everything);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
Settings.cheats.moon_jump_on_l = stob(Conf[CheatSection]["moon_jump_on_l"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gMoonJumpOnL", Settings.cheats.moon_jump_on_l);
|
2022-03-27 21:18:05 -04:00
|
|
|
|
|
|
|
|
|
Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]);
|
2022-04-06 20:42:23 -04:00
|
|
|
|
CVar_SetS32("gSuperTunic", Settings.cheats.super_tunic);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
2022-04-21 18:39:39 -04:00
|
|
|
|
Settings.cheats.ez_isg = stob(Conf[CheatSection]["ez_isg"]);
|
|
|
|
|
CVar_SetS32("gEzISG", Settings.cheats.ez_isg);
|
|
|
|
|
|
|
|
|
|
Settings.cheats.no_restrict_item = stob(Conf[CheatSection]["no_restrict_item"]);
|
|
|
|
|
CVar_SetS32("gNoRestrictItems", Settings.cheats.no_restrict_item);
|
|
|
|
|
|
|
|
|
|
Settings.cheats.freeze_time = stob(Conf[CheatSection]["freeze_time"]);
|
|
|
|
|
CVar_SetS32("gFreezeTime", Settings.cheats.freeze_time);
|
|
|
|
|
|
2022-04-26 19:50:24 -04:00
|
|
|
|
// Per-Controller
|
|
|
|
|
LoadPadSettings();
|
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
|
UpdateAudio();
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-26 19:50:24 -04:00
|
|
|
|
void LoadPadSettings() {
|
|
|
|
|
const std::shared_ptr<ConfigFile> pConf = GlobalCtx2::GetInstance()->GetConfig();
|
|
|
|
|
ConfigFile& Conf = *pConf;
|
|
|
|
|
|
|
|
|
|
for (const auto& [i, controllers] : Ship::Window::Controllers) {
|
|
|
|
|
for (const auto& controller : controllers) {
|
|
|
|
|
if (auto padConfSection = controller->GetPadConfSection()) {
|
|
|
|
|
Settings.controller.extra[i].gyro_sensitivity = Ship::stof(Conf[*padConfSection]["gyro_sensitivity"]);
|
|
|
|
|
Settings.controller.extra[i].rumble_strength = Ship::stof(Conf[*padConfSection]["rumble_strength"]);
|
|
|
|
|
Settings.controller.extra[i].gyro_drift_x = Ship::stof(Conf[*padConfSection]["gyro_drift_x"], 0.0f);
|
|
|
|
|
Settings.controller.extra[i].gyro_drift_y = Ship::stof(Conf[*padConfSection]["gyro_drift_y"], 0.0f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
|
void SaveSettings() {
|
|
|
|
|
const std::shared_ptr<ConfigFile> pConf = GlobalCtx2::GetInstance()->GetConfig();
|
|
|
|
|
ConfigFile& Conf = *pConf;
|
|
|
|
|
|
|
|
|
|
// Debug
|
|
|
|
|
Conf[ConfSection]["console"] = std::to_string(SohImGui::console->opened);
|
|
|
|
|
Conf[ConfSection]["menu_bar"] = std::to_string(Settings.debug.menu_bar);
|
|
|
|
|
Conf[ConfSection]["soh_debug"] = std::to_string(Settings.debug.soh);
|
|
|
|
|
Conf[ConfSection]["n64_mode"] = std::to_string(Settings.debug.n64mode);
|
|
|
|
|
|
|
|
|
|
// Audio
|
|
|
|
|
Conf[AudioSection]["master"] = std::to_string(Settings.audio.master);
|
|
|
|
|
Conf[AudioSection]["music_main"] = std::to_string(Settings.audio.music_main);
|
|
|
|
|
Conf[AudioSection]["music_sub"] = std::to_string(Settings.audio.music_sub);
|
|
|
|
|
Conf[AudioSection]["sfx"] = std::to_string(Settings.audio.sfx);
|
|
|
|
|
Conf[AudioSection]["fanfare"] = std::to_string(Settings.audio.fanfare);
|
|
|
|
|
|
|
|
|
|
// Enhancements
|
2022-04-21 18:38:56 -04:00
|
|
|
|
Conf[EnhancementSection]["skip_text"] = std::to_string(Settings.enhancements.skip_text);
|
|
|
|
|
Conf[EnhancementSection]["text_speed"] = std::to_string(Settings.enhancements.text_speed);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
|
|
|
|
|
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu);
|
2022-04-21 18:33:05 -04:00
|
|
|
|
Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon);
|
2022-03-31 18:32:32 -04:00
|
|
|
|
Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui);
|
2022-04-24 10:50:41 -04:00
|
|
|
|
Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops);
|
2022-04-21 18:40:22 -04:00
|
|
|
|
Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony);
|
2022-04-17 11:26:49 -04:00
|
|
|
|
Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood);
|
2022-04-26 18:36:28 -04:00
|
|
|
|
Conf[EnhancementSection]["uniform_lr"] = std::to_string(Settings.enhancements.uniform_lr);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
2022-04-21 18:40:22 -04:00
|
|
|
|
|
2022-03-27 21:18:05 -04:00
|
|
|
|
// Controllers
|
2022-04-26 19:50:24 -04:00
|
|
|
|
Conf[ControllerSection]["rumble_enabled"] = std::to_string(Settings.controller.rumble_enabled);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
Conf[ControllerSection]["input_scale"] = std::to_string(Settings.controller.input_scale);
|
|
|
|
|
Conf[ControllerSection]["input_enabled"] = std::to_string(Settings.controller.input_enabled);
|
2022-04-10 18:19:26 -04:00
|
|
|
|
Conf[ControllerSection]["dpad_pause_name"] = std::to_string(Settings.controller.dpad_pause_name);
|
2022-04-11 17:06:55 -04:00
|
|
|
|
Conf[ControllerSection]["dpad_ocarina_text"] = std::to_string(Settings.controller.dpad_ocarina_text);
|
2022-04-12 21:38:08 -04:00
|
|
|
|
Conf[ControllerSection]["dpad_shop"] = std::to_string(Settings.controller.dpad_shop);
|
2022-03-21 21:52:44 -04:00
|
|
|
|
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
|
|
|
|
// Cosmetics
|
|
|
|
|
Conf[CosmeticsSection]["tunic_kokiri_red"] = std::to_string(Settings.cosmetic.tunic_kokiri_red);
|
|
|
|
|
Conf[CosmeticsSection]["tunic_kokiri_green"] = std::to_string(Settings.cosmetic.tunic_kokiri_green);
|
|
|
|
|
Conf[CosmeticsSection]["tunic_kokiri_blue"] = std::to_string(Settings.cosmetic.tunic_kokiri_blue);
|
|
|
|
|
|
|
|
|
|
Conf[CosmeticsSection]["tunic_goron_red"] = std::to_string(Settings.cosmetic.tunic_goron_red);
|
|
|
|
|
Conf[CosmeticsSection]["tunic_goron_green"] = std::to_string(Settings.cosmetic.tunic_goron_green);
|
|
|
|
|
Conf[CosmeticsSection]["tunic_goron_blue"] = std::to_string(Settings.cosmetic.tunic_goron_blue);
|
|
|
|
|
|
|
|
|
|
Conf[CosmeticsSection]["tunic_zora_red"] = std::to_string(Settings.cosmetic.tunic_zora_red);
|
|
|
|
|
Conf[CosmeticsSection]["tunic_zora_green"] = std::to_string(Settings.cosmetic.tunic_zora_green);
|
|
|
|
|
Conf[CosmeticsSection]["tunic_zora_blue"] = std::to_string(Settings.cosmetic.tunic_zora_blue);
|
|
|
|
|
|
|
|
|
|
Conf[CosmeticsSection]["navi_idle_inner_red"] = std::to_string(Settings.cosmetic.navi_idle_inner_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_idle_inner_green"] = std::to_string(Settings.cosmetic.navi_idle_inner_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_idle_inner_blue"] = std::to_string(Settings.cosmetic.navi_idle_inner_blue);
|
|
|
|
|
Conf[CosmeticsSection]["navi_idle_outer_red"] = std::to_string(Settings.cosmetic.navi_idle_outer_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_idle_outer_green"] = std::to_string(Settings.cosmetic.navi_idle_outer_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_idle_outer_blue"] = std::to_string(Settings.cosmetic.navi_idle_outer_blue);
|
|
|
|
|
|
|
|
|
|
Conf[CosmeticsSection]["navi_npc_inner_red"] = std::to_string(Settings.cosmetic.navi_npc_inner_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_npc_inner_green"] = std::to_string(Settings.cosmetic.navi_npc_inner_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_npc_inner_blue"] = std::to_string(Settings.cosmetic.navi_npc_inner_blue);
|
|
|
|
|
Conf[CosmeticsSection]["navi_npc_outer_red"] = std::to_string(Settings.cosmetic.navi_npc_outer_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_npc_outer_green"] = std::to_string(Settings.cosmetic.navi_npc_outer_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_npc_outer_blue"] = std::to_string(Settings.cosmetic.navi_npc_outer_blue);
|
|
|
|
|
|
|
|
|
|
Conf[CosmeticsSection]["navi_enemy_inner_red"] = std::to_string(Settings.cosmetic.navi_enemy_inner_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_enemy_inner_green"] = std::to_string(Settings.cosmetic.navi_enemy_inner_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_enemy_inner_blue"] = std::to_string(Settings.cosmetic.navi_enemy_inner_blue);
|
|
|
|
|
Conf[CosmeticsSection]["navi_enemy_outer_red"] = std::to_string(Settings.cosmetic.navi_enemy_outer_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_enemy_outer_green"] = std::to_string(Settings.cosmetic.navi_enemy_outer_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_enemy_outer_blue"] = std::to_string(Settings.cosmetic.navi_enemy_outer_blue);
|
|
|
|
|
|
|
|
|
|
Conf[CosmeticsSection]["navi_prop_inner_red"] = std::to_string(Settings.cosmetic.navi_prop_inner_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_prop_inner_green"] = std::to_string(Settings.cosmetic.navi_prop_inner_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_prop_inner_blue"] = std::to_string(Settings.cosmetic.navi_prop_inner_blue);
|
|
|
|
|
Conf[CosmeticsSection]["navi_prop_outer_red"] = std::to_string(Settings.cosmetic.navi_prop_outer_red);
|
|
|
|
|
Conf[CosmeticsSection]["navi_prop_outer_green"] = std::to_string(Settings.cosmetic.navi_prop_outer_green);
|
|
|
|
|
Conf[CosmeticsSection]["navi_prop_outer_blue"] = std::to_string(Settings.cosmetic.navi_prop_outer_blue);
|
|
|
|
|
|
2022-03-27 21:18:05 -04:00
|
|
|
|
// Cheats
|
|
|
|
|
Conf[CheatSection]["debug_mode"] = std::to_string(Settings.cheats.debug_mode);
|
|
|
|
|
Conf[CheatSection]["infinite_money"] = std::to_string(Settings.cheats.infinite_money);
|
|
|
|
|
Conf[CheatSection]["infinite_health"] = std::to_string(Settings.cheats.infinite_health);
|
|
|
|
|
Conf[CheatSection]["infinite_ammo"] = std::to_string(Settings.cheats.infinite_ammo);
|
|
|
|
|
Conf[CheatSection]["infinite_magic"] = std::to_string(Settings.cheats.infinite_magic);
|
|
|
|
|
Conf[CheatSection]["no_clip"] = std::to_string(Settings.cheats.no_clip);
|
|
|
|
|
Conf[CheatSection]["climb_everything"] = std::to_string(Settings.cheats.climb_everything);
|
|
|
|
|
Conf[CheatSection]["moon_jump_on_l"] = std::to_string(Settings.cheats.moon_jump_on_l);
|
|
|
|
|
Conf[CheatSection]["super_tunic"] = std::to_string(Settings.cheats.super_tunic);
|
|
|
|
|
|
2022-04-26 19:50:24 -04:00
|
|
|
|
// Per-Controller
|
|
|
|
|
for (const auto& [i, controllers] : Ship::Window::Controllers) {
|
|
|
|
|
for (const auto& controller : controllers) {
|
|
|
|
|
if (auto padConfSection = controller->GetPadConfSection()) {
|
|
|
|
|
Conf[*padConfSection]["gyro_sensitivity"] = std::to_string(Settings.controller.extra[i].gyro_sensitivity);
|
|
|
|
|
Conf[*padConfSection]["rumble_strength"] = std::to_string(Settings.controller.extra[i].rumble_strength);
|
|
|
|
|
Conf[*padConfSection]["gyro_drift_x"] = std::to_string(Settings.controller.extra[i].gyro_drift_x);
|
|
|
|
|
Conf[*padConfSection]["gyro_drift_y"] = std::to_string(Settings.controller.extra[i].gyro_drift_y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-26 18:33:18 -04:00
|
|
|
|
|
2022-03-21 21:52:44 -04:00
|
|
|
|
Conf.Save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InitSettings() {
|
|
|
|
|
ModInternal::registerHookListener({ AUDIO_INIT, [](HookEvent ev) {
|
|
|
|
|
UpdateAudio();
|
|
|
|
|
}});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetSeqPlayerVolume(SeqPlayers playerId, float volume) {
|
|
|
|
|
Audio_SetGameVolume(playerId, volume);
|
|
|
|
|
}
|
2022-04-06 20:42:23 -04:00
|
|
|
|
}
|