From b1e70ded80eeb05e8b42b9b2e6a8f2b42f6ba659 Mon Sep 17 00:00:00 2001 From: Josh Bodner Date: Sun, 3 Apr 2022 16:15:41 -0700 Subject: [PATCH] Fixing rebase conflict --- libultraship/libultraship/GameSettings.cpp | 4 ++++ libultraship/libultraship/GameSettings.h | 1 + libultraship/libultraship/SohImGuiImpl.cpp | 5 +++++ soh/src/code/code_800EC960.c | 24 ++++++++-------------- soh/src/code/z_message_PAL.c | 5 +++-- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index f12042bc0..d7d75e31a 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -89,6 +89,9 @@ namespace Game { Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]); CVar_SetS32("gInputEnabled", Settings.controller.input_enabled); + + Settings.controller.dpad_ocarina_text = stob(Conf[ControllerSection]["dpad_ocarina_text"]); + CVar_SetS32("gDpadOcarinaText", Settings.controller.dpad_ocarina_text); // Cheats Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]); @@ -149,6 +152,7 @@ namespace Game { Conf[ControllerSection]["rumble_strength"] = std::to_string(Settings.controller.rumble_strength); 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_ocarina_text"] = std::to_string(Settings.controller.dpad_ocarina_text); // Cheats Conf[CheatSection]["debug_mode"] = std::to_string(Settings.cheats.debug_mode); diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 4f9bb4c99..746986770 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -34,6 +34,7 @@ struct SoHConfigType { float gyroDriftX = 0.0f; float gyroDriftY = 0.0f; bool input_enabled = false; + bool dpad_ocarina_text = false; } controller; // Cheats diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 7489d14a2..52fe50e37 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -353,6 +353,11 @@ namespace SohImGui { needs_save = true; } + if (ImGui::Checkbox("DPad Support in Ocarina and Text Choice", &Game::Settings.controller.dpad_ocarina_text)) { + CVar_SetS32(const_cast("gDpadOcarinaText"), Game::Settings.controller.dpad_ocarina_text); + needs_save = true; + } + ImGui::EndMenu(); } diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 81fbf79e5..416bfb74a 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -824,13 +824,12 @@ NatureAmbienceDataIO sNatureAmbienceDataIO[20] = { }, }; -u32 sOcarinaAllowedBtnMask = - (BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT | BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT); +u32 sOcarinaAllowedBtnMask = (BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT); s32 sOcarinaABtnMap = BTN_A; -s32 sOcarinaCUPBtnMap = BTN_CUP | BTN_DUP; -s32 sOcarinaCDownBtnMap = BTN_CDOWN | BTN_DDOWN; -s32 sOcarinaCLeftBtnMap = BTN_CLEFT | BTN_DLEFT; -s32 sOcarinaCRightBtnMap = BTN_CRIGHT | BTN_DRIGHT; +s32 sOcarinaCUPBtnMap = BTN_CUP; +s32 sOcarinaCDownBtnMap = BTN_CDOWN; +s32 sOcarinaCLeftBtnMap = BTN_CLEFT; +s32 sOcarinaCRightBtnMap = BTN_CRIGHT; u8 sOcarinaInpEnabled = 0; s8 D_80130F10 = 0; // "OCA", ocarina active? u8 sCurOcarinaBtnVal = 0xFF; @@ -1248,8 +1247,9 @@ void func_800F56A8(void); void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId); s32 Audio_SetGanonDistVol(u8 targetVol); +// Function originally not called, so repurposing for DPad input void func_800EC960(u8 custom) { - if (!custom) { + if (custom) { osSyncPrintf("AUDIO : Ocarina Control Assign Normal\n"); sOcarinaAllowedBtnMask = (BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT | BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT); @@ -1258,14 +1258,6 @@ void func_800EC960(u8 custom) { sOcarinaCDownBtnMap = BTN_CDOWN | BTN_DDOWN; sOcarinaCLeftBtnMap = BTN_CLEFT | BTN_DLEFT; sOcarinaCRightBtnMap = BTN_CRIGHT | BTN_DRIGHT; - } else { - osSyncPrintf("AUDIO : Ocarina Control Assign Custom\n"); - sOcarinaAllowedBtnMask = (BTN_A | BTN_B | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT); - sOcarinaABtnMap = BTN_B; - sOcarinaCUPBtnMap = BTN_CDOWN; - sOcarinaCDownBtnMap = BTN_A; - sOcarinaCLeftBtnMap = BTN_CLEFT; - sOcarinaCRightBtnMap = BTN_CRIGHT; } } @@ -1550,6 +1542,7 @@ void func_800ED200(void) { void func_800ED458(s32 arg0) { u32 phi_v1_2; + bool dpad = CVar_GetS32("gDpadOcarinaText", 0); if (D_80130F3C != 0 && D_80131880 != 0) { D_80131880--; @@ -1569,6 +1562,7 @@ void func_800ED458(s32 arg0) { D_8016BA18 &= phi_v1_2; } + func_800EC960(dpad); if (D_8016BA18 & sOcarinaABtnMap) { osSyncPrintf("Presss NA_KEY_D4 %08x\n", sOcarinaABtnMap); sCurOcarinaBtnVal = 2; diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 839a2900c..43b0fcc12 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -203,8 +203,9 @@ void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) { static s16 sAnalogStickHeld = false; MessageContext* msgCtx = &globalCtx->msgCtx; Input* input = &globalCtx->state.input[0]; + bool dpad = CVar_GetS32("gDpadOcarinaText", 0); - if ((input->rel.stick_y >= 30 && !sAnalogStickHeld) || CHECK_BTN_ALL(input->press.button, BTN_DUP)) { + if ((input->rel.stick_y >= 30 && !sAnalogStickHeld) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) { sAnalogStickHeld = true; msgCtx->choiceIndex--; if (msgCtx->choiceIndex > 128) { @@ -212,7 +213,7 @@ void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) { } else { Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - } else if ((input->rel.stick_y <= -30 && !sAnalogStickHeld) || CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { + } else if ((input->rel.stick_y <= -30 && !sAnalogStickHeld) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) { sAnalogStickHeld = true; msgCtx->choiceIndex++; if (msgCtx->choiceIndex > numChoices) {