diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 244e1a394..799681d59 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -14,6 +14,7 @@ #include "../../soh/include/z64audio.h" #include #include "SohHooks.h" +#include "../../soh/soh/Enhancements/debugconsole.h" #include "Window.h" @@ -34,14 +35,13 @@ namespace Game { 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); + Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1)); + Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1)); + Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1)); + Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1)); } void LoadSettings() { - const std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); ConfigFile& Conf = *pConf; @@ -50,196 +50,6 @@ namespace Game { 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 - 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); - - Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]); - CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod); - - Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]); - CVar_SetS32("gPauseLiveLink", Settings.enhancements.animated_pause_menu); - - Settings.enhancements.dynamic_wallet_icon = stob(Conf[EnhancementSection]["dynamic_wallet_icon"]); - CVar_SetS32("gDynamicWalletIcon", Settings.enhancements.dynamic_wallet_icon); - - Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]); - CVar_SetS32("gMinimalUI", Settings.enhancements.minimal_ui); - - Settings.enhancements.visualagony = stob(Conf[EnhancementSection]["visualagony"]); - CVar_SetS32("gVisualAgony", Settings.enhancements.visualagony); - - Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]); - CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood); - - Settings.enhancements.uniform_lr = stob(Conf[EnhancementSection]["uniform_lr"]); - //CVar_SetS32("gUniformLR", Settings.enhancements.uniform_lr); - CVar_SetS32("gUniformLR", 1); - - Settings.enhancements.newdrops = stob(Conf[EnhancementSection]["newdrops"]); - CVar_SetS32("gNewDrops", Settings.enhancements.newdrops); - - // Audio - Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]); - CVar_SetFloat("gGameMasterVolume", Settings.audio.master); - - Settings.audio.music_main = Ship::stof(Conf[AudioSection]["music_main"]); - CVar_SetFloat("gMainMusicVolume", Settings.audio.music_main); - - Settings.audio.music_sub = Ship::stof(Conf[AudioSection]["music_sub"]); - CVar_SetFloat("gSubMusicVolume", Settings.audio.music_sub); - - Settings.audio.sfx = Ship::stof(Conf[AudioSection]["sfx"]); - CVar_SetFloat("gSFXMusicVolume", Settings.audio.sfx); - - Settings.audio.fanfare = Ship::stof(Conf[AudioSection]["fanfare"]); - CVar_SetFloat("gFanfareVolume", Settings.audio.fanfare); - - // Controllers - Settings.controller.rumble_enabled = Ship::stof(Conf[ControllerSection]["rumble_enabled"]); - CVar_SetS32("gRumbleEnabled", Settings.controller.rumble_enabled); - - Settings.controller.input_scale = Ship::stof(Conf[ControllerSection]["input_scale"]); - CVar_SetFloat("gInputScale", Settings.controller.input_scale); - - Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]); - - CVar_SetS32("gInputEnabled", Settings.controller.input_enabled); - //Tunics - Settings.cosmetic.tunic_kokiri_red = (Conf[CosmeticsSection]["tunic_kokiri_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_red"]) : Settings.cosmetic.tunic_kokiri_red; - CVar_SetS32("gTunic_Kokiri_Red", Settings.cosmetic.tunic_kokiri_red); - Settings.cosmetic.tunic_kokiri_green = (Conf[CosmeticsSection]["tunic_kokiri_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_green"]) : Settings.cosmetic.tunic_kokiri_green; - CVar_SetS32("gTunic_Kokiri_Green", Settings.cosmetic.tunic_kokiri_green); - Settings.cosmetic.tunic_kokiri_blue = (Conf[CosmeticsSection]["tunic_kokiri_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_kokiri_blue"]) : Settings.cosmetic.tunic_kokiri_blue; - CVar_SetS32("gTunic_Kokiri_Blue", Settings.cosmetic.tunic_kokiri_blue); - - Settings.cosmetic.tunic_goron_red = (Conf[CosmeticsSection]["tunic_goron_red"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_red"]) : Settings.cosmetic.tunic_goron_red; - CVar_SetS32("gTunic_Goron_Red", Settings.cosmetic.tunic_goron_red); - Settings.cosmetic.tunic_goron_green = (Conf[CosmeticsSection]["tunic_goron_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_green"]) : Settings.cosmetic.tunic_goron_green; - CVar_SetS32("gTunic_Goron_Green", Settings.cosmetic.tunic_goron_green); - Settings.cosmetic.tunic_goron_blue = (Conf[CosmeticsSection]["tunic_goron_blue"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_goron_blue"]) : Settings.cosmetic.tunic_goron_blue; - CVar_SetS32("gTunic_Goron_Blue", Settings.cosmetic.tunic_goron_blue); - - Settings.cosmetic.tunic_zora_red = (Conf[CosmeticsSection]["tunic_zora_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_red"]) : Settings.cosmetic.tunic_zora_red; - CVar_SetS32("gTunic_Zora_Red", Settings.cosmetic.tunic_zora_red); - Settings.cosmetic.tunic_zora_green = (Conf[CosmeticsSection]["tunic_zora_green"] != "") ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_green"]) : Settings.cosmetic.tunic_zora_green; - CVar_SetS32("gTunic_Zora_Green", Settings.cosmetic.tunic_zora_green); - Settings.cosmetic.tunic_zora_blue = (Conf[CosmeticsSection]["tunic_zora_blue"] != "" ) ? Ship::stoi(Conf[CosmeticsSection]["tunic_zora_blue"]) : Settings.cosmetic.tunic_zora_blue; - CVar_SetS32("gTunic_Zora_Blue", Settings.cosmetic.tunic_zora_blue); - //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; - CVar_SetS32("gNavi_Idle_Inner_Red", Settings.cosmetic.navi_idle_inner_red); - 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; - CVar_SetS32("gNavi_Idle_Inner_Green", Settings.cosmetic.navi_idle_inner_green); - 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; - CVar_SetS32("gNavi_Idle_Inner_Blue", Settings.cosmetic.navi_idle_inner_blue); - 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; - CVar_SetS32("gNavi_Idle_Outer_Red", Settings.cosmetic.navi_idle_outer_red); - 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; - CVar_SetS32("gNavi_Idle_Outer_Green", Settings.cosmetic.navi_idle_outer_green); - 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; - CVar_SetS32("gNavi_Idle_Outer_Blue", Settings.cosmetic.navi_idle_outer_blue); - - 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; - CVar_SetS32("gNavi_NPC_Inner_Red", Settings.cosmetic.navi_npc_inner_red); - 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; - CVar_SetS32("gNavi_NPC_Inner_Green", Settings.cosmetic.navi_npc_inner_green); - 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; - CVar_SetS32("gNavi_NPC_Inner_Blue", Settings.cosmetic.navi_npc_inner_blue); - 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; - CVar_SetS32("gNavi_NPC_Outer_Red", Settings.cosmetic.navi_npc_outer_red); - 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; - CVar_SetS32("gNavi_NPC_Outer_Green", Settings.cosmetic.navi_npc_outer_green); - 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; - CVar_SetS32("gNavi_NPC_Outer_Blue", Settings.cosmetic.navi_npc_outer_blue); - - 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; - CVar_SetS32("gNavi_Enemy_Inner_Red", Settings.cosmetic.navi_enemy_inner_red); - 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; - CVar_SetS32("gNavi_Enemy_Inner_Green", Settings.cosmetic.navi_enemy_inner_green); - 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; - CVar_SetS32("gNavi_Enemy_Inner_Blue", Settings.cosmetic.navi_enemy_inner_blue); - 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; - CVar_SetS32("gNavi_Enemy_Outer_Red", Settings.cosmetic.navi_enemy_outer_red); - 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; - CVar_SetS32("gNavi_Enemy_Outer_Green", Settings.cosmetic.navi_enemy_outer_green); - 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; - CVar_SetS32("gNavi_Enemy_Outer_Blue", Settings.cosmetic.navi_enemy_outer_blue); - - 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; - CVar_SetS32("gNavi_Prop_Inner_Red", Settings.cosmetic.navi_prop_inner_red); - 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; - CVar_SetS32("gNavi_Prop_Inner_Green", Settings.cosmetic.navi_prop_inner_green); - 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; - CVar_SetS32("gNavi_Prop_Inner_Blue", Settings.cosmetic.navi_prop_inner_blue); - 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; - CVar_SetS32("gNavi_Prop_Outer_Red", Settings.cosmetic.navi_prop_outer_red); - 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; - CVar_SetS32("gNavi_Prop_Outer_Green", Settings.cosmetic.navi_prop_outer_green); - 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; - CVar_SetS32("gNavi_Prop_Outer_Blue", Settings.cosmetic.navi_prop_outer_blue); - - - - CVar_SetS32("gInputEnabled", Settings.controller.input_enabled); - - Settings.controller.dpad_pause_name = stob(Conf[ControllerSection]["dpad_pause_name"]); - CVar_SetS32("gDpadPauseName", Settings.controller.dpad_pause_name); - - Settings.controller.dpad_ocarina_text = stob(Conf[ControllerSection]["dpad_ocarina_text"]); - CVar_SetS32("gDpadOcarinaText", Settings.controller.dpad_ocarina_text); - - Settings.controller.dpad_shop = stob(Conf[ControllerSection]["dpad_shop"]); - CVar_SetS32("gDpadShop", Settings.controller.dpad_shop); - - // Cheats - Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]); - CVar_SetS32("gDebugEnabled", Settings.cheats.debug_mode); - - Settings.cheats.infinite_money = stob(Conf[CheatSection]["infinite_money"]); - CVar_SetS32("gInfiniteMoney", Settings.cheats.infinite_money); - - Settings.cheats.infinite_health = stob(Conf[CheatSection]["infinite_health"]); - CVar_SetS32("gInfiniteHealth", Settings.cheats.infinite_health); - - Settings.cheats.infinite_ammo = stob(Conf[CheatSection]["infinite_ammo"]); - CVar_SetS32("gInfiniteAmmo", Settings.cheats.infinite_ammo); - - Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]); - CVar_SetS32("gInfiniteMagic", Settings.cheats.infinite_magic); - - Settings.cheats.infinite_nayru = stob(Conf[CheatSection]["infinite_nayru"]); - CVar_SetS32("gInfiniteNayru", Settings.cheats.infinite_nayru); - - Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]); - CVar_SetS32("gNoClip", Settings.cheats.no_clip); - - Settings.cheats.climb_everything = stob(Conf[CheatSection]["climb_everything"]); - CVar_SetS32("gClimbEverything", Settings.cheats.climb_everything); - - Settings.cheats.moon_jump_on_l = stob(Conf[CheatSection]["moon_jump_on_l"]); - CVar_SetS32("gMoonJumpOnL", Settings.cheats.moon_jump_on_l); - - Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]); - CVar_SetS32("gSuperTunic", Settings.cheats.super_tunic); - - 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); - - // Per-Controller - LoadPadSettings(); - UpdateAudio(); } @@ -267,102 +77,9 @@ namespace Game { 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 - Conf[EnhancementSection]["skip_text"] = std::to_string(Settings.enhancements.skip_text); - Conf[EnhancementSection]["text_speed"] = std::to_string(Settings.enhancements.text_speed); - Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod); - Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); - Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon); - Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui); - Conf[EnhancementSection]["newdrops"] = std::to_string(Settings.enhancements.newdrops); - Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony); - Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood); - Conf[EnhancementSection]["uniform_lr"] = std::to_string(Settings.enhancements.uniform_lr); - - - // Controllers - Conf[ControllerSection]["rumble_enabled"] = std::to_string(Settings.controller.rumble_enabled); - Conf[ControllerSection]["input_scale"] = std::to_string(Settings.controller.input_scale); - Conf[ControllerSection]["input_enabled"] = std::to_string(Settings.controller.input_enabled); - Conf[ControllerSection]["dpad_pause_name"] = std::to_string(Settings.controller.dpad_pause_name); - Conf[ControllerSection]["dpad_ocarina_text"] = std::to_string(Settings.controller.dpad_ocarina_text); - Conf[ControllerSection]["dpad_shop"] = std::to_string(Settings.controller.dpad_shop); - - - // 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); - - // 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); - - // 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); - } - } - } Conf.Save(); + DebugConsole_SaveCVars(); } void InitSettings() { diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 2feea8dcb..1678eaf3f 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -4,108 +4,16 @@ struct SoHConfigType { // Debug struct { bool soh = false; - bool n64mode = false; bool menu_bar = false; bool soh_sink = true; } debug; - // Audio - struct { - float master = 1.0f; - float music_main = 1.0f; - float fanfare = 1.0f; - float sfx = 1.0f; - float music_sub = 1.0f; - } audio; - - // Enhancements - struct { - int text_speed = 1; - bool skip_text = false; - bool disable_lod = false; - bool animated_pause_menu = false; - bool dynamic_wallet_icon = false; - bool minimal_ui = false; - bool newdrops = false; - bool visualagony = false; - bool mm_bunny_hood = false; - bool uniform_lr = true; - } enhancements; - // Controller struct { - struct { - float gyro_sensitivity = 1.0f; - float rumble_strength = 1.0f; - float gyro_drift_x = 0.0f; - float gyro_drift_y = 0.0f; - } extra[4]; - bool rumble_enabled = true; - float input_scale = 1.0f; - bool input_enabled = false; - bool dpad_pause_name = false; - bool dpad_ocarina_text = false; - bool dpad_shop = false; + float gyroDriftX = 0.0f; + float gyroDriftY = 0.0f; } controller; - struct { - int tunic_kokiri_red = 30; - int tunic_kokiri_green = 105; - int tunic_kokiri_blue = 27; - int tunic_goron_red = 100; - int tunic_goron_green = 20; - int tunic_goron_blue = 0; - int tunic_zora_red = 0; - int tunic_zora_green = 60; - int tunic_zora_blue = 100; - - int navi_idle_inner_red = 255; - int navi_idle_inner_green = 255; - int navi_idle_inner_blue = 255; - int navi_idle_outer_red = 0; - int navi_idle_outer_green = 0; - int navi_idle_outer_blue = 255; - - int navi_enemy_inner_red = 255; - int navi_enemy_inner_green = 255; - int navi_enemy_inner_blue = 0; - int navi_enemy_outer_red = 200; - int navi_enemy_outer_green = 155; - int navi_enemy_outer_blue = 0; - - int navi_npc_inner_red = 150; - int navi_npc_inner_green = 150; - int navi_npc_inner_blue = 255; - int navi_npc_outer_red = 150; - int navi_npc_outer_green = 150; - int navi_npc_outer_blue = 255; - - int navi_prop_inner_red = 0; - int navi_prop_inner_green = 250; - int navi_prop_inner_blue = 0; - int navi_prop_outer_red = 0; - int navi_prop_outer_green = 250; - int navi_prop_outer_blue = 0; - - } cosmetic; - - // Cheats - struct { - bool debug_mode = false; - bool infinite_money = false; - bool infinite_health = false; - bool infinite_ammo = false; - bool infinite_magic = false; - bool infinite_nayru = false; - bool no_clip = false; - bool climb_everything = false; - bool moon_jump_on_l = false; - bool super_tunic = false; - bool ez_isg = false; - bool no_restrict_item = false; - bool freeze_time = false; - } cheats; - // Graphics struct { bool show = false; diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index 267607048..445037010 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -5,6 +5,7 @@ #include "spdlog/spdlog.h" #include "stox.h" #include "Window.h" +#include "Cvar.h" extern "C" uint8_t __osMaxControllers; @@ -197,6 +198,7 @@ namespace Ship { const char* contName = SDL_GameControllerName(Cont); const int isSpecialController = !strcmp("PS5 Controller", contName); + const float gyroSensitivity = CVar_GetFloat("gGyroSensitivity", 1.0f); if (gyro_drift_x == 0) { gyro_drift_x = gyroData[0]; diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 83ff7ef0e..364b56bff 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -324,16 +324,82 @@ namespace SohImGui { #define BindButton(btn, status) ImGui::Image(GetTextureByID(DefaultAssets[btn]->textureId), ImVec2(16.0f * scale, 16.0f * scale), ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, (status) ? 255 : 0)); - void BindAudioSlider(const char* name, const char* key, float* value, SeqPlayers playerId) { - ImGui::Text(name, static_cast(100 * *(value))); - if (ImGui::SliderFloat((std::string("##") + key).c_str(), value, 0.0f, 1.0f, "")) { - const float volume = floorf(*(value) * 100) / 100; + void BindAudioSlider(const char* name, const char* key, float defaultValue, SeqPlayers playerId) + { + float value = CVar_GetFloat(key, defaultValue); + + ImGui::Text(name, static_cast(100 * value)); + if (ImGui::SliderFloat((std::string("##") + key).c_str(), &value, 0.0f, 1.0f, "")) { + const float volume = floorf(value * 100) / 100; CVar_SetFloat(key, volume); needs_save = true; Game::SetSeqPlayerVolume(playerId, volume); } } + void EnhancementCheckbox(std::string text, std::string cvarName) + { + bool val = (bool)CVar_GetS32(cvarName.c_str(), 0); + if (ImGui::Checkbox(text.c_str(), &val)) { + CVar_SetS32(cvarName.c_str(), val); + needs_save = true; + } + } + + void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format) + { + int val = CVar_GetS32(cvarName.c_str(), 0); + + ImGui::Text(text.c_str(), val); + + if (ImGui::SliderInt(id.c_str(), &val, min, max, format.c_str())) + { + CVar_SetS32(cvarName.c_str(), val); + needs_save = true; + } + + if (val < min) + { + val = min; + CVar_SetS32(cvarName.c_str(), val); + needs_save = true; + } + + if (val > max) + { + val = max; + CVar_SetS32(cvarName.c_str(), val); + needs_save = true; + } + } + + void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue) + { + float val = CVar_GetFloat(cvarName.c_str(), defaultValue); + + ImGui::Text(text.c_str(), static_cast(100 * val)); + + if (ImGui::SliderFloat(id.c_str(), &val, min, max, format.c_str())) + { + CVar_SetFloat(cvarName.c_str(), val); + needs_save = true; + } + + if (val < min) + { + val = min; + CVar_SetFloat(cvarName.c_str(), val); + needs_save = true; + } + + if (val > max) + { + val = max; + CVar_SetFloat(cvarName.c_str(), val); + needs_save = true; + } + } + void DrawMainMenuAndCalculateGameSize() { console->Update(); ImGuiBackendNewFrame(); @@ -389,85 +455,42 @@ namespace SohImGui { ImGui::Separator(); if (ImGui::BeginMenu("Audio")) { - const float volume = Game::Settings.audio.master; - ImGui::Text("Master Volume: %d %%", static_cast(100 * volume)); - if (ImGui::SliderFloat("##Master_Vol", &Game::Settings.audio.master, 0.0f, 1.0f, "", ImGuiSliderFlags_AlwaysClamp)) { - CVar_SetFloat("gGameMasterVolume", Game::Settings.audio.master); - needs_save = true; - } + EnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f); - BindAudioSlider("Main Music Volume: %d %%", "gMainMusicVolume", &Game::Settings.audio.music_main, SEQ_BGM_MAIN); - BindAudioSlider("Sub Music Volume: %d %%", "gSubMusicVolume", &Game::Settings.audio.music_sub, SEQ_BGM_SUB); - BindAudioSlider("Sound Effects Volume: %d %%", "gSFXMusicVolume", &Game::Settings.audio.sfx, SEQ_SFX); - BindAudioSlider("Fanfare Volume: %d %%", "gFanfareVolume", &Game::Settings.audio.fanfare, SEQ_FANFARE); + BindAudioSlider("Main Music Volume: %d %%", "gMainMusicVolume", 1.0f, SEQ_BGM_MAIN); + BindAudioSlider("Sub Music Volume: %d %%", "gSubMusicVolume", 1.0f, SEQ_BGM_SUB); + BindAudioSlider("Sound Effects Volume: %d %%", "gSFXMusicVolume", 1.0f, SEQ_SFX); + BindAudioSlider("Fanfare Volume: %d %%", "gFanfareVolume", 1.0f, SEQ_FANFARE); ImGui::EndMenu(); } - if (ImGui::BeginMenu("Controller")) { - for (const auto& [i, controllers] : Ship::Window::Controllers) { - bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) { - return c->HasPadConf() && c->Connected(); - }) != controllers.end(); - - if (!hasPad) continue; - - auto menuLabel = "Controller " + std::to_string(i + 1); - if (ImGui::BeginMenu(menuLabel.c_str())) { - ImGui::Text("Gyro Sensitivity: %d %%", static_cast(100 * Game::Settings.controller.extra[i].gyro_sensitivity)); - if (ImGui::SliderFloat("##GYROSCOPE", &Game::Settings.controller.extra[i].gyro_sensitivity, 0.0f, 1.0f, "")) { - needs_save = true; - } - - if (ImGui::Button("Recalibrate Gyro")) { - Game::Settings.controller.extra[i].gyro_drift_x = 0; - Game::Settings.controller.extra[i].gyro_drift_y = 0; - needs_save = true; - } - - ImGui::Separator(); - - ImGui::Text("Rumble Strength: %d %%", static_cast(100 * Game::Settings.controller.extra[i].rumble_strength)); - if (ImGui::SliderFloat("##RUMBLE", &Game::Settings.controller.extra[i].rumble_strength, 0.0f, 1.0f, "")) { - needs_save = true; - } - - ImGui::EndMenu(); - } + if (ImGui::BeginMenu("Controller")) + { + EnhancementSliderFloat("Gyro Sensitivity: %d %%", "##GYROSCOPE", "gGyroSensitivity", 0.0f, 1.0f, "", 1.0f); + + if (ImGui::Button("Recalibrate Gyro")) { + Game::Settings.controller.gyroDriftX = 0; + Game::Settings.controller.gyroDriftY = 0; } ImGui::Separator(); + EnhancementSliderFloat("Rumble Strength: %d %%", "##RUMBLE", "gRumbleStrength", 0.0f, 1.0f, "", 1.0f); + + EnhancementCheckbox("Show Inputs", "gInputEnabled"); if (ImGui::Checkbox("Rumble Enabled", &Game::Settings.controller.rumble_enabled)) { CVar_SetS32("gRumbleEnabled", Game::Settings.controller.rumble_enabled); needs_save = true; } - if (ImGui::Checkbox("Show Inputs", &Game::Settings.controller.input_enabled)) { - needs_save = true; - } - - ImGui::Text("Input Scale: %.1f", Game::Settings.controller.input_scale); - if (ImGui::SliderFloat("##Input", &Game::Settings.controller.input_scale, 1.0f, 3.0f, "")) { - needs_save = true; - } + EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f); ImGui::Separator(); - if (ImGui::Checkbox("Dpad Support on Pause and File Select", &Game::Settings.controller.dpad_pause_name)) { - CVar_SetS32("gDpadPauseName", Game::Settings.controller.dpad_pause_name); - needs_save = true; - } - - if (ImGui::Checkbox("DPad Support in Ocarina and Text Choice", &Game::Settings.controller.dpad_ocarina_text)) { - CVar_SetS32("gDpadOcarinaText", Game::Settings.controller.dpad_ocarina_text); - needs_save = true; - } - - if (ImGui::Checkbox("DPad Support for Browsing Shop Items", &Game::Settings.controller.dpad_shop)) { - CVar_SetS32("gDpadShop", Game::Settings.controller.dpad_shop); - needs_save = true; - } + EnhancementCheckbox("Dpad Support on Pause and File Select", "gDpadPauseName"); + EnhancementCheckbox("DPad Support in Ocarina and Text Choice", "gDpadOcarinaText"); + EnhancementCheckbox("DPad Support for Browsing Shop Items", "gDpadShop"); ImGui::EndMenu(); } @@ -477,62 +500,22 @@ namespace SohImGui { ImGui::Text("Gameplay"); ImGui::Separator(); - ImGui::Text("Text Speed: %dx", Game::Settings.enhancements.text_speed); - if (ImGui::SliderInt("##TEXTSPEED", &Game::Settings.enhancements.text_speed, 1, 5, "")) { - CVar_SetS32("gTextSpeed", Game::Settings.enhancements.text_speed); - needs_save = true; - } + EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, ""); - if (ImGui::Checkbox("Skip Text", &Game::Settings.enhancements.skip_text)) { - CVar_SetS32("gSkipText", Game::Settings.enhancements.skip_text); - needs_save = true; - } - - if (ImGui::Checkbox("Minimal UI", &Game::Settings.enhancements.minimal_ui)) { - CVar_SetS32("gMinimalUI", Game::Settings.enhancements.minimal_ui); - needs_save = true; - } - - if (ImGui::Checkbox("MM Bunny Hood", &Game::Settings.enhancements.mm_bunny_hood)) { - CVar_SetS32("gMMBunnyHood", Game::Settings.enhancements.mm_bunny_hood); - needs_save = true; - } - - /*if (ImGui::Checkbox("Fix L&R Pause menu", &Game::Settings.enhancements.uniform_lr)) { - CVar_SetS32("gUniformLR", Game::Settings.enhancements.uniform_lr); - needs_save = true; - }*/ - - if (ImGui::Checkbox("Visual Stone of Agony", &Game::Settings.enhancements.visualagony)) { - CVar_SetS32("gVisualAgony", Game::Settings.enhancements.visualagony); - needs_save = true; - } + EnhancementCheckbox("Skip Text", "gSkipText"); + EnhancementCheckbox("Minimal UI", "gMinimalUI"); + EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood"); + EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony"); ImGui::Text("Graphics"); ImGui::Separator(); - HOOK(ImGui::Checkbox("N64 Mode", &Game::Settings.debug.n64mode)); + EnhancementCheckbox("N64 Mode", "gN64Mode"); - if (ImGui::Checkbox("Animated Link in Pause Menu", &Game::Settings.enhancements.animated_pause_menu)) { - CVar_SetS32("gPauseLiveLink", Game::Settings.enhancements.animated_pause_menu); - needs_save = true; - } - - if (ImGui::Checkbox("Disable LOD", &Game::Settings.enhancements.disable_lod)) { - CVar_SetS32("gDisableLOD", Game::Settings.enhancements.disable_lod); - needs_save = true; - } - - if (ImGui::Checkbox("Enable 3D Dropped items", &Game::Settings.enhancements.newdrops)) { - CVar_SetS32("gNewDrops", Game::Settings.enhancements.newdrops); - needs_save = true; - } - - if (ImGui::Checkbox("Dynamic Wallet Icon", &Game::Settings.enhancements.dynamic_wallet_icon)) { - CVar_SetS32("gDynamicWalletIcon", Game::Settings.enhancements.dynamic_wallet_icon); - - needs_save = true; - } + EnhancementCheckbox("Animated Link in Pause Menu", "gPauseLiveLink"); + EnhancementCheckbox("Disable LOD", "gDisableLOD"); + EnhancementCheckbox("Enable 3D Dropped items", "gNewDrops"); + EnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon"); ImGui::EndMenu(); } @@ -544,10 +527,7 @@ namespace SohImGui { ImGui::Text("Debug"); ImGui::Separator(); - if (ImGui::Checkbox("Debug Mode", &Game::Settings.cheats.debug_mode)) { - CVar_SetS32("gDebugEnabled", Game::Settings.cheats.debug_mode); - needs_save = true; - } + EnhancementCheckbox("Debug Mode", "gDebugEnabled"); ImGui::EndMenu(); } @@ -559,52 +539,23 @@ namespace SohImGui { if (ImGui::BeginMenu("Cheats")) { if (ImGui::BeginMenu("Infinite...")) { - if (ImGui::Checkbox("Money", &Game::Settings.cheats.infinite_money)) { - CVar_SetS32("gInfiniteMoney", Game::Settings.cheats.infinite_money); - needs_save = true; - } + EnhancementCheckbox("Money", "gInfiniteMoney"); + EnhancementCheckbox("Health", "gInfiniteHealth"); + EnhancementCheckbox("Ammo", "gInfiniteAmmo"); + EnhancementCheckbox("Magic", "gInfiniteMagic"); + EnhancementCheckbox("Nayru's Love", "gInfiniteNayru"); - if (ImGui::Checkbox("Health", &Game::Settings.cheats.infinite_health)) { - CVar_SetS32("gInfiniteHealth", Game::Settings.cheats.infinite_health); - needs_save = true; - } - - if (ImGui::Checkbox("Ammo", &Game::Settings.cheats.infinite_ammo)) { - CVar_SetS32("gInfiniteAmmo", Game::Settings.cheats.infinite_ammo); - needs_save = true; - } - - if (ImGui::Checkbox("Magic", &Game::Settings.cheats.infinite_magic)) { - CVar_SetS32("gInfiniteMagic", Game::Settings.cheats.infinite_magic); - needs_save = true; - } - - if (ImGui::Checkbox("Nayru's Love", &Game::Settings.cheats.infinite_nayru)) { - CVar_SetS32("gInfiniteNayru", Game::Settings.cheats.infinite_nayru); - needs_save = true; - } ImGui::EndMenu(); } - if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) { - CVar_SetS32("gNoClip", Game::Settings.cheats.no_clip); - needs_save = true; - } + EnhancementCheckbox("No Clip", "gNoClip"); + EnhancementCheckbox("Climb Everything", "gClimbEverything"); + EnhancementCheckbox("Moon Jump on L", "gMoonJumpOnL"); + EnhancementCheckbox("Super Tunic", "gSuperTunic"); + EnhancementCheckbox("Easy ISG", "gEzISG"); + EnhancementCheckbox("Unrestricted Items", "gNoRestrictItems"); + EnhancementCheckbox("Freeze Time", "gFreezeTime"); - if (ImGui::Checkbox("Climb Everything", &Game::Settings.cheats.climb_everything)) { - CVar_SetS32("gClimbEverything", Game::Settings.cheats.climb_everything); - needs_save = true; - } - - if (ImGui::Checkbox("Moon Jump on L", &Game::Settings.cheats.moon_jump_on_l)) { - CVar_SetS32("gMoonJumpOnL", Game::Settings.cheats.moon_jump_on_l); - needs_save = true; - } - - if (ImGui::Checkbox("Super Tunic", &Game::Settings.cheats.super_tunic)) { - CVar_SetS32("gSuperTunic", Game::Settings.cheats.super_tunic); - needs_save = true; - } ImGui::EndMenu(); } @@ -810,7 +761,9 @@ namespace SohImGui { gfx_current_game_window_viewport.y = main_pos.y; gfx_current_game_window_viewport.width = size.x; gfx_current_game_window_viewport.height = size.y; - if (Game::Settings.debug.n64mode) { + + if (CVar_GetS32("gN64Mode", 0)) + { gfx_current_dimensions.width = 320; gfx_current_dimensions.height = 240; const int sw = size.y * 320 / 240; @@ -825,7 +778,7 @@ namespace SohImGui { ImVec2 main_pos = ImGui::GetWindowPos(); ImVec2 size = ImGui::GetContentRegionAvail(); ImVec2 pos = ImVec2(0, 0); - if (Game::Settings.debug.n64mode) { + if (CVar_GetS32("gN64Mode", 0)) { const int sw = size.y * 320 / 240; pos = ImVec2(size.x / 2 - sw / 2, 0); size = ImVec2(sw, size.y); @@ -840,10 +793,10 @@ namespace SohImGui { ImGui::End(); - const float scale = Game::Settings.controller.input_scale; + const float scale = CVar_GetFloat("gInputScale", 1.0f); ImVec2 BtnPos = ImVec2(160 * scale, 85 * scale); - if (Game::Settings.controller.input_enabled) { + if (CVar_GetS32("gInputEnabled", 0)) { ImGui::SetNextWindowSize(BtnPos); ImGui::SetNextWindowPos(ImVec2(main_pos.x + size.x - BtnPos.x - 20, main_pos.y + size.y - BtnPos.y - 20)); diff --git a/libultraship/libultraship/SohImGuiImpl.h b/libultraship/libultraship/SohImGuiImpl.h index dc6e24ee1..b2b29e3d5 100644 --- a/libultraship/libultraship/SohImGuiImpl.h +++ b/libultraship/libultraship/SohImGuiImpl.h @@ -60,7 +60,13 @@ namespace SohImGui { extern Console* console; void Init(WindowImpl window_impl); void Update(EventImpl event); + + + void EnhancementCheckbox(std::string text, std::string cvarName); + void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format); + void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue); void DrawMainMenuAndCalculateGameSize(void); + void DrawFramebufferAndGameInput(void); void Render(void); void CancelFrame(void); diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index de8cab260..ff69830e7 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -327,9 +327,6 @@ static int CheckVarType(const std::string& input) return result; } -void DebugConsole_LoadCVars(); -void DebugConsole_SaveCVars(); - static bool SetCVarHandler(const std::vector& args) { if (args.size() < 3) return CMD_FAILED; diff --git a/soh/soh/Enhancements/debugconsole.h b/soh/soh/Enhancements/debugconsole.h index 21e0b51f1..581c19acd 100644 --- a/soh/soh/Enhancements/debugconsole.h +++ b/soh/soh/Enhancements/debugconsole.h @@ -1,3 +1,5 @@ #pragma once -void DebugConsole_Init(void); \ No newline at end of file +void DebugConsole_Init(void); +void DebugConsole_LoadCVars(); +void DebugConsole_SaveCVars(); \ No newline at end of file