From 02930be9ee876d998c5ca7a09c934ef69a8b8083 Mon Sep 17 00:00:00 2001 From: Zion <62904587+ZionHelios@users.noreply.github.com> Date: Wed, 27 Apr 2022 21:16:26 -0400 Subject: [PATCH 01/11] Update SohImGuiImpl.cpp Added back EndMenu into the Cheats section. Preventing the dropdown from expanding across the screen. Co-Authored-By: IShallRiseAgain <49771132+IShallRiseAgain@users.noreply.github.com> --- libultraship/libultraship/SohImGuiImpl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 5111a0d6d..3ac73ef82 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -605,6 +605,7 @@ namespace SohImGui { CVar_SetS32("gSuperTunic", Game::Settings.cheats.super_tunic); needs_save = true; } + ImGui::EndMenu(); } if (ImGui::BeginMenu("Cosmetics")) { From 60cbfd67beacf2b2f38947ff350cfb80aca9b32d Mon Sep 17 00:00:00 2001 From: KiritoDev <36680385+KiritoDv@users.noreply.github.com> Date: Wed, 27 Apr 2022 22:14:38 -0500 Subject: [PATCH 02/11] Fixed master volume slider --- libultraship/libultraship/SohImGuiImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 3ac73ef82..83ff7ef0e 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -391,8 +391,8 @@ namespace SohImGui { 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, "")) { - CVar_SetFloat("gGameMasterVolume", 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; } From 73194eee14a5b107ccc43c686404f953e008debc Mon Sep 17 00:00:00 2001 From: KiritoDev <36680385+KiritoDv@users.noreply.github.com> Date: Wed, 27 Apr 2022 22:27:54 -0500 Subject: [PATCH 03/11] Removed DirtyDirectory on kaleido --- .../overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index ac1864412..8732093ca 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -1619,9 +1619,9 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255); } } - + gSPDisplayList(POLY_KAL_DISP++, gLButtonIconDL); - + if (CVar_GetS32("gUniformLR", 0) == 0) { //Restore the misplace gDPSetPrimColor gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255); } @@ -3990,8 +3990,6 @@ void KaleidoScope_Update(GlobalContext* globalCtx) R_UPDATE_RATE = 3; R_PAUSE_MENU_MODE = 0; - ResourceMgr_DirtyDirectory("textures/icon_item_24_static*"); - ResourceMgr_DirtyDirectory("textures/icon_item_static*"); CVar_SetS32("gPauseTriforce", 0); func_800981B8(&globalCtx->objectCtx); From f5d983d06b01f789934aaf7413d6b2f1e42bfc22 Mon Sep 17 00:00:00 2001 From: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Date: Sun, 24 Apr 2022 18:33:19 -0700 Subject: [PATCH 04/11] Put hookshot reticle on TITLE_CARD_DISP --- soh/src/code/z_player_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 4adbb75ce..4bf581fc3 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -1215,7 +1215,7 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2 if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2572); - OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x07); + TITLE_CARD_DISP = Gfx_CallSetupDL(TITLE_CARD_DISP, 0x07); SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64); @@ -1224,10 +1224,10 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2 Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587), + gSPMatrix(TITLE_CARD_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); - gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL); + gSPSegment(TITLE_CARD_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPDisplayList(TITLE_CARD_DISP++, gLinkAdultHookshotReticleDL); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592); } From 2425ffe27b2b2b4ceec76b220bf35bc8880c0eb3 Mon Sep 17 00:00:00 2001 From: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Date: Fri, 29 Apr 2022 13:21:47 -0700 Subject: [PATCH 05/11] Put hookshot reticle on TITLE_CARD_DISP Rename to WORLD_OVERLAY_DISP Remove no-ops --- soh/include/macros.h | 12 ++++++------ soh/include/z64.h | 6 +++--- soh/src/code/graph.c | 10 ++++------ soh/src/code/z_actor.c | 15 +++++++-------- soh/src/code/z_player_lib.c | 8 ++++---- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/soh/include/macros.h b/soh/include/macros.h index 8563449b1..c57effe02 100644 --- a/soh/include/macros.h +++ b/soh/include/macros.h @@ -126,12 +126,12 @@ extern GraphicsContext* __gfxCtx; -#define WORK_DISP __gfxCtx->work.p -#define POLY_OPA_DISP __gfxCtx->polyOpa.p -#define POLY_XLU_DISP __gfxCtx->polyXlu.p -#define TITLE_CARD_DISP __gfxCtx->titlecard.p -#define POLY_KAL_DISP __gfxCtx->polyKal.p -#define OVERLAY_DISP __gfxCtx->overlay.p +#define WORK_DISP __gfxCtx->work.p +#define POLY_OPA_DISP __gfxCtx->polyOpa.p +#define POLY_XLU_DISP __gfxCtx->polyXlu.p +#define WORLD_OVERLAY_DISP __gfxCtx->worldOverlay.p +#define POLY_KAL_DISP __gfxCtx->polyKal.p +#define OVERLAY_DISP __gfxCtx->overlay.p // __gfxCtx shouldn't be used directly. // Use the DISP macros defined above when writing to display buffers. diff --git a/soh/include/z64.h b/soh/include/z64.h index 92966f239..f0dfba52d 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -83,7 +83,7 @@ typedef struct { /* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC /* 0x00008 */ Gfx polyOpaBuffer[0x2FC0]; /* 0x0BF08 */ Gfx polyXluBuffer[0x1000]; - /* 0xXXXXX */ Gfx titlecardBuffer[0x1000]; + /* 0xXXXXX */ Gfx worldOverlayBuffer[0x1000]; /* 0x0BF08 */ Gfx polyKalBuffer[0x1000]; /* 0x0FF08 */ Gfx overlayBuffer[0x800]; /* 0x11F08 */ Gfx workBuffer[0x100]; @@ -131,7 +131,7 @@ typedef struct OSScTask { typedef struct GraphicsContext { /* 0x0000 */ Gfx* polyOpaBuffer; // Pointer to "Zelda 0" /* 0x0004 */ Gfx* polyXluBuffer; // Pointer to "Zelda 1" - /* 0xXXX */ Gfx* titlecardBuffer; // Pointer to "Paris" + /* 0xXXX */ Gfx* worldOverlayBuffer; // Pointer to "Paris" /* 0xXXX */ Gfx* polyKalBuffer; // Pointer to "Rome" /* 0x0008 */ char unk_008[0x08]; // Unused, could this be pointers to "Zelda 2" / "Zelda 3" /* 0x0010 */ Gfx* overlayBuffer; // Pointer to "Zelda 4" @@ -151,7 +151,7 @@ typedef struct GraphicsContext { /* 0x02A8 */ TwoHeadGfxArena overlay; // "Zelda 4" /* 0x02B8 */ TwoHeadGfxArena polyOpa; // "Zelda 0" /* 0x02C8 */ TwoHeadGfxArena polyXlu; // "Zelda 1" - /* 0x0XXX */ TwoHeadGfxArena titlecard; // When in Paris... + /* 0x0XXX */ TwoHeadGfxArena worldOverlay; // When in Paris... /* 0x0XXX */ TwoHeadGfxArena polyKal; // When in Rome... /* 0x02D8 */ u32 gfxPoolIdx; /* 0x02DC */ u16* curFrameBuffer; diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index dbbbb9df1..10293fa5f 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -95,14 +95,14 @@ void Graph_InitTHGA(GraphicsContext* gfxCtx) { pool->tailMagic = GFXPOOL_TAIL_MAGIC; THGA_Ct(&gfxCtx->polyOpa, pool->polyOpaBuffer, sizeof(pool->polyOpaBuffer)); THGA_Ct(&gfxCtx->polyXlu, pool->polyXluBuffer, sizeof(pool->polyXluBuffer)); - THGA_Ct(&gfxCtx->titlecard, pool->titlecardBuffer, sizeof(pool->titlecardBuffer)); + THGA_Ct(&gfxCtx->worldOverlay, pool->worldOverlayBuffer, sizeof(pool->worldOverlayBuffer)); THGA_Ct(&gfxCtx->polyKal, pool->polyKalBuffer, sizeof(pool->polyKalBuffer)); THGA_Ct(&gfxCtx->overlay, pool->overlayBuffer, sizeof(pool->overlayBuffer)); THGA_Ct(&gfxCtx->work, pool->workBuffer, sizeof(pool->workBuffer)); gfxCtx->polyOpaBuffer = pool->polyOpaBuffer; gfxCtx->polyXluBuffer = pool->polyXluBuffer; - gfxCtx->titlecardBuffer = pool->titlecardBuffer; + gfxCtx->worldOverlayBuffer = pool->worldOverlayBuffer; gfxCtx->polyKalBuffer = pool->polyKalBuffer; gfxCtx->overlayBuffer = pool->overlayBuffer; gfxCtx->workBuffer = pool->workBuffer; @@ -276,7 +276,6 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gDPNoOpString(WORK_DISP++, "WORK_DISP 開始", 0); gDPNoOpString(POLY_OPA_DISP++, "POLY_OPA_DISP 開始", 0); gDPNoOpString(POLY_XLU_DISP++, "POLY_XLU_DISP 開始", 0); - gDPNoOpString(TITLE_CARD_DISP++, "TITLE_CARD_DISP 開始", 0);//unsure if needed gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 開始", 0); CLOSE_DISPS(gfxCtx, "../graph.c", 975); @@ -289,7 +288,6 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gDPNoOpString(WORK_DISP++, "WORK_DISP 終了", 0); gDPNoOpString(POLY_OPA_DISP++, "POLY_OPA_DISP 終了", 0); gDPNoOpString(POLY_XLU_DISP++, "POLY_XLU_DISP 終了", 0); - gDPNoOpString(TITLE_CARD_DISP++, "TITLE_CARD_DISP 終了", 0); gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 終了", 0); CLOSE_DISPS(gfxCtx, "../graph.c", 996); @@ -298,8 +296,8 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gSPBranchList(WORK_DISP++, gfxCtx->polyOpaBuffer); gSPBranchList(POLY_OPA_DISP++, gfxCtx->polyXluBuffer); - gSPBranchList(POLY_XLU_DISP++, gfxCtx->titlecardBuffer); - gSPBranchList(TITLE_CARD_DISP++, gfxCtx->polyKalBuffer); + gSPBranchList(POLY_XLU_DISP++, gfxCtx->worldOverlayBuffer); + gSPBranchList(WORLD_OVERLAY_DISP++, gfxCtx->polyKalBuffer); gSPBranchList(POLY_KAL_DISP++, gfxCtx->overlayBuffer); gDPPipeSync(OVERLAY_DISP++); gDPFullSync(OVERLAY_DISP++); diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 0c46a8fc5..bb55009bb 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -1022,31 +1022,30 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { height = (width * height > 0x1000) ? 0x1000 / width : height; titleSecondY = titleY + (height * 4); - //TITLE_CARD_DISP Goes over POLY_XLU_DISP but under POLY_KAL_DISP - TITLE_CARD_DISP = func_80093808(TITLE_CARD_DISP); + // WORLD_OVERLAY_DISP Goes over POLY_XLU_DISP but under POLY_KAL_DISP + WORLD_OVERLAY_DISP = func_80093808(WORLD_OVERLAY_DISP); - gDPSetPrimColor(TITLE_CARD_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity, + gDPSetPrimColor(WORLD_OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->alpha); - gDPLoadTextureBlock(TITLE_CARD_DISP++, (uintptr_t)titleCtx->texture, G_IM_FMT_IA, - + gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(TITLE_CARD_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1, + gSPTextureRectangle(WORLD_OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); height = titleCtx->height - height; // If texture is bigger than 0x1000, display the rest if (height > 0) { - gDPLoadTextureBlock(TITLE_CARD_DISP++, (uintptr_t)titleCtx->texture + 0x1000, + gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, (uintptr_t)titleCtx->texture + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(TITLE_CARD_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4, + gSPTextureRectangle(WORLD_OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4, titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 4bf581fc3..0251ee498 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -1215,7 +1215,7 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2 if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2572); - TITLE_CARD_DISP = Gfx_CallSetupDL(TITLE_CARD_DISP, 0x07); + WORLD_OVERLAY_DISP = Gfx_CallSetupDL(WORLD_OVERLAY_DISP, 0x07); SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64); @@ -1224,10 +1224,10 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2 Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY); - gSPMatrix(TITLE_CARD_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587), + gSPMatrix(WORLD_OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2587), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(TITLE_CARD_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); - gSPDisplayList(TITLE_CARD_DISP++, gLinkAdultHookshotReticleDL); + gSPSegment(WORLD_OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPDisplayList(WORLD_OVERLAY_DISP++, gLinkAdultHookshotReticleDL); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2592); } From 700bce684d8d33bc1c4fbf200a7d7b69250aad1b Mon Sep 17 00:00:00 2001 From: Nicholas Estelami Date: Mon, 25 Apr 2022 02:27:24 -0400 Subject: [PATCH 06/11] Removed redundant parameters in GameSettings --- libultraship/libultraship/GameSettings.cpp | 295 +------------------- libultraship/libultraship/GameSettings.h | 96 +------ libultraship/libultraship/SDLController.cpp | 2 + libultraship/libultraship/SohImGuiImpl.cpp | 283 ++++++++----------- libultraship/libultraship/SohImGuiImpl.h | 6 + soh/soh/Enhancements/debugconsole.cpp | 3 - soh/soh/Enhancements/debugconsole.h | 4 +- 7 files changed, 137 insertions(+), 552 deletions(-) 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 From c66c874549007b50c1646373b47b14edc796ccfb Mon Sep 17 00:00:00 2001 From: Nicholas Estelami Date: Fri, 29 Apr 2022 11:49:28 -0400 Subject: [PATCH 07/11] Fixed merge issues --- libultraship/libultraship/GameSettings.cpp | 4 - libultraship/libultraship/GameSettings.h | 6 - libultraship/libultraship/SDLController.cpp | 20 +- libultraship/libultraship/SohImGuiImpl.cpp | 301 ++++++++------------ soh/soh/OTRGlobals.cpp | 8 +- soh/src/code/z_player_lib.c | 24 +- 6 files changed, 144 insertions(+), 219 deletions(-) diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 799681d59..9b7543b7d 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -60,10 +60,6 @@ namespace Game { 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); } } } diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 1678eaf3f..4b9956d17 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -8,12 +8,6 @@ struct SoHConfigType { bool soh_sink = true; } debug; - // Controller - struct { - float gyroDriftX = 0.0f; - float gyroDriftY = 0.0f; - } controller; - // Graphics struct { bool show = false; diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index 445037010..c6892edbe 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -6,6 +6,7 @@ #include "stox.h" #include "Window.h" #include "Cvar.h" +#include extern "C" uint8_t __osMaxControllers; @@ -189,16 +190,15 @@ namespace Ship { if (SDL_GameControllerHasSensor(Cont, SDL_SENSOR_GYRO)) { size_t contNumber = GetControllerNumber(); - float& gyro_drift_x = Game::Settings.controller.extra[contNumber].gyro_drift_x; - float& gyro_drift_y = Game::Settings.controller.extra[contNumber].gyro_drift_y; - const float gyro_sensitivity = Game::Settings.controller.extra[contNumber].gyro_sensitivity; - + float gyroData[3]; SDL_GameControllerGetSensorData(Cont, SDL_SENSOR_GYRO, gyroData, 3); const char* contName = SDL_GameControllerName(Cont); const int isSpecialController = !strcmp("PS5 Controller", contName); - const float gyroSensitivity = CVar_GetFloat("gGyroSensitivity", 1.0f); + float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), 0.0f); + float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), 0.0f); + const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity").c_str(), 1.0f); if (gyro_drift_x == 0) { gyro_drift_x = gyroData[0]; @@ -213,6 +213,9 @@ namespace Ship { } } + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), gyro_drift_x); + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), gyro_drift_y); + if (isSpecialController == 1) { wGyroX = gyroData[0] - gyro_drift_x; wGyroY = -gyroData[2] - gyro_drift_y; @@ -346,7 +349,7 @@ namespace Ship { { if (SDL_GameControllerHasRumble(Cont)) { if (controller->rumble > 0) { - float rumble_strength = Game::Settings.controller.extra[GetControllerNumber()].rumble_strength; + float rumble_strength = CVar_GetFloat(StringHelper::Sprintf("gCont%i_RumbleStrength", GetControllerNumber()).c_str(), 1.0f); SDL_GameControllerRumble(Cont, 0xFFFF * rumble_strength, 0xFFFF * rumble_strength, 0); } else { SDL_GameControllerRumble(Cont, 0, 0, 0); @@ -414,11 +417,6 @@ namespace Ship { std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); ConfigFile& Conf = *pConf.get(); - Conf[ConfSection]["gyro_sensitivity"] = std::to_string(1.0f); - Conf[ConfSection]["rumble_strength"] = std::to_string(1.0f); - Conf[ConfSection]["gyro_drift_x"] = std::to_string(0.0f); - Conf[ConfSection]["gyro_drift_y"] = std::to_string(0.0f); - Conf.Save(); } diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 364b56bff..fb4841ee9 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -84,49 +84,51 @@ namespace SohImGui { ImGui_ImplWin32_Init(impl.dx11.window); break; } - kokiri_col[0] = std::clamp((float) CVar_GetS32("gTunic_Kokiri_Red", 30)/255, 0.0f, 1.0f); - kokiri_col[1] = std::clamp((float)CVar_GetS32("gTunic_Kokiri_Green", 105) / 255, 0.0f, 1.0f); - kokiri_col[2] = std::clamp((float)CVar_GetS32("gTunic_Kokiri_Blue", 27) / 255, 0.0f, 1.0f); - - goron_col[0] = std::clamp((float)CVar_GetS32("gTunic_Goron_Red", 100) / 255, 0.0f, 1.0f); - goron_col[1] = std::clamp((float)CVar_GetS32("gTunic_Goron_Green", 20) / 255, 0.0f, 1.0f); - goron_col[2] = std::clamp((float)CVar_GetS32("gTunic_Goron_Blue", 0) / 255, 0.0f, 1.0f); - zora_col[0] = std::clamp((float)CVar_GetS32("gTunic_Zora_Red", 0) / 255, 0.0f, 1.0f); - zora_col[1] = std::clamp((float)CVar_GetS32("gTunic_Zora_Green", 60) / 255, 0.0f, 1.0f); - zora_col[2] = std::clamp((float)CVar_GetS32("gTunic_Zora_Blue", 100) / 255, 0.0f, 1.0f); + // OTRTODO: This gameplay specific stuff should not be in libultraship. This needs to be moved to soh and use sTunicColors + kokiri_col[0] = 30 / 255.0f; + kokiri_col[1] = 105 / 255.0f; + kokiri_col[2] = 27 / 255.0f; - navi_idle_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_idle_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_idle_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Blue", 0) / 255, 0.0f, 1.0f); + goron_col[0] = 100 / 255.0f; + goron_col[1] = 20 / 255.0f; + goron_col[2] = 0; + + zora_col[0] = 0; + zora_col[1] = 60 / 255.0f; + zora_col[2] = 100 / 255.0f; - navi_idle_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_idle_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_idle_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_idle_i_col[0] = 0; + navi_idle_i_col[1] = 0; + navi_idle_i_col[2] = 0; - navi_npc_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_npc_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_npc_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Blue", 0) / 255, 0.0f, 1.0f); + navi_idle_o_col[0] = 0; + navi_idle_o_col[1] = 0; + navi_idle_o_col[2] = 0; - navi_npc_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_npc_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_npc_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_npc_i_col[0] = 0; + navi_npc_i_col[1] = 0; + navi_npc_i_col[2] = 0; - navi_enemy_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_enemy_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_enemy_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Blue", 0) / 255, 0.0f, 1.0f); + navi_npc_o_col[0] = 0; + navi_npc_o_col[1] = 0; + navi_npc_o_col[2] = 0; - navi_enemy_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_enemy_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_enemy_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_enemy_i_col[0] = 0; + navi_enemy_i_col[1] = 0; + navi_enemy_i_col[2] = 0; - navi_prop_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_prop_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_prop_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Blue", 0) / 255, 0.0f, 1.0f); + navi_enemy_o_col[0] = 0; + navi_enemy_o_col[1] = 0; + navi_enemy_o_col[2] = 0; - navi_prop_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_prop_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_prop_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_prop_i_col[0] = 0; + navi_prop_i_col[1] = 0; + navi_prop_i_col[2] = 0; + + navi_prop_o_col[0] = 0; + navi_prop_o_col[1] = 0; + navi_prop_o_col[2] = 0; } void ImGuiBackendInit() { @@ -373,11 +375,14 @@ namespace SohImGui { } } - void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue) + void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue, bool isPercentage) { float val = CVar_GetFloat(cvarName.c_str(), defaultValue); - ImGui::Text(text.c_str(), static_cast(100 * val)); + if (!isPercentage) + ImGui::Text(text.c_str(), val); + else + ImGui::Text(text.c_str(), static_cast(100 * val)); if (ImGui::SliderFloat(id.c_str(), &val, min, max, format.c_str())) { @@ -400,6 +405,28 @@ namespace SohImGui { } } + void EnhancementColor3(std::string text, std::string cvarName, float defaultColors[3]) + { + int r = CVar_GetS32((cvarName + "_Red").c_str(), (defaultColors[0] * 255.0f)); + int g = CVar_GetS32((cvarName + "_Green").c_str(), (defaultColors[1] * 255.0f)); + int b = CVar_GetS32((cvarName + "_Blue").c_str(), (defaultColors[2] * 255.0f)); + + float colors[3]; + colors[0] = r / 255.0f; + colors[1] = g / 255.0f; + colors[2] = b / 255.0f; + + { + if (ImGui::ColorEdit3(text.c_str(), colors)) + { + CVar_SetS32((cvarName + "_Red").c_str(), (int)(colors[0] * 255)); + CVar_SetS32((cvarName + "_Green").c_str(), (int)(colors[1] * 255)); + CVar_SetS32((cvarName + "_Blue").c_str(), (int)(colors[2] * 255)); + needs_save = true; + } + } + } + void DrawMainMenuAndCalculateGameSize() { console->Update(); ImGuiBackendNewFrame(); @@ -455,7 +482,7 @@ namespace SohImGui { ImGui::Separator(); if (ImGui::BeginMenu("Audio")) { - EnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f); + EnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true); BindAudioSlider("Main Music Volume: %d %%", "gMainMusicVolume", 1.0f, SEQ_BGM_MAIN); BindAudioSlider("Sub Music Volume: %d %%", "gSubMusicVolume", 1.0f, SEQ_BGM_SUB); @@ -465,26 +492,41 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Controller")) + 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; + 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())) + { + EnhancementSliderFloat("Gyro Sensitivity: %d %%", "##GYROSCOPE", StringHelper::Sprintf("gCont%i_GyroSensitivity", i), 0.0f, 1.0f, "", 1.0f, true); + + if (ImGui::Button("Recalibrate Gyro")) + { + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), 0); + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), 0); + needs_save = true; + } + + ImGui::Separator(); + + EnhancementSliderFloat("Rumble Strength: %d %%", "##RUMBLE", StringHelper::Sprintf("gCont%i_RumbleStrength", i), 0.0f, 1.0f, "", 1.0f, true); + + ImGui::EndMenu(); + } + ImGui::Separator(); } - 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; - } + EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled"); - EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f); + EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false); ImGui::Separator(); @@ -495,7 +537,8 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Enhancements")) { + if (ImGui::BeginMenu("Enhancements")) + { ImGui::Text("Gameplay"); ImGui::Separator(); @@ -520,7 +563,8 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Developer Tools")) { + if (ImGui::BeginMenu("Developer Tools")) + { HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh)); HOOK(ImGui::MenuItem("Console", nullptr, &console->opened)); @@ -532,12 +576,14 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Graphics")) { + if (ImGui::BeginMenu("Graphics")) + { HOOK(ImGui::MenuItem("Anti-aliasing", nullptr, &Game::Settings.graphics.show)); ImGui::EndMenu(); } - if (ImGui::BeginMenu("Cheats")) { + if (ImGui::BeginMenu("Cheats")) + { if (ImGui::BeginMenu("Infinite...")) { EnhancementCheckbox("Money", "gInfiniteMoney"); EnhancementCheckbox("Health", "gInfiniteHealth"); @@ -559,139 +605,26 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Cosmetics")) { + if (ImGui::BeginMenu("Cosmetics")) + { ImGui::Text("Tunics"); ImGui::Separator(); - if (ImGui::ColorEdit3("Kokiri Tunic", kokiri_col)) { - Game::Settings.cosmetic.tunic_kokiri_red = (int)(kokiri_col[0] * 255); - Game::Settings.cosmetic.tunic_kokiri_green = (int)(kokiri_col[1] * 255); - Game::Settings.cosmetic.tunic_kokiri_blue = (int)(kokiri_col[2] * 255); - CVar_SetS32("gTunic_Kokiri_Red", Game::Settings.cosmetic.tunic_kokiri_red); - CVar_SetS32("gTunic_Kokiri_Green", Game::Settings.cosmetic.tunic_kokiri_green); - CVar_SetS32("gTunic_Kokiri_Blue", Game::Settings.cosmetic.tunic_kokiri_blue); - needs_save = true; - } - if (ImGui::ColorEdit3("Goron Tunic", goron_col)) { - Game::Settings.cosmetic.tunic_goron_red = (int)(goron_col[0] * 255); - Game::Settings.cosmetic.tunic_goron_green = (int)(goron_col[1] * 255); - Game::Settings.cosmetic.tunic_goron_blue = (int)(goron_col[2] * 255); - CVar_SetS32("gTunic_Goron_Red", Game::Settings.cosmetic.tunic_goron_red); - CVar_SetS32("gTunic_Goron_Green", Game::Settings.cosmetic.tunic_goron_green); - CVar_SetS32("gTunic_Goron_Blue", Game::Settings.cosmetic.tunic_goron_blue); - needs_save = true; - } - if (ImGui::ColorEdit3("Zora Tunic", zora_col)) { - Game::Settings.cosmetic.tunic_zora_red = (int)(zora_col[0] * 255); - Game::Settings.cosmetic.tunic_zora_green = (int)(zora_col[1] * 255); - Game::Settings.cosmetic.tunic_zora_blue = (int)(zora_col[2] * 255); - CVar_SetS32("gTunic_Zora_Red", Game::Settings.cosmetic.tunic_zora_red); - CVar_SetS32("gTunic_Zora_Green", Game::Settings.cosmetic.tunic_zora_green); - CVar_SetS32("gTunic_Zora_Blue", Game::Settings.cosmetic.tunic_zora_blue); - needs_save = true; - } + + EnhancementColor3("Kokiri Tunic", "gTunic_Kokiri", kokiri_col); + EnhancementColor3("Goron Tunic", "gTunic_Goron", goron_col); + EnhancementColor3("Zora Tunic", "gTunic_Zora", zora_col); + ImGui::Text("Navi"); ImGui::Separator(); - if (ImGui::ColorEdit3("Navi Idle Inner", navi_idle_i_col)) { - Game::Settings.cosmetic.navi_idle_inner_red = (int)(navi_idle_i_col[0] * 255); - Game::Settings.cosmetic.navi_idle_inner_green = (int)(navi_idle_i_col[1] * 255); - Game::Settings.cosmetic.navi_idle_inner_blue = (int)(navi_idle_i_col[2] * 255); - CVar_SetS32("gNavi_Idle_Inner_Red", Game::Settings.cosmetic.navi_idle_inner_red); - CVar_SetS32("gNavi_Idle_Inner_Green", Game::Settings.cosmetic.navi_idle_inner_green); - CVar_SetS32("gNavi_Idle_Inner_Blue", Game::Settings.cosmetic.navi_idle_inner_blue); - needs_save = true; - } - if (ImGui::ColorEdit3("Navi Idle Outer", navi_idle_o_col)) { - Game::Settings.cosmetic.navi_idle_outer_red = (int)(navi_idle_o_col[0] * 255); - Game::Settings.cosmetic.navi_idle_outer_green = (int)(navi_idle_o_col[1] * 255); - Game::Settings.cosmetic.navi_idle_outer_blue = (int)(navi_idle_o_col[2] * 255); - CVar_SetS32("gNavi_Idle_Outer_Red", Game::Settings.cosmetic.navi_idle_outer_red); - CVar_SetS32("gNavi_Idle_Outer_Green", Game::Settings.cosmetic.navi_idle_outer_green); - CVar_SetS32("gNavi_Idle_Outer_Blue", Game::Settings.cosmetic.navi_idle_outer_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi NPC Inner", navi_npc_i_col)) { - Game::Settings.cosmetic.navi_npc_inner_red = (int)(navi_npc_i_col[0] * 255); - Game::Settings.cosmetic.navi_npc_inner_green = (int)(navi_npc_i_col[1] * 255); - Game::Settings.cosmetic.navi_npc_inner_blue = (int)(navi_npc_i_col[2] * 255); - CVar_SetS32("gNavi_NPC_Inner_Red", Game::Settings.cosmetic.navi_npc_inner_red); - CVar_SetS32("gNavi_NPC_Inner_Green", Game::Settings.cosmetic.navi_npc_inner_green); - CVar_SetS32("gNavi_NPC_Inner_Blue", Game::Settings.cosmetic.navi_npc_inner_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi NPC Outer", navi_npc_o_col)) { - Game::Settings.cosmetic.navi_npc_outer_red = (int)(navi_npc_o_col[0] * 255); - Game::Settings.cosmetic.navi_npc_outer_green = (int)(navi_npc_o_col[1] * 255); - Game::Settings.cosmetic.navi_npc_outer_blue = (int)(navi_npc_o_col[2] * 255); - CVar_SetS32("gNavi_NPC_Outer_Red", Game::Settings.cosmetic.navi_npc_outer_red); - CVar_SetS32("gNavi_NPC_Outer_Green", Game::Settings.cosmetic.navi_npc_outer_green); - CVar_SetS32("gNavi_NPC_Outer_Blue", Game::Settings.cosmetic.navi_npc_outer_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Enemy Inner", navi_enemy_i_col)) { - Game::Settings.cosmetic.navi_enemy_inner_red = (int)(navi_enemy_i_col[0] * 255); - Game::Settings.cosmetic.navi_enemy_inner_green = (int)(navi_enemy_i_col[1] * 255); - Game::Settings.cosmetic.navi_enemy_inner_blue = (int)(navi_enemy_i_col[2] * 255); - CVar_SetS32("gNavi_Enemy_Inner_Red", Game::Settings.cosmetic.navi_enemy_inner_red); - CVar_SetS32("gNavi_Enemy_Inner_Green", Game::Settings.cosmetic.navi_enemy_inner_green); - CVar_SetS32("gNavi_Enemy_Inner_Blue", Game::Settings.cosmetic.navi_enemy_inner_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Enemy Outer", navi_enemy_o_col)) { - Game::Settings.cosmetic.navi_enemy_outer_red = (int)(navi_enemy_o_col[0] * 255); - Game::Settings.cosmetic.navi_enemy_outer_green = (int)(navi_enemy_o_col[1] * 255); - Game::Settings.cosmetic.navi_enemy_outer_blue = (int)(navi_enemy_o_col[2] * 255); - CVar_SetS32("gNavi_Enemy_Outer_Red", Game::Settings.cosmetic.navi_enemy_outer_red); - CVar_SetS32("gNavi_Enemy_Outer_Green", Game::Settings.cosmetic.navi_enemy_outer_green); - CVar_SetS32("gNavi_Enemy_Outer_Blue", Game::Settings.cosmetic.navi_enemy_outer_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Prop Inner", navi_prop_i_col)) { - Game::Settings.cosmetic.navi_prop_inner_red = (int)(navi_prop_i_col[0] * 255); - Game::Settings.cosmetic.navi_prop_inner_green = (int)(navi_prop_i_col[1] * 255); - Game::Settings.cosmetic.navi_prop_inner_blue = (int)(navi_prop_i_col[2] * 255); - CVar_SetS32("gNavi_Prop_Inner_Red", Game::Settings.cosmetic.navi_prop_inner_red); - CVar_SetS32("gNavi_Prop_Inner_Green", Game::Settings.cosmetic.navi_prop_inner_green); - CVar_SetS32("gNavi_Prop_Inner_Blue", Game::Settings.cosmetic.navi_prop_inner_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Prop Outer", navi_prop_o_col)) { - Game::Settings.cosmetic.navi_prop_outer_red = (int)(navi_prop_o_col[0] * 255); - Game::Settings.cosmetic.navi_prop_outer_green = (int)(navi_prop_o_col[1] * 255); - Game::Settings.cosmetic.navi_prop_outer_blue = (int)(navi_prop_o_col[2] * 255); - CVar_SetS32("gNavi_Prop_Outer_Red", Game::Settings.cosmetic.navi_prop_outer_red); - CVar_SetS32("gNavi_Prop_Outer_Green", Game::Settings.cosmetic.navi_prop_outer_green); - CVar_SetS32("gNavi_Prop_Outer_Blue", Game::Settings.cosmetic.navi_prop_outer_blue); - needs_save = true; - } - - ImGui::EndMenu(); - } - - - if (ImGui::BeginMenu("Developer Tools")) { - HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh)); - HOOK(ImGui::MenuItem("Console", nullptr, &console->opened)); - if (ImGui::Checkbox("Easy ISG", &Game::Settings.cheats.ez_isg)) { - CVar_SetS32("gEzISG", Game::Settings.cheats.ez_isg); - needs_save = true; - } - - if (ImGui::Checkbox("Unrestricted Items", &Game::Settings.cheats.no_restrict_item)) { - CVar_SetS32("gNoRestrictItems", Game::Settings.cheats.no_restrict_item); - needs_save = true; - } - - if (ImGui::Checkbox("Freeze Time", &Game::Settings.cheats.freeze_time)) { - CVar_SetS32("gFreezeTime", Game::Settings.cheats.freeze_time); - needs_save = true; - } + EnhancementColor3("Navi Idle Inner", "gNavi_Idle_Inner", navi_idle_i_col); + EnhancementColor3("Navi Idle Outer", "gNavi_Idle_Outer", navi_idle_o_col); + EnhancementColor3("Navi NPC Inner", "gNavi_NPC_Inner", navi_npc_i_col); + EnhancementColor3("Navi NPC Outer", "gNavi_NPC_Outer", navi_npc_o_col); + EnhancementColor3("Navi Enemy Inner", "gNavi_Enemy_Inner", navi_enemy_i_col); + EnhancementColor3("Navi Enemy Outer", "gNavi_Enemy_Outer", navi_enemy_o_col); + EnhancementColor3("Navi Prop Inner", "gNavi_Prop_Inner", navi_prop_i_col); + EnhancementColor3("Navi Prop Outer", "gNavi_Prop_Outer", navi_prop_o_col); ImGui::EndMenu(); } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index f125437ab..69917e8ac 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -26,6 +26,7 @@ #include "../soh/Enhancements/debugger/debugger.h" #include "Utils/BitConverter.h" #include "variables.h" +#include OTRGlobals* OTRGlobals::Instance; @@ -888,8 +889,11 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { } extern "C" int Controller_ShouldRumble(size_t i) { - for (const auto& controller : Ship::Window::Controllers.at(i)) { - if (controller->CanRumble() && Game::Settings.controller.extra[i].rumble_strength > 0.001f) { + for (const auto& controller : Ship::Window::Controllers.at(i)) + { + float rumble_strength = CVar_GetFloat(StringHelper::Sprintf("gCont%i_RumbleStrength", i).c_str(), 1.0f); + + if (controller->CanRumble() && rumble_strength > 0.001f) { return 1; } } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 0251ee498..7f3507abd 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -744,24 +744,24 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[eyeIndex])); #endif if (tunic == PLAYER_TUNIC_KOKIRI) { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", &sTunicColors[PLAYER_TUNIC_KOKIRI].r), - CVar_GetS32("gTunic_Kokiri_Green", &sTunicColors[PLAYER_TUNIC_KOKIRI].g), - CVar_GetS32("gTunic_Kokiri_Blue", &sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", sTunicColors[PLAYER_TUNIC_KOKIRI].r), + CVar_GetS32("gTunic_Kokiri_Green", sTunicColors[PLAYER_TUNIC_KOKIRI].g), + CVar_GetS32("gTunic_Kokiri_Blue", sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; color = &sTemp; } else if (tunic == PLAYER_TUNIC_GORON) { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Goron_Red", &sTunicColors[PLAYER_TUNIC_GORON].r), - CVar_GetS32("gTunic_Goron_Green", &sTunicColors[PLAYER_TUNIC_GORON].g), - CVar_GetS32("gTunic_Goron_Blue", &sTunicColors[PLAYER_TUNIC_GORON].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Goron_Red", sTunicColors[PLAYER_TUNIC_GORON].r), + CVar_GetS32("gTunic_Goron_Green", sTunicColors[PLAYER_TUNIC_GORON].g), + CVar_GetS32("gTunic_Goron_Blue", sTunicColors[PLAYER_TUNIC_GORON].b) }; color = &sTemp; } else if (tunic == PLAYER_TUNIC_ZORA) { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Zora_Red", &sTunicColors[PLAYER_TUNIC_ZORA].r), - CVar_GetS32("gTunic_Zora_Green", &sTunicColors[PLAYER_TUNIC_ZORA].g), - CVar_GetS32("gTunic_Zora_Blue", &sTunicColors[PLAYER_TUNIC_ZORA].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Zora_Red", sTunicColors[PLAYER_TUNIC_ZORA].r), + CVar_GetS32("gTunic_Zora_Green", sTunicColors[PLAYER_TUNIC_ZORA].g), + CVar_GetS32("gTunic_Zora_Blue", sTunicColors[PLAYER_TUNIC_ZORA].b) }; color = &sTemp; } else { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", &sTunicColors[PLAYER_TUNIC_KOKIRI].r), - CVar_GetS32("gTunic_Kokiri_Green", &sTunicColors[PLAYER_TUNIC_KOKIRI].g), - CVar_GetS32("gTunic_Kokiri_Blue", &sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", sTunicColors[PLAYER_TUNIC_KOKIRI].r), + CVar_GetS32("gTunic_Kokiri_Green", sTunicColors[PLAYER_TUNIC_KOKIRI].g), + CVar_GetS32("gTunic_Kokiri_Blue", sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; color = &sTemp; } gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0); From bd5a563dae2f44e2e04db144e3f924aae9982c1f Mon Sep 17 00:00:00 2001 From: Nicholas Estelami Date: Tue, 26 Apr 2022 15:05:56 -0400 Subject: [PATCH 08/11] Implemented PAL language support. --- ZAPDTR/ZAPD/ZText.cpp | 30 +++- .../GC_NMQ_D/text/fra_message_data_static.xml | 5 + .../GC_NMQ_D/text/ger_message_data_static.xml | 5 + .../text/fra_message_data_static.xml | 5 + .../text/ger_message_data_static.xml | 5 + soh/soh/z_message_OTR.cpp | 44 ++++-- soh/src/code/z_message_PAL.c | 146 +++++------------- 7 files changed, 113 insertions(+), 127 deletions(-) create mode 100644 soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml create mode 100644 soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml create mode 100644 soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml create mode 100644 soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml diff --git a/ZAPDTR/ZAPD/ZText.cpp b/ZAPDTR/ZAPD/ZText.cpp index 58af61bc9..2e9e0f68a 100644 --- a/ZAPDTR/ZAPD/ZText.cpp +++ b/ZAPDTR/ZAPD/ZText.cpp @@ -12,6 +12,7 @@ REGISTER_ZFILENODE(Text, ZText); ZText::ZText(ZFile* nParent) : ZResource(nParent) { RegisterRequiredAttribute("CodeOffset"); + RegisterOptionalAttribute("LangOffset", "0"); } void ZText::ParseRawData() @@ -20,6 +21,16 @@ void ZText::ParseRawData() const auto& rawData = parent->GetRawData(); uint32_t currentPtr = StringHelper::StrToL(registeredAttributes.at("CodeOffset").value, 16); + uint32_t langPtr = currentPtr; + bool isPalLang = false; + + if (StringHelper::StrToL(registeredAttributes.at("LangOffset").value, 16) != 0) + { + langPtr = StringHelper::StrToL(registeredAttributes.at("LangOffset").value, 16); + + if (langPtr != currentPtr) + isPalLang = true; + } std::vector codeData; @@ -34,8 +45,18 @@ void ZText::ParseRawData() msgEntry.id = BitConverter::ToInt16BE(codeData, currentPtr + 0); msgEntry.textboxType = (codeData[currentPtr + 2] & 0xF0) >> 4; msgEntry.textboxYPos = (codeData[currentPtr + 2] & 0x0F); - msgEntry.segmentId = (codeData[currentPtr + 4]); - msgEntry.msgOffset = BitConverter::ToInt32BE(codeData, currentPtr + 4) & 0x00FFFFFF; + + if (isPalLang) + { + msgEntry.segmentId = (codeData[langPtr + 0]); + msgEntry.msgOffset = BitConverter::ToInt32BE(codeData, langPtr + 0) & 0x00FFFFFF; + } + else + { + msgEntry.segmentId = (codeData[langPtr + 4]); + msgEntry.msgOffset = BitConverter::ToInt32BE(codeData, langPtr + 4) & 0x00FFFFFF; + } + uint32_t msgPtr = msgEntry.msgOffset; unsigned char c = rawData[msgPtr]; @@ -82,6 +103,11 @@ void ZText::ParseRawData() break; currentPtr += 8; + + if (isPalLang) + langPtr += 4; + else + langPtr += 8; } int bp2 = 0; diff --git a/soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml b/soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml new file mode 100644 index 000000000..bfc725d99 --- /dev/null +++ b/soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml b/soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml new file mode 100644 index 000000000..c62e756a0 --- /dev/null +++ b/soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml b/soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml new file mode 100644 index 000000000..fcedf3e5f --- /dev/null +++ b/soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml b/soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml new file mode 100644 index 000000000..ec7f4cbff --- /dev/null +++ b/soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index 354997e16..ac1f013c2 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -8,27 +8,37 @@ #include extern "C" MessageTableEntry* sNesMessageEntryTablePtr; +extern "C" MessageTableEntry* sGerMessageEntryTablePtr; +extern "C" MessageTableEntry* sFraMessageEntryTablePtr; extern "C" MessageTableEntry* sStaffMessageEntryTablePtr; -//extern "C" MessageTableEntry* _message_0xFFFC_nes; +//extern "C" MessageTableEntry* _message_0xFFFC_nes; + +MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) { + auto file = std::static_pointer_cast(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(filePath)); + + if (file == nullptr) + return nullptr; + + MessageTableEntry* table = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file->messages.size()); + + for (int i = 0; i < file->messages.size(); i++) { + table[i].textId = file->messages[i].id; + table[i].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos; + table[i].segment = file->messages[i].msg.c_str(); + table[i].msgSize = file->messages[i].msg.size(); + + if (isNES && file->messages[i].id == 0xFFFC) + _message_0xFFFC_nes = (char*)file->messages[i].msg.c_str(); + } + + return table; +} extern "C" void OTRMessage_Init() { - auto file = std::static_pointer_cast(OTRGlobals::Instance->context->GetResourceManager()->LoadResource("text/nes_message_data_static/nes_message_data_static")); - - sNesMessageEntryTablePtr = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file->messages.size()); - - for (int i = 0; i < file->messages.size(); i++) - { - sNesMessageEntryTablePtr[i].textId = file->messages[i].id; - sNesMessageEntryTablePtr[i].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos; - sNesMessageEntryTablePtr[i].segment = file->messages[i].msg.c_str(); - sNesMessageEntryTablePtr[i].msgSize = file->messages[i].msg.size(); - - if (file->messages[i].id == 0xFFFC) - { - _message_0xFFFC_nes = (char*)file->messages[i].msg.c_str(); - } - } + sNesMessageEntryTablePtr = OTRMessage_LoadTable("text/nes_message_data_static/nes_message_data_static", true); + sGerMessageEntryTablePtr = OTRMessage_LoadTable("text/ger_message_data_static/ger_message_data_static", false); + sFraMessageEntryTablePtr = OTRMessage_LoadTable("text/fra_message_data_static/fra_message_data_static", false); auto file2 = std::static_pointer_cast(OTRGlobals::Instance->context->GetResourceManager()->LoadResource("text/staff_message_data_static/staff_message_data_static")); diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 6a29a6564..6dbe6f6d7 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -33,42 +33,12 @@ s16 sMessageHasSetSfx = false; u16 sOcarinaSongBitFlags = 0; // ocarina bit flags MessageTableEntry* sNesMessageEntryTablePtr; +MessageTableEntry* sGerMessageEntryTablePtr; +MessageTableEntry* sFraMessageEntryTablePtr; MessageTableEntry* sStaffMessageEntryTablePtr; char* _message_0xFFFC_nes; -//MessageTableEntry sNesMessageEntryTable[] = { -//#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \ -// { textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_nes }, -//#define DEFINE_MESSAGE_FFFC -//#include "text/message_data.h" -//#undef DEFINE_MESSAGE_FFFC -//#undef DEFINE_MESSAGE -// { 0xFFFF, 0, NULL }, -//}; -// -//const char* sGerMessageEntryTable[] = { -//#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) _message_##textId##_ger, -//#include "text/message_data.h" -//#undef DEFINE_MESSAGE -// NULL, -//}; -// -//const char* sFraMessageEntryTable[] = { -//#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) _message_##textId##_fra, -//#include "text/message_data.h" -//#undef DEFINE_MESSAGE -// NULL, -//}; -// -//MessageTableEntry sStaffMessageEntryTable[] = { -//#define DEFINE_MESSAGE(textId, type, yPos, staffMessage) \ -// { textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_staff }, -//#include "text/message_data_staff.h" -//#undef DEFINE_MESSAGE -// { 0xFFFF, 0, NULL }, -//}; - //MessageTableEntry* sNesMessageEntryTablePtr = sNesMessageEntryTable; //const char** sGerMessageEntryTablePtr = sGerMessageEntryTable; //const char** sFraMessageEntryTablePtr = sFraMessageEntryTable; @@ -310,69 +280,46 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { Font* font; const char* seg; - - if (gSaveContext.language == LANGUAGE_ENG) { - seg = messageTableEntry->segment; + if (gSaveContext.language == LANGUAGE_GER) + messageTableEntry = sGerMessageEntryTablePtr; + else if (gSaveContext.language == LANGUAGE_FRA) + messageTableEntry = sFraMessageEntryTablePtr; - while (messageTableEntry->textId != 0xFFFF) { - font = &globalCtx->msgCtx.font; + // If PAL languages are not present in the OTR file, default to English + if (messageTableEntry == NULL) + messageTableEntry = sNesMessageEntryTablePtr; - if (messageTableEntry->textId == textId) { - foundSeg = messageTableEntry->segment; - font->charTexBuf[0] = messageTableEntry->typePos; - //messageTableEntry++; - nextSeg = messageTableEntry->segment; - font->msgOffset = messageTableEntry->segment; - font->msgLength = messageTableEntry->msgSize; - // "Message found!!!" - osSyncPrintf(" メッセージが,見つかった!!! = %x " - "(data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n", - textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg); - return; - } - messageTableEntry++; - } - } else { - //languageSegmentTable = (gSaveContext.language == LANGUAGE_GER) ? sGerMessageEntryTablePtr : sFraMessageEntryTablePtr; // OTRTODO - seg = messageTableEntry->segment; - - while (messageTableEntry->textId != 0xFFFF) { - font = &globalCtx->msgCtx.font; - - if (messageTableEntry->textId == textId) { - foundSeg = *languageSegmentTable; - font->charTexBuf[0] = messageTableEntry->typePos; - languageSegmentTable++; - nextSeg = *languageSegmentTable; - font->msgOffset = foundSeg - seg; - font->msgLength = nextSeg - foundSeg; - // "Message found!!!" - osSyncPrintf(" メッセージが,見つかった!!! = %x " - "(data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n", - textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg); - return; - } - messageTableEntry++; - languageSegmentTable++; + seg = messageTableEntry->segment; + + while (messageTableEntry->textId != 0xFFFF) { + font = &globalCtx->msgCtx.font; + + if (messageTableEntry->textId == textId) { + foundSeg = messageTableEntry->segment; + font->charTexBuf[0] = messageTableEntry->typePos; + + nextSeg = messageTableEntry->segment; + font->msgOffset = messageTableEntry->segment; + font->msgLength = messageTableEntry->msgSize; + + // "Message found!!!" + osSyncPrintf(" メッセージが,見つかった!!! = %x " + "(data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n", + textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg); + return; } + messageTableEntry++; } + // "Message not found!!!" osSyncPrintf(" メッセージが,見つからなかった!!! = %x\n", textId); font = &globalCtx->msgCtx.font; messageTableEntry = sNesMessageEntryTablePtr; - if (gSaveContext.language == LANGUAGE_ENG) { - foundSeg = messageTableEntry->segment; - font->charTexBuf[0] = messageTableEntry->typePos; - messageTableEntry++; - nextSeg = messageTableEntry->segment; - } else { - //languageSegmentTable = (gSaveContext.language == LANGUAGE_GER) ? sGerMessageEntryTablePtr : sFraMessageEntryTablePtr; // OTRTODO - foundSeg = *languageSegmentTable; - font->charTexBuf[0] = messageTableEntry->typePos; - languageSegmentTable++; - nextSeg = *languageSegmentTable; - } + foundSeg = messageTableEntry->segment; + font->charTexBuf[0] = messageTableEntry->typePos; + messageTableEntry++; + nextSeg = messageTableEntry->segment; font->msgOffset = foundSeg - seg; font->msgLength = nextSeg - foundSeg; } @@ -391,7 +338,6 @@ void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) { if (messageTableEntry->textId == textId) { foundSeg = messageTableEntry->segment; font->charTexBuf[0] = messageTableEntry->typePos; - //messageTableEntry++; nextSeg = messageTableEntry->segment; font->msgOffset = messageTableEntry->segment; font->msgLength = messageTableEntry->msgSize; @@ -1145,7 +1091,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { } } if (msgCtx->textDelayTimer == 0) { - msgCtx->textDrawPos = i + 1; + msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1); msgCtx->textDelayTimer = msgCtx->textDelay; } else { msgCtx->textDelayTimer--; @@ -1640,26 +1586,10 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) { //DmaMgr_SendRequest1(font->msgBuf, (uintptr_t)(_staff_message_data_staticSegmentRomStart + 4 + font->msgOffset), //font->msgLength, "../z_message_PAL.c", 1954); } else { - if (gSaveContext.language == LANGUAGE_ENG) - { - Message_FindMessage(globalCtx, textId); - msgCtx->msgLength = font->msgLength; - char* src = (uintptr_t)font->msgOffset; - memcpy(font->msgBuf, src, font->msgLength); - } else if (gSaveContext.language == LANGUAGE_GER) { - // OTRTODO - //Message_FindMessage(globalCtx, textId); - //msgCtx->msgLength = font->msgLength; - //DmaMgr_SendRequest1(font->msgBuf, (uintptr_t)(_ger_message_data_staticSegmentRomStart + font->msgOffset), - //font->msgLength, "../z_message_PAL.c", 1978); - } else - { - // OTRTODO - //Message_FindMessage(globalCtx, textId); - //msgCtx->msgLength = font->msgLength; - //DmaMgr_SendRequest1(font->msgBuf, (uintptr_t)(_fra_message_data_staticSegmentRomStart + font->msgOffset), - //font->msgLength, "../z_message_PAL.c", 1990); - } + Message_FindMessage(globalCtx, textId); + msgCtx->msgLength = font->msgLength; + char* src = (uintptr_t)font->msgOffset; + memcpy(font->msgBuf, src, font->msgLength); } msgCtx->textBoxProperties = font->charTexBuf[0]; From 4c74acdd29fac954017ef82dfb82dbed8114c4cc Mon Sep 17 00:00:00 2001 From: Nicholas Estelami Date: Tue, 26 Apr 2022 18:10:54 -0400 Subject: [PATCH 09/11] Combined message table xmls --- .../xml/GC_NMQ_D/text/fra_message_data_static.xml | 5 ----- .../xml/GC_NMQ_D/text/ger_message_data_static.xml | 5 ----- .../xml/GC_NMQ_D/text/message_data_static.xml | 14 ++++++++++++++ .../xml/GC_NMQ_D/text/nes_message_data_static.xml | 5 ----- .../GC_NMQ_D/text/staff_message_data_static.xml | 5 ----- .../GC_NMQ_PAL_F/text/fra_message_data_static.xml | 5 ----- .../GC_NMQ_PAL_F/text/ger_message_data_static.xml | 5 ----- .../xml/GC_NMQ_PAL_F/text/message_data_static.xml | 14 ++++++++++++++ .../GC_NMQ_PAL_F/text/nes_message_data_static.xml | 5 ----- .../text/staff_message_data_static.xml | 5 ----- 10 files changed, 28 insertions(+), 40 deletions(-) delete mode 100644 soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml delete mode 100644 soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml create mode 100644 soh/assets/xml/GC_NMQ_D/text/message_data_static.xml delete mode 100644 soh/assets/xml/GC_NMQ_D/text/nes_message_data_static.xml delete mode 100644 soh/assets/xml/GC_NMQ_D/text/staff_message_data_static.xml delete mode 100644 soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml delete mode 100644 soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml create mode 100644 soh/assets/xml/GC_NMQ_PAL_F/text/message_data_static.xml delete mode 100644 soh/assets/xml/GC_NMQ_PAL_F/text/nes_message_data_static.xml delete mode 100644 soh/assets/xml/GC_NMQ_PAL_F/text/staff_message_data_static.xml diff --git a/soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml b/soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml deleted file mode 100644 index bfc725d99..000000000 --- a/soh/assets/xml/GC_NMQ_D/text/fra_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml b/soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml deleted file mode 100644 index c62e756a0..000000000 --- a/soh/assets/xml/GC_NMQ_D/text/ger_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/soh/assets/xml/GC_NMQ_D/text/message_data_static.xml b/soh/assets/xml/GC_NMQ_D/text/message_data_static.xml new file mode 100644 index 000000000..223493596 --- /dev/null +++ b/soh/assets/xml/GC_NMQ_D/text/message_data_static.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/soh/assets/xml/GC_NMQ_D/text/nes_message_data_static.xml b/soh/assets/xml/GC_NMQ_D/text/nes_message_data_static.xml deleted file mode 100644 index e2d39a916..000000000 --- a/soh/assets/xml/GC_NMQ_D/text/nes_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/soh/assets/xml/GC_NMQ_D/text/staff_message_data_static.xml b/soh/assets/xml/GC_NMQ_D/text/staff_message_data_static.xml deleted file mode 100644 index f675929e1..000000000 --- a/soh/assets/xml/GC_NMQ_D/text/staff_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml b/soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml deleted file mode 100644 index fcedf3e5f..000000000 --- a/soh/assets/xml/GC_NMQ_PAL_F/text/fra_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml b/soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml deleted file mode 100644 index ec7f4cbff..000000000 --- a/soh/assets/xml/GC_NMQ_PAL_F/text/ger_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/soh/assets/xml/GC_NMQ_PAL_F/text/message_data_static.xml b/soh/assets/xml/GC_NMQ_PAL_F/text/message_data_static.xml new file mode 100644 index 000000000..400a27e27 --- /dev/null +++ b/soh/assets/xml/GC_NMQ_PAL_F/text/message_data_static.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/soh/assets/xml/GC_NMQ_PAL_F/text/nes_message_data_static.xml b/soh/assets/xml/GC_NMQ_PAL_F/text/nes_message_data_static.xml deleted file mode 100644 index 4cf46d252..000000000 --- a/soh/assets/xml/GC_NMQ_PAL_F/text/nes_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/soh/assets/xml/GC_NMQ_PAL_F/text/staff_message_data_static.xml b/soh/assets/xml/GC_NMQ_PAL_F/text/staff_message_data_static.xml deleted file mode 100644 index 0a7efda81..000000000 --- a/soh/assets/xml/GC_NMQ_PAL_F/text/staff_message_data_static.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - From 8828d8a17002364367f02c577bb4efa069b58db7 Mon Sep 17 00:00:00 2001 From: Nicholas Estelami Date: Tue, 26 Apr 2022 18:52:25 -0400 Subject: [PATCH 10/11] Minor cleanup --- soh/src/code/z_message_PAL.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 6dbe6f6d7..c970aec5f 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -39,11 +39,6 @@ MessageTableEntry* sStaffMessageEntryTablePtr; char* _message_0xFFFC_nes; -//MessageTableEntry* sNesMessageEntryTablePtr = sNesMessageEntryTable; -//const char** sGerMessageEntryTablePtr = sGerMessageEntryTable; -//const char** sFraMessageEntryTablePtr = sFraMessageEntryTable; -//MessageTableEntry* sStaffMessageEntryTablePtr = sStaffMessageEntryTable; - s16 sTextboxBackgroundForePrimColors[][3] = { { 255, 255, 255 }, { 50, 20, 0 }, { 255, 60, 0 }, { 255, 255, 255 }, { 255, 255, 255 }, { 255, 255, 255 }, { 255, 255, 255 }, { 255, 255, 255 }, @@ -205,8 +200,6 @@ void Message_DrawTextChar(GlobalContext* globalCtx, void* textureImage, Gfx** p) s16 x = msgCtx->textPosX; s16 y = msgCtx->textPosY; - //gSPInvalidateTexCache(gfx++, 0); - //gSPInvalidateTexCache(gfx++, msgCtx->textboxSegment); gSPInvalidateTexCache(gfx++, textureImage); gDPPipeSync(gfx++); From 444026038e31c6320ebbb5e21f108a060b0b4fbb Mon Sep 17 00:00:00 2001 From: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Date: Fri, 29 Apr 2022 21:47:38 -0700 Subject: [PATCH 11/11] Fix cvar crash --- libultraship/libultraship/SDLController.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index c6892edbe..4533df20b 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -196,8 +196,8 @@ namespace Ship { const char* contName = SDL_GameControllerName(Cont); const int isSpecialController = !strcmp("PS5 Controller", contName); - float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), 0.0f); - float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), 0.0f); + float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), 0.0f); + float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), 0.0f); const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity").c_str(), 1.0f); if (gyro_drift_x == 0) { @@ -213,8 +213,8 @@ namespace Ship { } } - CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), gyro_drift_x); - CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), gyro_drift_y); + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), gyro_drift_x); + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), gyro_drift_y); if (isSpecialController == 1) { wGyroX = gyroData[0] - gyro_drift_x;