diff --git a/OTRExporter/assets/textures/icons/gIcon.png b/OTRExporter/assets/textures/icons/gIcon.png index 614de2b4c..e81a0fbce 100644 Binary files a/OTRExporter/assets/textures/icons/gIcon.png and b/OTRExporter/assets/textures/icons/gIcon.png differ diff --git a/libultraship b/libultraship index 57660fbb1..31189cc9b 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 57660fbb186d85923a1f771bfaafe241c209e579 +Subproject commit 31189cc9b3891a6049478e955a47589ce964265d diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index d14f63491..5186d941f 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -356,17 +356,24 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets ${CMAKE_CURRENT_SOURCE_DIR}/src/ ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/include - ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/binarytools + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/log ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/debug ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/menu - ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/misc - ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/core + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/utils + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/utils/binarytools + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/config ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource/type + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource/factory ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/audio + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/window + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/window/gui + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/config + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/public + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/public/libultra + ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/public/bridge ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern - ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/Mercury ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/tinyxml2 ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/ ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/ diff --git a/soh/include/z64.h b/soh/include/z64.h index aa7b98eb5..ecde677b0 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -41,7 +41,7 @@ #ifdef __cplusplus namespace LUS { - class Resource; + class IResource; class Scene; class DisplayList; }; diff --git a/soh/soh/Enhancements/audio/AudioCollection.cpp b/soh/soh/Enhancements/audio/AudioCollection.cpp index 289abc256..090d71cd9 100644 --- a/soh/soh/Enhancements/audio/AudioCollection.cpp +++ b/soh/soh/Enhancements/audio/AudioCollection.cpp @@ -229,7 +229,7 @@ void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) { excludedSequences.insert(seqInfo); includedSequences.erase(seqInfo); CVarSetInteger(cvarKey.c_str(), 1); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) { @@ -237,7 +237,7 @@ void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) { includedSequences.insert(seqInfo); excludedSequences.erase(seqInfo); CVarClear(cvarKey.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } void AudioCollection::InitializeShufflePool() { @@ -287,4 +287,4 @@ extern "C" bool AudioCollection_HasSequenceNum(uint16_t seqId) { extern "C" size_t AudioCollection_SequenceMapSize() { return AudioCollection::Instance->SequenceMapSize(); -} \ No newline at end of file +} diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 40f680ab9..fd24503bb 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -5,8 +5,7 @@ #include #include #include -#include -#include +#include #include #include "../randomizer/3drando/random.hpp" #include "../../OTRGlobals.h" @@ -158,7 +157,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { const std::string randomizeAllButton = "Randomize All" + hiddenTabId; if (ImGui::Button(resetAllButton.c_str())) { ResetGroup(map, type); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); if (type == SEQ_BGM_WORLD) { ReplayCurrentBGM(); } @@ -166,7 +165,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { ImGui::SameLine(); if (ImGui::Button(randomizeAllButton.c_str())) { RandomizeGroup(type); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); if (type == SEQ_BGM_WORLD) { ReplayCurrentBGM(); } @@ -205,7 +204,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { if (ImGui::Selectable(seqData.label.c_str())) { CVarSetInteger(cvarKey.c_str(), value); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); UpdateCurrentBGM(defaultValue, type); } } @@ -219,7 +218,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { ImGui::PushItemWidth(-FLT_MIN); if (ImGui::Button(resetButton.c_str())) { CVarSetInteger(cvarKey.c_str(), defaultValue); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); UpdateCurrentBGM(defaultValue, seqData.category); } ImGui::SameLine(); @@ -236,7 +235,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto it = validSequences.begin(); const auto& seqData = *std::next(it, rand() % validSequences.size()); CVarSetInteger(cvarKey.c_str(), seqData->sequenceId); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); UpdateCurrentBGM(seqData->sequenceId, type); } } @@ -306,19 +305,11 @@ void DrawTypeChip(SeqType type) { ImGui::EndDisabled(); } -void DrawSfxEditor(bool& open) { - if (!open) { - if (CVarGetInteger("gAudioEditor.WindowOpen", 0)) { - CVarClear("gAudioEditor.WindowOpen"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void AudioEditor::DrawElement() { AudioCollection::Instance->InitializeShufflePool(); ImGui::SetNextWindowSize(ImVec2(820, 630), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Audio Editor", &open)) { + if (!ImGui::Begin("Audio Editor", &mIsVisible)) { ImGui::End(); return; } @@ -381,7 +372,7 @@ void DrawSfxEditor(bool& open) { const std::string resetButton = "Reset##linkVoiceFreqMultiplier"; if (ImGui::Button(resetButton.c_str())) { CVarSetFloat("gLinkVoiceFreqMultiplier", 1.0f); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::NewLine(); @@ -553,11 +544,6 @@ void DrawSfxEditor(bool& open) { ImGui::End(); } -void InitAudioEditor() { - //Draw the bar in the menu. - LUS::AddWindow("Enhancements", "Audio Editor", DrawSfxEditor, CVarGetInteger("gAudioEditor.WindowOpen", 0)); -} - std::vector allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX }; void AudioEditor_RandomizeAll() { @@ -565,7 +551,7 @@ void AudioEditor_RandomizeAll() { RandomizeGroup(type); } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ReplayCurrentBGM(); } @@ -574,6 +560,6 @@ void AudioEditor_ResetAll() { ResetGroup(AudioCollection::Instance->GetAllSequences(), type); } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ReplayCurrentBGM(); } diff --git a/soh/soh/Enhancements/audio/AudioEditor.h b/soh/soh/Enhancements/audio/AudioEditor.h index ac380494b..5ca4457e3 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.h +++ b/soh/soh/Enhancements/audio/AudioEditor.h @@ -1,6 +1,18 @@ #pragma once #include "stdint.h" -void InitAudioEditor(); +#include +#include + +class AudioEditor : public LUS::GuiWindow { + public: + using LUS::GuiWindow::GuiWindow; + + void DrawElement() override; + void InitElement() override {}; + void UpdateElement() override {}; + ~AudioEditor() {}; +}; + void AudioEditor_RandomizeAll(); void AudioEditor_ResetAll(); diff --git a/soh/soh/Enhancements/controls/GameControlEditor.cpp b/soh/soh/Enhancements/controls/GameControlEditor.cpp index 025b2693c..719444d1b 100644 --- a/soh/soh/Enhancements/controls/GameControlEditor.cpp +++ b/soh/soh/Enhancements/controls/GameControlEditor.cpp @@ -10,11 +10,10 @@ #include #include #include -#include +#include #include -#include +#include -#include "Window.h" #include "../../UIWidgets.hpp" namespace GameControlEditor { @@ -86,11 +85,7 @@ namespace GameControlEditor { static CustomButtonMap ocarinaSharp = {"Pitch up", "gOcarinaSharpBtnMap", BTN_R}; static CustomButtonMap ocarinaFlat = {"Pitch down", "gOcarinaFlatBtnMap", BTN_Z}; - void DrawUI(bool&); - - void Init() { - LUS::AddWindow("Enhancements", "Additional Controller Options", DrawUI, CVarGetInteger("gControllerOptionsEnabled", 0)); - + void GameControlEditorWindow::InitElement() { addButtonName(BTN_A, "A"); addButtonName(BTN_B, "B"); addButtonName(BTN_CUP, "C Up"); @@ -137,7 +132,7 @@ namespace GameControlEditor { } if (ImGui::Selectable(i->second, i->first == currentButton)) { CVarSetInteger(mapping.cVarName, i->first); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } ImGui::EndCombo(); @@ -145,7 +140,7 @@ namespace GameControlEditor { UIWidgets::Spacer(0); } - void DrawOcarinaControlPanel() { + void DrawOcarinaControlPanel(GameControlEditorWindow* window) { if (!ImGui::CollapsingHeader("Ocarina Controls")) { return; } @@ -173,7 +168,7 @@ namespace GameControlEditor { ImGui::TableSetupColumn("Modifiers##CustomOcaranaModifiers", PANEL_TABLE_COLUMN_FLAGS); TableHelper::InitHeader(false); - LUS::BeginGroupPanel("Notes", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("Notes", ImGui::GetContentRegionAvail()); labelWidth = ImGui::CalcTextSize("D5").x + 10; DrawMapping(ocarinaD5, labelWidth, disableMask); DrawMapping(ocarinaB4, labelWidth, disableMask); @@ -182,16 +177,16 @@ namespace GameControlEditor { DrawMapping(ocarinaD4, labelWidth, disableMask); ImGui::Dummy(ImVec2(0, 5)); float cursorY = ImGui::GetCursorPosY(); - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); TableHelper::NextCol(); - LUS::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("Modifiers", ImGui::GetContentRegionAvail()); labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10; DrawMapping(ocarinaSongDisable, labelWidth, disableMask); DrawMapping(ocarinaSharp, labelWidth, disableMask); DrawMapping(ocarinaFlat, labelWidth, disableMask); - LUS::EndGroupPanel(cursorY - ImGui::GetCursorPosY() + 2); + window->EndGroupPanelPublic(cursorY - ImGui::GetCursorPosY() + 2); ImGui::EndTable(); } @@ -202,7 +197,7 @@ namespace GameControlEditor { UIWidgets::Spacer(0); } - LUS::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("Alternate controls", ImGui::GetContentRegionAvail()); if (ImGui::BeginTable("tableOcarinaAlternateControls", 2, ImGuiTableFlags_SizingFixedSame)) { ImGui::TableSetupColumn("D-pad", PANEL_TABLE_COLUMN_FLAGS); ImGui::TableSetupColumn("Right stick", PANEL_TABLE_COLUMN_FLAGS); @@ -214,27 +209,28 @@ namespace GameControlEditor { UIWidgets::Spacer(0); ImGui::EndTable(); } - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); ImGui::EndTable(); } - // CurrentPort is indexed started at 1 here due to the Generic tab, instead of 0 like in InputEditor + // CurrentPort is indexed started at 1 here due to the Generic tab, instead of 0 like in InputEditorWindow // Therefore CurrentPort - 1 must always be used inside this function instead of CurrentPort void DrawCustomButtons() { - LUS::GetInputEditor()->DrawControllerSelect(CurrentPort - 1); + auto inputEditorWindow = std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Input Editor")); + inputEditorWindow->DrawControllerSelect(CurrentPort - 1); - LUS::GetInputEditor()->DrawButton("Modifier 1", BTN_MODIFIER1, CurrentPort - 1, &BtnReading); - LUS::GetInputEditor()->DrawButton("Modifier 2", BTN_MODIFIER2, CurrentPort - 1, &BtnReading); + inputEditorWindow->DrawButton("Modifier 1", BTN_MODIFIER1, CurrentPort - 1, &BtnReading); + inputEditorWindow->DrawButton("Modifier 2", BTN_MODIFIER2, CurrentPort - 1, &BtnReading); } - void DrawCameraControlPanel() { + void DrawCameraControlPanel(GameControlEditorWindow* window) { if (!ImGui::CollapsingHeader("Camera Controls")) { return; } UIWidgets::Spacer(0); - LUS::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("Aiming/First-Person Camera", ImGui::GetContentRegionAvail()); UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming"); DrawHelpIcon("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming"); UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis"); @@ -255,10 +251,10 @@ namespace GameControlEditor { "gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true); } UIWidgets::Spacer(0); - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); UIWidgets::Spacer(0); - LUS::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("Third-Person Camera", ImGui::GetContentRegionAvail()); UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera"); DrawHelpIcon("Enables free camera control\nNote: You must remap C buttons off of the right stick in the " @@ -276,17 +272,17 @@ namespace GameControlEditor { "gFreeCameraDistMax", 100, 900, "", 185, true, false, true); UIWidgets::PaddedEnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed", "gFreeCameraTransitionSpeed", 0, 900, "", 25, true, false, true); - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); } - void DrawDpadControlPanel() { + void DrawDpadControlPanel(GameControlEditorWindow* window) { if (!ImGui::CollapsingHeader("D-Pad Controls")) { return; } ImVec2 cursor = ImGui::GetCursorPos(); ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - LUS::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("D-Pad Options", ImGui::GetContentRegionAvail()); UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", "gDpadPause"); DrawHelpIcon("Navigate Pause with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up to equip instead of navigate\n" "To make the cursor only move a single space no matter how long a direction is held, manually set gDpadHoldChange to 0"); @@ -295,17 +291,17 @@ namespace GameControlEditor { "To make the cursor only move a single space during name entry no matter how long a direction is held, manually set gDpadHoldChange to 0"); UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", "gDpadEquips"); DrawHelpIcon("Equip items and equipment on the D-pad\nIf used with D-pad on Pause Screen, you must hold C-Up to equip instead of navigate"); - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); } - void DrawMiscControlPanel() { + void DrawMiscControlPanel(GameControlEditorWindow* window) { if (!ImGui::CollapsingHeader("Miscellaneous Controls")) { return; } ImVec2 cursor = ImGui::GetCursorPos(); ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - LUS::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("Misc Controls", ImGui::GetContentRegionAvail()); UIWidgets::PaddedText("Allow the cursor to be on any slot"); static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" }; UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY); @@ -316,20 +312,20 @@ namespace GameControlEditor { DrawHelpIcon("Hold the assigned button to change the maximum walking speed\nTo change the assigned button, go into the Ports tabs above"); if (CVarGetInteger("gEnableWalkModify", 0)) { UIWidgets::Spacer(5); - LUS::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail()); + window->BeginGroupPanelPublic("Walk Modifier", ImGui::GetContentRegionAvail()); UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false); UIWidgets::PaddedEnhancementSliderFloat("Modifier 1: %d %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true); UIWidgets::PaddedEnhancementSliderFloat("Modifier 2: %d %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true); - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); } UIWidgets::Spacer(0); UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL"); DrawHelpIcon("Speak to Navi with L but enter first-person camera with C-Up"); - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); } - void DrawLEDControlPanel() { - LUS::BeginGroupPanel("LED Colors", ImGui::GetContentRegionAvail()); + void DrawLEDControlPanel(GameControlEditorWindow* window) { + window->BeginGroupPanelPublic("LED Colors", ImGui::GetContentRegionAvail()); static const char* ledSources[4] = { "Original Tunic Colors", "Cosmetics Tunic Colors", "Health Colors", "Custom" }; UIWidgets::PaddedText("Source"); UIWidgets::EnhancementCombobox("gLedColorSource", ledSources, LED_SOURCE_TUNIC_ORIGINAL); @@ -347,7 +343,7 @@ namespace GameControlEditor { color.b = colorVec.z * 255.0; CVarSetColor24("gLedPort1Color", color); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text("Custom Color"); @@ -359,20 +355,12 @@ namespace GameControlEditor { CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL) == LED_SOURCE_HEALTH, "Override redundant for health source.", UIWidgets::CheckboxGraphics::Cross, true); DrawHelpIcon("Shows red color when health is critical, otherwise displays according to color source."); - LUS::EndGroupPanel(); + window->EndGroupPanelPublic(0); } - void DrawUI(bool& open) { - if (!open) { - if (CVarGetInteger("gControllerOptionsEnabled", 0)) { - CVarClear("gControllerOptionsEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - + void GameControlEditorWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver); - if (ImGui::Begin("Game Controls Configuration", &open)) { + if (ImGui::Begin("Game Controls Configuration", &mIsVisible)) { ImGui::BeginTabBar("##CustomControllers"); if (ImGui::BeginTabItem("Generic")) { CurrentPort = 0; @@ -389,17 +377,25 @@ namespace GameControlEditor { ImGui::EndTabBar(); if (CurrentPort == 0) { - DrawOcarinaControlPanel(); - DrawCameraControlPanel(); - DrawDpadControlPanel(); - DrawMiscControlPanel(); + DrawOcarinaControlPanel(this); + DrawCameraControlPanel(this); + DrawDpadControlPanel(this); + DrawMiscControlPanel(this); } else { DrawCustomButtons(); if (CurrentPort == 1 && LUS::Context::GetInstance()->GetControlDeck()->GetDeviceFromPortIndex(0)->CanSetLed()) { - DrawLEDControlPanel(); + DrawLEDControlPanel(this); } } } ImGui::End(); } + + void GameControlEditorWindow::BeginGroupPanelPublic(const char* name, const ImVec2& size) { + BeginGroupPanel(name, size); + } + + void GameControlEditorWindow::EndGroupPanelPublic(float minHeight) { + EndGroupPanel(minHeight); + } } diff --git a/soh/soh/Enhancements/controls/GameControlEditor.h b/soh/soh/Enhancements/controls/GameControlEditor.h index 6db983f52..7cf306741 100644 --- a/soh/soh/Enhancements/controls/GameControlEditor.h +++ b/soh/soh/Enhancements/controls/GameControlEditor.h @@ -1,7 +1,21 @@ #pragma once +#include + namespace GameControlEditor { - static int CurrentPort = 0; - static int BtnReading = -1; - void Init(); -} +class GameControlEditorWindow : public LUS::GuiWindow { + public: + using LUS::GuiWindow::GuiWindow; + + void BeginGroupPanelPublic(const char* name, const ImVec2& size); + void EndGroupPanelPublic(float minHeight); + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; + +static int CurrentPort = 0; +static int BtnReading = -1; + +} // namespace GameControlEditor diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 5b7592e80..4f7bdbd5c 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1,6 +1,5 @@ #include "CosmeticsEditor.h" #include "authenticGfxPatches.h" -#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include @@ -10,6 +9,7 @@ #include #include #include "soh/Enhancements/randomizer/3drando/random.hpp" +#include #include "soh/UIWidgets.hpp" @@ -117,7 +117,7 @@ typedef struct { # Silly Options Lets get this one out of the way, probably the only thing that will be consistent between silly options is how they are rendered on the ImGui tab. So when adding one just make sure it follows the same general pattern as the rest. Notably: - - Make sure to RequestCvarSaveOnNextTick(), forgetting this will not persist your changes + - Make sure to SaveConsoleVariablesOnNextTick(), forgetting this will not persist your changes - Make sure reset properly resets the value - Depending on your use case you may or may not have to split the cvar into two values (cvar.Changed & cvar.Value) @@ -1424,7 +1424,7 @@ void Draw_Placements(){ void DrawSillyTab() { if (CVarGetInteger("gLetItSnow", 0)) { if (UIWidgets::EnhancementCheckbox("Let It Snow", "gLetItSnow")) { - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } if (UIWidgets::EnhancementSliderFloat("Link Body Scale: %f", "##Link_BodyScale", "gCosmetics.Link_BodyScale.Value", 0.001f, 0.025f, "", 0.01f, false)) { @@ -1434,7 +1434,7 @@ void DrawSillyTab() { if (ImGui::Button("Reset##Link_BodyScale")) { CVarClear("gCosmetics.Link_BodyScale.Value"); CVarClear("gCosmetics.Link_BodyScale.Changed"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); static Player* player = GET_PLAYER(gPlayState); player->actor.scale.x = 0.01f; player->actor.scale.y = 0.01f; @@ -1447,7 +1447,7 @@ void DrawSillyTab() { if (ImGui::Button("Reset##Link_HeadScale")) { CVarClear("gCosmetics.Link_HeadScale.Value"); CVarClear("gCosmetics.Link_HeadScale.Changed"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %f", "##Link_SwordScale", "gCosmetics.Link_SwordScale.Value", 1.0f, 2.5f, "", 1.0f, false)) { CVarSetInteger("gCosmetics.Link_SwordScale.Changed", 1); @@ -1456,44 +1456,44 @@ void DrawSillyTab() { if (ImGui::Button("Reset##Link_SwordScale")) { CVarClear("gCosmetics.Link_SwordScale.Value"); CVarClear("gCosmetics.Link_SwordScale.Changed"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %f", "##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength", -300.0f, 1000.0f, "", 0.0f, false); ImGui::SameLine(); if (ImGui::Button("Reset##BunnyHood_EarLength")) { CVarClear("gCosmetics.BunnyHood_EarLength"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread", -300.0f, 500.0f, "", 0.0f, false); ImGui::SameLine(); if (ImGui::Button("Reset##BunnyHood_EarSpread")) { CVarClear("gCosmetics.BunnyHood_EarSpread"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 1000.0f, "", 0.0f, false); ImGui::SameLine(); if (ImGui::Button("Reset##Goron_NeckLength")) { CVarClear("gCosmetics.Goron_NeckLength"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } UIWidgets::EnhancementCheckbox("Unfix Goron Spin", "gUnfixGoronSpin"); UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", "gCosmetics.Fairies_Size", 0.25f, 5.0f, "", 1.0f, false); ImGui::SameLine(); if (ImGui::Button("Reset##Fairies_Size")) { CVarClear("gCosmetics.Fairies_Size"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %f", "##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed", 0.25f, 5.0f, "", 1.0f, false); ImGui::SameLine(); if (ImGui::Button("Reset##N64Logo_SpinSpeed")) { CVarClear("gCosmetics.N64Logo_SpinSpeed"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } UIWidgets::EnhancementSliderFloat("Moon Size: %f", "##Moon_Size", "gCosmetics.Moon_Size", 0.5f, 2.0f, "", 1.0f, false); ImGui::SameLine(); if (ImGui::Button("Reset##Moon_Size")) { CVarClear("gCosmetics.Moon_Size"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %f", "##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed.Value", 100.0f, 6000.0f, "", 100.0f, false)) { CVarSetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 1); @@ -1502,7 +1502,7 @@ void DrawSillyTab() { if (ImGui::Button("Reset##Kak_Windmill_Speed")) { CVarClear("gCosmetics.Kak_Windmill_Speed.Value"); CVarClear("gCosmetics.Kak_Windmill_Speed.Changed"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } @@ -1610,7 +1610,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { CVarSetInteger((cosmeticOption.rainbowCvar), 0); CVarSetInteger((cosmeticOption.changedCvar), 1); ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text(cosmeticOption.label.c_str()); @@ -1618,7 +1618,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { if (ImGui::Button(("Random##" + cosmeticOption.label).c_str())) { RandomizeColor(cosmeticOption); ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); bool isRainbow = (bool)CVarGetInteger((cosmeticOption.rainbowCvar), 0); @@ -1626,20 +1626,20 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { CVarSetInteger((cosmeticOption.rainbowCvar), isRainbow); CVarSetInteger((cosmeticOption.changedCvar), 1); ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); bool isLocked = (bool)CVarGetInteger((cosmeticOption.lockedCvar), 0); if (ImGui::Checkbox(("Locked##" + cosmeticOption.label).c_str(), &isLocked)) { CVarSetInteger((cosmeticOption.lockedCvar), isLocked); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (CVarGetInteger((cosmeticOption.changedCvar), 0)) { ImGui::SameLine(); if (ImGui::Button(("Reset##" + cosmeticOption.label).c_str())) { ResetColor(cosmeticOption); ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } } @@ -1655,7 +1655,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) { } } ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button(("Reset##" + label).c_str())) { @@ -1665,7 +1665,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) { } } ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } for (auto& [id, cosmeticOption] : cosmeticOptions) { if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0))) { @@ -1679,17 +1679,9 @@ static const char* colorSchemes[2] = { "Gamecube", }; -void DrawCosmeticsEditor(bool& open) { - if (!open) { - if (CVarGetInteger("gCosmeticsEditorEnabled", 0)) { - CVarClear("gCosmeticsEditorEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void CosmeticsEditorWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(480, 520), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Cosmetics Editor", &open)) { + if (!ImGui::Begin("Cosmetics Editor", &mIsVisible)) { ImGui::End(); return; } @@ -1705,7 +1697,7 @@ void DrawCosmeticsEditor(bool& open) { CVarSetInteger(cosmeticOption.lockedCvar, 1); } } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button("Unlock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { @@ -1714,7 +1706,7 @@ void DrawCosmeticsEditor(bool& open) { CVarSetInteger(cosmeticOption.lockedCvar, 0); } } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } UIWidgets::EnhancementCheckbox("Sync Rainbow colors", "gCosmetics.RainbowSync"); @@ -1726,7 +1718,7 @@ void DrawCosmeticsEditor(bool& open) { } } ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button("Reset All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { @@ -1736,7 +1728,7 @@ void DrawCosmeticsEditor(bool& open) { } } ApplyOrResetCustomGfxPatches(); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (ImGui::Button("Lock All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) { @@ -1745,7 +1737,7 @@ void DrawCosmeticsEditor(bool& open) { CVarSetInteger(cosmeticOption.lockedCvar, 1); } } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button("Unlock All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { @@ -1754,7 +1746,7 @@ void DrawCosmeticsEditor(bool& open) { CVarSetInteger(cosmeticOption.lockedCvar, 0); } } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (ImGui::BeginTabBar("CosmeticsContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { @@ -1779,7 +1771,7 @@ void DrawCosmeticsEditor(bool& open) { if (ImGui::Button("Reset##Trails_Duration")) { CVarClear("gCosmetics.Trails_Duration.Value"); CVarClear("gCosmetics.Trails_Duration.Changed"); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::EndTabItem(); } @@ -1819,9 +1811,7 @@ void RegisterOnGameFrameUpdateHook() { }); } -void InitCosmeticsEditor() { - // Draw the bar in the menu. - LUS::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor, CVarGetInteger("gCosmeticsEditorEnabled", 0)); +void CosmeticsEditorWindow::InitElement() { // Convert the `current color` into the format that the ImGui color picker expects for (auto& [id, cosmeticOption] : cosmeticOptions) { Color_RGBA8 defaultColor = {cosmeticOption.defaultColor.x, cosmeticOption.defaultColor.y, cosmeticOption.defaultColor.z, cosmeticOption.defaultColor.w}; @@ -1832,7 +1822,7 @@ void InitCosmeticsEditor() { cosmeticOption.currentColor.z = cvarColor.b / 255.0; cosmeticOption.currentColor.w = cvarColor.a / 255.0; } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); ApplyAuthenticGfxPatches(); @@ -1848,7 +1838,7 @@ void CosmeticsEditor_RandomizeAll() { } } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); } @@ -1859,6 +1849,6 @@ void CosmeticsEditor_ResetAll() { } } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); } diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h index 475e93d7e..b22a51ba7 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #define PATCH_GFX(path, name, cvar, index, instruction) \ if (CVarGetInteger(cvar, 0)) { \ @@ -28,3 +28,12 @@ ImVec4 GetRandomValue(int MaximumPossible); void CosmeticsEditor_RandomizeAll(); void CosmeticsEditor_ResetAll(); void ApplyOrResetCustomGfxPatches(bool manualChange = true); + +class CosmeticsEditorWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; \ No newline at end of file diff --git a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp index a7265a23a..a9f3b1f19 100644 --- a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp +++ b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp @@ -3,8 +3,7 @@ #include "CrowdControl.h" #include "CrowdControlTypes.h" #include -#include -#include +#include #include #include #include diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 37feb8dbf..c94d5f806 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -1,8 +1,6 @@ #include "debugconsole.h" -#include #include #include "savestates.h" -#include #include "soh/ActorDB.h" #include @@ -32,18 +30,22 @@ extern PlayState* gPlayState; } #include +#include -#define CMD_REGISTER LUS::GetConsole()->AddCommand +#define CMD_REGISTER LUS::Context::GetInstance()->GetConsole()->AddCommand +// TODO: Commands should be using the output passed in. +#define ERROR_MESSAGE std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendErrorMessage +#define INFO_MESSAGE std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendInfoMessage -static bool ActorSpawnHandler(std::shared_ptr Console, const std::vector& args) { +static bool ActorSpawnHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) { - LUS::GetConsole()->SendErrorMessage("Not enough arguments passed to actorspawn"); - return CMD_FAILED; + ERROR_MESSAGE("Not enough arguments passed to actorspawn"); + return 1; } if (gPlayState == nullptr) { - LUS::GetConsole()->SendErrorMessage("PlayState == nullptr"); - return CMD_FAILED; + ERROR_MESSAGE("PlayState == nullptr"); + return 1; } Player* player = GET_PLAYER(gPlayState); @@ -54,8 +56,8 @@ static bool ActorSpawnHandler(std::shared_ptr Console, const std:: try { actorId = std::stoi(args[1]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("Invalid actor ID"); - return CMD_FAILED; + ERROR_MESSAGE("Invalid actor ID"); + return 1; } } else { actorId = nameId; @@ -89,67 +91,67 @@ static bool ActorSpawnHandler(std::shared_ptr Console, const std:: if (Actor_Spawn(&gPlayState->actorCtx, gPlayState, actorId, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z, spawnPoint.rot.x, spawnPoint.rot.y, spawnPoint.rot.z, params, 0) == NULL) { - LUS::GetConsole()->SendErrorMessage("Failed to spawn actor. Actor_Spawn returned NULL"); - return CMD_FAILED; + ERROR_MESSAGE("Failed to spawn actor. Actor_Spawn returned NULL"); + return 1; } - return CMD_SUCCESS; + return 0; } -static bool KillPlayerHandler(std::shared_ptr Console, const std::vector&) { +static bool KillPlayerHandler(std::shared_ptr Console, const std::vector&, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::SetPlayerHealth(); effect->parameters[0] = 0; GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] You've met with a terrible fate, haven't you?"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] You've met with a terrible fate, haven't you?"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not kill player."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Command failed: Could not kill player."); + return 1; } } -static bool SetPlayerHealthHandler(std::shared_ptr Console, const std::vector& args) { +static bool SetPlayerHealthHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } int health; try { health = std::stoi(args[1]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Health value must be an integer."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Health value must be an integer."); + return 1; } if (health < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Health value must be a positive integer"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Health value must be a positive integer"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::SetPlayerHealth(); effect->parameters[0] = health; GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Player health updated to %d", health); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Player health updated to %d", health); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not set player health."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Command failed: Could not set player health."); + return 1; } } -static bool LoadSceneHandler(std::shared_ptr Console, const std::vector&) { +static bool LoadSceneHandler(std::shared_ptr Console, const std::vector&, std::string* output) { gSaveContext.respawnFlag = 0; gSaveContext.seqId = 0xFF; gSaveContext.gameMode = 0; - return CMD_SUCCESS; + return 0; } -static bool RupeeHandler(std::shared_ptr Console, const std::vector& args) { +static bool RupeeHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - return CMD_FAILED; + return 1; } int rupeeAmount; @@ -157,58 +159,58 @@ static bool RupeeHandler(std::shared_ptr Console, const std::vecto rupeeAmount = std::stoi(args[1]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Rupee count must be an integer."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Rupee count must be an integer."); + return 1; } if (rupeeAmount < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Rupee count must be positive"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Rupee count must be positive"); + return 1; } gSaveContext.rupees = rupeeAmount; - LUS::GetConsole()->SendInfoMessage("Set rupee count to %u", rupeeAmount); - return CMD_SUCCESS; + INFO_MESSAGE("Set rupee count to %u", rupeeAmount); + return 0; } -static bool SetPosHandler(std::shared_ptr Console, const std::vector args) { +static bool SetPosHandler(std::shared_ptr Console, const std::vector args, std::string* output) { if (gPlayState == nullptr) { - LUS::GetConsole()->SendErrorMessage("PlayState == nullptr"); - return CMD_FAILED; + ERROR_MESSAGE("PlayState == nullptr"); + return 1; } Player* player = GET_PLAYER(gPlayState); if (args.size() == 1) { - LUS::GetConsole()->SendInfoMessage("Player position is [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x, + INFO_MESSAGE("Player position is [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z); - return CMD_SUCCESS; + return 0; } if (args.size() < 4) - return CMD_FAILED; + return 1; player->actor.world.pos.x = std::stof(args[1]); player->actor.world.pos.y = std::stof(args[2]); player->actor.world.pos.z = std::stof(args[3]); - LUS::GetConsole()->SendInfoMessage("Set player position to [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x, + INFO_MESSAGE("Set player position to [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z); - return CMD_SUCCESS; + return 0; } -static bool ResetHandler(std::shared_ptr Console, std::vector args) { +static bool ResetHandler(std::shared_ptr Console, std::vector args, std::string* output) { if (gPlayState == nullptr) { - LUS::GetConsole()->SendErrorMessage("PlayState == nullptr"); - return CMD_FAILED; + ERROR_MESSAGE("PlayState == nullptr"); + return 1; } SET_NEXT_GAMESTATE(&gPlayState->state, TitleSetup_Init, GameState); gPlayState->state.running = false; GameInteractor::Instance->ExecuteHooks(gSaveContext.fileNum); - return CMD_SUCCESS; + return 0; } const static std::map ammoItems{ @@ -218,29 +220,29 @@ const static std::map ammoItems{ { "beans", ITEM_BEAN } }; -static bool AddAmmoHandler(std::shared_ptr Console, const std::vector& args) { +static bool AddAmmoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } int amount; try { amount = std::stoi(args[2]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("Ammo count must be an integer"); - return CMD_FAILED; + ERROR_MESSAGE("Ammo count must be an integer"); + return 1; } if (amount < 0) { - LUS::GetConsole()->SendErrorMessage("Ammo count must be positive"); - return CMD_FAILED; + ERROR_MESSAGE("Ammo count must be positive"); + return 1; } const auto& it = ammoItems.find(args[1]); if (it == ammoItems.end()) { - LUS::GetConsole()->SendErrorMessage("Invalid ammo type. Options are 'sticks', 'nuts', 'bombs', 'seeds', 'arrows', 'bombchus' and 'beans'"); - return CMD_FAILED; + ERROR_MESSAGE("Invalid ammo type. Options are 'sticks', 'nuts', 'bombs', 'seeds', 'arrows', 'bombchus' and 'beans'"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::AddOrTakeAmmo(); @@ -249,38 +251,38 @@ static bool AddAmmoHandler(std::shared_ptr Console, const std::vec GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Added ammo."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Added ammo."); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not add ammo."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not add ammo."); + return 1; } } -static bool TakeAmmoHandler(std::shared_ptr Console, const std::vector& args) { +static bool TakeAmmoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } int amount; try { amount = std::stoi(args[2]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("Ammo count must be an integer"); - return CMD_FAILED; + ERROR_MESSAGE("Ammo count must be an integer"); + return 1; } if (amount < 0) { - LUS::GetConsole()->SendErrorMessage("Ammo count must be positive"); - return CMD_FAILED; + ERROR_MESSAGE("Ammo count must be positive"); + return 1; } const auto& it = ammoItems.find(args[1]); if (it == ammoItems.end()) { - LUS::GetConsole()->SendErrorMessage( + ERROR_MESSAGE( "Invalid ammo type. Options are 'sticks', 'nuts', 'bombs', 'seeds', 'arrows', 'bombchus' and 'beans'"); - return CMD_FAILED; + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::AddOrTakeAmmo(); @@ -289,11 +291,11 @@ static bool TakeAmmoHandler(std::shared_ptr Console, const std::ve GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Took ammo."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Took ammo."); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not take ammo."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not take ammo."); + return 1; } } @@ -304,63 +306,63 @@ const static std::map bottleItems{ { "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO }, }; -static bool BottleHandler(std::shared_ptr Console, const std::vector& args) { +static bool BottleHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } unsigned int slot; try { slot = std::stoi(args[2]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Bottle slot must be an integer."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Bottle slot must be an integer."); + return 1; } if ((slot < 1) || (slot > 4)) { - LUS::GetConsole()->SendErrorMessage("Invalid slot passed"); - return CMD_FAILED; + ERROR_MESSAGE("Invalid slot passed"); + return 1; } const auto& it = bottleItems.find(args[1]); if (it == bottleItems.end()) { - LUS::GetConsole()->SendErrorMessage("Invalid item passed"); - return CMD_FAILED; + ERROR_MESSAGE("Invalid item passed"); + return 1; } // I dont think you can do OOB with just this gSaveContext.inventory.items[0x11 + slot] = it->second; - return CMD_SUCCESS; + return 0; } -static bool BHandler(std::shared_ptr Console, const std::vector& args) { +static bool BHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } gSaveContext.equips.buttonItems[0] = std::stoi(args[1]); - return CMD_SUCCESS; + return 0; } -static bool ItemHandler(std::shared_ptr Console, const std::vector& args) { +static bool ItemHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } gSaveContext.inventory.items[std::stoi(args[1])] = std::stoi(args[2]); - return CMD_SUCCESS; + return 0; } -static bool GiveItemHandler(std::shared_ptr Console, const std::vector args) { +static bool GiveItemHandler(std::shared_ptr Console, const std::vector args, std::string* output) { if (args.size() < 3) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GetItemEntry getItemEntry = GET_ITEM_NONE; @@ -369,19 +371,19 @@ static bool GiveItemHandler(std::shared_ptr Console, const std::ve } else if (args[1].compare("randomizer") == 0) { getItemEntry = ItemTableManager::Instance->RetrieveItemEntry(MOD_RANDOMIZER, std::stoi(args[2])); } else { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid argument passed, must be 'vanilla' or 'randomizer'"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'vanilla' or 'randomizer'"); + return 1; } GiveItemEntryWithoutActor(gPlayState, getItemEntry); - return CMD_SUCCESS; + return 0; } -static bool EntranceHandler(std::shared_ptr Console, const std::vector& args) { +static bool EntranceHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } unsigned int entrance; @@ -389,8 +391,8 @@ static bool EntranceHandler(std::shared_ptr Console, const std::ve try { entrance = std::stoi(args[1], nullptr, 16); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Entrance value must be a Hex number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Entrance value must be a Hex number."); + return 1; } gPlayState->nextEntranceIndex = entrance; @@ -399,7 +401,7 @@ static bool EntranceHandler(std::shared_ptr Console, const std::ve gSaveContext.nextTransitionType = 11; } -static bool VoidHandler(std::shared_ptr Console, const std::vector& args) { +static bool VoidHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (gPlayState != nullptr) { gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gPlayState->actorCtx.flags.tempSwch; gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gPlayState->actorCtx.flags.tempCollect; @@ -409,39 +411,39 @@ static bool VoidHandler(std::shared_ptr Console, const std::vector gPlayState->fadeTransition = 2; gSaveContext.nextTransitionType = 2; } else { - LUS::GetConsole()->SendErrorMessage("gPlayState == nullptr"); - return CMD_FAILED; + ERROR_MESSAGE("gPlayState == nullptr"); + return 1; } - return CMD_SUCCESS; + return 0; } -static bool ReloadHandler(std::shared_ptr Console, const std::vector& args) { +static bool ReloadHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (gPlayState != nullptr) { gPlayState->nextEntranceIndex = gSaveContext.entranceIndex; gPlayState->sceneLoadFlag = 0x14; gPlayState->fadeTransition = 11; gSaveContext.nextTransitionType = 11; } else { - LUS::GetConsole()->SendErrorMessage("gPlayState == nullptr"); - return CMD_FAILED; + ERROR_MESSAGE("gPlayState == nullptr"); + return 1; } - return CMD_SUCCESS; + return 0; } const static std::map fw_options { { "clear", 0}, {"warp", 1}, {"backup", 2} }; -static bool FWHandler(std::shared_ptr Console, const std::vector& args) { +static bool FWHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } const auto& it = fw_options.find(args[1]); if (it == fw_options.end()) { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid option. Options are 'clear', 'warp', 'backup'"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid option. Options are 'clear', 'warp', 'backup'"); + return 1; } if (gPlayState != nullptr) { @@ -449,8 +451,8 @@ static bool FWHandler(std::shared_ptr Console, const std::vectorsecond) { case 0: //clear gSaveContext.fw = clear; - LUS::GetConsole()->SendInfoMessage("[SOH] Farore's wind point cleared! Reload scene to take effect."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Farore's wind point cleared! Reload scene to take effect."); + return 0; break; case 1: //warp if (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0) { @@ -458,147 +460,147 @@ static bool FWHandler(std::shared_ptr Console, const std::vectornextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; gPlayState->fadeTransition = 5; } else { - LUS::GetConsole()->SendErrorMessage("Farore's wind not set!"); - return CMD_FAILED; + ERROR_MESSAGE("Farore's wind not set!"); + return 1; } - return CMD_SUCCESS; + return 0; break; case 2: //backup if (CVarGetInteger("gBetterFW", 0)) { gSaveContext.fw = gSaveContext.backupFW; gSaveContext.fw.set = 1; - LUS::GetConsole()->SendInfoMessage("[SOH] Backup FW data copied! Reload scene to take effect."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Backup FW data copied! Reload scene to take effect."); + return 0; } else { - LUS::GetConsole()->SendErrorMessage("Better Farore's Wind isn't turned on!"); - return CMD_FAILED; + ERROR_MESSAGE("Better Farore's Wind isn't turned on!"); + return 1; } break; } } else { - LUS::GetConsole()->SendErrorMessage("gPlayState == nullptr"); - return CMD_FAILED; + ERROR_MESSAGE("gPlayState == nullptr"); + return 1; } - return CMD_SUCCESS; + return 0; } -static bool FileSelectHandler(std::shared_ptr Console, const std::vector& args) { +static bool FileSelectHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (gPlayState != nullptr) { SET_NEXT_GAMESTATE(&gPlayState->state, FileChoose_Init, FileChooseContext); gPlayState->state.running = 0; } else { - LUS::GetConsole()->SendErrorMessage("gPlayState == nullptr"); - return CMD_FAILED; + ERROR_MESSAGE("gPlayState == nullptr"); + return 1; } - return CMD_SUCCESS; + return 0; } -static bool QuitHandler(std::shared_ptr Console, const std::vector& args) { +static bool QuitHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { LUS::Context::GetInstance()->GetWindow()->Close(); - return CMD_SUCCESS; + return 0; } -static bool SaveStateHandler(std::shared_ptr Console, const std::vector& args) { +static bool SaveStateHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE }); switch (rtn) { case SaveStateReturn::SUCCESS: - LUS::GetConsole()->SendInfoMessage("[SOH] Saved state to slot %u", slot); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Saved state to slot %u", slot); + return 0; case SaveStateReturn::FAIL_WRONG_GAMESTATE: - LUS::GetConsole()->SendErrorMessage("[SOH] Can not save a state outside of \"GamePlay\""); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Can not save a state outside of \"GamePlay\""); + return 1; } } -static bool LoadStateHandler(std::shared_ptr Console, const std::vector& args) { +static bool LoadStateHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD }); switch (rtn) { case SaveStateReturn::SUCCESS: - LUS::GetConsole()->SendInfoMessage("[SOH] Loaded state from slot (%u)", slot); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Loaded state from slot (%u)", slot); + return 0; case SaveStateReturn::FAIL_INVALID_SLOT: - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid State Slot Number (%u)", slot); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid State Slot Number (%u)", slot); + return 1; case SaveStateReturn::FAIL_STATE_EMPTY: - LUS::GetConsole()->SendErrorMessage("[SOH] State Slot (%u) is empty", slot); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] State Slot (%u) is empty", slot); + return 1; case SaveStateReturn::FAIL_WRONG_GAMESTATE: - LUS::GetConsole()->SendErrorMessage("[SOH] Can not load a state outside of \"GamePlay\""); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Can not load a state outside of \"GamePlay\""); + return 1; } } -static bool StateSlotSelectHandler(std::shared_ptr Console, const std::vector& args) { +static bool StateSlotSelectHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t slot; try { slot = std::stoi(args[1], nullptr, 10); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] SaveState slot value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] SaveState slot value must be a number."); + return 1; } if (slot < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid slot passed. Slot must be between 0 and 2"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid slot passed. Slot must be between 0 and 2"); + return 1; } OTRGlobals::Instance->gSaveStateMgr->SetCurrentSlot(slot); - LUS::GetConsole()->SendInfoMessage("[SOH] Slot %u selected", + INFO_MESSAGE("[SOH] Slot %u selected", OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot()); - return CMD_SUCCESS; + return 0; } -static bool InvisibleHandler(std::shared_ptr Console, const std::vector& args) { +static bool InvisibleHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Invisible value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invisible value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::InvisibleLink(); GameInteractionEffectQueryResult result = state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Invisible Link %s", state ? "enabled" : "disabled"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Invisible Link %s", state ? "enabled" : "disabled"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not %s Invisible Link.", + INFO_MESSAGE("[SOH] Command failed: Could not %s Invisible Link.", state ? "enable" : "disable"); - return CMD_FAILED; + return 1; } } -static bool GiantLinkHandler(std::shared_ptr Console, const std::vector& args) { +static bool GiantLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Giant value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Giant value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyLinkSize(); @@ -606,27 +608,27 @@ static bool GiantLinkHandler(std::shared_ptr Console, const std::v GameInteractionEffectQueryResult result = state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Giant Link %s", state ? "enabled" : "disabled"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Giant Link %s", state ? "enabled" : "disabled"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not %s Giant Link.", + INFO_MESSAGE("[SOH] Command failed: Could not %s Giant Link.", state ? "enable" : "disable"); - return CMD_FAILED; + return 1; } } -static bool MinishLinkHandler(std::shared_ptr Console, const std::vector& args) { +static bool MinishLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Minish value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Minish value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyLinkSize(); @@ -634,81 +636,81 @@ static bool MinishLinkHandler(std::shared_ptr Console, const std:: GameInteractionEffectQueryResult result = state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Minish Link %s", state ? "enabled" : "disabled"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Minish Link %s", state ? "enabled" : "disabled"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not %s Minish Link.", + INFO_MESSAGE("[SOH] Command failed: Could not %s Minish Link.", state ? "enable" : "disable"); - return CMD_FAILED; + return 1; } } -static bool AddHeartContainerHandler(std::shared_ptr Console, const std::vector& args) { +static bool AddHeartContainerHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } int hearts; try { hearts = std::stoi(args[1]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Hearts value must be an integer."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Hearts value must be an integer."); + return 1; } if (hearts < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Hearts value must be a positive integer"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Hearts value must be a positive integer"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyHeartContainers(); effect->parameters[0] = hearts; GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Added %d heart containers", hearts); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Added %d heart containers", hearts); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not add heart containers."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not add heart containers."); + return 1; } } -static bool RemoveHeartContainerHandler(std::shared_ptr Console, const std::vector& args) { +static bool RemoveHeartContainerHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } int hearts; try { hearts = std::stoi(args[1]); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Hearts value must be an integer."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Hearts value must be an integer."); + return 1; } if (hearts < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Hearts value must be a positive integer"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Hearts value must be a positive integer"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyHeartContainers(); effect->parameters[0] = -hearts; GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Removed %d heart containers", hearts); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Removed %d heart containers", hearts); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not remove heart containers."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not remove heart containers."); + return 1; } } -static bool GravityHandler(std::shared_ptr Console, const std::vector& args) { +static bool GravityHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyGravity(); @@ -716,32 +718,32 @@ static bool GravityHandler(std::shared_ptr Console, const std::vec try { effect->parameters[0] = LUS::Math::clamp(std::stoi(args[1], nullptr, 10), GI_GRAVITY_LEVEL_LIGHT, GI_GRAVITY_LEVEL_HEAVY); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Gravity value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Gravity value must be a number."); + return 1; } GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Updated gravity."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Updated gravity."); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not update gravity."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Command failed: Could not update gravity."); + return 1; } } -static bool NoUIHandler(std::shared_ptr Console, const std::vector& args) { +static bool NoUIHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] No UI value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] No UI value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::NoUI(); @@ -749,150 +751,150 @@ static bool NoUIHandler(std::shared_ptr Console, const std::vector state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] No UI %s", state ? "enabled" : "disabled"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] No UI %s", state ? "enabled" : "disabled"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not %s No UI.", + INFO_MESSAGE("[SOH] Command failed: Could not %s No UI.", state ? "enable" : "disable"); - return CMD_FAILED; + return 1; } } -static bool FreezeHandler(std::shared_ptr Console, const std::vector& args) { +static bool FreezeHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::FreezePlayer(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Player frozen"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Player frozen"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not freeze player."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not freeze player."); + return 1; } } -static bool DefenseModifierHandler(std::shared_ptr Console, const std::vector& args) { +static bool DefenseModifierHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyDefenseModifier(); try { effect->parameters[0] = std::stoi(args[1], nullptr, 10); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Defense modifier value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Defense modifier value must be a number."); + return 1; } GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Defense modifier set to %d", effect->parameters[0]); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Defense modifier set to %d", effect->parameters[0]); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not set defense modifier."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not set defense modifier."); + return 1; } } -static bool DamageHandler(std::shared_ptr Console, const std::vector& args) { +static bool DamageHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyHealth(); try { int value = std::stoi(args[1], nullptr, 10); if (value < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid value passed. Value must be greater than 0"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid value passed. Value must be greater than 0"); + return 1; } effect->parameters[0] = -value; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Damage value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Damage value must be a number."); + return 1; } GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Player damaged"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Player damaged"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not damage player."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not damage player."); + return 1; } } -static bool HealHandler(std::shared_ptr Console, const std::vector& args) { +static bool HealHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyHealth(); try { int value = std::stoi(args[1], nullptr, 10); if (value < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid value passed. Value must be greater than 0"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid value passed. Value must be greater than 0"); + return 1; } effect->parameters[0] = value; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Damage value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Damage value must be a number."); + return 1; } GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Player healed"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Player healed"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not heal player."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not heal player."); + return 1; } } -static bool FillMagicHandler(std::shared_ptr Console, const std::vector& args) { +static bool FillMagicHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::FillMagic(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Magic filled"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Magic filled"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not fill magic."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not fill magic."); + return 1; } } -static bool EmptyMagicHandler(std::shared_ptr Console, const std::vector& args) { +static bool EmptyMagicHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::EmptyMagic(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Magic emptied"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Magic emptied"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not empty magic."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not empty magic."); + return 1; } } -static bool NoZHandler(std::shared_ptr Console, const std::vector& args) { +static bool NoZHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] NoZ value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] NoZ value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::DisableZTargeting(); @@ -900,27 +902,27 @@ static bool NoZHandler(std::shared_ptr Console, const std::vector< state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] NoZ " + std::string(state ? "enabled" : "disabled")); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] NoZ " + std::string(state ? "enabled" : "disabled")); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not " + + INFO_MESSAGE("[SOH] Command failed: Could not " + std::string(state ? "enable" : "disable") + " NoZ."); - return CMD_FAILED; + return 1; } } -static bool OneHitKOHandler(std::shared_ptr Console, const std::vector& args) { +static bool OneHitKOHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] One-hit KO value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] One-hit KO value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::OneHitKO(); @@ -928,27 +930,27 @@ static bool OneHitKOHandler(std::shared_ptr Console, const std::ve state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] One-hit KO " + std::string(state ? "enabled" : "disabled")); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] One-hit KO " + std::string(state ? "enabled" : "disabled")); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not " + + INFO_MESSAGE("[SOH] Command failed: Could not " + std::string(state ? "enable" : "disable") + " One-hit KO."); - return CMD_FAILED; + return 1; } } -static bool PacifistHandler(std::shared_ptr Console, const std::vector& args) { +static bool PacifistHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Pacifist value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Pacifist value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::PacifistMode(); @@ -956,27 +958,27 @@ static bool PacifistHandler(std::shared_ptr Console, const std::ve state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Pacifist " + std::string(state ? "enabled" : "disabled")); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Pacifist " + std::string(state ? "enabled" : "disabled")); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not " + + INFO_MESSAGE("[SOH] Command failed: Could not " + std::string(state ? "enable" : "disable") + " Pacifist."); - return CMD_FAILED; + return 1; } } -static bool PaperLinkHandler(std::shared_ptr Console, const std::vector& args) { +static bool PaperLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Paper Link value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Paper Link value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyLinkSize(); @@ -985,27 +987,27 @@ static bool PaperLinkHandler(std::shared_ptr Console, const std::v state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Paper Link " + std::string(state ? "enabled" : "disabled")); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Paper Link " + std::string(state ? "enabled" : "disabled")); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not " + + INFO_MESSAGE("[SOH] Command failed: Could not " + std::string(state ? "enable" : "disable") + " Paper Link."); - return CMD_FAILED; + return 1; } } -static bool RainstormHandler(std::shared_ptr Console, const std::vector& args) { +static bool RainstormHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Rainstorm value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Rainstorm value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::WeatherRainstorm(); @@ -1013,27 +1015,27 @@ static bool RainstormHandler(std::shared_ptr Console, const std::v state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Rainstorm " + std::string(state ? "enabled" : "disabled")); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Rainstorm " + std::string(state ? "enabled" : "disabled")); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not " + + INFO_MESSAGE("[SOH] Command failed: Could not " + std::string(state ? "enable" : "disable") + " Rainstorm."); - return CMD_FAILED; + return 1; } } -static bool ReverseControlsHandler(std::shared_ptr Console, const std::vector& args) { +static bool ReverseControlsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } uint8_t state; try { state = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Reverse controls value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Reverse controls value must be a number."); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ReverseControls(); @@ -1041,61 +1043,61 @@ static bool ReverseControlsHandler(std::shared_ptr Console, const state ? GameInteractor::ApplyEffect(effect) : GameInteractor::RemoveEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Reverse controls " + + INFO_MESSAGE("[SOH] Reverse controls " + std::string(state ? "enabled" : "disabled")); - return CMD_SUCCESS; + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not " + + INFO_MESSAGE("[SOH] Command failed: Could not " + std::string(state ? "enable" : "disable") + " Reverse controls."); - return CMD_FAILED; + return 1; } } -static bool UpdateRupeesHandler(std::shared_ptr Console, const std::vector& args) { +static bool UpdateRupeesHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyRupees(); try { effect->parameters[0] = std::stoi(args[1], nullptr, 10); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Rupee value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Rupee value must be a number."); + return 1; } GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Rupees updated"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Rupees updated"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not update rupees."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not update rupees."); + return 1; } } -static bool SpeedModifierHandler(std::shared_ptr Console, const std::vector& args) { +static bool SpeedModifierHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyRunSpeedModifier(); try { effect->parameters[0] = std::stoi(args[1], nullptr, 10); } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Speed modifier value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Speed modifier value must be a number."); + return 1; } GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Speed modifier updated"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Speed modifier updated"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not update speed modifier."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not update speed modifier."); + return 1; } } @@ -1105,16 +1107,16 @@ const static std::map boots { { "hover", PLAYER_BOOTS_HOVER }, }; -static bool BootsHandler(std::shared_ptr Console, const std::vector& args) { +static bool BootsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } const auto& it = boots.find(args[1]); if (it == boots.end()) { - LUS::GetConsole()->SendErrorMessage("Invalid boot type. Options are 'kokiri', 'iron' and 'hover'"); - return CMD_FAILED; + ERROR_MESSAGE("Invalid boot type. Options are 'kokiri', 'iron' and 'hover'"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::ForceEquipBoots(); @@ -1122,11 +1124,11 @@ static bool BootsHandler(std::shared_ptr Console, const std::vecto GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Boots updated."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Boots updated."); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not update boots."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not update boots."); + return 1; } } @@ -1136,16 +1138,16 @@ const static std::map shields { { "mirror", ITEM_SHIELD_MIRROR }, }; -static bool GiveShieldHandler(std::shared_ptr Console, const std::vector& args) { +static bool GiveShieldHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } const auto& it = shields.find(args[1]); if (it == shields.end()) { - LUS::GetConsole()->SendErrorMessage("Invalid shield type. Options are 'deku', 'hylian' and 'mirror'"); - return CMD_FAILED; + ERROR_MESSAGE("Invalid shield type. Options are 'deku', 'hylian' and 'mirror'"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::GiveOrTakeShield(); @@ -1153,24 +1155,24 @@ static bool GiveShieldHandler(std::shared_ptr Console, const std:: GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Gave shield."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Gave shield."); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not give shield."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not give shield."); + return 1; } } -static bool TakeShieldHandler(std::shared_ptr Console, const std::vector& args) { +static bool TakeShieldHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } const auto& it = shields.find(args[1]); if (it == shields.end()) { - LUS::GetConsole()->SendErrorMessage("Invalid shield type. Options are 'deku', 'hylian' and 'mirror'"); - return CMD_FAILED; + ERROR_MESSAGE("Invalid shield type. Options are 'deku', 'hylian' and 'mirror'"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::GiveOrTakeShield(); @@ -1178,86 +1180,86 @@ static bool TakeShieldHandler(std::shared_ptr Console, const std:: GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Took shield."); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Took shield."); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not take shield."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not take shield."); + return 1; } } -static bool KnockbackHandler(std::shared_ptr Console, const std::vector& args) { +static bool KnockbackHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } GameInteractionEffectBase* effect = new GameInteractionEffect::KnockbackPlayer(); try { int value = std::stoi(args[1], nullptr, 10); if (value < 0) { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid value passed. Value must be greater than 0"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid value passed. Value must be greater than 0"); + return 1; } effect->parameters[0] = value; } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] Knockback value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Knockback value must be a number."); + return 1; } GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Knockback applied"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Knockback applied"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not apply knockback."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not apply knockback."); + return 1; } } -static bool ElectrocuteHandler(std::shared_ptr Console, const std::vector& args) { +static bool ElectrocuteHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::ElectrocutePlayer(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Electrocuted player"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Electrocuted player"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not electrocute player."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not electrocute player."); + return 1; } } -static bool BurnHandler(std::shared_ptr Console, const std::vector& args) { +static bool BurnHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::BurnPlayer(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Burned player"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Burned player"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not burn player."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not burn player."); + return 1; } } -static bool CuccoStormHandler(std::shared_ptr Console, const std::vector& args) { +static bool CuccoStormHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectQueryResult result = GameInteractor::RawAction::SpawnActor(ACTOR_EN_NIW, 0); if (result == GameInteractionEffectQueryResult::Possible) { - LUS::GetConsole()->SendInfoMessage("[SOH] Spawned cucco storm"); - return CMD_SUCCESS; + INFO_MESSAGE("[SOH] Spawned cucco storm"); + return 0; } else { - LUS::GetConsole()->SendInfoMessage("[SOH] Command failed: Could not spawn cucco storm."); - return CMD_FAILED; + INFO_MESSAGE("[SOH] Command failed: Could not spawn cucco storm."); + return 1; } } -static bool GenerateRandoHandler(std::shared_ptr Console, const std::vector& args) { +static bool GenerateRandoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() == 1) { if (GenerateRandomizer()) { - return CMD_SUCCESS; + return 0; } } @@ -1270,22 +1272,22 @@ static bool GenerateRandoHandler(std::shared_ptr Console, const st } if (GenerateRandomizer(seed + std::to_string(value))){ - return CMD_SUCCESS; + return 0; } } catch (std::invalid_argument const& ex) { - LUS::GetConsole()->SendErrorMessage("[SOH] seed|count value must be a number."); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] seed|count value must be a number."); + return 1; } - LUS::GetConsole()->SendErrorMessage("[SOH] Rando generation already in progress"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Rando generation already in progress"); + return 1; } -static bool CosmeticsHandler(std::shared_ptr Console, const std::vector& args) { +static bool CosmeticsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } if (args[1].compare("reset") == 0) { @@ -1293,17 +1295,17 @@ static bool CosmeticsHandler(std::shared_ptr Console, const std::v } else if (args[1].compare("randomize") == 0) { CosmeticsEditor_RandomizeAll(); } else { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); + return 1; } - return CMD_SUCCESS; + return 0; } -static bool SfxHandler(std::shared_ptr Console, const std::vector& args) { +static bool SfxHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { - LUS::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Unexpected arguments passed"); + return 1; } if (args[1].compare("reset") == 0) { @@ -1311,290 +1313,198 @@ static bool SfxHandler(std::shared_ptr Console, const std::vector< } else if (args[1].compare("randomize") == 0) { AudioEditor_RandomizeAll(); } else { - LUS::GetConsole()->SendErrorMessage("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); - return CMD_FAILED; + ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); + return 1; } - return CMD_SUCCESS; -} - -#define VARTYPE_INTEGER 0 -#define VARTYPE_FLOAT 1 -#define VARTYPE_STRING 2 -#define VARTYPE_RGBA 3 - -static int CheckVarType(const std::string& input) -{ - int result = VARTYPE_STRING; - - if (input[0] == '#') { - return VARTYPE_RGBA; - } - - for (size_t i = 0; i < input.size(); i++) - { - if (!(std::isdigit(input[i]) || input[i] == '.')) - { - break; - } - else - { - if (input[i] == '.') - result = VARTYPE_FLOAT; - else if (std::isdigit(input[i]) && result != VARTYPE_FLOAT) - result = VARTYPE_INTEGER; - } - } - - return result; -} - -static bool SetCVarHandler(std::shared_ptr Console, const std::vector& args) { - if (args.size() < 3) - return CMD_FAILED; - - int vType = CheckVarType(args[2]); - - if (vType == VARTYPE_STRING) - CVarSetString(args[1].c_str(), args[2].c_str()); - else if (vType == VARTYPE_FLOAT) - CVarSetFloat((char*)args[1].c_str(), std::stof(args[2])); - else if (vType == VARTYPE_RGBA) - { - uint32_t val = std::stoul(&args[2].c_str()[1], nullptr, 16); - Color_RGBA8 clr; - clr.r = val >> 24; - clr.g = val >> 16; - clr.b = val >> 8; - clr.a = val & 0xFF; - CVarSetColor((char*)args[1].c_str(), clr); - } - else - CVarSetInteger(args[1].c_str(), std::stoi(args[2])); - - CVarSave(); - - //LUS::GetConsole()->SendInfoMessage("[SOH] Updated player position to [ %.2f, %.2f, %.2f ]", pos.x, pos.y, pos.z); - return CMD_SUCCESS; -} - -static bool GetCVarHandler(std::shared_ptr Console, const std::vector& args) { - if (args.size() < 2) - return CMD_FAILED; - - auto cvar = CVarGet(args[1].c_str()); - - if (cvar != nullptr) - { - if (cvar->Type == LUS::ConsoleVariableType::Integer) - LUS::GetConsole()->SendInfoMessage("[SOH] Variable %s is %i", args[1].c_str(), cvar->Integer); - else if (cvar->Type == LUS::ConsoleVariableType::Float) - LUS::GetConsole()->SendInfoMessage("[SOH] Variable %s is %f", args[1].c_str(), cvar->Float); - else if (cvar->Type == LUS::ConsoleVariableType::String) - LUS::GetConsole()->SendInfoMessage("[SOH] Variable %s is %s", args[1].c_str(), cvar->String.c_str()); - else if (cvar->Type == LUS::ConsoleVariableType::Color) - LUS::GetConsole()->SendInfoMessage("[SOH] Variable %s is %08X", args[1].c_str(), cvar->Color); - } - else - { - LUS::GetConsole()->SendInfoMessage("[SOH] Could not find variable %s", args[1].c_str()); - } - - - return CMD_SUCCESS; + return 0; } void DebugConsole_Init(void) { // Console - CMD_REGISTER("file_select", { FileSelectHandler, "Returns to the file select." }); - CMD_REGISTER("reset", { ResetHandler, "Resets the game." }); - CMD_REGISTER("quit", { QuitHandler, "Quits the game." }); + CMD_REGISTER("file_select", {FileSelectHandler, "Returns to the file select."}); + CMD_REGISTER("reset", {ResetHandler, "Resets the game."}); + CMD_REGISTER("quit", {QuitHandler, "Quits the game."}); // Save States - CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." }); - CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." }); - CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", { - { "Slot number", LUS::ArgumentType::NUMBER, } + CMD_REGISTER("save_state", {SaveStateHandler, "Save a state."}); + CMD_REGISTER("load_state", {LoadStateHandler, "Load a state."}); + CMD_REGISTER("set_slot", {StateSlotSelectHandler, "Selects a SaveState slot", { + {"Slot number", LUS::ArgumentType::NUMBER,} }}); // Map & Location - CMD_REGISTER("void", { VoidHandler, "Voids out of the current map." }); - CMD_REGISTER("reload", { ReloadHandler, "Reloads the current map." }); - CMD_REGISTER("fw", { FWHandler,"Spawns the player where Farore's Wind is set." , { - { "clear|warp|backup", LUS::ArgumentType::TEXT } + CMD_REGISTER("void", {VoidHandler, "Voids out of the current map."}); + CMD_REGISTER("reload", {ReloadHandler, "Reloads the current map."}); + CMD_REGISTER("fw", {FWHandler, "Spawns the player where Farore's Wind is set.", { + {"clear|warp|backup", LUS::ArgumentType::TEXT} }}); - CMD_REGISTER("entrance", { EntranceHandler, "Sends player to the entered entrance (hex)", { - { "entrance", LUS::ArgumentType::NUMBER } + CMD_REGISTER("entrance", {EntranceHandler, "Sends player to the entered entrance (hex)", { + {"entrance", LUS::ArgumentType::NUMBER} }}); // Gameplay - CMD_REGISTER("kill", { KillPlayerHandler, "Commit suicide." }); + CMD_REGISTER("kill", {KillPlayerHandler, "Commit suicide."}); - CMD_REGISTER("map", { LoadSceneHandler, "Load up kak?" }); + CMD_REGISTER("map", {LoadSceneHandler, "Load up kak?"}); - CMD_REGISTER("rupee", { RupeeHandler, "Set your rupee counter.", { - {"amount", LUS::ArgumentType::NUMBER } + CMD_REGISTER("rupee", {RupeeHandler, "Set your rupee counter.", { + {"amount", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("bItem", { BHandler, "Set an item to the B button.", { - { "Item ID", LUS::ArgumentType::NUMBER } + CMD_REGISTER("bItem", {BHandler, "Set an item to the B button.", { + {"Item ID", LUS::ArgumentType::NUMBER} }}); CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor name/id", LUS::ArgumentType::NUMBER }, // TODO there should be an actor_id arg type - { "data", LUS::ArgumentType::NUMBER }, - { "x", LUS::ArgumentType::PLAYER_POS, true }, - { "y", LUS::ArgumentType::PLAYER_POS, true }, - { "z", LUS::ArgumentType::PLAYER_POS, true }, - { "rx", LUS::ArgumentType::PLAYER_ROT, true }, - { "ry", LUS::ArgumentType::PLAYER_ROT, true }, - { "rz", LUS::ArgumentType::PLAYER_ROT, true } + {"data", LUS::ArgumentType::NUMBER}, + {"x", LUS::ArgumentType::NUMBER, true}, + {"y", LUS::ArgumentType::NUMBER, true}, + {"z", LUS::ArgumentType::NUMBER, true}, + {"rx", LUS::ArgumentType::NUMBER, true}, + {"ry", LUS::ArgumentType::NUMBER, true}, + {"rz", LUS::ArgumentType::NUMBER, true} }}); - CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", { - { "x", LUS::ArgumentType::PLAYER_POS, true }, - { "y", LUS::ArgumentType::PLAYER_POS, true }, - { "z", LUS::ArgumentType::PLAYER_POS, true } + CMD_REGISTER("pos", {SetPosHandler, "Sets the position of the player.", { + {"x", LUS::ArgumentType::NUMBER, true}, + {"y", LUS::ArgumentType::NUMBER, true}, + {"z", LUS::ArgumentType::NUMBER, true} }}); - CMD_REGISTER("set", { SetCVarHandler, "Sets a console variable.", { - { "varName", LUS::ArgumentType::TEXT }, - { "varValue", LUS::ArgumentType::TEXT } + CMD_REGISTER("addammo", {AddAmmoHandler, "Adds ammo of an item.", { + {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT}, + {"count", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("get", { GetCVarHandler, "Gets a console variable.", { - { "varName", LUS::ArgumentType::TEXT } - }}); - - CMD_REGISTER("addammo", { AddAmmoHandler, "Adds ammo of an item.", { - { "sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT }, - { "count", LUS::ArgumentType::NUMBER } + CMD_REGISTER("takeammo", {TakeAmmoHandler, "Removes ammo of an item.", { + {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT}, + {"count", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("takeammo", { TakeAmmoHandler, "Removes ammo of an item.", { - { "sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT }, - { "count", LUS::ArgumentType::NUMBER } + CMD_REGISTER("bottle", {BottleHandler, "Changes item in a bottle slot.", { + {"item", LUS::ArgumentType::TEXT}, + {"slot", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("bottle", { BottleHandler, "Changes item in a bottle slot.", { - { "item", LUS::ArgumentType::TEXT }, - { "slot", LUS::ArgumentType::NUMBER } + CMD_REGISTER("give_item", {GiveItemHandler, "Gives an item to the player as if it was given from an actor", { + {"vanilla|randomizer", LUS::ArgumentType::TEXT}, + {"giveItemID", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("give_item", { GiveItemHandler, "Gives an item to the player as if it was given from an actor", { - { "vanilla|randomizer", LUS::ArgumentType::TEXT }, - { "giveItemID", LUS::ArgumentType::NUMBER } + CMD_REGISTER("item", {ItemHandler, "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", { + {"slot", LUS::ArgumentType::NUMBER}, + {"item id", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("item", { ItemHandler, "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", { - { "slot", LUS::ArgumentType::NUMBER }, - { "item id", LUS::ArgumentType::NUMBER } + CMD_REGISTER("invisible", {InvisibleHandler, "Activate Link's Elvish cloak, making him appear invisible.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("invisible", { InvisibleHandler, "Activate Link's Elvish cloak, making him appear invisible.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("giant_link", {GiantLinkHandler, "Turn Link into a giant Lonky boi.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("giant_link", { GiantLinkHandler, "Turn Link into a giant Lonky boi.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("minish_link", {MinishLinkHandler, "Turn Link into a minish boi.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("minish_link", { MinishLinkHandler, "Turn Link into a minish boi.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("add_heart_container", + {AddHeartContainerHandler, "Give Link a heart! The maximum amount of hearts is 20!"}); + + CMD_REGISTER("remove_heart_container", + {RemoveHeartContainerHandler, "Remove a heart from Link. The minimal amount of hearts is 3."}); + + CMD_REGISTER("gravity", {GravityHandler, "Set gravity level.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("add_heart_container", { AddHeartContainerHandler, "Give Link a heart! The maximum amount of hearts is 20!" }); - - CMD_REGISTER("remove_heart_container", { RemoveHeartContainerHandler, "Remove a heart from Link. The minimal amount of hearts is 3." }); - - CMD_REGISTER("gravity", { GravityHandler, "Set gravity level.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("no_ui", {NoUIHandler, "Disables the UI.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("no_ui", { NoUIHandler, "Disables the UI.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("freeze", {FreezeHandler, "Freezes Link in place"}); + + CMD_REGISTER("defense_modifier", {DefenseModifierHandler, "Sets the defense modifier.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("freeze", { FreezeHandler, "Freezes Link in place" }); - - CMD_REGISTER("defense_modifier", { DefenseModifierHandler, "Sets the defense modifier.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("damage", {DamageHandler, "Deal damage to Link.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("damage", { DamageHandler, "Deal damage to Link.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("heal", {HealHandler, "Heals Link.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("heal", { HealHandler, "Heals Link.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("fill_magic", {FillMagicHandler, "Fills magic."}); + + CMD_REGISTER("empty_magic", {EmptyMagicHandler, "Empties magic."}); + + CMD_REGISTER("no_z", {NoZHandler, "Disables Z-button presses.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("fill_magic", { FillMagicHandler, "Fills magic." }); + CMD_REGISTER("ohko", {OneHitKOHandler, + "Activates one hit KO. Any damage kills Link and he cannot gain health in this mode.", { + {"value", LUS::ArgumentType::NUMBER} + }}); - CMD_REGISTER("empty_magic", { EmptyMagicHandler, "Empties magic." }); - - CMD_REGISTER("no_z", { NoZHandler, "Disables Z-button presses.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("pacifist", {PacifistHandler, "Activates pacifist mode. Prevents Link from using his weapon.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("ohko", { OneHitKOHandler, "Activates one hit KO. Any damage kills Link and he cannot gain health in this mode.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("paper_link", {PaperLinkHandler, "Link but made out of paper.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("pacifist", { PacifistHandler, "Activates pacifist mode. Prevents Link from using his weapon.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("rainstorm", {RainstormHandler, "Activates rainstorm."}); + + CMD_REGISTER("reverse_controls", {ReverseControlsHandler, "Reverses the controls.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("paper_link", { PaperLinkHandler, "Link but made out of paper.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("update_rupees", {UpdateRupeesHandler, "Adds rupees.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("rainstorm", { RainstormHandler, "Activates rainstorm." }); - - CMD_REGISTER("reverse_controls", { ReverseControlsHandler, "Reverses the controls.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("speed_modifier", {SpeedModifierHandler, "Sets the speed modifier.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("update_rupees", { UpdateRupeesHandler, "Adds rupees.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("boots", {BootsHandler, "Activates boots.", { + {"kokiri|iron|hover", LUS::ArgumentType::TEXT}, }}); - CMD_REGISTER("speed_modifier", { SpeedModifierHandler, "Sets the speed modifier.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("giveshield", {GiveShieldHandler, "Gives a shield and equips it when Link is the right age for it.", { + {"deku|hylian|mirror", LUS::ArgumentType::TEXT}, }}); - CMD_REGISTER("boots", { BootsHandler, "Activates boots.", { - { "kokiri|iron|hover", LUS::ArgumentType::TEXT }, + CMD_REGISTER("takeshield", {TakeShieldHandler, "Takes a shield and unequips it if Link is wearing it.", { + {"deku|hylian|mirror", LUS::ArgumentType::TEXT}, }}); - CMD_REGISTER("giveshield", { GiveShieldHandler, "Gives a shield and equips it when Link is the right age for it.", { - { "deku|hylian|mirror", LUS::ArgumentType::TEXT }, + CMD_REGISTER("knockback", {KnockbackHandler, "Knocks Link back.", { + {"value", LUS::ArgumentType::NUMBER} }}); - CMD_REGISTER("takeshield", { TakeShieldHandler, "Takes a shield and unequips it if Link is wearing it.", { - { "deku|hylian|mirror", LUS::ArgumentType::TEXT }, + CMD_REGISTER("electrocute", {ElectrocuteHandler, "Electrocutes Link."}); + + CMD_REGISTER("burn", {BurnHandler, "Burns Link."}); + + CMD_REGISTER("cucco_storm", {CuccoStormHandler, "Cucco Storm"}); + + CMD_REGISTER("gen_rando", {GenerateRandoHandler, "Generate a randomizer seed", { + {"seed|count", LUS::ArgumentType::NUMBER, true}, + {"testing", LUS::ArgumentType::NUMBER, true}, }}); - CMD_REGISTER("knockback", { KnockbackHandler, "Knocks Link back.", { - { "value", LUS::ArgumentType::NUMBER } + CMD_REGISTER("cosmetics", {CosmeticsHandler, "Change cosmetics.", { + {"reset|randomize", LUS::ArgumentType::TEXT}, }}); - CMD_REGISTER("electrocute", { ElectrocuteHandler, "Electrocutes Link." }); - - CMD_REGISTER("burn", { BurnHandler, "Burns Link." }); - - CMD_REGISTER("cucco_storm", { CuccoStormHandler, "Cucco Storm" }); - - CMD_REGISTER("gen_rando", { GenerateRandoHandler, "Generate a randomizer seed", { - { "seed|count", LUS::ArgumentType::NUMBER, true }, - { "testing", LUS::ArgumentType::NUMBER, true }, - }}); - - CMD_REGISTER("cosmetics", { CosmeticsHandler, "Change cosmetics.", { - { "reset|randomize", LUS::ArgumentType::TEXT }, - }}); - - CMD_REGISTER("sfx", { SfxHandler, "Change SFX.", { - { "reset|randomize", LUS::ArgumentType::TEXT }, + CMD_REGISTER("sfx", {SfxHandler, "Change SFX.", { + {"reset|randomize", LUS::ArgumentType::TEXT}, }}); CVarSave(); diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index 31725bbb2..de35a6acd 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -1,7 +1,6 @@ #include "actorViewer.h" #include "../../util.h" #include "../../UIWidgets.hpp" -#include #include "soh/ActorDB.h" #include @@ -9,6 +8,7 @@ #include #include #include +#include extern "C" { #include @@ -97,17 +97,9 @@ void PopulateActorDropdown(int i, std::vector& data) { } -void DrawActorViewer(bool& open) { - if (!open) { - if (CVarGetInteger("gActorViewerEnabled", 0)) { - CVarClear("gActorViewerEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void ActorViewerWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Actor Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Actor Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -352,7 +344,3 @@ void DrawActorViewer(bool& open) { ImGui::End(); } - -void InitActorViewer() { - LUS::AddWindow("Developer Tools", "Actor Viewer", DrawActorViewer, CVarGetInteger("gActorViewerEnabled", 0)); -} diff --git a/soh/soh/Enhancements/debugger/actorViewer.h b/soh/soh/Enhancements/debugger/actorViewer.h index 9fe3ab4f5..319e9a969 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.h +++ b/soh/soh/Enhancements/debugger/actorViewer.h @@ -1,3 +1,12 @@ #pragma once -void InitActorViewer(); +#include + +class ActorViewerWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void DrawElement() override; + void InitElement() override {}; + void UpdateElement() override {}; +}; \ No newline at end of file diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index 1d5e4b04c..f9a67d2a8 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -1,5 +1,4 @@ #include "colViewer.h" -#include #include "../../frame_interpolation.h" #include "../../UIWidgets.hpp" @@ -7,6 +6,7 @@ #include #include #include +#include extern "C" { #include @@ -51,17 +51,9 @@ static std::vector sphereGfx; static std::vector sphereVtx; // Draws the ImGui window for the collision viewer -void DrawColViewerWindow(bool& open) { - if (!open) { - if (CVarGetInteger("gCollisionViewerEnabled", 0)) { - CVarClear("gCollisionViewerEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void ColViewerWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Collision Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Collision Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -290,9 +282,7 @@ void CreateSphereData() { sphereGfx.push_back(gsSPEndDisplayList()); } -void InitColViewer() { - LUS::AddWindow("Developer Tools", "Collision Viewer", DrawColViewerWindow, CVarGetInteger("gCollisionViewerEnabled", 0)); - +void ColViewerWindow::InitElement() { CreateCylinderData(); CreateSphereData(); } diff --git a/soh/soh/Enhancements/debugger/colViewer.h b/soh/soh/Enhancements/debugger/colViewer.h index e38da7951..c54345f8a 100644 --- a/soh/soh/Enhancements/debugger/colViewer.h +++ b/soh/soh/Enhancements/debugger/colViewer.h @@ -1,4 +1,14 @@ #pragma once -void InitColViewer(); -void DrawColViewer(); \ No newline at end of file +#include + +void DrawColViewer(); + +class ColViewerWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; \ No newline at end of file diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index b48b1b3de..c019facb4 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -1,7 +1,6 @@ #include "debugSaveEditor.h" #include "../../util.h" #include "../../OTRGlobals.h" -#include #include "../../UIWidgets.hpp" #include @@ -10,6 +9,7 @@ #include #include #include +#include extern "C" { #include @@ -605,7 +605,7 @@ void DrawInfoTab() { void DrawBGSItemFlag(uint8_t itemID) { const ItemMapEntry& slotEntry = itemMapping[itemID]; - ImGui::Image(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1)); + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1)); ImGui::SameLine(); int tradeIndex = itemID - ITEM_POCKET_EGG; bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0; @@ -647,7 +647,7 @@ void DrawInventoryTab() { uint8_t item = gSaveContext.inventory.items[index]; if (item != ITEM_NONE) { const ItemMapEntry& slotEntry = itemMapping.find(item)->second; - if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { selectedIndex = index; ImGui::OpenPopup(itemPopupPicker); @@ -695,7 +695,7 @@ void DrawInventoryTab() { ImGui::SameLine(); } const ItemMapEntry& slotEntry = possibleItems[pickerIndex]; - if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { gSaveContext.inventory.items[selectedIndex] = slotEntry.id; // Set adult trade item flag if you're playing adult trade shuffle in rando @@ -733,7 +733,7 @@ void DrawInventoryTab() { ImGui::PushItemWidth(32.0f); ImGui::BeginGroup(); - ImGui::Image(LUS::GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f)); + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f)); ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item)); ImGui::EndGroup(); @@ -1148,7 +1148,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const uint8_t item = items[CUR_UPG_VALUE(categoryId)]; if (item != ITEM_NONE) { const ItemMapEntry& slotEntry = itemMapping[item]; - if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { ImGui::OpenPopup(upgradePopupPicker); } @@ -1176,7 +1176,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const UIWidgets::SetLastItemHoverText("None"); } else { const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]]; - if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { Inventory_ChangeUpgrade(categoryId, pickerIndex); ImGui::CloseCurrentPopup(); @@ -1213,7 +1213,7 @@ void DrawEquipmentTab() { bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0; const ItemMapEntry& entry = itemMapping[equipmentValues[i]]; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::GetTextureByName(hasEquip ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasEquip) { gSaveContext.inventory.equipment &= ~bitMask; @@ -1312,7 +1312,7 @@ void DrawQuestItemButton(uint32_t item) { uint32_t bitMask = 1 << entry.id; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasQuestItem) { gSaveContext.inventory.questItems &= ~bitMask; @@ -1330,7 +1330,7 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) { uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::GetTextureByName(hasItem ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasItem) { gSaveContext.inventory.dungeonItems[scene] &= ~bitMask; @@ -1377,7 +1377,7 @@ void DrawQuestStatusTab() { uint32_t bitMask = 1 << entry.id; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasQuestItem) { gSaveContext.inventory.questItems &= ~bitMask; @@ -1440,7 +1440,7 @@ void DrawQuestStatusTab() { if (dungeonItemsScene != SCENE_BDAN_BOSS) { float lineHeight = ImGui::GetTextLineHeightWithSpacing(); - ImGui::Image(LUS::GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight)); + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight)); ImGui::SameLine(); if (ImGui::InputScalar("##Keys", ImGuiDataType_S8, gSaveContext.inventory.dungeonKeys + dungeonItemsScene)) { gSaveContext.sohStats.dungeonKeys[dungeonItemsScene] = gSaveContext.inventory.dungeonKeys[dungeonItemsScene]; @@ -1733,17 +1733,9 @@ void DrawPlayerTab() { } } -void DrawSaveEditor(bool& open) { - if (!open) { - if (CVarGetInteger("gSaveEditorEnabled", 0)) { - CVarClear("gSaveEditorEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void SaveEditorWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Save Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Save Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -1785,35 +1777,33 @@ void DrawSaveEditor(bool& open) { ImGui::End(); } -void InitSaveEditor() { - LUS::AddWindow("Developer Tools", "Save Editor", DrawSaveEditor, CVarGetInteger("gSaveEditorEnabled", 0)); - +void SaveEditorWindow::InitElement() { // Load item icons into ImGui for (const auto& entry : itemMapping) { - LUS::LoadResource(entry.second.name, entry.second.texturePath); - LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); } for (const auto& entry : gregMapping) { ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f); ImVec4 gregFadedGreen = gregGreen; gregFadedGreen.w = 0.3f; - LUS::LoadResource(entry.second.name, entry.second.texturePath, gregGreen); - LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, gregGreen); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen); } for (const auto& entry : questMapping) { - LUS::LoadResource(entry.second.name, entry.second.texturePath); - LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); } for (const auto& entry : songMapping) { - LUS::LoadResource(entry.name, gSongNoteTex, entry.color); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); ImVec4 fadedCol = entry.color; fadedCol.w = 0.3f; - LUS::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); } for (const auto& entry : vanillaSongMapping) { - LUS::LoadResource(entry.name, gSongNoteTex, entry.color); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); ImVec4 fadedCol = entry.color; fadedCol.w = 0.3f; - LUS::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); } } diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.h b/soh/soh/Enhancements/debugger/debugSaveEditor.h index 06fd38c37..0128f8801 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.h +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.h @@ -6,8 +6,7 @@ #include #include #include - -void InitSaveEditor(); +#include typedef enum { EVENT_CHECK_INF, @@ -583,4 +582,13 @@ const std::vector state3 = { "Force Pull Ocarina", "Restore Nayru's Love", "Travelling to Hook Target" -}; \ No newline at end of file +}; + +class SaveEditorWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; diff --git a/soh/soh/Enhancements/debugger/debugger.cpp b/soh/soh/Enhancements/debugger/debugger.cpp deleted file mode 100644 index 9a157377f..000000000 --- a/soh/soh/Enhancements/debugger/debugger.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "debugger.h" -#include "debugSaveEditor.h" -#include "colViewer.h" -#include "actorViewer.h" -#include "dlViewer.h" - -extern "C" { - -void Debug_Init(void) { - InitSaveEditor(); - InitColViewer(); - InitActorViewer(); - InitDLViewer(); -} - -void Debug_Draw(void) { - DrawColViewer(); -} - -} diff --git a/soh/soh/Enhancements/debugger/debugger.h b/soh/soh/Enhancements/debugger/debugger.h deleted file mode 100644 index bbefd2e21..000000000 --- a/soh/soh/Enhancements/debugger/debugger.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -void Debug_Init(void); -void Debug_Draw(void); - -#ifdef __cplusplus -} -#endif diff --git a/soh/soh/Enhancements/debugger/dlViewer.cpp b/soh/soh/Enhancements/debugger/dlViewer.cpp index a5865d84f..2fce8860a 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.cpp +++ b/soh/soh/Enhancements/debugger/dlViewer.cpp @@ -1,7 +1,6 @@ #include "actorViewer.h" #include "../../util.h" #include "../../UIWidgets.hpp" -#include #include "ResourceManager.h" #include "DisplayList.h" #include "../../OTRGlobals.h" @@ -11,6 +10,7 @@ #include #include #include +#include "dlViewer.h" extern "C" { #include @@ -38,17 +38,9 @@ std::map cmdMap = { { G_ENDDL, "gsSPEndDisplayList" }, }; -void DrawDLViewer(bool& open) { - if (!open) { - if (CVarGetInteger("gDLViewerEnabled", 0)) { - CVarClear("gDLViewerEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void DLViewerWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Display List Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Display List Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -140,8 +132,6 @@ void DrawDLViewer(bool& open) { ImGui::End(); } -void InitDLViewer() { - LUS::AddWindow("Developer Tools", "Display List Viewer", DrawDLViewer, CVarGetInteger("gDLViewerEnabled", 0)); - +void DLViewerWindow::InitElement() { displayListsSearchResults = ResourceMgr_ListFiles("*DL", &displayListsSearchResultsCount); } diff --git a/soh/soh/Enhancements/debugger/dlViewer.h b/soh/soh/Enhancements/debugger/dlViewer.h index 6fd5fa5fa..348372a49 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.h +++ b/soh/soh/Enhancements/debugger/dlViewer.h @@ -1,3 +1,12 @@ #pragma once -void InitDLViewer(); +#include + +class DLViewerWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index 4b0f43a5a..46eb3b547 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -335,7 +335,7 @@ void GameInteractor::RawAction::SetCosmeticsColor(uint8_t cosmeticCategory, uint break; } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); } diff --git a/soh/soh/Enhancements/gameplaystats.cpp b/soh/soh/Enhancements/gameplaystats.cpp index e0f5ff7f6..0f1880968 100644 --- a/soh/soh/Enhancements/gameplaystats.cpp +++ b/soh/soh/Enhancements/gameplaystats.cpp @@ -1,17 +1,17 @@ extern "C" { #include "gameplaystats.h" } +#include "gameplaystatswindow.h" #include "soh/SaveManager.h" #include "functions.h" #include "macros.h" -#include "ImGuiImpl.h" #include "../UIWidgets.hpp" #include #include #include -#include +#include extern "C" { #include @@ -623,17 +623,9 @@ void DrawGameplayStatsOptionsTab() { UIWidgets::PaddedEnhancementCheckbox("Show Debug Info", "gGameplayStats.ShowDebugInfo"); } -void DrawStatsTracker(bool& open) { - if (!open) { - if (CVarGetInteger("gGameplayStats.Enabled", 0)) { - CVarClear("gGameplayStats.Enabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void GameplayStatsWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(480, 550), ImGuiCond_Appearing); - if (!ImGui::Begin("Gameplay Stats", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Gameplay Stats", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -862,8 +854,7 @@ void SetupDisplayColors() { } } -extern "C" void InitStatTracker() { - LUS::AddWindow("Enhancements", "Gameplay Stats", DrawStatsTracker, CVarGetInteger("gGameplayStats.Enabled", 0)); +void GameplayStatsWindow::InitElement() { SetupDisplayNames(); SetupDisplayColors(); diff --git a/soh/soh/Enhancements/gameplaystatswindow.h b/soh/soh/Enhancements/gameplaystatswindow.h new file mode 100644 index 000000000..2a3786415 --- /dev/null +++ b/soh/soh/Enhancements/gameplaystatswindow.h @@ -0,0 +1,11 @@ +#include +#include "gameplaystats.h" + +class GameplayStatsWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; \ No newline at end of file diff --git a/soh/soh/Enhancements/presets.cpp b/soh/soh/Enhancements/presets.cpp index 8871abaf5..7b2ca6595 100644 --- a/soh/soh/Enhancements/presets.cpp +++ b/soh/soh/Enhancements/presets.cpp @@ -2,9 +2,9 @@ #include #include #include -#include #include #include "soh/UIWidgets.hpp" +#include void clearCvars(std::vector cvarsToClear) { for(const char* cvar : cvarsToClear) { @@ -59,7 +59,7 @@ void DrawPresetSelector(PresetType presetTypeId) { if (selectedPresetId != 0) { applyPreset(selectedPresetDef.entries); } - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::PopStyleVar(1); } diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 390b6220d..202147bb9 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "3drando/rando_main.hpp" #include "3drando/random.hpp" @@ -28,6 +27,8 @@ #include "draw.h" #include "rando_hash.h" #include +#include +#include "randomizer_settings_window.h" extern "C" uint32_t ResourceMgr_IsGameMasterQuest(); extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum); @@ -3148,20 +3149,12 @@ bool GenerateRandomizer(std::string seed /*= ""*/) { return false; } -void DrawRandoEditor(bool& open) { +void RandomizerSettingsWindow::DrawElement() { if (generated) { generated = 0; randoThread.join(); } - if (!open) { - if (CVarGetInteger("gRandomizerSettingsEnabled", 0)) { - CVarClear("gRandomizerSettingsEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - // Randomizer settings // Logic Settings static const char* randoLogicRules[2] = { "Glitchless", "No logic" }; @@ -3228,7 +3221,7 @@ void DrawRandoEditor(bool& open) { static bool disableGFKeyring = false; ImGui::SetNextWindowSize(ImVec2(920, 600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Randomizer Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Randomizer Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -4664,7 +4657,7 @@ void DrawRandoEditor(bool& open) { excludedLocationString += ","; } CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text(rcObject->rcShortName.c_str()); @@ -4705,7 +4698,7 @@ void DrawRandoEditor(bool& open) { excludedLocationString += ","; } CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text(rcObject->rcShortName.c_str()); @@ -4883,7 +4876,7 @@ void DrawRandoEditor(bool& open) { enabledTrickString += ","; } CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button("Enable All")) { @@ -4900,7 +4893,7 @@ void DrawRandoEditor(bool& open) { enabledTrickString += ","; } CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } if (ImGui::BeginTable("trickTags", showTag.size(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) { @@ -4977,7 +4970,7 @@ void DrawRandoEditor(bool& open) { enabledTrickString += ","; } CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::BeginChild("ChildTricksDisabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); @@ -5013,7 +5006,7 @@ void DrawRandoEditor(bool& open) { enabledTrickString += ","; } CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } DrawTagChips(*rtObject.rtTags); ImGui::SameLine(); @@ -5087,7 +5080,7 @@ void DrawRandoEditor(bool& open) { enabledTrickString += ","; } CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::BeginChild("ChildTricksEnabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); @@ -5125,7 +5118,7 @@ void DrawRandoEditor(bool& open) { enabledTrickString += ","; } CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } DrawTagChips(*rtObject.rtTags); ImGui::SameLine(); @@ -6131,17 +6124,8 @@ void InitRandoItemTable() { } -void InitRando() { - LUS::AddWindow("Randomizer", "Randomizer Settings", DrawRandoEditor, CVarGetInteger("gRandomizerSettingsEnabled", 0)); +void RandomizerSettingsWindow::InitElement() { Randomizer::CreateCustomMessages(); seedString = (char*)calloc(MAX_SEED_STRING_SIZE, sizeof(char)); InitRandoItemTable(); } - -extern "C" { - -void Rando_Init(void) { - InitRando(); -} - -} diff --git a/soh/soh/Enhancements/randomizer/randomizer.h b/soh/soh/Enhancements/randomizer/randomizer.h index 62f4c526e..bd1af3b74 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.h +++ b/soh/soh/Enhancements/randomizer/randomizer.h @@ -102,7 +102,6 @@ class Randomizer { extern "C" { #endif -void Rando_Init(void); bool GenerateRandomizer(std::string seed = ""); #ifdef __cplusplus diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index c417f2a36..3a1e2947c 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1,14 +1,14 @@ #include "randomizer_check_tracker.h" #include "../../OTRGlobals.h" -#include #include "../../UIWidgets.hpp" #include #include #include -#include -#include +#include #include "3drando/item_location.hpp" +#include "soh/Enhancements/game-interactor/GameInteractor.h" + extern "C" { #include "variables.h" @@ -103,20 +103,11 @@ bool optExpandAll; // A bool that will expand all checks once RandomizerCheck lastLocationChecked = RC_UNKNOWN_CHECK; RandomizerCheckArea previousArea = RCAREA_INVALID; RandomizerCheckArea currentArea = RCAREA_INVALID; -OSContPad* trackerButtonsPressed; std::vector buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT, BTN_CRIGHT, BTN_L, BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT }; -void DrawCheckTracker(bool& open) { - if (!open) { - if (CVarGetInteger("gCheckTrackerEnabled", 0)) { - CVarClear("gCheckTrackerEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void CheckTrackerWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); if (doInitialize) { @@ -135,6 +126,7 @@ void DrawCheckTracker(bool& open) { if (CVarGetInteger("gCheckTrackerDisplayType", 0) == 1) { int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", 6)]; int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", 8)]; + OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); bool comboButtonsHeld = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & comboButton1Mask && trackerButtonsPressed[0].button & comboButton2Mask; @@ -143,7 +135,7 @@ void DrawCheckTracker(bool& open) { } } - BeginFloatWindows("Check Tracker", open, ImGuiWindowFlags_NoScrollbar); + BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar); if (!initialized) { ImGui::Text("Waiting for file load..."); //TODO Language @@ -963,18 +955,10 @@ static const char* windowType[] = { "Floating", "Window" }; static const char* displayType[] = { "Always", "Combo Button Hold" }; static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button", "Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }; -void DrawCheckTrackerOptions(bool& open) { - if (!open) { - if (CVarGetInteger("gCheckTrackerSettingsEnabled", 0)) { - CVarClear("gCheckTrackerSettingsEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void CheckTrackerSettingsWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Check Tracker Settings", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Check Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -1028,9 +1012,7 @@ void DrawCheckTrackerOptions(bool& open) { ImGui::End(); } -void InitCheckTracker() { - LUS::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVarGetInteger("gCheckTrackerEnabled", 0)); - LUS::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions, CVarGetInteger("gCheckTrackerSettingsEnabled", 0)); +void CheckTrackerWindow::InitElement() { Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default); Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default); Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default); @@ -1051,13 +1033,10 @@ void InitCheckTracker() { Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default); Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default); - LUS::RegisterHook([](OSContPad* cont_pad) { - trackerButtonsPressed = cont_pad; - }); - LUS::RegisterHook([](uint32_t fileNum) { + GameInteractor::Instance->RegisterGameHook([](uint32_t fileNum) { doInitialize = true; }); - LUS::RegisterHook([](uint32_t fileNum) { + GameInteractor::Instance->RegisterGameHook([](uint32_t fileNum) { Teardown(); }); LocationTable_Init(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h index da0e0d92c..0ed3a8526 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h @@ -1,7 +1,31 @@ #pragma once +#include + namespace CheckTracker { +class CheckTrackerSettingsWindow : public LUS::GuiWindow { + public: + using LUS::GuiWindow::GuiWindow; + ~CheckTrackerSettingsWindow() {}; + + protected: + void InitElement() override {}; + void DrawElement() override; + void UpdateElement() override {}; +}; + +class CheckTrackerWindow : public LUS::GuiWindow { + public: + using LUS::GuiWindow::GuiWindow; + ~CheckTrackerWindow() {}; + + protected: + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; + // Check tracker check visibility categories typedef enum { RCSHOW_UNCHECKED, @@ -27,7 +51,6 @@ typedef enum { //repeat... #define INDEX_TO_16BIT_LITTLE_ENDIAN_BITMASK(idx) (0x8000 >> (7 - (idx % 8) + ((idx % 16) / 8) * 8)) -void InitCheckTracker(); -void DrawCheckTracker(bool& open); + } // namespace CheckTracker \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.h b/soh/soh/Enhancements/randomizer/randomizer_entrance.h index 57e58d93b..c00f29701 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.h @@ -40,12 +40,16 @@ typedef struct { int16_t overrideDestination; } EntranceOverride; +#ifdef __cplusplus +extern "C" { +#endif + void Entrance_Init(void); void Entrance_ResetEntranceTable(void); uint8_t Entrance_EntranceIsNull(EntranceOverride* entranceOverride); -int16_t Entrance_GetOverride(int16_t index); -int16_t Entrance_OverrideNextIndex(int16_t nextEntranceIndex); -int16_t Entrance_OverrideDynamicExit(int16_t dynamicExitIndex); +int16_t Entrance_GetOverride(int16_t index); +int16_t Entrance_OverrideNextIndex(int16_t nextEntranceIndex); +int16_t Entrance_OverrideDynamicExit(int16_t dynamicExitIndex); uint32_t Entrance_SceneAndSpawnAre(uint8_t scene, uint8_t spawn); void Entrance_SetGameOverEntrance(void); void Entrance_SetSavewarpEntrance(void); @@ -60,5 +64,8 @@ int32_t Entrance_OverrideSpawnSceneRoom(int32_t sceneNum, int32_t spawn, int32_t void Entrance_EnableFW(void); uint8_t Entrance_GetIsEntranceDiscovered(uint16_t entranceIndex); void Entrance_SetEntranceDiscovered(uint16_t entranceIndex); +#ifdef __cplusplus +} +#endif #endif //_RANDO_ENTRANCE_H_ diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index 967229e1f..d70ee2695 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -1,13 +1,11 @@ #include "randomizer_entrance_tracker.h" #include "soh/OTRGlobals.h" -#include #include "soh/UIWidgets.hpp" #include #include #include -#include -#include +#include extern "C" { #include @@ -621,18 +619,10 @@ void InitEntranceTrackingData() { SortEntranceListByType(destListSortedByType, 1); } -void DrawEntranceTracker(bool& open) { - if (!open) { - if (CVarGetInteger("gEntranceTrackerEnabled", 0)) { - CVarClear("gEntranceTrackerEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void EntranceTrackerWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Entrance Tracker", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -921,9 +911,7 @@ void DrawEntranceTracker(bool& open) { ImGui::End(); } -void InitEntranceTracker() { - LUS::AddWindow("Randomizer", "Entrance Tracker", DrawEntranceTracker, CVarGetInteger("gEntranceTrackerEnabled", 0)); - +void EntranceTrackerWindow::InitElement() { // Setup hooks for loading and clearing the entrance tracker data GameInteractor::Instance->RegisterGameHook([](int32_t fileNum) { InitEntranceTrackingData(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h index 61ecd9ac2..e0c216dcf 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h @@ -3,6 +3,7 @@ #include #include #include +#include typedef enum { // ENTRANCE_GROUP_NO_GROUP, @@ -79,5 +80,12 @@ void SetCurrentGrottoIDForTracker(int16_t entranceIndex); void SetLastEntranceOverrideForTracker(int16_t entranceIndex); void ClearEntranceTrackingData(); void InitEntranceTrackingData(); -void DrawEntranceTracker(bool& open); -void InitEntranceTracker(); + +class EntranceTrackerWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index a37439750..9838b7461 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -1,14 +1,13 @@ #include "randomizer_item_tracker.h" #include "../../util.h" #include "../../OTRGlobals.h" -#include #include "../../UIWidgets.hpp" #include #include #include -#include -#include +#include +#include "soh/Enhancements/game-interactor/GameInteractor.h" #include extern "C" { @@ -30,8 +29,6 @@ void DrawBottle(ItemTrackerItem item); void DrawQuest(ItemTrackerItem item); void DrawSong(ItemTrackerItem item); -OSContPad* buttonsPressed; - bool shouldUpdateVectors = true; std::vector mainWindowItems = {}; @@ -452,7 +449,7 @@ void DrawItemCount(ItemTrackerItem item) { void DrawEquip(ItemTrackerItem item) { bool hasEquip = (item.data & gSaveContext.inventory.equipment) != 0; int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - ImGui::Image(LUS::GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id)); @@ -462,7 +459,7 @@ void DrawQuest(ItemTrackerItem item) { bool hasQuestItem = (item.data & gSaveContext.inventory.questItems) != 0; int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); ImGui::BeginGroup(); - ImGui::Image(LUS::GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); if (item.id == QUEST_SKULL_TOKEN) { @@ -524,7 +521,7 @@ void DrawItem(ItemTrackerItem item) { } ImGui::BeginGroup(); - ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); DrawItemCount(item); @@ -542,7 +539,7 @@ void DrawBottle(ItemTrackerItem item) { } int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id)); @@ -557,11 +554,11 @@ void DrawDungeonItem(ItemTrackerItem item) { bool hasSmallKey = (gSaveContext.inventory.dungeonKeys[item.data]) >= 0; ImGui::BeginGroup(); if (itemId == ITEM_KEY_SMALL) { - ImGui::Image(LUS::GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); } else { - ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); } @@ -601,7 +598,7 @@ void DrawSong(ItemTrackerItem item) { bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0; ImVec2 p = ImGui::GetCursorScreenPos(); ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y)); - ImGui::Image(LUS::GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1)); UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(item.id)); } @@ -637,7 +634,7 @@ void DrawNotes(bool resizeable = false) { ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput); if (ImGui::IsItemDeactivatedAfterEdit() && IsValidSaveFile()) { CVarSetString(("gItemTrackerNotes" + std::to_string(gSaveContext.fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str()); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::EndGroup(); } @@ -848,19 +845,14 @@ void UpdateVectors() { shouldUpdateVectors = false; } -void DrawItemTracker(bool& open) { +void ItemTrackerWindow::DrawElement() { UpdateVectors(); - if (!open) { - if (CVarGetInteger("gItemTrackerEnabled", 0)) { - CVarClear("gItemTrackerEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } + int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); int comboButton1Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton1", 6)]; int comboButton2Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton2", 8)]; + OSContPad* buttonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask; bool isPaused = CVarGetInteger("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0; @@ -960,18 +952,10 @@ static const char* buttons[14] = { "A", "B", "C-Up", "C-Down", "C-Left", "C-Righ static const char* displayTypes[3] = { "Hidden", "Main Window", "Seperate" }; static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Seperate" }; -void DrawItemTrackerOptions(bool& open) { - if (!open) { - if (CVarGetInteger("gItemTrackerSettingsEnabled", 0)) { - CVarClear("gItemTrackerSettingsEnabled"); - LUS::RequestCvarSaveOnNextTick(); - } - return; - } - +void ItemTrackerSettingsWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(600,375), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Item Tracker Settings", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { + if (!ImGui::Begin("Item Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; } @@ -991,7 +975,7 @@ void DrawItemTrackerOptions(bool& open) { CVarSetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y); CVarSetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z); CVarSetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::PopItemWidth(); @@ -1086,9 +1070,7 @@ void DrawItemTrackerOptions(bool& open) { ImGui::End(); } -void InitItemTracker() { - LUS::AddWindow("Randomizer", "Item Tracker", DrawItemTracker, CVarGetInteger("gItemTrackerEnabled", 0)); - LUS::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions, CVarGetInteger("gItemTrackerSettingsEnabled", 0)); +void ItemTrackerWindow::InitElement() { float trackerBgR = CVarGetFloat("gItemTrackerBgColorR", 0); float trackerBgG = CVarGetFloat("gItemTrackerBgColorG", 0); float trackerBgB = CVarGetFloat("gItemTrackerBgColorB", 0); @@ -1103,16 +1085,14 @@ void InitItemTracker() { if (itemTrackerNotes.empty()) { itemTrackerNotes.push_back(0); } - LUS::RegisterHook([](OSContPad* cont_pad) { - buttonsPressed = cont_pad; - }); - LUS::RegisterHook([](uint32_t fileNum) { + + GameInteractor::Instance->RegisterGameHook([](uint32_t fileNum) { const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), ""); itemTrackerNotes.resize(strlen(initialTrackerNotes) + 1); strcpy(itemTrackerNotes.Data, initialTrackerNotes); }); - LUS::RegisterHook([](uint32_t fileNum) { + GameInteractor::Instance->RegisterGameHook([](uint32_t fileNum) { CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), ""); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); }); } diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h index bfc0a93a0..63bfa6292 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h @@ -3,9 +3,8 @@ #include #include #include +#include -void InitItemTracker(); -void DrawItemTracker(bool& open); void DrawItemAmmo(int itemId); typedef struct ItemTrackerItem { @@ -25,3 +24,23 @@ typedef struct ItemTrackerDungeon { uint32_t id; std::vector items; } ItemTrackerDungeon; + +class ItemTrackerSettingsWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + protected: + void InitElement() override {}; + void DrawElement() override; + void UpdateElement() override {}; +}; + +class ItemTrackerWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + +protected: + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer_settings_window.h b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h new file mode 100644 index 000000000..bbb55ca3c --- /dev/null +++ b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h @@ -0,0 +1,10 @@ +#include + +class RandomizerSettingsWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override {}; +}; \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer_tricks.cpp b/soh/soh/Enhancements/randomizer/randomizer_tricks.cpp index c28056987..a0ce8d680 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_tricks.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_tricks.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include "z64.h" //Difficulty base tag vectors: diff --git a/soh/soh/Enhancements/randomizer/randomizer_tricks.h b/soh/soh/Enhancements/randomizer/randomizer_tricks.h index aa06388ef..6fb4a4341 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_tricks.h +++ b/soh/soh/Enhancements/randomizer/randomizer_tricks.h @@ -1,8 +1,9 @@ #pragma once #include "randomizerTypes.h" #include -#include -#include +#include +#include +#include typedef enum { RTAREA_GENERAL, diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index d976cb764..c96df2154 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -10,8 +10,6 @@ #include #include -#include - #include "z64.h" #include "z64save.h" #include @@ -23,6 +21,8 @@ #include "../../src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "../../src/overlays/actors/ovl_En_Fr/z_en_fr.h" +#include + extern "C" PlayState* gPlayState; template <> struct fmt::formatter { @@ -837,7 +837,7 @@ extern "C" void ProcessSaveStateRequests(void) { } void SaveStateMgr::SetCurrentSlot(unsigned int slot) { - LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot); + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot); this->currentSlot = slot; } @@ -855,12 +855,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) { this->states[request.slot] = std::make_shared(OTRGlobals::Instance->gSaveStateMgr, request.slot); } this->states[request.slot]->Save(); - LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot); + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot); break; case RequestType::LOAD: if (this->states.contains(request.slot)) { this->states[request.slot]->Load(); - LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot); + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot); } else { SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); } @@ -876,7 +876,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) { SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { if (gPlayState == nullptr) { SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\""); - LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot); + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot); return SaveStateReturn::FAIL_WRONG_GAMESTATE; } @@ -890,7 +890,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { return SaveStateReturn::SUCCESS; } else { SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); - LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot); + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot); return SaveStateReturn::FAIL_INVALID_SLOT; } [[unlikely]] default: diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp deleted file mode 100644 index 88ea3f727..000000000 --- a/soh/soh/GameMenuBar.cpp +++ /dev/null @@ -1,1438 +0,0 @@ -// -// GameMenuBar.cpp -// soh -// -// Created by David Chavez on 24.08.22. -// - -#include "GameMenuBar.hpp" - -#include -#include -#define IMGUI_DEFINE_MATH_OPERATORS -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __SWITCH__ -#include -#endif - -#include "UIWidgets.hpp" -#include "include/global.h" -#include "include/z64audio.h" -#include "soh/SaveManager.h" -#include "OTRGlobals.h" -#include "soh/Enhancements/presets.h" -#include "soh/Enhancements/mods.h" -#include "soh/resource/type/Skeleton.h" - -#ifdef ENABLE_CROWD_CONTROL -#include "Enhancements/crowd-control/CrowdControl.h" -#endif - -#include "Enhancements/game-interactor/GameInteractor.h" -#include "Enhancements/cosmetics/authenticGfxPatches.h" - -bool ShouldClearTextureCacheAtEndOfFrame = false; -bool isBetaQuestEnabled = false; - -extern "C" { - void enableBetaQuest() { isBetaQuestEnabled = true; } - void disableBetaQuest() { isBetaQuestEnabled = false; } -} - -extern "C" PlayState* gPlayState; - -enum SeqPlayers { - /* 0 */ SEQ_BGM_MAIN, - /* 1 */ SEQ_FANFARE, - /* 2 */ SEQ_SFX, - /* 3 */ SEQ_BGM_SUB, - /* 4 */ SEQ_MAX -}; - -namespace GameMenuBar { - - // MARK: - Properties - - static const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" }; - static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" }; - static const char* allPowers[9] = { - "Vanilla (1x)", - "Double (2x)", - "Quadruple (4x)", - "Octuple (8x)", - "Foolish (16x)", - "Ridiculous (32x)", - "Merciless (64x)", - "Pure Torture (128x)", - "OHKO (256x)" }; - static const char* subPowers[8] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6], allPowers[7] }; - static const char* subSubPowers[7] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6] }; - static const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" }; - static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" }; - static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" }; - static const char* bonkDamageValues[8] = { - "No Damage", - "0.25 Heart", - "0.5 Heart", - "1 Heart", - "2 Hearts", - "4 Hearts", - "8 Hearts", - "OHKO" - }; - - // MARK: - Helpers - - std::string GetWindowButtonText(const char* text, bool menuOpen) { - char buttonText[100] = ""; - if (menuOpen) { - strcat(buttonText, ICON_FA_CHEVRON_RIGHT " "); - } - strcat(buttonText, text); - if (!menuOpen) { strcat(buttonText, " "); } - return buttonText; - } - - void UpdateAudio() { - Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f)); - Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f)); - Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f)); - Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); - } - - // MARK: - Delegates - - void SetupHooks() { - LUS::RegisterHook(UpdateAudio); - LUS::RegisterHook(UpdateAudio); - } - - void Draw() { - if (ImGui::BeginMenu("Settings")) - { - if (ImGui::BeginMenu("Audio")) { - UIWidgets::PaddedEnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true); - if (UIWidgets::PaddedEnhancementSliderFloat("Main Music Volume: %d %%", "##Main_Music_Vol", "gMainMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f)); - } - if (UIWidgets::PaddedEnhancementSliderFloat("Sub Music Volume: %d %%", "##Sub_Music_Vol", "gSubMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f)); - } - if (UIWidgets::PaddedEnhancementSliderFloat("Sound Effects Volume: %d %%", "##Sound_Effect_Vol", "gSFXMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); - } - if (UIWidgets::PaddedEnhancementSliderFloat("Fanfare Volume: %d %%", "##Fanfare_Vol", "gFanfareVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f)); - } - - ImGui::Text("Audio API (Needs reload)"); - auto audioBackends = LUS::GetAvailableAudioBackends(); - auto currentAudioBackend = LUS::GetCurrentAudioBackend(); - - if (audioBackends.size() <= 1) { - UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); - } - if (ImGui::BeginCombo("##AApi", currentAudioBackend.second)) { - for (uint8_t i = 0; i < audioBackends.size(); i++) { - if (ImGui::Selectable(audioBackends[i].second, audioBackends[i] == currentAudioBackend)) { - LUS::SetCurrentAudioBackend(i, audioBackends[i]); - } - } - - ImGui::EndCombo(); - } - if (audioBackends.size() <= 1) { - UIWidgets::ReEnableComponent(""); - } - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Controller")) { - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2 (12.0f, 6.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); - if (ImGui::Button(GetWindowButtonText("Controller Mapping", CVarGetInteger("gControllerConfigurationEnabled", 0)).c_str(), ImVec2 (-1.0f, 0.0f))) - { - if (CVarGetInteger("gControllerConfigurationEnabled", 0)) { - CVarClear("gControllerConfigurationEnabled"); - } else { - CVarSetInteger("gControllerConfigurationEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::ToggleInputEditorWindow(CVarGetInteger("gControllerConfigurationEnabled", 0)); - } - if (ImGui::Button(GetWindowButtonText("Additional Controller Options", CVarGetInteger("gControllerOptionsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gControllerOptionsEnabled", 0)) { - CVarClear("gControllerOptionsEnabled"); - } else { - CVarSetInteger("gControllerOptionsEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Additional Controller Options", CVarGetInteger("gControllerOptionsEnabled", 0)); - } - UIWidgets::PaddedSeparator(); - ImGui::PopStyleColor(1); - ImGui::PopStyleVar(3); - #ifndef __SWITCH__ - UIWidgets::EnhancementCheckbox("Menubar Controller Navigation", "gControlNav"); - UIWidgets::Tooltip("Allows controller navigation of the SOH menu bar (Settings, Enhancements,...)\nCAUTION: This will disable game inputs while the menubar is visible.\n\nD-pad to move between items, A to select, and X to grab focus on the menu bar"); - #endif - UIWidgets::PaddedEnhancementCheckbox("Show Inputs", "gInputEnabled", true, false); - UIWidgets::Tooltip("Shows currently pressed inputs on the bottom right of the screen"); - UIWidgets::PaddedEnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false, true, true, false); - UIWidgets::Tooltip("Sets the on screen size of the displayed inputs from the Show Inputs setting"); - UIWidgets::PaddedEnhancementSliderInt("Simulated Input Lag: %d frames", "##SimulatedInputLag", "gSimulatedInputLag", 0, 6, "", 0, true, true, false); - UIWidgets::Tooltip("Buffers your inputs to be executed a specified amount of frames later"); - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Graphics")) { - #ifndef __APPLE__ - UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true); - UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing"); - LUS::SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1)); - #endif - #ifndef __WIIU__ - UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, true, true, false); - UIWidgets::Tooltip("Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel"); - LUS::SetMSAALevel(CVarGetInteger("gMSAAValue", 1)); - #endif - - { // FPS Slider - const int minFps = 20; - static int maxFps; - if (LUS::WindowBackend() == LUS::Backend::DX11) { - maxFps = 360; - } else { - maxFps = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); - } - int currentFps = fmax(fmin(OTRGlobals::Instance->GetInterpolationFPS(), maxFps), minFps); - #ifdef __WIIU__ - UIWidgets::Spacer(0); - // only support divisors of 60 on the Wii U - if (currentFps > 60) { - currentFps = 60; - } else { - currentFps = 60 / (60 / currentFps); - } - - int fpsSlider = 1; - if (currentFps == 20) { - ImGui::Text("FPS: Original (20)"); - } else { - ImGui::Text("FPS: %d", currentFps); - if (currentFps == 30) { - fpsSlider = 2; - } else { // currentFps == 60 - fpsSlider = 3; - } - } - if (CVarGetInteger("gMatchRefreshRate", 0)) { - UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); - } - - if (ImGui::Button(" - ##WiiUFPS")) { - fpsSlider--; - } - ImGui::SameLine(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); - - UIWidgets::Spacer(0); - - ImGui::SliderInt("##WiiUFPSSlider", &fpsSlider, 1, 3, "", ImGuiSliderFlags_AlwaysClamp); - - ImGui::SameLine(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); - if (ImGui::Button(" + ##WiiUFPS")) { - fpsSlider++; - } - - if (CVarGetInteger("gMatchRefreshRate", 0)) { - UIWidgets::ReEnableComponent(""); - } - if (fpsSlider > 3) { - fpsSlider = 3; - } else if (fpsSlider < 1) { - fpsSlider = 1; - } - - if (fpsSlider == 1) { - currentFps = 20; - } else if (fpsSlider == 2) { - currentFps = 30; - } else if (fpsSlider == 3) { - currentFps = 60; - } - CVarSetInteger("gInterpolationFPS", currentFps); - LUS::RequestCvarSaveOnNextTick(); - #else - bool matchingRefreshRate = - CVarGetInteger("gMatchRefreshRate", 0) && LUS::WindowBackend() != LUS::Backend::DX11; - UIWidgets::PaddedEnhancementSliderInt( - (currentFps == 20) ? "FPS: Original (20)" : "FPS: %d", - "##FPSInterpolation", "gInterpolationFPS", minFps, maxFps, "", 20, true, true, false, matchingRefreshRate); - #endif - if (LUS::WindowBackend() == LUS::Backend::DX11) { - UIWidgets::Tooltip( - "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is purely " - "visual and does not impact game logic, execution of glitches etc.\n\n" - "A higher target FPS than your monitor's refresh rate will waste resources, and might give a worse result." - ); - } else { - UIWidgets::Tooltip( - "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is purely " - "visual and does not impact game logic, execution of glitches etc." - ); - } - } // END FPS Slider - - if (LUS::WindowBackend() == LUS::Backend::DX11) { - UIWidgets::Spacer(0); - if (ImGui::Button("Match Refresh Rate")) { - int hz = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); - if (hz >= 20 && hz <= 360) { - CVarSetInteger("gInterpolationFPS", hz); - LUS::RequestCvarSaveOnNextTick(); - } - } - } else { - UIWidgets::PaddedEnhancementCheckbox("Match Refresh Rate", "gMatchRefreshRate", true, false); - } - UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate"); - - if (LUS::WindowBackend() == LUS::Backend::DX11) { - UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger("gExtraLatencyThreshold", 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS", - "##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 80, true, true, false); - UIWidgets::Tooltip("When Interpolation FPS setting is at least this threshold, add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter. This setting allows the CPU to work on one frame while GPU works on the previous frame.\nThis setting should be used when your computer is too slow to do CPU + GPU work in time."); - } - - UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f); - - ImGui::Text("Renderer API (Needs reload)"); - auto renderingBackends = LUS::GetAvailableRenderingBackends(); - auto currentRenderingBackend = LUS::GetCurrentRenderingBackend(); - - if (renderingBackends.size() <= 1) { - UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); - } - if (ImGui::BeginCombo("##RApi", currentRenderingBackend.second)) { - for (uint8_t i = 0; i < renderingBackends.size(); i++) { - if (ImGui::Selectable(renderingBackends[i].second, renderingBackends[i] == currentRenderingBackend)) { - LUS::SetCurrentRenderingBackend(i, renderingBackends[i]); - } - } - - ImGui::EndCombo(); - } - if (renderingBackends.size() <= 1) { - UIWidgets::ReEnableComponent(""); - } - - if (LUS::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { - UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false); - } - - if (LUS::SupportsWindowedFullscreen()) { - UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", "gSdlWindowedFullscreen", true, false); - } - - if (LUS::SupportsViewports()) { - UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows", "gEnableMultiViewports", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); - UIWidgets::Tooltip("Allows windows to be able to be dragged off of the main game window. Requires a reload to take effect."); - } - - // If more filters are added to LUS, make sure to add them to the filters list here - ImGui::Text("Texture Filter (Needs reload)"); - const char* filters[] = { LUS::GetSupportedTextureFilters()[0], LUS::GetSupportedTextureFilters()[1], - LUS::GetSupportedTextureFilters()[2] }; - UIWidgets::EnhancementCombobox("gTextureFilter", filters, 0); - - UIWidgets::Spacer(0); - - LUS::DrawSettings(); - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Languages")) { - UIWidgets::PaddedEnhancementCheckbox("Translate Title Screen", "gTitleScreenTranslation"); - if (UIWidgets::EnhancementRadioButton("English", "gLanguages", LANGUAGE_ENG)) { - GameInteractor::Instance->ExecuteHooks(); - } - if (UIWidgets::EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER)) { - GameInteractor::Instance->ExecuteHooks(); - } - if (UIWidgets::EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA)) { - GameInteractor::Instance->ExecuteHooks(); - } - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Accessibility")) { - #if defined(_WIN32) || defined(__APPLE__) - UIWidgets::PaddedEnhancementCheckbox("Text to Speech", "gA11yTTS"); - UIWidgets::Tooltip("Enables text to speech for in game dialog"); - #endif - UIWidgets::PaddedEnhancementCheckbox("Disable Idle Camera Re-Centering", "gA11yDisableIdleCam"); - UIWidgets::Tooltip("Disables the automatic re-centering of the camera when idle."); - - ImGui::EndMenu(); - } - ImGui::EndMenu(); - } - - ImGui::SetCursorPosY(0.0f); - - if (ImGui::BeginMenu("Enhancements")) - { - DrawPresetSelector(PRESET_TYPE_ENHANCEMENTS); - - UIWidgets::PaddedSeparator(); - - if (ImGui::BeginMenu("Gameplay")) - { - if (ImGui::BeginMenu("Time Savers")) - { - UIWidgets::PaddedEnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "", 1, true, false, true); - UIWidgets::PaddedEnhancementCheckbox("Skip Text", "gSkipText", false, true); - UIWidgets::Tooltip("Holding down B skips text"); - UIWidgets::PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "", 1, true, false, true); - UIWidgets::PaddedEnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "", 3, true, false, true); - UIWidgets::Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword"); - UIWidgets::PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0, true, false, true); - UIWidgets::PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", "gFasterBlockPush", 0, 5, "", 0, true, false, true); - UIWidgets::PaddedEnhancementCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift", true, false); - UIWidgets::Tooltip("Speeds up lifting silver rocks and obelisks"); - UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName", true, false); - UIWidgets::Tooltip("Allows you to have \"Link\" as a premade file name"); - UIWidgets::PaddedEnhancementCheckbox("No Forced Navi", "gNoForcedNavi", true, false); - UIWidgets::Tooltip("Prevent forced Navi conversations"); - UIWidgets::PaddedEnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze", true, false); - UIWidgets::Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas"); - UIWidgets::PaddedEnhancementCheckbox("Fast Chests", "gFastChests", true, false); - UIWidgets::Tooltip("Kick open every chest"); - UIWidgets::PaddedText("Chest size & texture matches contents", true, false); - if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 0)) { - if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) == 0) { - CVarSetInteger("gChestSizeDependsStoneOfAgony", 0); - } - } - UIWidgets::Tooltip( - "Chest sizes and textures are changed to help identify the item inside.\n" - " - Major items: Large gold chests\n" - " - Lesser items: Large brown chests\n" - " - Junk items: Small brown chests\n" - " - Small keys: Small silver chest\n" - " - Boss keys: Vanilla size and texture\n" - " - Skulltula Tokens: Small skulltula chest\n" - ); - if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) > 0) { - UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false); - UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony."); - } - UIWidgets::PaddedEnhancementCheckbox("Skip Pickup Messages", "gFastDrops", true, false); - UIWidgets::Tooltip("Skip pickup messages for new consumable items and bottle swipes"); - UIWidgets::PaddedEnhancementCheckbox("Ask to Equip New Items", "gAskToEquip", true, false); - UIWidgets::Tooltip("Adds a prompt to equip newly-obtained swords, shields and tunics"); - UIWidgets::PaddedEnhancementCheckbox("Better Owl", "gBetterOwl", true, false); - UIWidgets::Tooltip("The default response to Kaepora Gaebora is always that you understood what he said"); - UIWidgets::PaddedEnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", true, false); - bool forceSkipScarecrow = gSaveContext.n64ddFlag && - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SKIP_SCARECROWS_SONG); - static const char* forceSkipScarecrowText = - "This setting is forcefully enabled because a savefile\nwith \"Skip Scarecrow Song\" is loaded"; - UIWidgets::Tooltip("Skip the part where the Ocarina playback is called when you play a song"); - UIWidgets::PaddedEnhancementCheckbox("Skip Scarecrow Song", "gSkipScarecrow", true, false, - forceSkipScarecrow, forceSkipScarecrowText, UIWidgets::CheckboxGraphics::Checkmark); - UIWidgets::Tooltip("Pierre appears when Ocarina is pulled out. Requires learning scarecrow song."); - UIWidgets::PaddedEnhancementCheckbox("Remember Save Location", "gRememberSaveLocation", true, false); - UIWidgets::Tooltip("When loading a save, places Link at the last entrance he went through.\n" - "This doesn't work if the save was made in a grotto."); - UIWidgets::PaddedEnhancementCheckbox("Skip Magic Arrow Equip Animation", "gSkipArrowAnimation", true, false); - UIWidgets::PaddedEnhancementCheckbox("Skip save confirmation", "gSkipSaveConfirmation", true, false); - UIWidgets::Tooltip("Skip the \"Game saved.\" confirmation screen"); - UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false); - UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking " - "to the guard next to the gate."); - UIWidgets::PaddedEnhancementCheckbox("Faster Farore's Wind", "gFastFarores", true, false); - UIWidgets::Tooltip("Greatly decreases cast time of Farore's Wind magic spell."); - UIWidgets::PaddedEnhancementCheckbox("Nighttime GS Always Spawn", "gNightGSAlwaysSpawn", true, false); - UIWidgets::Tooltip("Nighttime Skulltulas will spawn during both day and night."); - UIWidgets::PaddedEnhancementCheckbox("Dampe Appears All Night", "gDampeAllNight", true, false); - UIWidgets::Tooltip("Makes Dampe appear anytime during the night, not just his usual working hours."); - UIWidgets::PaddedEnhancementCheckbox("Time Travel with the Song of Time", "gTimeTravel", true, false); - UIWidgets::Tooltip("Allows Link to freely change age by playing the Song of Time.\n" - "Time Blocks can still be used properly.\n\n" - "Requirements:\n" - "- Obtained the Ocarina of Time\n" - "- Obtained the Song of Time\n" - "- Obtained the Master Sword\n" - "- Not within range of Time Block\n" - "- Not within range of Ocarina playing spots"); - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Items")) - { - UIWidgets::PaddedEnhancementCheckbox("Instant Putaway", "gInstantPutaway", true, false); - UIWidgets::Tooltip("Allow Link to put items away without having to wait around"); - UIWidgets::PaddedEnhancementCheckbox("Instant Boomerang Recall", "gFastBoomerang", true, false); - UIWidgets::Tooltip("Instantly return the boomerang to Link by pressing its item button while it's in the air"); - UIWidgets::PaddedEnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput", true, false); - UIWidgets::Tooltip("Prevent dropping inputs when playing the ocarina quickly"); - UIWidgets::PaddedText("Bunny Hood Effect", true, false); - UIWidgets::EnhancementCombobox("gMMBunnyHood", bunnyHoodOptions, 0); - UIWidgets::Tooltip( - "Wearing the Bunny Hood grants a speed increase like in Majora's Mask. The longer jump option is not accounted for in randomizer logic.\n\n" - "Also disables NPC's reactions to wearing the Bunny Hood." - ); - UIWidgets::PaddedEnhancementCheckbox("Mask Select in Inventory", "gMaskSelect", true, false); - UIWidgets::Tooltip("After completing the mask trading sub-quest, press A and any direction on the mask slot to change masks"); - UIWidgets::PaddedEnhancementCheckbox("Nuts explode bombs", "gNutsExplodeBombs", true, false); - UIWidgets::Tooltip("Makes nuts explode bombs, similar to how they interact with bombchus. This does not affect bombflowers."); - UIWidgets::PaddedEnhancementCheckbox("Equip Multiple Arrows at Once", "gSeparateArrows", true, false); - UIWidgets::Tooltip("Allow the bow and magic arrows to be equipped at the same time on different slots"); - UIWidgets::PaddedEnhancementCheckbox("Bow as Child/Slingshot as Adult", "gBowSlingShotAmmoFix", true, false); - UIWidgets::Tooltip("Allows child to use bow with arrows.\nAllows adult to use slingshot with seeds.\n\nRequires glitches or 'Timeless Equipment' cheat to equip."); - UIWidgets::PaddedEnhancementCheckbox("Better Farore's Wind", "gBetterFW", true, false); - UIWidgets::Tooltip("Helps FW persist between ages, gives child and adult separate FW points, and can be used in more places."); - UIWidgets::PaddedEnhancementCheckbox("Static Explosion Radius", "gStaticExplosionRadius", true, false); - UIWidgets::Tooltip("Explosions are now a static size, like in Majora's Mask and OoT3D. Makes bombchu hovering much easier."); - UIWidgets::PaddedEnhancementCheckbox("Prevent Bombchus Forcing First-Person", "gDisableFirstPersonChus", true, false); - UIWidgets::Tooltip("Prevent bombchus from forcing the camera into first-person mode when released."); - UIWidgets::PaddedEnhancementCheckbox("Aiming reticle for the bow/slingshot", "gBowReticle", true, false); - UIWidgets::Tooltip("Aiming with a bow or slingshot will display a reticle as with the hookshot when the projectile is ready to fire."); - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Difficulty Options")) - { - ImGui::Text("Damage Multiplier"); - UIWidgets::EnhancementCombobox("gDamageMul", allPowers, 0); - UIWidgets::Tooltip( - "Modifies all sources of damage not affected by other sliders\n" - "2x: Can survive all common attacks from the start of the game\n" - "4x: Dies in 1 hit to any substantial attack from the start of the game\n" - "8x: Can only survive trivial damage from the start of the game\n" - "16x: Can survive all common attacks with max health without double defense\n" - "32x: Can survive all common attacks with max health and double defense\n" - "64x: Can survive trivial damage with max health without double defense\n" - "128x: Can survive trivial damage with max health and double defense\n" - "256x: Cannot survive damage" - ); - UIWidgets::PaddedText("Fall Damage Multiplier", true, false); - UIWidgets::EnhancementCombobox("gFallDamageMul", subPowers, 0); - UIWidgets::Tooltip( - "Modifies all fall damage\n" - "2x: Can survive all fall damage from the start of the game\n" - "4x: Can only survive short fall damage from the start of the game\n" - "8x: Cannot survive any fall damage from the start of the game\n" - "16x: Can survive all fall damage with max health without double defense\n" - "32x: Can survive all fall damage with max health and double defense\n" - "64x: Can survive short fall damage with double defense\n" - "128x: Cannot survive fall damage" - ); - UIWidgets::PaddedText("Void Damage Multiplier", true, false); - UIWidgets::EnhancementCombobox("gVoidDamageMul", subSubPowers, 0); - UIWidgets::Tooltip( - "Modifies damage taken after falling into a void\n" - "2x: Can survive void damage from the start of the game\n" - "4x: Cannot survive void damage from the start of the game\n" - "8x: Can survive void damage twice with max health without double defense\n" - "16x: Can survive void damage with max health without double defense\n" - "32x: Can survive void damage with max health and double defense\n" - "64x: Cannot survive void damage" - ); - UIWidgets::PaddedText("Bonk Damage Multiplier", true, false); - UIWidgets::EnhancementCombobox("gBonkDamageMul", bonkDamageValues, 0); - UIWidgets::Tooltip("Modifies damage taken after bonking."); - UIWidgets::PaddedEnhancementCheckbox("Spawn with full health", "gFullHealthSpawn", true, false); - UIWidgets::Tooltip("Respawn with full health instead of 3 Hearts"); - UIWidgets::PaddedEnhancementCheckbox("No Random Drops", "gNoRandomDrops", true, false); - UIWidgets::Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses"); - bool forceEnableBombchuDrops = gSaveContext.n64ddFlag && - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_ENABLE_BOMBCHU_DROPS) == 1; - static const char* forceEnableBombchuDropsText = - "This setting is forcefully enabled because a savefile\nwith \"Enable Bombchu Drops\" is loaded."; - UIWidgets::PaddedEnhancementCheckbox("Enable Bombchu Drops", "gBombchuDrops", true, false, - forceEnableBombchuDrops, forceEnableBombchuDropsText, UIWidgets::CheckboxGraphics::Checkmark); - UIWidgets::Tooltip("Bombchus will sometimes drop in place of bombs"); - UIWidgets::PaddedEnhancementCheckbox("No Heart Drops", "gNoHeartDrops", true, false); - UIWidgets::Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series"); - UIWidgets::PaddedEnhancementCheckbox("Hyper Bosses", "gHyperBosses", true, false); - UIWidgets::Tooltip("All major bosses move and act twice as fast."); - UIWidgets::PaddedEnhancementCheckbox("Hyper Enemies", "gHyperEnemies", true, false); - UIWidgets::Tooltip("All regular enemies and mini-bosses move and act twice as fast."); - UIWidgets::PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false); - UIWidgets::Tooltip("Always get the heart piece/purple rupee from the spinning Goron pot"); - UIWidgets::PaddedEnhancementCheckbox("Always Win Dampe Digging Game", "gDampeWin", true, false, SaveManager::Instance->IsRandoFile(), - "This setting is always enabled in randomizer files", UIWidgets::CheckboxGraphics::Checkmark); - UIWidgets::Tooltip("Always win the heart piece/purple rupee on the first dig in Dampe's grave digging game, just like in rando\nIn a rando file, this is unconditionally enabled"); - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Potion Values")) - { - UIWidgets::EnhancementCheckbox("Change Red Potion Effect", "gRedPotionEffect"); - UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Red Potions"); - bool disabledRedPotion = !CVarGetInteger("gRedPotionEffect", 0); - static const char* disabledTooltipRedPotion = "This option is disabled because \"Change Red Potion Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", "gRedPotionHealth", 1, 100, "", 0, true, disabledRedPotion, disabledTooltipRedPotion); - UIWidgets::Tooltip("Changes the amount of health restored by Red Potions"); - UIWidgets::EnhancementCheckbox("Red Potion Percent Restore", "gRedPercentRestore", disabledRedPotion, disabledTooltipRedPotion); - UIWidgets::Tooltip("Toggles from Red Potions restoring a fixed amount of health to a percent of the player's current max health"); - - ImGui::Separator(); - - UIWidgets::EnhancementCheckbox("Change Green Potion Effect", "gGreenPotionEffect"); - UIWidgets::Tooltip("Enable the following changes to the amount of mana restored by Green Potions"); - bool disabledGreenPotion = !CVarGetInteger("gGreenPotionEffect", 0); - static const char* disabledTooltipGreenPotion = "This option is disabled because \"Change Green Potion Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", "gGreenPotionMana", 1, 100, "", 0, true, disabledGreenPotion, disabledTooltipGreenPotion); - UIWidgets::Tooltip("Changes the amount of mana restored by Green Potions, base max mana is 48, max upgraded mana is 96"); - UIWidgets::EnhancementCheckbox("Green Potion Percent Restore", "gGreenPercentRestore", disabledGreenPotion, disabledTooltipGreenPotion); - UIWidgets::Tooltip("Toggles from Green Potions restoring a fixed amount of mana to a percent of the player's current max mana"); - - ImGui::Separator(); - - UIWidgets::EnhancementCheckbox("Change Blue Potion Effects", "gBluePotionEffects"); - UIWidgets::Tooltip("Enable the following changes to the amount of health and mana restored by Blue Potions"); - bool disabledBluePotion = !CVarGetInteger("gBluePotionEffects", 0); - static const char* disabledTooltipBluePotion = "This option is disabled because \"Change Blue Potion Effects\" is turned off"; - UIWidgets::EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", "gBluePotionHealth", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); - UIWidgets::Tooltip("Changes the amount of health restored by Blue Potions"); - UIWidgets::EnhancementCheckbox("Blue Potion Health Percent Restore", "gBlueHealthPercentRestore", disabledBluePotion, disabledTooltipBluePotion); - UIWidgets::Tooltip("Toggles from Blue Potions restoring a fixed amount of health to a percent of the player's current max health"); - - ImGui::Separator(); - - UIWidgets::EnhancementSliderInt("Blue Potion Mana: %d", "##BLUEPOTIONMANA", "gBluePotionMana", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); - UIWidgets::Tooltip("Changes the amount of mana restored by Blue Potions, base max mana is 48, max upgraded mana is 96"); - UIWidgets::EnhancementCheckbox("Blue Potion Mana Percent Restore", "gBlueManaPercentRestore", disabledBluePotion, disabledTooltipBluePotion); - UIWidgets::Tooltip("Toggles from Blue Potions restoring a fixed amount of mana to a percent of the player's current max mana"); - - ImGui::Separator(); - - UIWidgets::EnhancementCheckbox("Change Milk Effect", "gMilkEffect"); - UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Milk"); - bool disabledMilk = !CVarGetInteger("gMilkEffect", 0); - static const char* disabledTooltipMilk = "This option is disabled because \"Change Milk Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", "gMilkHealth", 1, 100, "", 0, true, disabledMilk, disabledTooltipMilk); - UIWidgets::Tooltip("Changes the amount of health restored by Milk"); - UIWidgets::EnhancementCheckbox("Milk Percent Restore", "gMilkPercentRestore", disabledMilk, disabledTooltipMilk); - UIWidgets::Tooltip("Toggles from Milk restoring a fixed amount of health to a percent of the player's current max health"); - - ImGui::Separator(); - - UIWidgets::EnhancementCheckbox("Separate Half Milk Effect", "gSeparateHalfMilkEffect", disabledMilk, disabledTooltipMilk); - UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Half Milk\nIf this is disabled, Half Milk will behave the same as Full Milk."); - bool disabledHalfMilk = disabledMilk || !CVarGetInteger("gSeparateHalfMilkEffect", 0); - static const char* disabledTooltipHalfMilk = "This option is disabled because \"Separate Half Milk Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", "gHalfMilkHealth", 1, 100, "", 0, true, disabledHalfMilk, disabledTooltipHalfMilk); - UIWidgets::Tooltip("Changes the amount of health restored by Half Milk"); - UIWidgets::EnhancementCheckbox("Half Milk Percent Restore", "gHalfMilkPercentRestore", disabledHalfMilk, disabledTooltipHalfMilk); - UIWidgets::Tooltip("Toggles from Half Milk restoring a fixed amount of health to a percent of the player's current max health"); - - ImGui::Separator(); - - UIWidgets::EnhancementCheckbox("Change Fairy Effect", "gFairyEffect"); - UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairies"); - bool disabledFairy = !CVarGetInteger("gFairyEffect", 0); - static const char* disabledTooltipFairy = "This option is disabled because \"Change Fairy Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", "gFairyHealth", 1, 100, "", 0, true, disabledFairy, disabledTooltipFairy); - UIWidgets::Tooltip("Changes the amount of health restored by Fairies"); - UIWidgets::EnhancementCheckbox("Fairy Percent Restore", "gFairyPercentRestore", disabledFairy, disabledTooltipFairy); - UIWidgets::Tooltip("Toggles from Fairies restoring a fixed amount of health to a percent of the player's current max health"); - - ImGui::Separator(); - - UIWidgets::EnhancementCheckbox("Change Fairy Revive Effect", "gFairyReviveEffect"); - UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairy Revivals"); - bool disabledFairyRevive = !CVarGetInteger("gFairyReviveEffect", 0); - static const char* disabledTooltipFairyRevive = "This option is disabled because \"Change Fairy Revive Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", "gFairyReviveHealth", 1, 100, "", 0, true, disabledFairyRevive, disabledTooltipFairyRevive); - UIWidgets::Tooltip("Changes the amount of health restored by Fairy Revivals"); - UIWidgets::EnhancementCheckbox("Fairy Revive Percent Restore", "gFairyRevivePercentRestore", disabledFairyRevive, disabledTooltipFairyRevive); - UIWidgets::Tooltip("Toggles from Fairy Revivals restoring a fixed amount of health to a percent of the player's current max health"); - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Shooting Gallery")) { - UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeShootingGallery"); - UIWidgets::Tooltip("Turn on/off changes to the shooting gallery behavior"); - bool disabled = !CVarGetInteger("gCustomizeShootingGallery", 0); - static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; - UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantShootingGalleryWin", true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("Skips the shooting gallery minigame"); - UIWidgets::PaddedEnhancementCheckbox("No Rupee Randomization", "gConstantAdultGallery", true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("Forces the rupee order to not be randomized as adult, making it the same as chlid"); - UIWidgets::PaddedEnhancementSliderInt("Child Starting Ammunition: %d", "##cShootingGalleryAmmunition", "gChildShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as a child"); - UIWidgets::PaddedEnhancementSliderInt("Adult Starting Ammunition: %d", "##aShootingGalleryAmmunition", "gAdultShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as an adult"); - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Bombchu Bowling")) { - UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeBombchuBowling"); - UIWidgets::Tooltip("Turn on/off changes to the bombchu bowling behavior"); - bool disabled = CVarGetInteger("gCustomizeBombchuBowling", 0) == 0; - static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; - UIWidgets::PaddedEnhancementCheckbox("Remove Small Cucco", "gBombchuBowlingNoSmallCucco", true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("Prevents the small cucco from appearing in the bombchu bowling minigame"); - UIWidgets::PaddedEnhancementCheckbox("Remove Big Cucco", "gBombchuBowlingNoBigCucco", true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("Prevents the big cucco from appearing in the bombchu bowling minigame"); - UIWidgets::PaddedEnhancementSliderInt("Bombchu Count: %d", "##cBombchuBowlingAmmunition", "gBombchuBowlingAmmunition", 3, 20, "", 10, true, true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("The number of bombchus available at the start of the bombchu bowling minigame"); - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Fishing")) { - UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeFishing"); - UIWidgets::Tooltip("Turn on/off changes to the fishing behavior"); - bool disabled = !CVarGetInteger("gCustomizeFishing", 0); - static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; - UIWidgets::PaddedEnhancementCheckbox("Instant Fishing", "gInstantFishing", true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("All fish will be caught instantly"); - UIWidgets::PaddedEnhancementCheckbox("Guarantee Bite", "gGuaranteeFishingBite", true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("When a line is stable, guarantee bite. Otherwise use default logic"); - UIWidgets::PaddedEnhancementCheckbox("Fish Never Escape", "gFishNeverEscape", true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("Once a hook has been set, fish will never let go while being reeled in."); - UIWidgets::PaddedEnhancementSliderInt("Child Minimum Weight: %d", "##cMinimumWeight", "gChildMinimumWeightFish", 3, 10, "", 10, true, true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("The minimum weight for the unique fishing reward as a child"); - UIWidgets::PaddedEnhancementSliderInt("Adult Minimum Weight: %d", "##aMinimumWeight", "gAdultMinimumWeightFish", 6, 13, "", 13, true, true, false, disabled, disabledTooltip); - UIWidgets::Tooltip("The minimum weight for the unique fishing reward as an adult"); - ImGui::EndMenu(); - } - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Reduced Clutter")) - { - UIWidgets::EnhancementCheckbox("Mute Low HP Alarm", "gLowHpAlarm"); - UIWidgets::Tooltip("Disable the low HP beeping sound"); - UIWidgets::PaddedEnhancementCheckbox("Minimal UI", "gMinimalUI", true, false); - UIWidgets::Tooltip("Hides most of the UI when not needed\nNote: Doesn't activate until after loading a new scene"); - UIWidgets::PaddedEnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio", true, false); - UIWidgets::Tooltip("Disables the voice audio when Navi calls you"); - UIWidgets::PaddedEnhancementCheckbox("Disable Hot/Underwater Warning Text", "gDisableTunicWarningText", true, false); - UIWidgets::Tooltip("Disables warning text when you don't have on the Goron/Zora Tunic in Hot/Underwater conditions."); - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - UIWidgets::EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony"); - UIWidgets::Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); - UIWidgets::PaddedEnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots", true, false); - UIWidgets::Tooltip("Allows equipping the tunic and boots to c-buttons"); - UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved", true, false); - UIWidgets::Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); - UIWidgets::PaddedEnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime", true, false); - UIWidgets::Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods"); - UIWidgets::PaddedEnhancementCheckbox("Enable visible guard vision", "gGuardVision", true, false); - UIWidgets::PaddedEnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect", true, false); - UIWidgets::PaddedEnhancementCheckbox("Item counts in messages", "gInjectItemCounts", true, false); - UIWidgets::Tooltip("Injects item counts in pickup messages, like golden skulltula tokens and heart pieces"); - UIWidgets::PaddedEnhancementCheckbox("Pull grave during the day", "gDayGravePull", true, false); - UIWidgets::Tooltip("Allows graves to be pulled when child during the day"); - UIWidgets::PaddedEnhancementCheckbox("Dogs follow you everywhere", "gDogFollowsEverywhere", true, false); - UIWidgets::Tooltip("Allows dogs to follow you anywhere you go, even if you leave the market"); - UIWidgets::PaddedEnhancementCheckbox("Don't require input for Credits sequence", "gNoInputForCredits", true, false); - UIWidgets::Tooltip("Removes the input requirement on textboxes after defeating Ganon, allowing Credits sequence to continue to progress"); - - // Blue Fire Arrows - bool forceEnableBlueFireArrows = gSaveContext.n64ddFlag && - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BLUE_FIRE_ARROWS); - static const char* forceEnableBlueFireArrowsText = - "This setting is forcefully enabled because a savefile\nwith \"Blue Fire Arrows\" is loaded."; - UIWidgets::PaddedEnhancementCheckbox("Blue Fire Arrows", "gBlueFireArrows", true, false, - forceEnableBlueFireArrows, forceEnableBlueFireArrowsText, UIWidgets::CheckboxGraphics::Checkmark); - UIWidgets::Tooltip("Allows Ice Arrows to melt red ice.\nMay require a room reload if toggled during gameplay."); - - // Sunlight Arrows - bool forceEnableSunLightArrows = gSaveContext.n64ddFlag && - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SUNLIGHT_ARROWS); - static const char* forceEnableSunLightArrowsText = - "This setting is forcefully enabled because a savefile\nwith \"Sunlight Arrows\" is loaded."; - UIWidgets::PaddedEnhancementCheckbox("Sunlight Arrows", "gSunlightArrows", true, false, - forceEnableSunLightArrows, forceEnableSunLightArrowsText, UIWidgets::CheckboxGraphics::Checkmark); - UIWidgets::Tooltip("Allows Light Arrows to activate sun switches.\nMay require a room reload if toggled during gameplay."); - - UIWidgets::PaddedEnhancementCheckbox("Disable Crit wiggle", "gDisableCritWiggle", true, false); - UIWidgets::Tooltip("Disable random camera wiggle at low health"); - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Graphics")) - { - if (UIWidgets::PaddedEnhancementCheckbox("Use Alternate Assets", "gAltAssets", true, false)) { - ShouldClearTextureCacheAtEndOfFrame = true; - } - UIWidgets::PaddedEnhancementCheckbox("Disable LOD", "gDisableLOD", true, false); - UIWidgets::Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance"); - if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false)) { - if (CVarGetInteger("gDisableDrawDistance", 0) == 0) { - CVarSetInteger("gDisableKokiriDrawDistance", 0); - } - } - UIWidgets::Tooltip("Turns off the objects draw distance, making objects being visible from a longer range"); - if (CVarGetInteger("gDisableDrawDistance", 0) == 1) { - UIWidgets::PaddedEnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance", true, false); - UIWidgets::Tooltip("The Kokiri are mystical beings that fade into view when approached\nEnabling this will remove their draw distance"); - } - UIWidgets::PaddedEnhancementCheckbox("N64 Mode", "gLowResMode", true, false); - UIWidgets::Tooltip("Sets aspect ratio to 4:3 and lowers resolution to 240p, the N64's native resolution"); - UIWidgets::PaddedEnhancementCheckbox("Glitch line-up tick", "gDrawLineupTick", true, false); - UIWidgets::Tooltip("Displays a tick in the top center of the screen to help with glitch line-ups in SoH, as traditional UI based line-ups do not work outside of 4:3"); - UIWidgets::PaddedEnhancementCheckbox("Enable 3D Dropped items/projectiles", "gNewDrops", true, false); - UIWidgets::Tooltip("Change most 2D items and projectiles on the overworld to their 3D versions"); - UIWidgets::PaddedEnhancementCheckbox("Disable Black Bar Letterboxes", "gDisableBlackBars", true, false); - UIWidgets::Tooltip("Disables Black Bar Letterboxes during cutscenes and Z-targeting\nNote: there may be minor visual glitches that were covered up by the black bars\nPlease disable this setting before reporting a bug"); - UIWidgets::PaddedEnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon", true, false); - UIWidgets::Tooltip("Changes the rupee in the wallet icon to match the wallet size you currently have"); - UIWidgets::PaddedEnhancementCheckbox("Always show dungeon entrances", "gAlwaysShowDungeonMinimapIcon", true, false); - UIWidgets::Tooltip("Always shows dungeon entrance icons on the minimap"); - UIWidgets::PaddedEnhancementCheckbox("Show Gauntlets in First Person", "gFPSGauntlets", true, false); - UIWidgets::Tooltip("Renders Gauntlets when using the Bow and Hookshot like in OOT3D"); - UIWidgets::Spacer(0); - if (ImGui::BeginMenu("Animated Link in Pause Menu")) { - ImGui::Text("Rotation"); - UIWidgets::EnhancementRadioButton("Disabled", "gPauseLiveLinkRotation", 0); - UIWidgets::EnhancementRadioButton("Rotate Link with D-pad", "gPauseLiveLinkRotation", 1); - UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the D-pad\nUse D-pad Up or D-pad Down to reset Link's rotation"); - UIWidgets::EnhancementRadioButton("Rotate Link with C-buttons", "gPauseLiveLinkRotation", 2); - UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the C-buttons\nUse C-Up or C-Down to reset Link's rotation"); - UIWidgets::EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3); - UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the Right Stick\nYou can zoom in by pointing up and reset Link's rotation by pointing down"); - if (CVarGetInteger("gPauseLiveLinkRotation", 0) != 0) { - UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", "gPauseLiveLinkRotationSpeed", 1, 20, "", 1); - } - UIWidgets::PaddedSeparator(); - ImGui::Text("Static loop"); - UIWidgets::EnhancementRadioButton("Disabled", "gPauseLiveLink", 0); - UIWidgets::EnhancementRadioButton("Idle (standing)", "gPauseLiveLink", 1); - UIWidgets::EnhancementRadioButton("Idle (look around)", "gPauseLiveLink", 2); - UIWidgets::EnhancementRadioButton("Idle (belt)", "gPauseLiveLink", 3); - UIWidgets::EnhancementRadioButton("Idle (shield)", "gPauseLiveLink", 4); - UIWidgets::EnhancementRadioButton("Idle (test sword)", "gPauseLiveLink", 5); - UIWidgets::EnhancementRadioButton("Idle (yawn)", "gPauseLiveLink", 6); - UIWidgets::EnhancementRadioButton("Battle Stance", "gPauseLiveLink", 7); - UIWidgets::EnhancementRadioButton("Walking (no shield)", "gPauseLiveLink", 8); - UIWidgets::EnhancementRadioButton("Walking (holding shield)", "gPauseLiveLink", 9); - UIWidgets::EnhancementRadioButton("Running (no shield)", "gPauseLiveLink", 10); - UIWidgets::EnhancementRadioButton("Running (holding shield)", "gPauseLiveLink", 11); - UIWidgets::EnhancementRadioButton("Hand on hip", "gPauseLiveLink", 12); - UIWidgets::EnhancementRadioButton("Spin attack charge", "gPauseLiveLink", 13); - UIWidgets::EnhancementRadioButton("Look at hand", "gPauseLiveLink", 14); - UIWidgets::PaddedSeparator(); - ImGui::Text("Randomize"); - UIWidgets::EnhancementRadioButton("Random", "gPauseLiveLink", 15); - UIWidgets::Tooltip("Randomize the animation played each time you open the menu"); - UIWidgets::EnhancementRadioButton("Random cycle", "gPauseLiveLink", 16); - UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time"); - UIWidgets::EnhancementRadioButton("Random cycle (Idle)", "gPauseLiveLink", 17); - UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time (Idle animations only)"); - if (CVarGetInteger("gPauseLiveLink", 0) >= 16) { - UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", "gMinFrameCount", 1, 1000, "", 0); - } - - ImGui::EndMenu(); - } - UIWidgets::PaddedText("Fix Vanishing Paths", true, false); - if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", zFightingOptions, 0) && gPlayState != NULL) { - UpdateDirtPathFixState(gPlayState->sceneNum); - } - UIWidgets::Tooltip("Disabled: Paths vanish more the higher the resolution (Z-fighting is based on resolution)\n" - "Consistent: Certain paths vanish the same way in all resolutions\n" - "No Vanish: Paths do not vanish, Link seems to sink in to some paths\n" - "This might affect other decal effects\n"); - UIWidgets::PaddedEnhancementSliderInt("Text Spacing: %d", "##TEXTSPACING", "gTextSpacing", 4, 6, "", 6, true, true, true); - UIWidgets::Tooltip("Space between text characters (useful for HD font textures)"); - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Fixes")) - { - UIWidgets::EnhancementCheckbox("Fix L&R Pause menu", "gUniformLR"); - UIWidgets::Tooltip("Makes the L and R buttons in the pause menu the same color"); - UIWidgets::PaddedEnhancementCheckbox("Fix L&Z Page switch in Pause menu", "gNGCKaleidoSwitcher", true, false); - UIWidgets::Tooltip("Makes L and R switch pages like on the GameCube\nZ opens the Debug Menu instead"); - UIWidgets::PaddedEnhancementCheckbox("Fix Dungeon entrances", "gFixDungeonMinimapIcon", true, false); - UIWidgets::Tooltip("Removes the dungeon entrance icon on the top-left corner of the screen when no dungeon is present on the current map"); - UIWidgets::PaddedEnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle", true, false); - UIWidgets::Tooltip("Re-enables the two-handed idle animation, a seemingly finished animation that was disabled on accident in the original game"); - UIWidgets::PaddedEnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix", true, false); - UIWidgets::Tooltip("Fixes a bug where the Gravedigging Tour Heart Piece disappears if the area reloads"); - UIWidgets::PaddedEnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix", true, false); - UIWidgets::Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw"); - UIWidgets::PaddedEnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix", true, false); - UIWidgets::Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button"); - UIWidgets::PaddedEnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix", true, false); - UIWidgets::Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield"); - if (UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix", true, false)) { - if (!CVarGetInteger("gCrouchStabHammerFix", 0)) { - CVarClear("gCrouchStabFix"); - } - } - UIWidgets::Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally"); - if (CVarGetInteger("gCrouchStabHammerFix", 0)) { - UIWidgets::PaddedEnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix", true, false); - UIWidgets::Tooltip("Make crouch stabbing always do the same damage as a regular slash"); - } - UIWidgets::PaddedEnhancementCheckbox("Fix credits timing", "gCreditsFix", true, false); - UIWidgets::Tooltip("Extend certain credits scenes so the music lines up properly with the visuals"); - UIWidgets::PaddedEnhancementCheckbox("Fix Gerudo Warrior's clothing colors", "gGerudoWarriorClothingFix", true, false); - UIWidgets::Tooltip("Prevent the Gerudo Warrior's clothes changing color when changing Link's tunic or using bombs in front of her"); - UIWidgets::PaddedEnhancementCheckbox("Fix Camera Drift", "gFixCameraDrift", true, false); - UIWidgets::Tooltip("Fixes camera slightly drifting to the left when standing still due to a math error"); - UIWidgets::PaddedEnhancementCheckbox("Fix Camera Swing", "gFixCameraSwing", true, false); - UIWidgets::Tooltip("Fixes camera getting stuck on collision when standing still, also fixes slight shift back in camera when stop moving"); - UIWidgets::PaddedEnhancementCheckbox("Fix Hanging Ledge Swing Rate", "gFixHangingLedgeSwingRate", true, false); - UIWidgets::Tooltip("Fixes camera swing rate when player falls off a ledge and camera swings around"); - UIWidgets::PaddedEnhancementCheckbox("Fix Missing Jingle after 5 Silver Rupees", "gSilverRupeeJingleExtend", true, false); - UIWidgets::Tooltip( - "Adds 5 higher pitches for the Silver Rupee Jingle for the rooms with more than 5 Silver Rupees. " - "Currently only relevant in Master Quest."); - if (UIWidgets::PaddedEnhancementCheckbox("Fix out of bounds textures", "gFixTexturesOOB", true, false)) { - ApplyAuthenticGfxPatches(); - } - UIWidgets::Tooltip("Fixes authentic out of bounds texture reads, instead loading textures with the correct size"); - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Restoration")) - { - UIWidgets::EnhancementCheckbox("Authentic Logo Screen", "gAuthenticLogo"); - UIWidgets::Tooltip("Hide the game version and build details and display the authentic model and texture on the boot logo start screen"); - UIWidgets::PaddedEnhancementCheckbox("Red Ganon blood", "gRedGanonBlood", true, false); - UIWidgets::Tooltip("Restore the original red blood from NTSC 1.0/1.1. Disable for green blood"); - UIWidgets::PaddedEnhancementCheckbox("Fish while hovering", "gHoverFishing", true, false); - UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows casting the Fishing Rod while using the Hover Boots"); - UIWidgets::PaddedEnhancementCheckbox("N64 Weird Frames", "gN64WeirdFrames", true, false); - UIWidgets::Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64"); - UIWidgets::PaddedEnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB", true, false); - UIWidgets::Tooltip("Allows bombchus to explode out of bounds\nSimilar to GameCube and Wii VC"); - UIWidgets::PaddedEnhancementCheckbox("Quick Putaway", "gQuickPutaway", true, false); - UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows putting away an item without an animation and performing Putaway Ocarina Items"); - UIWidgets::PaddedEnhancementCheckbox("Restore old Gold Skulltula cutscene", "gGsCutscene", true, false); - UIWidgets::PaddedEnhancementCheckbox("Quick Bongo Kill", "gQuickBongoKill", true, false); - UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows bypassing Bongo Bongo's intro cutscene to quickly kill him"); - - ImGui::EndMenu(); - } - - UIWidgets::Spacer(0); - - if (ImGui::BeginMenu("Extra Modes")) { - UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false); - UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and " - "press the C-Buttons to use items and mess with Player 1!"); - - UIWidgets::Spacer(0); - - UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", "gRupeeDash", true, false); - - if (CVarGetInteger("gRupeeDash", 0)) { - UIWidgets::Tooltip("Rupees reduced over time, Link suffers damage when the count hits 0."); - UIWidgets::PaddedEnhancementSliderInt( - "Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 3, 5, "", 5, true, true, false, - !CVarGetInteger("gRupeeDash", 0), - "This option is disabled because \"Rupee Dash Mode\" is turned off"); - UIWidgets::Tooltip("Interval between Rupee reduction in Rupee Dash Mode"); - } - - UIWidgets::Spacer(0); - - UIWidgets::PaddedEnhancementCheckbox("Shadow Tag Mode", "gShadowTag", true, false); - - if (CVarGetInteger("gShadowTag", 0)) { - UIWidgets::Tooltip("A wallmaster follows Link everywhere, don't get caught!"); - } - - ImGui::EndMenu(); - } - - UIWidgets::PaddedSeparator(false, true); - - // Autosave enum value of 1 is the default in presets and the old checkbox "on" state for backwards compatibility - UIWidgets::PaddedText("Autosave", false, true); - UIWidgets::EnhancementCombobox("gAutosave", autosaveLabels, 0); - UIWidgets::Tooltip("Automatically save the game when changing locations and/or obtaining items\n" - "Major items exclude rupees and health/magic/ammo refills (but include bombchus unless bombchu drops are enabled)"); - - UIWidgets::PaddedSeparator(true, true, 2.0f, 2.0f); - - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0)); - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); - - if (ImGui::Button(GetWindowButtonText("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gCosmeticsEditorEnabled", 0)) { - CVarClear("gCosmeticsEditorEnabled"); - } else { - CVarSetInteger("gCosmeticsEditorEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0)); - } - if (ImGui::Button(GetWindowButtonText("Audio Editor", CVarGetInteger("gAudioEditor.WindowOpen", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gAudioEditor.WindowOpen", 0)) { - CVarClear("gAudioEditor.WindowOpen"); - } else { - CVarSetInteger("gAudioEditor.WindowOpen", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Audio Editor", CVarGetInteger("gAudioEditor.WindowOpen", 0)); - } - if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVarGetInteger("gGameplayStats.Enabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { - if (CVarGetInteger("gGameplayStats.Enabled", 0)) { - CVarClear("gGameplayStats.Enabled"); - } else { - CVarSetInteger("gGameplayStats.Enabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Gameplay Stats", CVarGetInteger("gGameplayStats.Enabled", 0)); - } - ImGui::PopStyleVar(3); - ImGui::PopStyleColor(1); - - #ifdef __SWITCH__ - UIWidgets::Spacer(0); - ImGui::Text("Switch performance mode"); - if (UIWidgets::EnhancementCombobox("gSwitchPerfMode", SWITCH_CPU_PROFILES, (int)LUS::SwitchProfiles::STOCK)) { - SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger("gSwitchPerfMode", (int)LUS::SwitchProfiles::STOCK)]); - LUS::Switch::ApplyOverclock(); - } - #endif - - ImGui::EndMenu(); - } - - ImGui::SetCursorPosY(0.0f); - - if (ImGui::BeginMenu("Cheats")) - { - if (ImGui::BeginMenu("Infinite...")) { - UIWidgets::EnhancementCheckbox("Money", "gInfiniteMoney"); - UIWidgets::PaddedEnhancementCheckbox("Health", "gInfiniteHealth", true, false); - UIWidgets::PaddedEnhancementCheckbox("Ammo", "gInfiniteAmmo", true, false); - UIWidgets::PaddedEnhancementCheckbox("Magic", "gInfiniteMagic", true, false); - UIWidgets::PaddedEnhancementCheckbox("Nayru's Love", "gInfiniteNayru", true, false); - UIWidgets::PaddedEnhancementCheckbox("Epona Boost", "gInfiniteEpona", true, false); - - ImGui::EndMenu(); - } - - UIWidgets::PaddedEnhancementCheckbox("No Clip", "gNoClip", true, false); - UIWidgets::Tooltip("Allows you to walk through walls"); - UIWidgets::PaddedEnhancementCheckbox("Climb Everything", "gClimbEverything", true, false); - UIWidgets::Tooltip("Makes every surface in the game climbable"); - UIWidgets::PaddedEnhancementCheckbox("Hookshot Everything", "gHookshotEverything", true, false); - UIWidgets::Tooltip("Makes every surface in the game hookshot-able"); - UIWidgets::EnhancementSliderFloat("Hookshot Reach Multiplier: %.1fx", "##gCheatHookshotReachMultiplier", "gCheatHookshotReachMultiplier", 1.0f, 5.0f, "", 1.0f, false); - UIWidgets::PaddedEnhancementCheckbox("Moon Jump on L", "gMoonJumpOnL", true, false); - UIWidgets::Tooltip("Holding L makes you float into the air"); - UIWidgets::PaddedEnhancementCheckbox("Super Tunic", "gSuperTunic", true, false); - UIWidgets::Tooltip("Makes every tunic have the effects of every other tunic"); - UIWidgets::PaddedEnhancementCheckbox("Easy ISG", "gEzISG", true, false); - UIWidgets::Tooltip("Passive Infinite Sword Glitch\nIt makes your sword's swing effect and hitbox stay active indefinitely"); - UIWidgets::PaddedEnhancementCheckbox("Timeless Equipment", "gTimelessEquipment", true, false); - UIWidgets::Tooltip("Allows any item to be equipped, regardless of age\nAlso allows Child to use Adult strength upgrades"); - UIWidgets::PaddedEnhancementCheckbox("Easy Frame Advancing", "gCheatEasyPauseBufferEnabled", true, false); - UIWidgets::Tooltip("Continue holding START button when unpausing to only advance a single frame and then re-pause"); - const bool bEasyFrameAdvanceEnabled = CVarGetInteger("gCheatEasyPauseBufferEnabled", 0); - UIWidgets::PaddedEnhancementCheckbox("Easy Input Buffering", "gCheatEasyInputBufferingEnabled", true, false, bEasyFrameAdvanceEnabled, "Forced enabled when Easy Frame Advancing is enabled"); - UIWidgets::Tooltip("Inputs that are held down while the Subscreen is closing will be pressed when the game is resumed"); - UIWidgets::PaddedEnhancementCheckbox("Unrestricted Items", "gNoRestrictItems", true, false); - UIWidgets::Tooltip("Allows you to use any item at any location"); - UIWidgets::PaddedEnhancementCheckbox("Freeze Time", "gFreezeTime", true, false); - UIWidgets::Tooltip("Freezes the time of day"); - UIWidgets::PaddedEnhancementCheckbox("Drops Don't Despawn", "gDropsDontDie", true, false); - UIWidgets::Tooltip("Drops from enemies, grass, etc. don't disappear after a set amount of time"); - UIWidgets::PaddedEnhancementCheckbox("Fireproof Deku Shield", "gFireproofDekuShield", true, false); - UIWidgets::Tooltip("Prevents the Deku Shield from burning on contact with fire"); - UIWidgets::PaddedEnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded", true, false); - UIWidgets::Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks"); - UIWidgets::PaddedEnhancementCheckbox("Time Sync", "gTimeSync", true, false); - UIWidgets::Tooltip("This syncs the ingame time with the real world time"); - UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); - UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); - - { - static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); - static int32_t lastBetaQuestEnabled = betaQuestEnabled; - static int32_t betaQuestWorld = CVarGetInteger("gBetaQuestWorld", 0xFFEF); - static int32_t lastBetaQuestWorld = betaQuestWorld; - - if (!isBetaQuestEnabled) { - UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); - } - - UIWidgets::PaddedEnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest", true, false); - UIWidgets::Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game."); - betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); - if (betaQuestEnabled) { - if (betaQuestEnabled != lastBetaQuestEnabled) { - betaQuestWorld = 0; - } - - ImGui::Text("Beta Quest World: %d", betaQuestWorld); - - if (ImGui::Button(" - ##BetaQuest")) { - betaQuestWorld--; - } - ImGui::SameLine(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); - - ImGui::SliderInt("##BetaQuest", &betaQuestWorld, 0, 8, "", ImGuiSliderFlags_AlwaysClamp); - UIWidgets::Tooltip("Set the Beta Quest world to explore. *WARNING* Changing this will reset your game.\nCtrl+Click to type in a value."); - - ImGui::SameLine(); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); - if (ImGui::Button(" + ##BetaQuest")) { - betaQuestWorld++; - } - - if (betaQuestWorld > 8) { - betaQuestWorld = 8; - } - else if (betaQuestWorld < 0) { - betaQuestWorld = 0; - } - } - else { - lastBetaQuestWorld = betaQuestWorld = 0xFFEF; - CVarClear("gBetaQuestWorld"); - } - if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld) - { - // Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene. - lastBetaQuestEnabled = betaQuestEnabled; - lastBetaQuestWorld = betaQuestWorld; - CVarSetInteger("gEnableBetaQuest", betaQuestEnabled); - CVarSetInteger("gBetaQuestWorld", betaQuestWorld); - - LUS::DispatchConsoleCommand("reset"); - - LUS::RequestCvarSaveOnNextTick(); - } - - if (!isBetaQuestEnabled) { - UIWidgets::ReEnableComponent(""); - } - } - - if (ImGui::Button("Change Age")) { - CVarSetInteger("gSwitchAge", 1); - } - UIWidgets::Tooltip("Switches Link's age and reloads the area."); - - ImGui::EndMenu(); - } - - ImGui::SetCursorPosY(0.0f); - - if (ImGui::BeginMenu("Developer Tools")) - { - UIWidgets::EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled"); - UIWidgets::Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right, and open the debug menu with L on the pause screen"); - UIWidgets::PaddedEnhancementCheckbox("OoT Skulltula Debug", "gSkulltulaDebugEnabled", true, false); - UIWidgets::Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map icons (boss key, compass, map screen locations, etc) will set the GS bits in that area.\nUSE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT."); - UIWidgets::PaddedEnhancementCheckbox("Fast File Select", "gSkipLogoTitle", true, false); - UIWidgets::Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu"); - if (CVarGetInteger("gSkipLogoTitle", 0)) { - ImGui::Text("Loading :"); - UIWidgets::EnhancementCombobox("gSaveFileID", FastFileSelect, 0); - }; - UIWidgets::PaddedEnhancementCheckbox("Better Debug Warp Screen", "gBetterDebugWarpScreen", true, false); - UIWidgets::Tooltip("Optimized debug warp screen, with the added ability to chose entrances and time of day"); - UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", "gDebugWarpScreenTranslation", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); - UIWidgets::Tooltip("Translate the Debug Warp Screen based on the game language"); - UIWidgets::PaddedSeparator(); - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0,0)); - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); - if (ImGui::Button(GetWindowButtonText("Stats", CVarGetInteger("gStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gStatsEnabled", 0)) { - CVarClear("gStatsEnabled"); - } else { - CVarSetInteger("gStatsEnabled", 1); - } - LUS::ToggleStatisticsWindow(CVarGetInteger("gStatsEnabled", 0)); - LUS::RequestCvarSaveOnNextTick(); - } - UIWidgets::Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"); - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Console", CVarGetInteger("gConsoleEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gConsoleEnabled", 0)) { - CVarClear("gConsoleEnabled"); - } else { - CVarSetInteger("gConsoleEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::ToggleConsoleWindow(CVarGetInteger("gConsoleEnabled", 0)); - } - UIWidgets::Tooltip("Enables the console window, allowing you to input commands, type help for some examples"); - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gSaveEditorEnabled", 0)) { - CVarClear("gSaveEditorEnabled"); - } else { - CVarSetInteger("gSaveEditorEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gCollisionViewerEnabled", 0)) { - CVarClear("gCollisionViewerEnabled"); - } else { - CVarSetInteger("gCollisionViewerEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gActorViewerEnabled", 0)) { - CVarClear("gActorViewerEnabled"); - } else { - CVarSetInteger("gActorViewerEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Display List Viewer", CVarGetInteger("gDLViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) - { - if (CVarGetInteger("gDLViewerEnabled", 0)) { - CVarClear("gDLViewerEnabled"); - } else { - CVarSetInteger("gDLViewerEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Display List Viewer", CVarGetInteger("gDLViewerEnabled", 0)); - } - ImGui::PopStyleVar(3); - ImGui::PopStyleColor(1); - - ImGui::EndMenu(); - } - - ImGui::SetCursorPosY(0.0f); - - if (ImGui::BeginMenu("Randomizer")) - { - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0)); - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); - #ifdef __WIIU__ - static ImVec2 buttonSize(200.0f * 2.0f, 0.0f); - #else - static ImVec2 buttonSize(200.0f, 0.0f); - #endif - if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0)).c_str(), buttonSize)) - { - if (CVarGetInteger("gRandomizerSettingsEnabled", 0)) { - CVarClear("gRandomizerSettingsEnabled"); - } else { - CVarSetInteger("gRandomizerSettingsEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonSize)) - { - if (CVarGetInteger("gItemTrackerEnabled", 0)) { - CVarClear("gItemTrackerEnabled"); - } else { - CVarSetInteger("gItemTrackerEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize)) - { - if (CVarGetInteger("gItemTrackerSettingsEnabled", 0)) { - CVarClear("gItemTrackerSettingsEnabled"); - } else { - CVarSetInteger("gItemTrackerSettingsEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonSize)) - { - if (CVarGetInteger("gEntranceTrackerEnabled", 0)) { - CVarClear("gEntranceTrackerEnabled"); - } else { - CVarSetInteger("gEntranceTrackerEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonSize)) - { - if (CVarGetInteger("gCheckTrackerEnabled", 0)) { - CVarClear("gCheckTrackerEnabled"); - } else { - CVarSetInteger("gCheckTrackerEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)); - } - UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize)) - { - if (CVarGetInteger("gCheckTrackerSettingsEnabled", 0)) { - CVarClear("gCheckTrackerSettingsEnabled"); - } else { - CVarSetInteger("gCheckTrackerSettingsEnabled", 1); - } - LUS::RequestCvarSaveOnNextTick(); - LUS::EnableWindow("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)); - } - ImGui::PopStyleVar(3); - ImGui::PopStyleColor(1); - - UIWidgets::PaddedSeparator(); - - if (ImGui::BeginMenu("Rando Enhancements")) - { - UIWidgets::EnhancementCheckbox("Rando-Relevant Navi Hints", "gRandoRelevantNavi", false, "", UIWidgets::CheckboxGraphics::Cross, true); - UIWidgets::Tooltip( - "Replace Navi's overworld quest hints with rando-related gameplay hints." - ); - UIWidgets::PaddedEnhancementCheckbox("Random Rupee Names", "gRandomizeRupeeNames", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); - UIWidgets::Tooltip( - "When obtaining rupees, randomize what the rupee is called in the textbox." - ); - - // Only disable the key colors checkbox when none of the keysanity settings are set to "Any Dungeon", "Overworld" or "Anywhere" - bool disableKeyColors = true; - - if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANY_DUNGEON || - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OVERWORLD || - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANYWHERE || - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_KEYS) != RO_GERUDO_KEYS_VANILLA || - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANY_DUNGEON || - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OVERWORLD || - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANYWHERE || - (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_VANILLA && - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_OWN_DUNGEON && - OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_STARTWITH) || - !gSaveContext.n64ddFlag) { - disableKeyColors = false; - } - - static const char* disableKeyColorsText = - "This setting is disabled because a savefile is loaded without any key\n" - "shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\""; - - UIWidgets::PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false, - disableKeyColors, disableKeyColorsText, UIWidgets::CheckboxGraphics::Cross, true); - UIWidgets::Tooltip( - "Matches the color of small keys and boss keys to the dungeon they belong to. " - "This helps identify keys from afar and adds a little bit of flair.\n\nThis only " - "applies to seeds with keys and boss keys shuffled to Any Dungeon, Overworld, or Anywhere."); - UIWidgets::PaddedEnhancementCheckbox("Quest Item Fanfares", "gRandoQuestItemFanfares", true, false); - UIWidgets::Tooltip( - "Play unique fanfares when obtaining quest items " - "(medallions/stones/songs). Note that these fanfares are longer than usual." - ); - ImGui::EndMenu(); - } - - UIWidgets::PaddedSeparator(); - - #ifdef ENABLE_CROWD_CONTROL - UIWidgets::EnhancementCheckbox("Crowd Control", "gCrowdControl"); - UIWidgets::Tooltip("Will attempt to connect to the Crowd Control server. Check out crowdcontrol.live for more information."); - - if (CVarGetInteger("gCrowdControl", 0)) { - CrowdControl::Instance->Enable(); - } else { - CrowdControl::Instance->Disable(); - } - - UIWidgets::Spacer(0); - #endif - - UIWidgets::EnhancementCheckbox("Enemy Randomizer", "gRandomizedEnemies"); - UIWidgets::Tooltip( - "Randomizes regular enemies every time you load a room. Bosses, mini-bosses and a few specific regular enemies are excluded.\n\n" - "Enemies that need more than Deku Nuts + either Deku Sticks or a sword to kill are excluded from spawning in \"clear enemy\" rooms." - ); - - if (CVarGetInteger("gRandomizedEnemies", 0)) { - - bool disableSeededEnemies = !gSaveContext.n64ddFlag && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2; - static const char* disableSeededEnemiesText = "This setting is disabled because it relies on a randomizer savefile."; - - UIWidgets::PaddedEnhancementCheckbox("Seeded Enemy Spawns", "gSeededRandomizedEnemies", true, false, disableSeededEnemies, disableSeededEnemiesText); - UIWidgets::Tooltip( - "Enemy spawns will stay consistent throughout room reloads. Enemy spawns are based on randomizer seeds, so this only works with randomizer savefiles." - ); - } - - ImGui::EndMenu(); - } - } -} diff --git a/soh/soh/GameMenuBar.hpp b/soh/soh/GameMenuBar.hpp deleted file mode 100644 index 07280707b..000000000 --- a/soh/soh/GameMenuBar.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// GameMenuBar.hpp -// soh -// -// Created by David Chavez on 24.08.22. -// - -#ifndef GameMenuBar_hpp -#define GameMenuBar_hpp - -#include - -#ifdef __cplusplus -extern "C" { -#endif - void enableBetaQuest(); - void disableBetaQuest(); -#ifdef __cplusplus -} -#endif - -namespace GameMenuBar { - void SetupHooks(); - void Draw(); -} - -#endif /* GameMenuBar_hpp */ diff --git a/soh/soh/GbiWrap.cpp b/soh/soh/GbiWrap.cpp index 074a638e7..46f4c877c 100644 --- a/soh/soh/GbiWrap.cpp +++ b/soh/soh/GbiWrap.cpp @@ -16,10 +16,9 @@ int32_t OTRGetLastScancode(); void ResourceMgr_LoadDirectory(const char* resName); void ResourceMgr_LoadFile(const char* resName); char* ResourceMgr_LoadFileFromDisk(const char* filePath); -char* GetResourceDataByName(char* texPath); uint16_t ResourceMgr_LoadTexWidthByName(char* texPath); uint16_t ResourceMgr_LoadTexHeightByName(char* texPath); -size_t GetResourceTexSizeByName(const char* name); +size_t ResourceGetTexSizeByName(const char* name); char* ResourceMgr_LoadTexOrDListByName(char* filePath); char* ResourceMgr_LoadIfDListByName(char* filePath); char* ResourceMgr_LoadPlayerAnimByName(char* animPath); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index fa1824014..58a1e0644 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -34,7 +34,6 @@ #include "Enhancements/audio/AudioCollection.h" #include "Enhancements/audio/AudioEditor.h" #include "Enhancements/debugconsole.h" -#include "Enhancements/debugger/debugger.h" #include "Enhancements/randomizer/randomizer.h" #include "Enhancements/randomizer/randomizer_entrance_tracker.h" #include "Enhancements/randomizer/randomizer_item_tracker.h" @@ -47,7 +46,6 @@ #include "z64.h" #include "macros.h" #include -#include #include "Enhancements/custom-message/CustomMessageManager.h" #if not defined (__SWITCH__) && not defined(__WIIU__) @@ -73,7 +71,7 @@ #include "Enhancements/custom-message/CustomMessageTypes.h" #include #include "Enhancements/item-tables/ItemTableManager.h" -#include "GameMenuBar.hpp" +#include "SohGui.hpp" #include "ActorDB.h" #ifdef ENABLE_CROWD_CONTROL @@ -247,7 +245,7 @@ OTRGlobals::OTRGlobals() { OOT_PAL_GC_DBG2 }; // tell LUS to reserve 3 SoH specific threads (Game, Audio, Save) - context = LUS::Context::CreateInstance("Ship of Harkinian", "soh", OTRFiles, {}, 3); + context = LUS::Context::CreateInstance("Ship of Harkinian", "soh", "shipofharkinian.json", OTRFiles, {}, 3); context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Animation, "Animation", std::make_shared()); context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared()); @@ -331,7 +329,7 @@ bool OTRGlobals::HasOriginal() { } uint32_t OTRGlobals::GetInterpolationFPS() { - if (LUS::WindowBackend() == LUS::Backend::DX11) { + if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { return CVarGetInteger("gInterpolationFPS", 20); } @@ -746,13 +744,12 @@ extern "C" void InitOTR() { #elif defined(__WIIU__) LUS::WiiU::Init(); #endif - LUS::AddSetupHooksDelegate(GameMenuBar::SetupHooks); - LUS::RegisterMenuDrawMethod(GameMenuBar::Draw); OTRGlobals::Instance = new OTRGlobals(); - SaveManager::Instance = new SaveManager(); CustomMessageManager::Instance = new CustomMessageManager(); ItemTableManager::Instance = new ItemTableManager(); + SaveManager::Instance = new SaveManager(); + SohGui::SetupGuiElements(); GameInteractor::Instance = new GameInteractor(); AudioCollection::Instance = new AudioCollection(); ActorDB::Instance = new ActorDB(); @@ -763,22 +760,13 @@ extern "C" void InitOTR() { SpeechSynthesizer::Instance = new SAPISpeechSynthesizer(); SpeechSynthesizer::Instance->Init(); #endif - + clearMtx = (uintptr_t)&gMtxClear; OTRMessage_Init(); OTRAudio_Init(); - InitCosmeticsEditor(); - GameControlEditor::Init(); - InitAudioEditor(); - DebugConsole_Init(); - Debug_Init(); - Rando_Init(); - InitItemTracker(); - InitEntranceTracker(); - InitStatTracker(); - CheckTracker::InitCheckTracker(); OTRExtScanner(); VanillaItemTable_Init(); + DebugConsole_Init(); InitMods(); ActorDB::AddBuiltInCustomActors(); @@ -803,12 +791,22 @@ extern "C" void InitOTR() { #endif } +extern "C" void SaveManager_ThreadPoolWait() { + SaveManager::Instance->ThreadPoolWait(); +} + extern "C" void DeinitOTR() { + SaveManager_ThreadPoolWait(); OTRAudio_Exit(); #ifdef ENABLE_CROWD_CONTROL CrowdControl::Instance->Disable(); CrowdControl::Instance->Shutdown(); #endif + + // Destroying gui here because we have shared ptrs to LUS objects which output to SPDLOG which is destroyed before these shared ptrs. + SohGui::Destroy(); + + OTRGlobals::Instance->context = nullptr; } #ifdef _WIN32 @@ -1108,7 +1106,7 @@ extern "C" void ResourceMgr_LoadFile(const char* resName) { LUS::Context::GetInstance()->GetResourceManager()->LoadResource(resName); } -std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { +std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { std::string Path = path; if (ResourceMgr_IsGameMasterQuest()) { size_t pos = 0; @@ -1126,7 +1124,7 @@ extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) { return nullptr; } - return (char*)res->GetPointer(); + return (char*)res->GetRawPointer(); } extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) { @@ -1145,7 +1143,7 @@ extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) { extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) { auto res = GetResourceByNameHandlingMQ(texPath); - return res->InitData->Type == LUS::ResourceType::SOH_Background; + return res->GetInitData()->Type == LUS::ResourceType::SOH_Background; } extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize) @@ -1193,9 +1191,9 @@ extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath); extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) { auto res = GetResourceByNameHandlingMQ(filePath); - if (res->InitData->Type == LUS::ResourceType::DisplayList) + if (res->GetInitData()->Type == LUS::ResourceType::DisplayList) return (char*)&((std::static_pointer_cast(res))->Instructions[0]); - else if (res->InitData->Type == LUS::ResourceType::Array) + else if (res->GetInitData()->Type == LUS::ResourceType::Array) return (char*)(std::static_pointer_cast(res))->Vertices.data(); else { return (char*)GetResourceDataByNameHandlingMQ(filePath); @@ -1205,7 +1203,7 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) { extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) { auto res = GetResourceByNameHandlingMQ(filePath); - if (res->InitData->Type == LUS::ResourceType::DisplayList) + if (res->GetInitData()->Type == LUS::ResourceType::DisplayList) return (char*)&((std::static_pointer_cast(res))->Instructions[0]); return nullptr; @@ -1316,15 +1314,15 @@ extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) { } extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) { - return (CollisionHeader*) GetResourceDataByName(path); + return (CollisionHeader*) ResourceGetDataByName(path); } extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) { - return (Vtx*) GetResourceDataByName(path); + return (Vtx*) ResourceGetDataByName(path); } extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) { - SequenceData* sequence = (SequenceData*) GetResourceDataByName(path); + SequenceData* sequence = (SequenceData*) ResourceGetDataByName(path); return *sequence; } @@ -1389,11 +1387,11 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) { } extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) { - return (SoundFontSample*) GetResourceDataByName(path); + return (SoundFontSample*) ResourceGetDataByName(path); } extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) { - return (SoundFont*) GetResourceDataByName(path); + return (SoundFont*) ResourceGetDataByName(path); } extern "C" int ResourceMgr_OTRSigCheck(char* imgData) @@ -1415,7 +1413,7 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData) } extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) { - return (AnimationHeaderCommon*) GetResourceDataByName(path); + return (AnimationHeaderCommon*) ResourceGetDataByName(path); } extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) { @@ -1429,14 +1427,14 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel bool isAlt = CVarGetInteger("gAltAssets", 0); if (isAlt) { - pathStr = LUS::Resource::gAltAssetPrefix + pathStr; + pathStr = LUS::IResource::gAltAssetPrefix + pathStr; } - SkeletonHeader* skelHeader = (SkeletonHeader*) GetResourceDataByName(pathStr.c_str()); + SkeletonHeader* skelHeader = (SkeletonHeader*) ResourceGetDataByName(pathStr.c_str()); // If there isn't an alternate model, load the regular one if (isAlt && skelHeader == NULL) { - skelHeader = (SkeletonHeader*) GetResourceDataByName(path); + skelHeader = (SkeletonHeader*) ResourceGetDataByName(path); } // This function is only called when a skeleton is initialized. @@ -1463,8 +1461,8 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path) { return (s32*)GetResourceDataByNameHandlingMQ(path); } -std::filesystem::path GetSaveFile(std::shared_ptr Conf) { - const std::string fileName = Conf->getString("Game.SaveName", LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav")); +std::filesystem::path GetSaveFile(std::shared_ptr Conf) { + const std::string fileName = Conf->GetString("Game.SaveName", LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav")); std::filesystem::path saveFile = std::filesystem::absolute(fileName); if (!exists(saveFile.parent_path())) { @@ -1475,13 +1473,13 @@ std::filesystem::path GetSaveFile(std::shared_ptr Conf) { } std::filesystem::path GetSaveFile() { - const std::shared_ptr pConf = OTRGlobals::Instance->context->GetConfig(); + const std::shared_ptr pConf = OTRGlobals::Instance->context->GetConfig(); return GetSaveFile(pConf); } void OTRGlobals::CheckSaveFile(size_t sramSize) const { - const std::shared_ptr pConf = Instance->context->GetConfig(); + const std::shared_ptr pConf = Instance->context->GetConfig(); std::filesystem::path savePath = GetSaveFile(pConf); std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); @@ -1595,11 +1593,11 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo } extern "C" uint32_t OTRGetCurrentWidth() { - return OTRGlobals::Instance->context->GetWindow()->GetCurrentWidth(); + return OTRGlobals::Instance->context->GetWindow()->GetWidth(); } extern "C" uint32_t OTRGetCurrentHeight() { - return OTRGlobals::Instance->context->GetWindow()->GetCurrentHeight(); + return OTRGlobals::Instance->context->GetWindow()->GetHeight(); } Color_RGB8 GetColorForControllerLED() { @@ -1684,10 +1682,6 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) { return ((int)ceilf(OTRGetDimensionFromRightEdge(v))); } -extern "C" bool AudioPlayer_Init(void) { - return AudioPlayerInit(); -} - extern "C" int AudioPlayer_Buffered(void) { return AudioPlayerBuffered(); } @@ -1714,22 +1708,6 @@ extern "C" int Controller_ShouldRumble(size_t slot) { return 0; } -extern "C" void Controller_BlockGameInput() { - auto controlDeck = LUS::Context::GetInstance()->GetControlDeck(); - - controlDeck->BlockGameInput(); -} - -extern "C" void Controller_UnblockGameInput() { - auto controlDeck = LUS::Context::GetInstance()->GetControlDeck(); - - controlDeck->UnblockGameInput(); -} - -extern "C" void Hooks_ExecuteAudioInit() { - LUS::ExecuteHooks(); -} - extern "C" void* getN64WeirdFrame(s32 i) { char* weirdFrameBytes = reinterpret_cast(n64WeirdFrames); return &weirdFrameBytes[i + sizeof(n64WeirdFrames)]; @@ -2049,29 +2027,29 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { if (textId == TEXT_RANDO_SAVE_VERSION_WARNING) { messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_RANDO_SAVE_VERSION_WARNING); } - font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition(); - switch (gSaveContext.language) { - case LANGUAGE_FRA: - return msgCtx->msgLength = font->msgLength = - CopyStringToCharBuffer(messageEntry.GetFrench(), buffer, maxBufferSize); - case LANGUAGE_GER: - return msgCtx->msgLength = font->msgLength = - CopyStringToCharBuffer(messageEntry.GetGerman(), buffer, maxBufferSize); - case LANGUAGE_ENG: - default: - return msgCtx->msgLength = font->msgLength = - CopyStringToCharBuffer(messageEntry.GetEnglish(), buffer, maxBufferSize); - } + font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition(); + switch (gSaveContext.language) { + case LANGUAGE_FRA: + return msgCtx->msgLength = font->msgLength = + CopyStringToCharBuffer(messageEntry.GetFrench(), buffer, maxBufferSize); + case LANGUAGE_GER: + return msgCtx->msgLength = font->msgLength = + CopyStringToCharBuffer(messageEntry.GetGerman(), buffer, maxBufferSize); + case LANGUAGE_ENG: + default: + return msgCtx->msgLength = font->msgLength = + CopyStringToCharBuffer(messageEntry.GetEnglish(), buffer, maxBufferSize); + } return false; } extern "C" void Overlay_DisplayText(float duration, const char* text) { - LUS::GetGameOverlay()->TextDrawNotification(duration, true, text); + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); } extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) { float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05; - LUS::GetGameOverlay()->TextDrawNotification(duration, true, text); + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); } extern "C" void Entrance_ClearEntranceTrackingData(void) { @@ -2093,7 +2071,3 @@ extern "C" void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex) { extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement) { gfx_register_blended_texture(name, mask, replacement); } - -extern "C" void SaveManager_ThreadPoolWait() { - SaveManager::Instance->ThreadPoolWait(); -} diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index ea2a2b5a8..05ea04e12 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -7,7 +7,7 @@ #include #ifdef __cplusplus -#include +#include #include "Enhancements/savestates.h" #include "Enhancements/randomizer/randomizer.h" #include @@ -103,7 +103,6 @@ float OTRGetDimensionFromLeftEdge(float v); float OTRGetDimensionFromRightEdge(float v); int16_t OTRGetRectDimensionFromLeftEdge(float v); int16_t OTRGetRectDimensionFromRightEdge(float v); -bool AudioPlayer_Init(void); int AudioPlayer_Buffered(void); int AudioPlayer_GetDesiredBuffered(void); void AudioPlayer_Play(const uint8_t* buf, uint32_t len); @@ -111,7 +110,6 @@ void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples); int Controller_ShouldRumble(size_t slot); void Controller_BlockGameInput(); void Controller_UnblockGameInput(); -void Hooks_ExecuteAudioInit(); void* getN64WeirdFrame(s32 i); int GetEquipNowMessage(char* buffer, char* src, const int maxBufferSize); u32 SpoilerFileExists(const char* spoilerFileName); diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index e7f4c852a..7d981d337 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -6,7 +6,6 @@ #include "functions.h" #include "macros.h" #include -#include #include "soh/Enhancements/boss-rush/BossRush.h" #include @@ -354,7 +353,6 @@ void SaveManager::Init() { const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); auto sOldSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav"); auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.bak"); - LUS::RegisterHook([this]() { ThreadPoolWait(); }); GameInteractor::Instance->RegisterGameHook([this](uint32_t fileNum) { ThreadPoolWait(); }); // If the save directory does not exist, create it @@ -838,7 +836,9 @@ void SaveManager::LoadFile(int fileNum) { } void SaveManager::ThreadPoolWait() { - smThreadPool->wait_for_tasks(); + if (smThreadPool) { + smThreadPool->wait_for_tasks(); + } } bool SaveManager::SaveFile_Exist(int fileNum) { @@ -2334,7 +2334,6 @@ extern "C" void Save_SaveGlobal(void) { extern "C" void Save_LoadFile(void) { SaveManager::Instance->LoadFile(gSaveContext.fileNum); - LUS::ExecuteHooks(gSaveContext.fileNum); } extern "C" void Save_AddLoadFunction(char* name, int version, SaveManager::LoadFunc func) { @@ -2355,7 +2354,6 @@ extern "C" void Save_CopyFile(int from, int to) { extern "C" void Save_DeleteFile(int fileNum) { SaveManager::Instance->DeleteZeldaFile(fileNum); - LUS::ExecuteHooks(fileNum); } extern "C" u32 Save_Exist(int fileNum) { diff --git a/soh/soh/SaveManager.h b/soh/soh/SaveManager.h index ec0a2d787..a3fe83253 100644 --- a/soh/soh/SaveManager.h +++ b/soh/soh/SaveManager.h @@ -31,9 +31,7 @@ typedef struct { #include #include "thread-pool/BS_thread_pool.hpp" -extern "C" { #include "z64save.h" -} #include diff --git a/soh/soh/SohGui.cpp b/soh/soh/SohGui.cpp new file mode 100644 index 000000000..73b006df9 --- /dev/null +++ b/soh/soh/SohGui.cpp @@ -0,0 +1,208 @@ +// +// SohGui.cpp +// soh +// +// Created by David Chavez on 24.08.22. +// + +#include "SohGui.hpp" + +#include +#include +#define IMGUI_DEFINE_MATH_OPERATORS +#include +#include +#include + +#ifdef __APPLE__ +#include "graphic/Fast3D/gfx_metal.h" +#endif + +#ifdef __SWITCH__ +#include +#endif + +#include "UIWidgets.hpp" +#include "include/global.h" +#include "include/z64audio.h" +#include "soh/SaveManager.h" +#include "OTRGlobals.h" +#include "soh/Enhancements/presets.h" +#include "soh/resource/type/Skeleton.h" +#include "libultraship/libultraship.h" + +#ifdef ENABLE_CROWD_CONTROL +#include "Enhancements/crowd-control/CrowdControl.h" +#endif + +#include "Enhancements/game-interactor/GameInteractor.h" +#include "Enhancements/cosmetics/authenticGfxPatches.h" + +bool ShouldClearTextureCacheAtEndOfFrame = false; +bool isBetaQuestEnabled = false; + +extern "C" { + void enableBetaQuest() { isBetaQuestEnabled = true; } + void disableBetaQuest() { isBetaQuestEnabled = false; } +} + + +namespace SohGui { + + // MARK: - Properties + + static const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" }; + static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" }; + static const char* allPowers[9] = { + "Vanilla (1x)", + "Double (2x)", + "Quadruple (4x)", + "Octuple (8x)", + "Foolish (16x)", + "Ridiculous (32x)", + "Merciless (64x)", + "Pure Torture (128x)", + "OHKO (256x)" }; + static const char* subPowers[8] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6], allPowers[7] }; + static const char* subSubPowers[7] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6] }; + static const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" }; + static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" }; + static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" }; + static const char* bonkDamageValues[8] = { + "No Damage", + "0.25 Heart", + "0.5 Heart", + "1 Heart", + "2 Hearts", + "4 Hearts", + "8 Hearts", + "OHKO" + }; + + static const inline std::vector> audioBackends = { +#ifdef _WIN32 + { "wasapi", "Windows Audio Session API" }, +#endif +#if defined(__linux) + { "pulse", "PulseAudio" }, +#endif + { "sdl", "SDL Audio" } + }; + + + // MARK: - Helpers + + std::string GetWindowButtonText(const char* text, bool menuOpen) { + char buttonText[100] = ""; + if (menuOpen) { + strcat(buttonText, ICON_FA_CHEVRON_RIGHT " "); + } + strcat(buttonText, text); + if (!menuOpen) { strcat(buttonText, " "); } + return buttonText; + } + + + // MARK: - Delegates + + std::shared_ptr mSohMenuBar; + + std::shared_ptr mConsoleWindow; + std::shared_ptr mStatsWindow; + std::shared_ptr mInputEditorWindow; + + std::shared_ptr mAudioEditorWindow; + std::shared_ptr mGameControlEditorWindow; + std::shared_ptr mCosmeticsEditorWindow; + std::shared_ptr mActorViewerWindow; + std::shared_ptr mColViewerWindow; + std::shared_ptr mSaveEditorWindow; + std::shared_ptr mDLViewerWindow; + std::shared_ptr mGameplayStatsWindow; + std::shared_ptr mCheckTrackerSettingsWindow; + std::shared_ptr mCheckTrackerWindow; + std::shared_ptr mEntranceTrackerWindow; + std::shared_ptr mItemTrackerSettingsWindow; + std::shared_ptr mItemTrackerWindow; + std::shared_ptr mRandomizerSettingsWindow; + + void SetupGuiElements() { + auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); + + mSohMenuBar = std::make_shared("gOpenMenuBar", CVarGetInteger("gOpenMenuBar", 0)); + gui->SetMenuBar(std::reinterpret_pointer_cast(mSohMenuBar)); + + if (gui->GetMenuBar() && !gui->GetMenuBar()->IsVisible()) { +#if defined(__SWITCH__) || defined(__WIIU__) + gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press - to access enhancements menu"); +#else + gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press F1 to access enhancements menu"); +#endif + } + + mStatsWindow = gui->GetGuiWindow("Stats"); + if (mStatsWindow == nullptr) { + SPDLOG_ERROR("Could not find stats window"); + } + + mConsoleWindow = gui->GetGuiWindow("Console"); + if (mConsoleWindow == nullptr) { + SPDLOG_ERROR("Could not find console window"); + } + + mInputEditorWindow = gui->GetGuiWindow("Input Editor"); + if (mInputEditorWindow == nullptr) { + SPDLOG_ERROR("Could not find input editor window"); + } + + mAudioEditorWindow = std::make_shared("gAudioEditor.WindowOpen", "Audio Editor"); + gui->AddGuiWindow(mAudioEditorWindow); + mGameControlEditorWindow = std::make_shared("gGameControlEditorEnabled", "Game Control Editor"); + gui->AddGuiWindow(mGameControlEditorWindow); + mCosmeticsEditorWindow = std::make_shared("gCosmeticsEditorEnabled", "Cosmetics Editor"); + gui->AddGuiWindow(mCosmeticsEditorWindow); + mActorViewerWindow = std::make_shared("gActorViewerEnabled", "Actor Viewer"); + gui->AddGuiWindow(mActorViewerWindow); + mColViewerWindow = std::make_shared("gCollisionViewerEnabled", "Collision Viewer"); + gui->AddGuiWindow(mColViewerWindow); + mSaveEditorWindow = std::make_shared("gSaveEditorEnabled", "Save Editor"); + gui->AddGuiWindow(mSaveEditorWindow); + mDLViewerWindow = std::make_shared("gDLViewerEnabled", "Display List Viewer"); + gui->AddGuiWindow(mDLViewerWindow); + mGameplayStatsWindow = std::make_shared("gGameplayStatsEnabled", "Gameplay Stats"); + gui->AddGuiWindow(mGameplayStatsWindow); + mCheckTrackerWindow = std::make_shared("gCheckTrackerEnabled", "Check Tracker"); + gui->AddGuiWindow(mCheckTrackerWindow); + mCheckTrackerSettingsWindow = std::make_shared("gCheckTrackerSettingsEnabled", "Check Tracker Settings"); + gui->AddGuiWindow(mCheckTrackerSettingsWindow); + mEntranceTrackerWindow = std::make_shared("gEntranceTrackerEnabled","Entrance Tracker"); + gui->AddGuiWindow(mEntranceTrackerWindow); + mItemTrackerWindow = std::make_shared("gItemTrackerEnabled", "Item Tracker"); + gui->AddGuiWindow(mItemTrackerWindow); + mItemTrackerSettingsWindow = std::make_shared("gItemTrackerSettingsEnabled", "Item Tracker Settings"); + gui->AddGuiWindow(mItemTrackerSettingsWindow); + mRandomizerSettingsWindow = std::make_shared("gRandomizerSettingsEnabled", "Randomizer Settings"); + gui->AddGuiWindow(mRandomizerSettingsWindow); + } + + void Destroy() { + mRandomizerSettingsWindow = nullptr; + mItemTrackerWindow = nullptr; + mItemTrackerSettingsWindow = nullptr; + mEntranceTrackerWindow = nullptr; + mCheckTrackerWindow = nullptr; + mCheckTrackerSettingsWindow = nullptr; + mGameplayStatsWindow = nullptr; + mDLViewerWindow = nullptr; + mSaveEditorWindow = nullptr; + mColViewerWindow = nullptr; + mActorViewerWindow = nullptr; + mCosmeticsEditorWindow = nullptr; + mGameControlEditorWindow = nullptr; + mAudioEditorWindow = nullptr; + mInputEditorWindow = nullptr; + mStatsWindow = nullptr; + mConsoleWindow = nullptr; + mSohMenuBar = nullptr; + } +} diff --git a/soh/soh/SohGui.hpp b/soh/soh/SohGui.hpp new file mode 100644 index 000000000..59333fd42 --- /dev/null +++ b/soh/soh/SohGui.hpp @@ -0,0 +1,42 @@ +// +// SohGui.hpp +// soh +// +// Created by David Chavez on 24.08.22. +// + +#ifndef SohGui_hpp +#define SohGui_hpp + +#include +#include "SohMenuBar.h" +#include "Enhancements/audio/AudioEditor.h" +#include "Enhancements/controls/GameControlEditor.h" +#include "Enhancements/cosmetics/CosmeticsEditor.h" +#include "Enhancements/debugger/actorViewer.h" +#include "Enhancements/debugger/colViewer.h" +#include "Enhancements/debugger/debugSaveEditor.h" +#include "Enhancements/debugger/dlViewer.h" +#include "Enhancements/gameplaystatswindow.h" +#include "Enhancements/randomizer/randomizer_check_tracker.h" +#include "Enhancements/randomizer/randomizer_entrance_tracker.h" +#include "Enhancements/randomizer/randomizer_item_tracker.h" +#include "Enhancements/randomizer/randomizer_settings_window.h" + +#ifdef __cplusplus +extern "C" { +#endif + void enableBetaQuest(); + void disableBetaQuest(); +#ifdef __cplusplus +} +#endif + +namespace SohGui { + void SetupHooks(); + void SetupGuiElements(); + void Draw(); + void Destroy(); +} + +#endif /* SohGui_hpp */ diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp new file mode 100644 index 000000000..18effbe81 --- /dev/null +++ b/soh/soh/SohMenuBar.cpp @@ -0,0 +1,1463 @@ +#include "SohMenuBar.h" +#include "ImGui/imgui.h" +#include "public/bridge/consolevariablebridge.h" +#include +#include "UIWidgets.hpp" +#include "include/z64audio.h" +#include "OTRGlobals.h" +#include "z64.h" +#include "Enhancements/game-interactor/GameInteractor.h" +#include "soh/Enhancements/presets.h" +#include "soh/Enhancements/mods.h" +#include "Enhancements/cosmetics/authenticGfxPatches.h" +#ifdef ENABLE_CROWD_CONTROL +#include "Enhancements/crowd-control/CrowdControl.h" +#endif + + +#include "Enhancements/audio/AudioEditor.h" +#include "Enhancements/controls/GameControlEditor.h" +#include "Enhancements/cosmetics/CosmeticsEditor.h" +#include "Enhancements/debugger/actorViewer.h" +#include "Enhancements/debugger/colViewer.h" +#include "Enhancements/debugger/debugSaveEditor.h" +#include "Enhancements/debugger/dlViewer.h" +#include "Enhancements/gameplaystatswindow.h" +#include "Enhancements/randomizer/randomizer_check_tracker.h" +#include "Enhancements/randomizer/randomizer_entrance_tracker.h" +#include "Enhancements/randomizer/randomizer_item_tracker.h" +#include "Enhancements/randomizer/randomizer_settings_window.h" + +extern bool ShouldClearTextureCacheAtEndOfFrame; +extern bool isBetaQuestEnabled; + +extern "C" PlayState* gPlayState; + +enum SeqPlayers { + /* 0 */ SEQ_BGM_MAIN, + /* 1 */ SEQ_FANFARE, + /* 2 */ SEQ_SFX, + /* 3 */ SEQ_BGM_SUB, + /* 4 */ SEQ_MAX +}; + +std::string GetWindowButtonText(const char* text, bool menuOpen) { + char buttonText[100] = ""; + if (menuOpen) { + strcat(buttonText, ICON_FA_CHEVRON_RIGHT " "); + } + strcat(buttonText, text); + if (!menuOpen) { strcat(buttonText, " "); } + return buttonText; +} + + static const char* filters[3] = { +#ifdef __WIIU__ + "", +#else + "Three-Point", +#endif + "Linear", "None" + }; + + static const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" }; + static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" }; + static const char* allPowers[9] = { + "Vanilla (1x)", + "Double (2x)", + "Quadruple (4x)", + "Octuple (8x)", + "Foolish (16x)", + "Ridiculous (32x)", + "Merciless (64x)", + "Pure Torture (128x)", + "OHKO (256x)" }; + static const char* subPowers[8] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6], allPowers[7] }; + static const char* subSubPowers[7] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6] }; + static const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" }; + static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" }; + static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" }; + static const char* bonkDamageValues[8] = { + "No Damage", + "0.25 Heart", + "0.5 Heart", + "1 Heart", + "2 Hearts", + "4 Hearts", + "8 Hearts", + "OHKO" + }; + +extern "C" SaveContext gSaveContext; + +namespace SohGui { + +void DrawMenuBarIcon() { + static bool gameIconLoaded = false; + if (!gameIconLoaded) { + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTexture("Game_Icon", "textures/icons/gIcon.png"); + gameIconLoaded = true; + } + + if (LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon")) { +#ifdef __SWITCH__ + ImVec2 iconSize = ImVec2(20.0f, 20.0f); + float posScale = 1.0f; +#elif defined(__WIIU__) + ImVec2 iconSize = ImVec2(16.0f * 2, 16.0f * 2); + float posScale = 2.0f; +#else + ImVec2 iconSize = ImVec2(16.0f, 16.0f); + float posScale = 1.0f; +#endif + ImGui::SetCursorPos(ImVec2(5, 2.5f) * posScale); + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), iconSize); + ImGui::SameLine(); + ImGui::SetCursorPos(ImVec2(25, 0) * posScale); + } +} + +void DrawShipMenu() { + if (ImGui::BeginMenu("Ship")) { + if (ImGui::MenuItem("Reset", +#ifdef __APPLE__ + "Command-R" +#else + "Ctrl+R" +#endif + )) { + std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); + } +#if !defined(__SWITCH__) && !defined(__WIIU__) + auto backend = LUS::Context::GetInstance()->GetWindow()->GetWindowBackend(); + if (ImGui::MenuItem("Toggle Fullscreen", "F9")) { + LUS::Context::GetInstance()->GetWindow()->ToggleFullscreen(); + } + if (ImGui::MenuItem("Quit")) { + LUS::Context::GetInstance()->GetWindow()->Close(); + } +#endif + ImGui::EndMenu(); + } +} + +extern std::shared_ptr mInputEditorWindow; +extern std::shared_ptr mGameControlEditorWindow; + +void DrawSettingsMenu() { + if (ImGui::BeginMenu("Settings")) + { + if (ImGui::BeginMenu("Audio")) { + UIWidgets::PaddedEnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true); + if (UIWidgets::PaddedEnhancementSliderFloat("Main Music Volume: %d %%", "##Main_Music_Vol", "gMainMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f)); + } + if (UIWidgets::PaddedEnhancementSliderFloat("Sub Music Volume: %d %%", "##Sub_Music_Vol", "gSubMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f)); + } + if (UIWidgets::PaddedEnhancementSliderFloat("Sound Effects Volume: %d %%", "##Sound_Effect_Vol", "gSFXMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); + } + if (UIWidgets::PaddedEnhancementSliderFloat("Fanfare Volume: %d %%", "##Fanfare_Vol", "gFanfareVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f)); + } + + static std::unordered_map audioBackendNames = { + { LUS::AudioBackend::WASAPI, "Windows Audio Session API" }, + { LUS::AudioBackend::PULSE, "PulseAudio" }, + { LUS::AudioBackend::SDL, "SDL" }, + }; + + ImGui::Text("Audio API (Needs reload)"); + auto currentAudioBackend = LUS::Context::GetInstance()->GetAudio()->GetAudioBackend(); + + if (LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { + UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); + } + if (ImGui::BeginCombo("##AApi", audioBackendNames[currentAudioBackend])) { + for (uint8_t i = 0; i < LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) { + auto backend = LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i]; + if (ImGui::Selectable(audioBackendNames[backend], backend == currentAudioBackend)) { + LUS::Context::GetInstance()->GetAudio()->SetAudioBackend(backend); + } + } + ImGui::EndCombo(); + } + if (LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { + UIWidgets::ReEnableComponent(""); + } + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Controller")) { + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2 (12.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); + if (mInputEditorWindow) { + if (ImGui::Button(GetWindowButtonText("Controller Mapping", CVarGetInteger("gControllerConfigurationEnabled", 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { + mInputEditorWindow->ToggleVisibility(); + } + } + if (mGameControlEditorWindow) { + if (ImGui::Button(GetWindowButtonText("Additional Controller Options", CVarGetInteger("gGameControlEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mGameControlEditorWindow->ToggleVisibility(); + } + } + UIWidgets::PaddedSeparator(); + ImGui::PopStyleColor(1); + ImGui::PopStyleVar(3); + #ifndef __SWITCH__ + UIWidgets::EnhancementCheckbox("Menubar Controller Navigation", "gControlNav"); + UIWidgets::Tooltip("Allows controller navigation of the SOH menu bar (Settings, Enhancements,...)\nCAUTION: This will disable game inputs while the menubar is visible.\n\nD-pad to move between items, A to select, and X to grab focus on the menu bar"); + #endif + UIWidgets::PaddedEnhancementCheckbox("Show Inputs", "gInputEnabled", true, false); + UIWidgets::Tooltip("Shows currently pressed inputs on the bottom right of the screen"); + UIWidgets::PaddedEnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false, true, true, false); + UIWidgets::Tooltip("Sets the on screen size of the displayed inputs from the Show Inputs setting"); + UIWidgets::PaddedEnhancementSliderInt("Simulated Input Lag: %d frames", "##SimulatedInputLag", "gSimulatedInputLag", 0, 6, "", 0, true, true, false); + UIWidgets::Tooltip("Buffers your inputs to be executed a specified amount of frames later"); + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Graphics")) { + #ifndef __APPLE__ + UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true); + UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing"); + // OTRTODO: fix this + // LUS::SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1)); + #endif + #ifndef __WIIU__ + UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, true, true, false); + UIWidgets::Tooltip("Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel"); + // OTRTODO: fix this + // LUS::SetMSAALevel(CVarGetInteger("gMSAAValue", 1)); + #endif + + { // FPS Slider + const int minFps = 20; + static int maxFps; + if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { + maxFps = 360; + } else { + maxFps = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + } + int currentFps = fmax(fmin(OTRGlobals::Instance->GetInterpolationFPS(), maxFps), minFps); + #ifdef __WIIU__ + UIWidgets::Spacer(0); + // only support divisors of 60 on the Wii U + if (currentFps > 60) { + currentFps = 60; + } else { + currentFps = 60 / (60 / currentFps); + } + + int fpsSlider = 1; + if (currentFps == 20) { + ImGui::Text("FPS: Original (20)"); + } else { + ImGui::Text("FPS: %d", currentFps); + if (currentFps == 30) { + fpsSlider = 2; + } else { // currentFps == 60 + fpsSlider = 3; + } + } + if (CVarGetInteger("gMatchRefreshRate", 0)) { + UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); + } + + if (ImGui::Button(" - ##WiiUFPS")) { + fpsSlider--; + } + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); + + UIWidgets::Spacer(0); + + ImGui::SliderInt("##WiiUFPSSlider", &fpsSlider, 1, 3, "", ImGuiSliderFlags_AlwaysClamp); + + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); + if (ImGui::Button(" + ##WiiUFPS")) { + fpsSlider++; + } + + if (CVarGetInteger("gMatchRefreshRate", 0)) { + UIWidgets::ReEnableComponent(""); + } + if (fpsSlider > 3) { + fpsSlider = 3; + } else if (fpsSlider < 1) { + fpsSlider = 1; + } + + if (fpsSlider == 1) { + currentFps = 20; + } else if (fpsSlider == 2) { + currentFps = 30; + } else if (fpsSlider == 3) { + currentFps = 60; + } + CVarSetInteger("gInterpolationFPS", currentFps); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + #else + bool matchingRefreshRate = + CVarGetInteger("gMatchRefreshRate", 0) && LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() != LUS::WindowBackend::DX11; + UIWidgets::PaddedEnhancementSliderInt( + (currentFps == 20) ? "FPS: Original (20)" : "FPS: %d", + "##FPSInterpolation", "gInterpolationFPS", minFps, maxFps, "", 20, true, true, false, matchingRefreshRate); + #endif + if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { + UIWidgets::Tooltip( + "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is purely " + "visual and does not impact game logic, execution of glitches etc.\n\n" + "A higher target FPS than your monitor's refresh rate will waste resources, and might give a worse result." + ); + } else { + UIWidgets::Tooltip( + "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is purely " + "visual and does not impact game logic, execution of glitches etc." + ); + } + } // END FPS Slider + + if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { + UIWidgets::Spacer(0); + if (ImGui::Button("Match Refresh Rate")) { + int hz = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + if (hz >= 20 && hz <= 360) { + CVarSetInteger("gInterpolationFPS", hz); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + } + } + } else { + UIWidgets::PaddedEnhancementCheckbox("Match Refresh Rate", "gMatchRefreshRate", true, false); + } + UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate"); + + if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { + UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger("gExtraLatencyThreshold", 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS", + "##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 80, true, true, false); + UIWidgets::Tooltip("When Interpolation FPS setting is at least this threshold, add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter. This setting allows the CPU to work on one frame while GPU works on the previous frame.\nThis setting should be used when your computer is too slow to do CPU + GPU work in time."); + } + + UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f); + + + static std::unordered_map windowBackendNames = { + { LUS::WindowBackend::DX11, "DirectX" }, + { LUS::WindowBackend::SDL_OPENGL, "OpenGL"}, + { LUS::WindowBackend::SDL_METAL, "Metal" }, + { LUS::WindowBackend::GX2, "GX2"} + }; + + ImGui::Text("Renderer API (Needs reload)"); + LUS::WindowBackend runningWindowBackend = LUS::Context::GetInstance()->GetWindow()->GetWindowBackend(); + LUS::WindowBackend configWindowBackend; + int configWindowBackendId = LUS::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1); + if (configWindowBackendId != -1 && configWindowBackendId < static_cast(LUS::WindowBackend::BACKEND_COUNT)) { + configWindowBackend = static_cast(configWindowBackendId); + } else { + configWindowBackend = runningWindowBackend; + } + + if (LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { + UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); + } + if (ImGui::BeginCombo("##RApi", windowBackendNames[configWindowBackend])) { + for (size_t i = 0; i < LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size(); i++) { + auto backend = LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->data()[i]; + if (ImGui::Selectable(windowBackendNames[backend], backend == configWindowBackend)) { + LUS::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id", static_cast(backend)); + LUS::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name", + windowBackendNames[backend]); + LUS::Context::GetInstance()->GetConfig()->Save(); + } + } + ImGui::EndCombo(); + } + if (LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { + UIWidgets::ReEnableComponent(""); + } + + if (LUS::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { + UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false); + } + + if (LUS::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen()) { + UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", "gSdlWindowedFullscreen", true, false); + } + + if (LUS::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports()) { + UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows", "gEnableMultiViewports", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip("Allows windows to be able to be dragged off of the main game window. Requires a reload to take effect."); + } + + // If more filters are added to LUS, make sure to add them to the filters list here + ImGui::Text("Texture Filter (Needs reload)"); + + UIWidgets::EnhancementCombobox("gTextureFilter", filters, 0); + + UIWidgets::Spacer(0); + + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings(); + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Languages")) { + UIWidgets::PaddedEnhancementCheckbox("Translate Title Screen", "gTitleScreenTranslation"); + if (UIWidgets::EnhancementRadioButton("English", "gLanguages", LANGUAGE_ENG)) { + GameInteractor::Instance->ExecuteHooks(); + } + if (UIWidgets::EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER)) { + GameInteractor::Instance->ExecuteHooks(); + } + if (UIWidgets::EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA)) { + GameInteractor::Instance->ExecuteHooks(); + } + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Accessibility")) { + #if defined(_WIN32) || defined(__APPLE__) + UIWidgets::PaddedEnhancementCheckbox("Text to Speech", "gA11yTTS"); + UIWidgets::Tooltip("Enables text to speech for in game dialog"); + #endif + UIWidgets::PaddedEnhancementCheckbox("Disable Idle Camera Re-Centering", "gA11yDisableIdleCam"); + UIWidgets::Tooltip("Disables the automatic re-centering of the camera when idle."); + + ImGui::EndMenu(); + } + ImGui::EndMenu(); + } +} + +extern std::shared_ptr mAudioEditorWindow; +extern std::shared_ptr mCosmeticsEditorWindow; +extern std::shared_ptr mGameplayStatsWindow; + +void DrawEnhancementsMenu() { + if (ImGui::BeginMenu("Enhancements")) + { + DrawPresetSelector(PRESET_TYPE_ENHANCEMENTS); + + UIWidgets::PaddedSeparator(); + + if (ImGui::BeginMenu("Gameplay")) + { + if (ImGui::BeginMenu("Time Savers")) + { + UIWidgets::PaddedEnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "", 1, true, false, true); + UIWidgets::PaddedEnhancementCheckbox("Skip Text", "gSkipText", false, true); + UIWidgets::Tooltip("Holding down B skips text"); + UIWidgets::PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "", 1, true, false, true); + UIWidgets::PaddedEnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "", 3, true, false, true); + UIWidgets::Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword"); + UIWidgets::PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0, true, false, true); + UIWidgets::PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", "gFasterBlockPush", 0, 5, "", 0, true, false, true); + UIWidgets::PaddedEnhancementCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift", true, false); + UIWidgets::Tooltip("Speeds up lifting silver rocks and obelisks"); + UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName", true, false); + UIWidgets::Tooltip("Allows you to have \"Link\" as a premade file name"); + UIWidgets::PaddedEnhancementCheckbox("No Forced Navi", "gNoForcedNavi", true, false); + UIWidgets::Tooltip("Prevent forced Navi conversations"); + UIWidgets::PaddedEnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze", true, false); + UIWidgets::Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas"); + UIWidgets::PaddedEnhancementCheckbox("Fast Chests", "gFastChests", true, false); + UIWidgets::Tooltip("Kick open every chest"); + UIWidgets::PaddedText("Chest size & texture matches contents", true, false); + if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 0)) { + if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) == 0) { + CVarSetInteger("gChestSizeDependsStoneOfAgony", 0); + } + } + UIWidgets::Tooltip( + "Chest sizes and textures are changed to help identify the item inside.\n" + " - Major items: Large gold chests\n" + " - Lesser items: Large brown chests\n" + " - Junk items: Small brown chests\n" + " - Small keys: Small silver chest\n" + " - Boss keys: Vanilla size and texture\n" + " - Skulltula Tokens: Small skulltula chest\n" + ); + if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) > 0) { + UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false); + UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony."); + } + UIWidgets::PaddedEnhancementCheckbox("Skip Pickup Messages", "gFastDrops", true, false); + UIWidgets::Tooltip("Skip pickup messages for new consumable items and bottle swipes"); + UIWidgets::PaddedEnhancementCheckbox("Ask to Equip New Items", "gAskToEquip", true, false); + UIWidgets::Tooltip("Adds a prompt to equip newly-obtained swords, shields and tunics"); + UIWidgets::PaddedEnhancementCheckbox("Better Owl", "gBetterOwl", true, false); + UIWidgets::Tooltip("The default response to Kaepora Gaebora is always that you understood what he said"); + UIWidgets::PaddedEnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", true, false); + bool forceSkipScarecrow = gSaveContext.n64ddFlag && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SKIP_SCARECROWS_SONG); + static const char* forceSkipScarecrowText = + "This setting is forcefully enabled because a savefile\nwith \"Skip Scarecrow Song\" is loaded"; + UIWidgets::Tooltip("Skip the part where the Ocarina playback is called when you play a song"); + UIWidgets::PaddedEnhancementCheckbox("Skip Scarecrow Song", "gSkipScarecrow", true, false, + forceSkipScarecrow, forceSkipScarecrowText, UIWidgets::CheckboxGraphics::Checkmark); + UIWidgets::Tooltip("Pierre appears when Ocarina is pulled out. Requires learning scarecrow song."); + UIWidgets::PaddedEnhancementCheckbox("Remember Save Location", "gRememberSaveLocation", true, false); + UIWidgets::Tooltip("When loading a save, places Link at the last entrance he went through.\n" + "This doesn't work if the save was made in a grotto."); + UIWidgets::PaddedEnhancementCheckbox("Skip Magic Arrow Equip Animation", "gSkipArrowAnimation", true, false); + UIWidgets::PaddedEnhancementCheckbox("Skip save confirmation", "gSkipSaveConfirmation", true, false); + UIWidgets::Tooltip("Skip the \"Game saved.\" confirmation screen"); + UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false); + UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking " + "to the guard next to the gate."); + UIWidgets::PaddedEnhancementCheckbox("Faster Farore's Wind", "gFastFarores", true, false); + UIWidgets::Tooltip("Greatly decreases cast time of Farore's Wind magic spell."); + UIWidgets::PaddedEnhancementCheckbox("Nighttime GS Always Spawn", "gNightGSAlwaysSpawn", true, false); + UIWidgets::Tooltip("Nighttime Skulltulas will spawn during both day and night."); + UIWidgets::PaddedEnhancementCheckbox("Dampe Appears All Night", "gDampeAllNight", true, false); + UIWidgets::Tooltip("Makes Dampe appear anytime during the night, not just his usual working hours."); + UIWidgets::PaddedEnhancementCheckbox("Time Travel with the Song of Time", "gTimeTravel", true, false); + UIWidgets::Tooltip("Allows Link to freely change age by playing the Song of Time.\n" + "Time Blocks can still be used properly.\n\n" + "Requirements:\n" + "- Obtained the Ocarina of Time\n" + "- Obtained the Song of Time\n" + "- Obtained the Master Sword\n" + "- Not within range of Time Block\n" + "- Not within range of Ocarina playing spots"); + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Items")) + { + UIWidgets::PaddedEnhancementCheckbox("Instant Putaway", "gInstantPutaway", true, false); + UIWidgets::Tooltip("Allow Link to put items away without having to wait around"); + UIWidgets::PaddedEnhancementCheckbox("Instant Boomerang Recall", "gFastBoomerang", true, false); + UIWidgets::Tooltip("Instantly return the boomerang to Link by pressing its item button while it's in the air"); + UIWidgets::PaddedEnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput", true, false); + UIWidgets::Tooltip("Prevent dropping inputs when playing the ocarina quickly"); + UIWidgets::PaddedText("Bunny Hood Effect", true, false); + UIWidgets::EnhancementCombobox("gMMBunnyHood", bunnyHoodOptions, 0); + UIWidgets::Tooltip( + "Wearing the Bunny Hood grants a speed increase like in Majora's Mask. The longer jump option is not accounted for in randomizer logic.\n\n" + "Also disables NPC's reactions to wearing the Bunny Hood." + ); + UIWidgets::PaddedEnhancementCheckbox("Mask Select in Inventory", "gMaskSelect", true, false); + UIWidgets::Tooltip("After completing the mask trading sub-quest, press A and any direction on the mask slot to change masks"); + UIWidgets::PaddedEnhancementCheckbox("Nuts explode bombs", "gNutsExplodeBombs", true, false); + UIWidgets::Tooltip("Makes nuts explode bombs, similar to how they interact with bombchus. This does not affect bombflowers."); + UIWidgets::PaddedEnhancementCheckbox("Equip Multiple Arrows at Once", "gSeparateArrows", true, false); + UIWidgets::Tooltip("Allow the bow and magic arrows to be equipped at the same time on different slots"); + UIWidgets::PaddedEnhancementCheckbox("Bow as Child/Slingshot as Adult", "gBowSlingShotAmmoFix", true, false); + UIWidgets::Tooltip("Allows child to use bow with arrows.\nAllows adult to use slingshot with seeds.\n\nRequires glitches or 'Timeless Equipment' cheat to equip."); + UIWidgets::PaddedEnhancementCheckbox("Better Farore's Wind", "gBetterFW", true, false); + UIWidgets::Tooltip("Helps FW persist between ages, gives child and adult separate FW points, and can be used in more places."); + UIWidgets::PaddedEnhancementCheckbox("Static Explosion Radius", "gStaticExplosionRadius", true, false); + UIWidgets::Tooltip("Explosions are now a static size, like in Majora's Mask and OoT3D. Makes bombchu hovering much easier."); + UIWidgets::PaddedEnhancementCheckbox("Prevent Bombchus Forcing First-Person", "gDisableFirstPersonChus", true, false); + UIWidgets::Tooltip("Prevent bombchus from forcing the camera into first-person mode when released."); + UIWidgets::PaddedEnhancementCheckbox("Aiming reticle for the bow/slingshot", "gBowReticle", true, false); + UIWidgets::Tooltip("Aiming with a bow or slingshot will display a reticle as with the hookshot when the projectile is ready to fire."); + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Difficulty Options")) + { + ImGui::Text("Damage Multiplier"); + UIWidgets::EnhancementCombobox("gDamageMul", allPowers, 0); + UIWidgets::Tooltip( + "Modifies all sources of damage not affected by other sliders\n" + "2x: Can survive all common attacks from the start of the game\n" + "4x: Dies in 1 hit to any substantial attack from the start of the game\n" + "8x: Can only survive trivial damage from the start of the game\n" + "16x: Can survive all common attacks with max health without double defense\n" + "32x: Can survive all common attacks with max health and double defense\n" + "64x: Can survive trivial damage with max health without double defense\n" + "128x: Can survive trivial damage with max health and double defense\n" + "256x: Cannot survive damage" + ); + UIWidgets::PaddedText("Fall Damage Multiplier", true, false); + UIWidgets::EnhancementCombobox("gFallDamageMul", subPowers, 0); + UIWidgets::Tooltip( + "Modifies all fall damage\n" + "2x: Can survive all fall damage from the start of the game\n" + "4x: Can only survive short fall damage from the start of the game\n" + "8x: Cannot survive any fall damage from the start of the game\n" + "16x: Can survive all fall damage with max health without double defense\n" + "32x: Can survive all fall damage with max health and double defense\n" + "64x: Can survive short fall damage with double defense\n" + "128x: Cannot survive fall damage" + ); + UIWidgets::PaddedText("Void Damage Multiplier", true, false); + UIWidgets::EnhancementCombobox("gVoidDamageMul", subSubPowers, 0); + UIWidgets::Tooltip( + "Modifies damage taken after falling into a void\n" + "2x: Can survive void damage from the start of the game\n" + "4x: Cannot survive void damage from the start of the game\n" + "8x: Can survive void damage twice with max health without double defense\n" + "16x: Can survive void damage with max health without double defense\n" + "32x: Can survive void damage with max health and double defense\n" + "64x: Cannot survive void damage" + ); + UIWidgets::PaddedText("Bonk Damage Multiplier", true, false); + UIWidgets::EnhancementCombobox("gBonkDamageMul", bonkDamageValues, 0); + UIWidgets::Tooltip("Modifies damage taken after bonking."); + UIWidgets::PaddedEnhancementCheckbox("Spawn with full health", "gFullHealthSpawn", true, false); + UIWidgets::Tooltip("Respawn with full health instead of 3 Hearts"); + UIWidgets::PaddedEnhancementCheckbox("No Random Drops", "gNoRandomDrops", true, false); + UIWidgets::Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses"); + bool forceEnableBombchuDrops = gSaveContext.n64ddFlag && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_ENABLE_BOMBCHU_DROPS) == 1; + static const char* forceEnableBombchuDropsText = + "This setting is forcefully enabled because a savefile\nwith \"Enable Bombchu Drops\" is loaded."; + UIWidgets::PaddedEnhancementCheckbox("Enable Bombchu Drops", "gBombchuDrops", true, false, + forceEnableBombchuDrops, forceEnableBombchuDropsText, UIWidgets::CheckboxGraphics::Checkmark); + UIWidgets::Tooltip("Bombchus will sometimes drop in place of bombs"); + UIWidgets::PaddedEnhancementCheckbox("No Heart Drops", "gNoHeartDrops", true, false); + UIWidgets::Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series"); + UIWidgets::PaddedEnhancementCheckbox("Hyper Bosses", "gHyperBosses", true, false); + UIWidgets::Tooltip("All major bosses move and act twice as fast."); + UIWidgets::PaddedEnhancementCheckbox("Hyper Enemies", "gHyperEnemies", true, false); + UIWidgets::Tooltip("All regular enemies and mini-bosses move and act twice as fast."); + UIWidgets::PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false); + UIWidgets::Tooltip("Always get the heart piece/purple rupee from the spinning Goron pot"); + UIWidgets::PaddedEnhancementCheckbox("Always Win Dampe Digging Game", "gDampeWin", true, false, SaveManager::Instance->IsRandoFile(), + "This setting is always enabled in randomizer files", UIWidgets::CheckboxGraphics::Checkmark); + UIWidgets::Tooltip("Always win the heart piece/purple rupee on the first dig in Dampe's grave digging game, just like in rando\nIn a rando file, this is unconditionally enabled"); + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Potion Values")) + { + UIWidgets::EnhancementCheckbox("Change Red Potion Effect", "gRedPotionEffect"); + UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Red Potions"); + bool disabledRedPotion = !CVarGetInteger("gRedPotionEffect", 0); + static const char* disabledTooltipRedPotion = "This option is disabled because \"Change Red Potion Effect\" is turned off"; + UIWidgets::EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", "gRedPotionHealth", 1, 100, "", 0, true, disabledRedPotion, disabledTooltipRedPotion); + UIWidgets::Tooltip("Changes the amount of health restored by Red Potions"); + UIWidgets::EnhancementCheckbox("Red Potion Percent Restore", "gRedPercentRestore", disabledRedPotion, disabledTooltipRedPotion); + UIWidgets::Tooltip("Toggles from Red Potions restoring a fixed amount of health to a percent of the player's current max health"); + + ImGui::Separator(); + + UIWidgets::EnhancementCheckbox("Change Green Potion Effect", "gGreenPotionEffect"); + UIWidgets::Tooltip("Enable the following changes to the amount of mana restored by Green Potions"); + bool disabledGreenPotion = !CVarGetInteger("gGreenPotionEffect", 0); + static const char* disabledTooltipGreenPotion = "This option is disabled because \"Change Green Potion Effect\" is turned off"; + UIWidgets::EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", "gGreenPotionMana", 1, 100, "", 0, true, disabledGreenPotion, disabledTooltipGreenPotion); + UIWidgets::Tooltip("Changes the amount of mana restored by Green Potions, base max mana is 48, max upgraded mana is 96"); + UIWidgets::EnhancementCheckbox("Green Potion Percent Restore", "gGreenPercentRestore", disabledGreenPotion, disabledTooltipGreenPotion); + UIWidgets::Tooltip("Toggles from Green Potions restoring a fixed amount of mana to a percent of the player's current max mana"); + + ImGui::Separator(); + + UIWidgets::EnhancementCheckbox("Change Blue Potion Effects", "gBluePotionEffects"); + UIWidgets::Tooltip("Enable the following changes to the amount of health and mana restored by Blue Potions"); + bool disabledBluePotion = !CVarGetInteger("gBluePotionEffects", 0); + static const char* disabledTooltipBluePotion = "This option is disabled because \"Change Blue Potion Effects\" is turned off"; + UIWidgets::EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", "gBluePotionHealth", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::Tooltip("Changes the amount of health restored by Blue Potions"); + UIWidgets::EnhancementCheckbox("Blue Potion Health Percent Restore", "gBlueHealthPercentRestore", disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::Tooltip("Toggles from Blue Potions restoring a fixed amount of health to a percent of the player's current max health"); + + ImGui::Separator(); + + UIWidgets::EnhancementSliderInt("Blue Potion Mana: %d", "##BLUEPOTIONMANA", "gBluePotionMana", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::Tooltip("Changes the amount of mana restored by Blue Potions, base max mana is 48, max upgraded mana is 96"); + UIWidgets::EnhancementCheckbox("Blue Potion Mana Percent Restore", "gBlueManaPercentRestore", disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::Tooltip("Toggles from Blue Potions restoring a fixed amount of mana to a percent of the player's current max mana"); + + ImGui::Separator(); + + UIWidgets::EnhancementCheckbox("Change Milk Effect", "gMilkEffect"); + UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Milk"); + bool disabledMilk = !CVarGetInteger("gMilkEffect", 0); + static const char* disabledTooltipMilk = "This option is disabled because \"Change Milk Effect\" is turned off"; + UIWidgets::EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", "gMilkHealth", 1, 100, "", 0, true, disabledMilk, disabledTooltipMilk); + UIWidgets::Tooltip("Changes the amount of health restored by Milk"); + UIWidgets::EnhancementCheckbox("Milk Percent Restore", "gMilkPercentRestore", disabledMilk, disabledTooltipMilk); + UIWidgets::Tooltip("Toggles from Milk restoring a fixed amount of health to a percent of the player's current max health"); + + ImGui::Separator(); + + UIWidgets::EnhancementCheckbox("Separate Half Milk Effect", "gSeparateHalfMilkEffect", disabledMilk, disabledTooltipMilk); + UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Half Milk\nIf this is disabled, Half Milk will behave the same as Full Milk."); + bool disabledHalfMilk = disabledMilk || !CVarGetInteger("gSeparateHalfMilkEffect", 0); + static const char* disabledTooltipHalfMilk = "This option is disabled because \"Separate Half Milk Effect\" is turned off"; + UIWidgets::EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", "gHalfMilkHealth", 1, 100, "", 0, true, disabledHalfMilk, disabledTooltipHalfMilk); + UIWidgets::Tooltip("Changes the amount of health restored by Half Milk"); + UIWidgets::EnhancementCheckbox("Half Milk Percent Restore", "gHalfMilkPercentRestore", disabledHalfMilk, disabledTooltipHalfMilk); + UIWidgets::Tooltip("Toggles from Half Milk restoring a fixed amount of health to a percent of the player's current max health"); + + ImGui::Separator(); + + UIWidgets::EnhancementCheckbox("Change Fairy Effect", "gFairyEffect"); + UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairies"); + bool disabledFairy = !CVarGetInteger("gFairyEffect", 0); + static const char* disabledTooltipFairy = "This option is disabled because \"Change Fairy Effect\" is turned off"; + UIWidgets::EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", "gFairyHealth", 1, 100, "", 0, true, disabledFairy, disabledTooltipFairy); + UIWidgets::Tooltip("Changes the amount of health restored by Fairies"); + UIWidgets::EnhancementCheckbox("Fairy Percent Restore", "gFairyPercentRestore", disabledFairy, disabledTooltipFairy); + UIWidgets::Tooltip("Toggles from Fairies restoring a fixed amount of health to a percent of the player's current max health"); + + ImGui::Separator(); + + UIWidgets::EnhancementCheckbox("Change Fairy Revive Effect", "gFairyReviveEffect"); + UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairy Revivals"); + bool disabledFairyRevive = !CVarGetInteger("gFairyReviveEffect", 0); + static const char* disabledTooltipFairyRevive = "This option is disabled because \"Change Fairy Revive Effect\" is turned off"; + UIWidgets::EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", "gFairyReviveHealth", 1, 100, "", 0, true, disabledFairyRevive, disabledTooltipFairyRevive); + UIWidgets::Tooltip("Changes the amount of health restored by Fairy Revivals"); + UIWidgets::EnhancementCheckbox("Fairy Revive Percent Restore", "gFairyRevivePercentRestore", disabledFairyRevive, disabledTooltipFairyRevive); + UIWidgets::Tooltip("Toggles from Fairy Revivals restoring a fixed amount of health to a percent of the player's current max health"); + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Shooting Gallery")) { + UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeShootingGallery"); + UIWidgets::Tooltip("Turn on/off changes to the shooting gallery behavior"); + bool disabled = !CVarGetInteger("gCustomizeShootingGallery", 0); + static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; + UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantShootingGalleryWin", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Skips the shooting gallery minigame"); + UIWidgets::PaddedEnhancementCheckbox("No Rupee Randomization", "gConstantAdultGallery", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Forces the rupee order to not be randomized as adult, making it the same as chlid"); + UIWidgets::PaddedEnhancementSliderInt("Child Starting Ammunition: %d", "##cShootingGalleryAmmunition", "gChildShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as a child"); + UIWidgets::PaddedEnhancementSliderInt("Adult Starting Ammunition: %d", "##aShootingGalleryAmmunition", "gAdultShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as an adult"); + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Bombchu Bowling")) { + UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeBombchuBowling"); + UIWidgets::Tooltip("Turn on/off changes to the bombchu bowling behavior"); + bool disabled = CVarGetInteger("gCustomizeBombchuBowling", 0) == 0; + static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; + UIWidgets::PaddedEnhancementCheckbox("Remove Small Cucco", "gBombchuBowlingNoSmallCucco", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Prevents the small cucco from appearing in the bombchu bowling minigame"); + UIWidgets::PaddedEnhancementCheckbox("Remove Big Cucco", "gBombchuBowlingNoBigCucco", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Prevents the big cucco from appearing in the bombchu bowling minigame"); + UIWidgets::PaddedEnhancementSliderInt("Bombchu Count: %d", "##cBombchuBowlingAmmunition", "gBombchuBowlingAmmunition", 3, 20, "", 10, true, true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("The number of bombchus available at the start of the bombchu bowling minigame"); + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Fishing")) { + UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeFishing"); + UIWidgets::Tooltip("Turn on/off changes to the fishing behavior"); + bool disabled = !CVarGetInteger("gCustomizeFishing", 0); + static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; + UIWidgets::PaddedEnhancementCheckbox("Instant Fishing", "gInstantFishing", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("All fish will be caught instantly"); + UIWidgets::PaddedEnhancementCheckbox("Guarantee Bite", "gGuaranteeFishingBite", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("When a line is stable, guarantee bite. Otherwise use default logic"); + UIWidgets::PaddedEnhancementCheckbox("Fish Never Escape", "gFishNeverEscape", true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("Once a hook has been set, fish will never let go while being reeled in."); + UIWidgets::PaddedEnhancementSliderInt("Child Minimum Weight: %d", "##cMinimumWeight", "gChildMinimumWeightFish", 3, 10, "", 10, true, true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("The minimum weight for the unique fishing reward as a child"); + UIWidgets::PaddedEnhancementSliderInt("Adult Minimum Weight: %d", "##aMinimumWeight", "gAdultMinimumWeightFish", 6, 13, "", 13, true, true, false, disabled, disabledTooltip); + UIWidgets::Tooltip("The minimum weight for the unique fishing reward as an adult"); + ImGui::EndMenu(); + } + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Reduced Clutter")) + { + UIWidgets::EnhancementCheckbox("Mute Low HP Alarm", "gLowHpAlarm"); + UIWidgets::Tooltip("Disable the low HP beeping sound"); + UIWidgets::PaddedEnhancementCheckbox("Minimal UI", "gMinimalUI", true, false); + UIWidgets::Tooltip("Hides most of the UI when not needed\nNote: Doesn't activate until after loading a new scene"); + UIWidgets::PaddedEnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio", true, false); + UIWidgets::Tooltip("Disables the voice audio when Navi calls you"); + UIWidgets::PaddedEnhancementCheckbox("Disable Hot/Underwater Warning Text", "gDisableTunicWarningText", true, false); + UIWidgets::Tooltip("Disables warning text when you don't have on the Goron/Zora Tunic in Hot/Underwater conditions."); + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + UIWidgets::EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony"); + UIWidgets::Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); + UIWidgets::PaddedEnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots", true, false); + UIWidgets::Tooltip("Allows equipping the tunic and boots to c-buttons"); + UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved", true, false); + UIWidgets::Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); + UIWidgets::PaddedEnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime", true, false); + UIWidgets::Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods"); + UIWidgets::PaddedEnhancementCheckbox("Enable visible guard vision", "gGuardVision", true, false); + UIWidgets::PaddedEnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect", true, false); + UIWidgets::PaddedEnhancementCheckbox("Item counts in messages", "gInjectItemCounts", true, false); + UIWidgets::Tooltip("Injects item counts in pickup messages, like golden skulltula tokens and heart pieces"); + UIWidgets::PaddedEnhancementCheckbox("Pull grave during the day", "gDayGravePull", true, false); + UIWidgets::Tooltip("Allows graves to be pulled when child during the day"); + UIWidgets::PaddedEnhancementCheckbox("Dogs follow you everywhere", "gDogFollowsEverywhere", true, false); + UIWidgets::Tooltip("Allows dogs to follow you anywhere you go, even if you leave the market"); + UIWidgets::PaddedEnhancementCheckbox("Don't require input for Credits sequence", "gNoInputForCredits", true, false); + UIWidgets::Tooltip("Removes the input requirement on textboxes after defeating Ganon, allowing Credits sequence to continue to progress"); + + // Blue Fire Arrows + bool forceEnableBlueFireArrows = gSaveContext.n64ddFlag && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BLUE_FIRE_ARROWS); + static const char* forceEnableBlueFireArrowsText = + "This setting is forcefully enabled because a savefile\nwith \"Blue Fire Arrows\" is loaded."; + UIWidgets::PaddedEnhancementCheckbox("Blue Fire Arrows", "gBlueFireArrows", true, false, + forceEnableBlueFireArrows, forceEnableBlueFireArrowsText, UIWidgets::CheckboxGraphics::Checkmark); + UIWidgets::Tooltip("Allows Ice Arrows to melt red ice.\nMay require a room reload if toggled during gameplay."); + + // Sunlight Arrows + bool forceEnableSunLightArrows = gSaveContext.n64ddFlag && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SUNLIGHT_ARROWS); + static const char* forceEnableSunLightArrowsText = + "This setting is forcefully enabled because a savefile\nwith \"Sunlight Arrows\" is loaded."; + UIWidgets::PaddedEnhancementCheckbox("Sunlight Arrows", "gSunlightArrows", true, false, + forceEnableSunLightArrows, forceEnableSunLightArrowsText, UIWidgets::CheckboxGraphics::Checkmark); + UIWidgets::Tooltip("Allows Light Arrows to activate sun switches.\nMay require a room reload if toggled during gameplay."); + + UIWidgets::PaddedEnhancementCheckbox("Disable Crit wiggle", "gDisableCritWiggle", true, false); + UIWidgets::Tooltip("Disable random camera wiggle at low health"); + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Graphics")) + { + if (UIWidgets::PaddedEnhancementCheckbox("Use Alternate Assets", "gAltAssets", true, false)) { + ShouldClearTextureCacheAtEndOfFrame = true; + } + UIWidgets::PaddedEnhancementCheckbox("Disable LOD", "gDisableLOD", true, false); + UIWidgets::Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance"); + if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false)) { + if (CVarGetInteger("gDisableDrawDistance", 0) == 0) { + CVarSetInteger("gDisableKokiriDrawDistance", 0); + } + } + UIWidgets::Tooltip("Turns off the objects draw distance, making objects being visible from a longer range"); + if (CVarGetInteger("gDisableDrawDistance", 0) == 1) { + UIWidgets::PaddedEnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance", true, false); + UIWidgets::Tooltip("The Kokiri are mystical beings that fade into view when approached\nEnabling this will remove their draw distance"); + } + UIWidgets::PaddedEnhancementCheckbox("N64 Mode", "gLowResMode", true, false); + UIWidgets::Tooltip("Sets aspect ratio to 4:3 and lowers resolution to 240p, the N64's native resolution"); + UIWidgets::PaddedEnhancementCheckbox("Glitch line-up tick", "gDrawLineupTick", true, false); + UIWidgets::Tooltip("Displays a tick in the top center of the screen to help with glitch line-ups in SoH, as traditional UI based line-ups do not work outside of 4:3"); + UIWidgets::PaddedEnhancementCheckbox("Enable 3D Dropped items/projectiles", "gNewDrops", true, false); + UIWidgets::Tooltip("Change most 2D items and projectiles on the overworld to their 3D versions"); + UIWidgets::PaddedEnhancementCheckbox("Disable Black Bar Letterboxes", "gDisableBlackBars", true, false); + UIWidgets::Tooltip("Disables Black Bar Letterboxes during cutscenes and Z-targeting\nNote: there may be minor visual glitches that were covered up by the black bars\nPlease disable this setting before reporting a bug"); + UIWidgets::PaddedEnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon", true, false); + UIWidgets::Tooltip("Changes the rupee in the wallet icon to match the wallet size you currently have"); + UIWidgets::PaddedEnhancementCheckbox("Always show dungeon entrances", "gAlwaysShowDungeonMinimapIcon", true, false); + UIWidgets::Tooltip("Always shows dungeon entrance icons on the minimap"); + UIWidgets::PaddedEnhancementCheckbox("Show Gauntlets in First Person", "gFPSGauntlets", true, false); + UIWidgets::Tooltip("Renders Gauntlets when using the Bow and Hookshot like in OOT3D"); + UIWidgets::Spacer(0); + if (ImGui::BeginMenu("Animated Link in Pause Menu")) { + ImGui::Text("Rotation"); + UIWidgets::EnhancementRadioButton("Disabled", "gPauseLiveLinkRotation", 0); + UIWidgets::EnhancementRadioButton("Rotate Link with D-pad", "gPauseLiveLinkRotation", 1); + UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the D-pad\nUse D-pad Up or D-pad Down to reset Link's rotation"); + UIWidgets::EnhancementRadioButton("Rotate Link with C-buttons", "gPauseLiveLinkRotation", 2); + UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the C-buttons\nUse C-Up or C-Down to reset Link's rotation"); + UIWidgets::EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3); + UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the Right Stick\nYou can zoom in by pointing up and reset Link's rotation by pointing down"); + if (CVarGetInteger("gPauseLiveLinkRotation", 0) != 0) { + UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", "gPauseLiveLinkRotationSpeed", 1, 20, "", 1); + } + UIWidgets::PaddedSeparator(); + ImGui::Text("Static loop"); + UIWidgets::EnhancementRadioButton("Disabled", "gPauseLiveLink", 0); + UIWidgets::EnhancementRadioButton("Idle (standing)", "gPauseLiveLink", 1); + UIWidgets::EnhancementRadioButton("Idle (look around)", "gPauseLiveLink", 2); + UIWidgets::EnhancementRadioButton("Idle (belt)", "gPauseLiveLink", 3); + UIWidgets::EnhancementRadioButton("Idle (shield)", "gPauseLiveLink", 4); + UIWidgets::EnhancementRadioButton("Idle (test sword)", "gPauseLiveLink", 5); + UIWidgets::EnhancementRadioButton("Idle (yawn)", "gPauseLiveLink", 6); + UIWidgets::EnhancementRadioButton("Battle Stance", "gPauseLiveLink", 7); + UIWidgets::EnhancementRadioButton("Walking (no shield)", "gPauseLiveLink", 8); + UIWidgets::EnhancementRadioButton("Walking (holding shield)", "gPauseLiveLink", 9); + UIWidgets::EnhancementRadioButton("Running (no shield)", "gPauseLiveLink", 10); + UIWidgets::EnhancementRadioButton("Running (holding shield)", "gPauseLiveLink", 11); + UIWidgets::EnhancementRadioButton("Hand on hip", "gPauseLiveLink", 12); + UIWidgets::EnhancementRadioButton("Spin attack charge", "gPauseLiveLink", 13); + UIWidgets::EnhancementRadioButton("Look at hand", "gPauseLiveLink", 14); + UIWidgets::PaddedSeparator(); + ImGui::Text("Randomize"); + UIWidgets::EnhancementRadioButton("Random", "gPauseLiveLink", 15); + UIWidgets::Tooltip("Randomize the animation played each time you open the menu"); + UIWidgets::EnhancementRadioButton("Random cycle", "gPauseLiveLink", 16); + UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time"); + UIWidgets::EnhancementRadioButton("Random cycle (Idle)", "gPauseLiveLink", 17); + UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time (Idle animations only)"); + if (CVarGetInteger("gPauseLiveLink", 0) >= 16) { + UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", "gMinFrameCount", 1, 1000, "", 0); + } + + ImGui::EndMenu(); + } + UIWidgets::PaddedText("Fix Vanishing Paths", true, false); + if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", zFightingOptions, 0) && gPlayState != NULL) { + UpdateDirtPathFixState(gPlayState->sceneNum); + } + UIWidgets::Tooltip("Disabled: Paths vanish more the higher the resolution (Z-fighting is based on resolution)\n" + "Consistent: Certain paths vanish the same way in all resolutions\n" + "No Vanish: Paths do not vanish, Link seems to sink in to some paths\n" + "This might affect other decal effects\n"); + UIWidgets::PaddedEnhancementSliderInt("Text Spacing: %d", "##TEXTSPACING", "gTextSpacing", 4, 6, "", 6, true, true, true); + UIWidgets::Tooltip("Space between text characters (useful for HD font textures)"); + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Fixes")) + { + UIWidgets::EnhancementCheckbox("Fix L&R Pause menu", "gUniformLR"); + UIWidgets::Tooltip("Makes the L and R buttons in the pause menu the same color"); + UIWidgets::PaddedEnhancementCheckbox("Fix L&Z Page switch in Pause menu", "gNGCKaleidoSwitcher", true, false); + UIWidgets::Tooltip("Makes L and R switch pages like on the GameCube\nZ opens the Debug Menu instead"); + UIWidgets::PaddedEnhancementCheckbox("Fix Dungeon entrances", "gFixDungeonMinimapIcon", true, false); + UIWidgets::Tooltip("Removes the dungeon entrance icon on the top-left corner of the screen when no dungeon is present on the current map"); + UIWidgets::PaddedEnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle", true, false); + UIWidgets::Tooltip("Re-enables the two-handed idle animation, a seemingly finished animation that was disabled on accident in the original game"); + UIWidgets::PaddedEnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix", true, false); + UIWidgets::Tooltip("Fixes a bug where the Gravedigging Tour Heart Piece disappears if the area reloads"); + UIWidgets::PaddedEnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix", true, false); + UIWidgets::Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw"); + UIWidgets::PaddedEnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix", true, false); + UIWidgets::Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button"); + UIWidgets::PaddedEnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix", true, false); + UIWidgets::Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield"); + if (UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix", true, false)) { + if (!CVarGetInteger("gCrouchStabHammerFix", 0)) { + CVarClear("gCrouchStabFix"); + } + } + UIWidgets::Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally"); + if (CVarGetInteger("gCrouchStabHammerFix", 0)) { + UIWidgets::PaddedEnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix", true, false); + UIWidgets::Tooltip("Make crouch stabbing always do the same damage as a regular slash"); + } + UIWidgets::PaddedEnhancementCheckbox("Fix credits timing", "gCreditsFix", true, false); + UIWidgets::Tooltip("Extend certain credits scenes so the music lines up properly with the visuals"); + UIWidgets::PaddedEnhancementCheckbox("Fix Gerudo Warrior's clothing colors", "gGerudoWarriorClothingFix", true, false); + UIWidgets::Tooltip("Prevent the Gerudo Warrior's clothes changing color when changing Link's tunic or using bombs in front of her"); + UIWidgets::PaddedEnhancementCheckbox("Fix Camera Drift", "gFixCameraDrift", true, false); + UIWidgets::Tooltip("Fixes camera slightly drifting to the left when standing still due to a math error"); + UIWidgets::PaddedEnhancementCheckbox("Fix Camera Swing", "gFixCameraSwing", true, false); + UIWidgets::Tooltip("Fixes camera getting stuck on collision when standing still, also fixes slight shift back in camera when stop moving"); + UIWidgets::PaddedEnhancementCheckbox("Fix Hanging Ledge Swing Rate", "gFixHangingLedgeSwingRate", true, false); + UIWidgets::Tooltip("Fixes camera swing rate when player falls off a ledge and camera swings around"); + UIWidgets::PaddedEnhancementCheckbox("Fix Missing Jingle after 5 Silver Rupees", "gSilverRupeeJingleExtend", true, false); + UIWidgets::Tooltip( + "Adds 5 higher pitches for the Silver Rupee Jingle for the rooms with more than 5 Silver Rupees. " + "Currently only relevant in Master Quest."); + if (UIWidgets::PaddedEnhancementCheckbox("Fix out of bounds textures", "gFixTexturesOOB", true, false)) { + ApplyAuthenticGfxPatches(); + } + UIWidgets::Tooltip("Fixes authentic out of bounds texture reads, instead loading textures with the correct size"); + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Restoration")) + { + UIWidgets::EnhancementCheckbox("Authentic Logo Screen", "gAuthenticLogo"); + UIWidgets::Tooltip("Hide the game version and build details and display the authentic model and texture on the boot logo start screen"); + UIWidgets::PaddedEnhancementCheckbox("Red Ganon blood", "gRedGanonBlood", true, false); + UIWidgets::Tooltip("Restore the original red blood from NTSC 1.0/1.1. Disable for green blood"); + UIWidgets::PaddedEnhancementCheckbox("Fish while hovering", "gHoverFishing", true, false); + UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows casting the Fishing Rod while using the Hover Boots"); + UIWidgets::PaddedEnhancementCheckbox("N64 Weird Frames", "gN64WeirdFrames", true, false); + UIWidgets::Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64"); + UIWidgets::PaddedEnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB", true, false); + UIWidgets::Tooltip("Allows bombchus to explode out of bounds\nSimilar to GameCube and Wii VC"); + UIWidgets::PaddedEnhancementCheckbox("Quick Putaway", "gQuickPutaway", true, false); + UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows putting away an item without an animation and performing Putaway Ocarina Items"); + UIWidgets::PaddedEnhancementCheckbox("Restore old Gold Skulltula cutscene", "gGsCutscene", true, false); + UIWidgets::PaddedEnhancementCheckbox("Quick Bongo Kill", "gQuickBongoKill", true, false); + UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows bypassing Bongo Bongo's intro cutscene to quickly kill him"); + + ImGui::EndMenu(); + } + + UIWidgets::Spacer(0); + + if (ImGui::BeginMenu("Extra Modes")) { + UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false); + UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and " + "press the C-Buttons to use items and mess with Player 1!"); + + UIWidgets::Spacer(0); + + UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", "gRupeeDash", true, false); + + if (CVarGetInteger("gRupeeDash", 0)) { + UIWidgets::Tooltip("Rupees reduced over time, Link suffers damage when the count hits 0."); + UIWidgets::PaddedEnhancementSliderInt( + "Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 3, 5, "", 5, true, true, false, + !CVarGetInteger("gRupeeDash", 0), + "This option is disabled because \"Rupee Dash Mode\" is turned off"); + UIWidgets::Tooltip("Interval between Rupee reduction in Rupee Dash Mode"); + } + + UIWidgets::Spacer(0); + + UIWidgets::PaddedEnhancementCheckbox("Shadow Tag Mode", "gShadowTag", true, false); + + if (CVarGetInteger("gShadowTag", 0)) { + UIWidgets::Tooltip("A wallmaster follows Link everywhere, don't get caught!"); + } + + ImGui::EndMenu(); + } + + UIWidgets::PaddedSeparator(false, true); + + // Autosave enum value of 1 is the default in presets and the old checkbox "on" state for backwards compatibility + UIWidgets::PaddedText("Autosave", false, true); + UIWidgets::EnhancementCombobox("gAutosave", autosaveLabels, 0); + UIWidgets::Tooltip("Automatically save the game when changing locations and/or obtaining items\n" + "Major items exclude rupees and health/magic/ammo refills (but include bombchus unless bombchu drops are enabled)"); + + UIWidgets::PaddedSeparator(true, true, 2.0f, 2.0f); + + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); + + if (mCosmeticsEditorWindow) { + if (ImGui::Button(GetWindowButtonText("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mCosmeticsEditorWindow->ToggleVisibility(); + } + } + + if (mAudioEditorWindow) { + if (ImGui::Button(GetWindowButtonText("Audio Editor", CVarGetInteger("gAudioEditor.WindowOpen", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mAudioEditorWindow->ToggleVisibility(); + } + } + + if (mGameplayStatsWindow) { + if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mGameplayStatsWindow->ToggleVisibility(); + } + } + ImGui::PopStyleVar(3); + ImGui::PopStyleColor(1); + + #ifdef __SWITCH__ + UIWidgets::Spacer(0); + ImGui::Text("Switch performance mode"); + if (UIWidgets::EnhancementCombobox("gSwitchPerfMode", SWITCH_CPU_PROFILES, (int)LUS::SwitchProfiles::STOCK)) { + SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger("gSwitchPerfMode", (int)LUS::SwitchProfiles::STOCK)]); + LUS::Switch::ApplyOverclock(); + } + #endif + + ImGui::EndMenu(); + } +} + +void DrawCheatsMenu() { + if (ImGui::BeginMenu("Cheats")) + { + if (ImGui::BeginMenu("Infinite...")) { + UIWidgets::EnhancementCheckbox("Money", "gInfiniteMoney"); + UIWidgets::PaddedEnhancementCheckbox("Health", "gInfiniteHealth", true, false); + UIWidgets::PaddedEnhancementCheckbox("Ammo", "gInfiniteAmmo", true, false); + UIWidgets::PaddedEnhancementCheckbox("Magic", "gInfiniteMagic", true, false); + UIWidgets::PaddedEnhancementCheckbox("Nayru's Love", "gInfiniteNayru", true, false); + UIWidgets::PaddedEnhancementCheckbox("Epona Boost", "gInfiniteEpona", true, false); + + ImGui::EndMenu(); + } + + UIWidgets::PaddedEnhancementCheckbox("No Clip", "gNoClip", true, false); + UIWidgets::Tooltip("Allows you to walk through walls"); + UIWidgets::PaddedEnhancementCheckbox("Climb Everything", "gClimbEverything", true, false); + UIWidgets::Tooltip("Makes every surface in the game climbable"); + UIWidgets::PaddedEnhancementCheckbox("Hookshot Everything", "gHookshotEverything", true, false); + UIWidgets::Tooltip("Makes every surface in the game hookshot-able"); + UIWidgets::EnhancementSliderFloat("Hookshot Reach Multiplier: %.1fx", "##gCheatHookshotReachMultiplier", "gCheatHookshotReachMultiplier", 1.0f, 5.0f, "", 1.0f, false); + UIWidgets::PaddedEnhancementCheckbox("Moon Jump on L", "gMoonJumpOnL", true, false); + UIWidgets::Tooltip("Holding L makes you float into the air"); + UIWidgets::PaddedEnhancementCheckbox("Super Tunic", "gSuperTunic", true, false); + UIWidgets::Tooltip("Makes every tunic have the effects of every other tunic"); + UIWidgets::PaddedEnhancementCheckbox("Easy ISG", "gEzISG", true, false); + UIWidgets::Tooltip("Passive Infinite Sword Glitch\nIt makes your sword's swing effect and hitbox stay active indefinitely"); + UIWidgets::PaddedEnhancementCheckbox("Timeless Equipment", "gTimelessEquipment", true, false); + UIWidgets::Tooltip("Allows any item to be equipped, regardless of age\nAlso allows Child to use Adult strength upgrades"); + UIWidgets::PaddedEnhancementCheckbox("Easy Frame Advancing", "gCheatEasyPauseBufferEnabled", true, false); + UIWidgets::Tooltip("Continue holding START button when unpausing to only advance a single frame and then re-pause"); + const bool bEasyFrameAdvanceEnabled = CVarGetInteger("gCheatEasyPauseBufferEnabled", 0); + UIWidgets::PaddedEnhancementCheckbox("Easy Input Buffering", "gCheatEasyInputBufferingEnabled", true, false, bEasyFrameAdvanceEnabled, "Forced enabled when Easy Frame Advancing is enabled"); + UIWidgets::Tooltip("Inputs that are held down while the Subscreen is closing will be pressed when the game is resumed"); + UIWidgets::PaddedEnhancementCheckbox("Unrestricted Items", "gNoRestrictItems", true, false); + UIWidgets::Tooltip("Allows you to use any item at any location"); + UIWidgets::PaddedEnhancementCheckbox("Freeze Time", "gFreezeTime", true, false); + UIWidgets::Tooltip("Freezes the time of day"); + UIWidgets::PaddedEnhancementCheckbox("Drops Don't Despawn", "gDropsDontDie", true, false); + UIWidgets::Tooltip("Drops from enemies, grass, etc. don't disappear after a set amount of time"); + UIWidgets::PaddedEnhancementCheckbox("Fireproof Deku Shield", "gFireproofDekuShield", true, false); + UIWidgets::Tooltip("Prevents the Deku Shield from burning on contact with fire"); + UIWidgets::PaddedEnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded", true, false); + UIWidgets::Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks"); + UIWidgets::PaddedEnhancementCheckbox("Time Sync", "gTimeSync", true, false); + UIWidgets::Tooltip("This syncs the ingame time with the real world time"); + UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); + UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); + + { + static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); + static int32_t lastBetaQuestEnabled = betaQuestEnabled; + static int32_t betaQuestWorld = CVarGetInteger("gBetaQuestWorld", 0xFFEF); + static int32_t lastBetaQuestWorld = betaQuestWorld; + + if (!isBetaQuestEnabled) { + UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); + } + + UIWidgets::PaddedEnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest", true, false); + UIWidgets::Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game."); + betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); + if (betaQuestEnabled) { + if (betaQuestEnabled != lastBetaQuestEnabled) { + betaQuestWorld = 0; + } + + ImGui::Text("Beta Quest World: %d", betaQuestWorld); + + if (ImGui::Button(" - ##BetaQuest")) { + betaQuestWorld--; + } + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); + + ImGui::SliderInt("##BetaQuest", &betaQuestWorld, 0, 8, "", ImGuiSliderFlags_AlwaysClamp); + UIWidgets::Tooltip("Set the Beta Quest world to explore. *WARNING* Changing this will reset your game.\nCtrl+Click to type in a value."); + + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f); + if (ImGui::Button(" + ##BetaQuest")) { + betaQuestWorld++; + } + + if (betaQuestWorld > 8) { + betaQuestWorld = 8; + } + else if (betaQuestWorld < 0) { + betaQuestWorld = 0; + } + } + else { + lastBetaQuestWorld = betaQuestWorld = 0xFFEF; + CVarClear("gBetaQuestWorld"); + } + if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld) + { + // Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene. + lastBetaQuestEnabled = betaQuestEnabled; + lastBetaQuestWorld = betaQuestWorld; + CVarSetInteger("gEnableBetaQuest", betaQuestEnabled); + CVarSetInteger("gBetaQuestWorld", betaQuestWorld); + + std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + } + + if (!isBetaQuestEnabled) { + UIWidgets::ReEnableComponent(""); + } + } + + if (ImGui::Button("Change Age")) { + CVarSetInteger("gSwitchAge", 1); + } + UIWidgets::Tooltip("Switches Link's age and reloads the area."); + + ImGui::EndMenu(); + } +} + +extern std::shared_ptr mStatsWindow; +extern std::shared_ptr mConsoleWindow; +extern std::shared_ptr mSaveEditorWindow; +extern std::shared_ptr mColViewerWindow; +extern std::shared_ptr mActorViewerWindow; +extern std::shared_ptr mDLViewerWindow; + +void DrawDeveloperToolsMenu() { + if (ImGui::BeginMenu("Developer Tools")) + { + UIWidgets::EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled"); + UIWidgets::Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right, and open the debug menu with L on the pause screen"); + UIWidgets::PaddedEnhancementCheckbox("OoT Skulltula Debug", "gSkulltulaDebugEnabled", true, false); + UIWidgets::Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map icons (boss key, compass, map screen locations, etc) will set the GS bits in that area.\nUSE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT."); + UIWidgets::PaddedEnhancementCheckbox("Fast File Select", "gSkipLogoTitle", true, false); + UIWidgets::Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu"); + if (CVarGetInteger("gSkipLogoTitle", 0)) { + ImGui::Text("Loading :"); + UIWidgets::EnhancementCombobox("gSaveFileID", FastFileSelect, 0); + }; + UIWidgets::PaddedEnhancementCheckbox("Better Debug Warp Screen", "gBetterDebugWarpScreen", true, false); + UIWidgets::Tooltip("Optimized debug warp screen, with the added ability to chose entrances and time of day"); + UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", "gDebugWarpScreenTranslation", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip("Translate the Debug Warp Screen based on the game language"); + UIWidgets::PaddedSeparator(); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0,0)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); + if (mStatsWindow) { + if (ImGui::Button(GetWindowButtonText("Stats", CVarGetInteger("gStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mStatsWindow->ToggleVisibility(); + } + UIWidgets::Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"); + } + UIWidgets::Spacer(0); + if (mConsoleWindow) { + if (ImGui::Button(GetWindowButtonText("Console", CVarGetInteger("gConsoleEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mConsoleWindow->ToggleVisibility(); + } + UIWidgets::Tooltip("Enables the console window, allowing you to input commands, type help for some examples"); + } + UIWidgets::Spacer(0); + if (mSaveEditorWindow) { + if (ImGui::Button(GetWindowButtonText("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mSaveEditorWindow->ToggleVisibility(); + } + } + UIWidgets::Spacer(0); + if (mColViewerWindow) { + if (ImGui::Button(GetWindowButtonText("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mColViewerWindow->ToggleVisibility(); + } + } + UIWidgets::Spacer(0); + if (mActorViewerWindow) { + if (ImGui::Button(GetWindowButtonText("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mActorViewerWindow->ToggleVisibility(); + } + } + UIWidgets::Spacer(0); + if (mDLViewerWindow) { + if (ImGui::Button(GetWindowButtonText("Display List Viewer", CVarGetInteger("gDLViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mDLViewerWindow->ToggleVisibility(); + } + } + + ImGui::PopStyleVar(3); + ImGui::PopStyleColor(1); + + ImGui::EndMenu(); + } +} + +extern std::shared_ptr mRandomizerSettingsWindow; +extern std::shared_ptr mItemTrackerWindow; +extern std::shared_ptr mItemTrackerSettingsWindow; +extern std::shared_ptr mEntranceTrackerWindow; +extern std::shared_ptr mCheckTrackerWindow; +extern std::shared_ptr mCheckTrackerSettingsWindow; + +void DrawRandomizerMenu() { + if (ImGui::BeginMenu("Randomizer")) { + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); + #ifdef __WIIU__ + static ImVec2 buttonSize(200.0f * 2.0f, 0.0f); + #else + static ImVec2 buttonSize(200.0f, 0.0f); + #endif + if (mRandomizerSettingsWindow) { + if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0)).c_str(), buttonSize)) { + mRandomizerSettingsWindow->ToggleVisibility(); + } + } + + UIWidgets::Spacer(0); + if (mItemTrackerWindow) { + if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonSize)) { + mItemTrackerWindow->ToggleVisibility(); + } + } + + UIWidgets::Spacer(0); + if (mItemTrackerSettingsWindow) { + if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize)) { + mItemTrackerSettingsWindow->ToggleVisibility(); + } + } + UIWidgets::Spacer(0); + if (mEntranceTrackerWindow) { + if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonSize)) { + mEntranceTrackerWindow->ToggleVisibility(); + } + } + UIWidgets::Spacer(0); + if (mCheckTrackerWindow) { + if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonSize)) { + mCheckTrackerWindow->ToggleVisibility(); + } + } + UIWidgets::Spacer(0); + if (mCheckTrackerSettingsWindow) { + if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize)) { + mCheckTrackerSettingsWindow->ToggleVisibility(); + } + } + ImGui::PopStyleVar(3); + ImGui::PopStyleColor(1); + + UIWidgets::PaddedSeparator(); + + if (ImGui::BeginMenu("Rando Enhancements")) + { + UIWidgets::EnhancementCheckbox("Rando-Relevant Navi Hints", "gRandoRelevantNavi", false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip( + "Replace Navi's overworld quest hints with rando-related gameplay hints." + ); + UIWidgets::PaddedEnhancementCheckbox("Random Rupee Names", "gRandomizeRupeeNames", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip( + "When obtaining rupees, randomize what the rupee is called in the textbox." + ); + + // Only disable the key colors checkbox when none of the keysanity settings are set to "Any Dungeon", "Overworld" or "Anywhere" + bool disableKeyColors = true; + + if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANY_DUNGEON || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OVERWORLD || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANYWHERE || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_KEYS) != RO_GERUDO_KEYS_VANILLA || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANY_DUNGEON || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OVERWORLD || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_ANYWHERE || + (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_VANILLA && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_OWN_DUNGEON && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) != RO_GANON_BOSS_KEY_STARTWITH) || + !gSaveContext.n64ddFlag) { + disableKeyColors = false; + } + + static const char* disableKeyColorsText = + "This setting is disabled because a savefile is loaded without any key\n" + "shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\""; + + UIWidgets::PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false, + disableKeyColors, disableKeyColorsText, UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip( + "Matches the color of small keys and boss keys to the dungeon they belong to. " + "This helps identify keys from afar and adds a little bit of flair.\n\nThis only " + "applies to seeds with keys and boss keys shuffled to Any Dungeon, Overworld, or Anywhere."); + UIWidgets::PaddedEnhancementCheckbox("Quest Item Fanfares", "gRandoQuestItemFanfares", true, false); + UIWidgets::Tooltip( + "Play unique fanfares when obtaining quest items " + "(medallions/stones/songs). Note that these fanfares are longer than usual." + ); + ImGui::EndMenu(); + } + + UIWidgets::PaddedSeparator(); + + #ifdef ENABLE_CROWD_CONTROL + UIWidgets::EnhancementCheckbox("Crowd Control", "gCrowdControl"); + UIWidgets::Tooltip("Will attempt to connect to the Crowd Control server. Check out crowdcontrol.live for more information."); + + if (CVarGetInteger("gCrowdControl", 0)) { + CrowdControl::Instance->Enable(); + } else { + CrowdControl::Instance->Disable(); + } + + UIWidgets::Spacer(0); + #endif + + UIWidgets::EnhancementCheckbox("Enemy Randomizer", "gRandomizedEnemies"); + UIWidgets::Tooltip( + "Randomizes regular enemies every time you load a room. Bosses, mini-bosses and a few specific regular enemies are excluded.\n\n" + "Enemies that need more than Deku Nuts + either Deku Sticks or a sword to kill are excluded from spawning in \"clear enemy\" rooms." + ); + + if (CVarGetInteger("gRandomizedEnemies", 0)) { + + bool disableSeededEnemies = !gSaveContext.n64ddFlag && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2; + static const char* disableSeededEnemiesText = "This setting is disabled because it relies on a randomizer savefile."; + + UIWidgets::PaddedEnhancementCheckbox("Seeded Enemy Spawns", "gSeededRandomizedEnemies", true, false, disableSeededEnemies, disableSeededEnemiesText); + UIWidgets::Tooltip( + "Enemy spawns will stay consistent throughout room reloads. Enemy spawns are based on randomizer seeds, so this only works with randomizer savefiles." + ); + } + + ImGui::EndMenu(); + } +} + +void SohMenuBar::DrawElement() { + if (ImGui::BeginMenuBar()) { + DrawMenuBarIcon(); + + static ImVec2 sWindowPadding(8.0f, 8.0f); + + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, sWindowPadding); + + DrawShipMenu(); + + ImGui::SetCursorPosY(0.0f); + + DrawSettingsMenu(); + + ImGui::SetCursorPosY(0.0f); + + DrawEnhancementsMenu(); + + ImGui::SetCursorPosY(0.0f); + + DrawCheatsMenu(); + + ImGui::SetCursorPosY(0.0f); + + DrawDeveloperToolsMenu(); + + ImGui::SetCursorPosY(0.0f); + + DrawRandomizerMenu(); + + ImGui::PopStyleVar(1); + ImGui::EndMenuBar(); + } +} +} // namespace SohGui \ No newline at end of file diff --git a/soh/soh/SohMenuBar.h b/soh/soh/SohMenuBar.h new file mode 100644 index 000000000..ce62344ad --- /dev/null +++ b/soh/soh/SohMenuBar.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include "window/gui/GuiMenuBar.h" +#include "window/gui/GuiElement.h" + +namespace SohGui { +class SohMenuBar : public LUS::GuiMenuBar { + public: + using LUS::GuiMenuBar::GuiMenuBar; + protected: + void DrawElement() override; + void InitElement() override {}; + void UpdateElement() override {}; +}; +} // namespace SohGui \ No newline at end of file diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index 30a6f6837..86ecaaef8 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -9,8 +9,7 @@ #define IMGUI_DEFINE_MATH_OPERATORS #include -#include -#include +#include #include #include "soh/Enhancements/cosmetics/CosmeticsEditor.h" @@ -206,7 +205,7 @@ namespace UIWidgets { bool val = (bool)CVarGetInteger(cvarName, defaultValue); if (CustomCheckbox(text, &val, disabled, disabledGraphic)) { CVarSetInteger(cvarName, val); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } @@ -246,7 +245,7 @@ namespace UIWidgets { CVarSetInteger(cvarName, i); selected = i; changed = true; - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } } @@ -259,7 +258,7 @@ namespace UIWidgets { if (disabledValue >= 0 && selected != disabledValue) { CVarSetInteger(cvarName, disabledValue); changed = true; - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } @@ -348,7 +347,7 @@ namespace UIWidgets { if (changed) { CVarSetInteger(cvarName, val); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } return changed; @@ -424,7 +423,7 @@ namespace UIWidgets { if (changed) { CVarSetFloat(cvarName, val); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } return changed; @@ -471,7 +470,7 @@ namespace UIWidgets { int val = CVarGetInteger(cvarName, 0); if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { CVarSetInteger(cvarName, id); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ret = true; } ImGui::SameLine(); @@ -498,7 +497,7 @@ namespace UIWidgets { CVarSetColor(cvarName, colorsRGBA); CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color"); @@ -523,7 +522,7 @@ namespace UIWidgets { NewColors.b = fmin(fmax(colors->z * 255, 0), 255); CVarSetColor(cvarName, NewColors); CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode. - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } Tooltip("Chooses a random color\nOverwrites previously chosen color"); @@ -584,7 +583,7 @@ namespace UIWidgets { colors.a = 255.0; CVarSetColor(cvarName, colors); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } } @@ -600,7 +599,7 @@ namespace UIWidgets { colors.a = ColorRGBA.w * 255.0; CVarSetColor(cvarName, colors); - LUS::RequestCvarSaveOnNextTick(); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } } diff --git a/soh/soh/resource/importer/AnimationFactory.cpp b/soh/soh/resource/importer/AnimationFactory.cpp index 6a7b47799..c2aaf3067 100644 --- a/soh/soh/resource/importer/AnimationFactory.cpp +++ b/soh/soh/resource/importer/AnimationFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr AnimationFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +AnimationFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Animation with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Animation with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -25,7 +24,7 @@ std::shared_ptr AnimationFactory::ReadResource(std::shared_ptr reader, std::shared_ptr resource) { +void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { std::shared_ptr animation = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, animation); diff --git a/soh/soh/resource/importer/AnimationFactory.h b/soh/soh/resource/importer/AnimationFactory.h index 6323e988c..dee2026f9 100644 --- a/soh/soh/resource/importer/AnimationFactory.h +++ b/soh/soh/resource/importer/AnimationFactory.h @@ -6,13 +6,12 @@ namespace LUS { class AnimationFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class AnimationFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/AudioSampleFactory.cpp b/soh/soh/resource/importer/AudioSampleFactory.cpp index a04734f45..9d1477a51 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.cpp +++ b/soh/soh/resource/importer/AudioSampleFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr AudioSampleFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +AudioSampleFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 2: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr AudioSampleFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr audioSample = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, audioSample); diff --git a/soh/soh/resource/importer/AudioSampleFactory.h b/soh/soh/resource/importer/AudioSampleFactory.h index 79b028860..6e9ddc17c 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.h +++ b/soh/soh/resource/importer/AudioSampleFactory.h @@ -7,14 +7,13 @@ namespace LUS { class AudioSampleFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class AudioSampleFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/AudioSequenceFactory.cpp b/soh/soh/resource/importer/AudioSequenceFactory.cpp index 20cb7fc18..a4862cb19 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.cpp +++ b/soh/soh/resource/importer/AudioSequenceFactory.cpp @@ -3,13 +3,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr AudioSequenceFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +AudioSequenceFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 2: factory = std::make_shared(); break; @@ -17,7 +16,7 @@ std::shared_ptr AudioSequenceFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -27,7 +26,7 @@ std::shared_ptr AudioSequenceFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr audioSequence = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, audioSequence); diff --git a/soh/soh/resource/importer/AudioSequenceFactory.h b/soh/soh/resource/importer/AudioSequenceFactory.h index 402f8788c..12b3809aa 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.h +++ b/soh/soh/resource/importer/AudioSequenceFactory.h @@ -7,14 +7,13 @@ namespace LUS { class AudioSequenceFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class AudioSequenceFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.cpp b/soh/soh/resource/importer/AudioSoundFontFactory.cpp index 9dc1d38c5..5a94cb5f8 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.cpp +++ b/soh/soh/resource/importer/AudioSoundFontFactory.cpp @@ -4,13 +4,12 @@ #include "libultraship/libultraship.h" namespace LUS { -std::shared_ptr AudioSoundFontFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +AudioSoundFontFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 2: factory = std::make_shared(); break; @@ -18,7 +17,7 @@ std::shared_ptr AudioSoundFontFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -28,7 +27,7 @@ std::shared_ptr AudioSoundFontFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr audioSoundFont = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont); @@ -88,7 +87,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr drum.sound.sample = nullptr; } else { auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); - drum.sound.sample = static_cast(res ? res->GetPointer() : nullptr); + drum.sound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } audioSoundFont->drums.push_back(drum); @@ -132,7 +131,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr std::string sampleFileName = reader->ReadString(); instrument.lowNotesSound.tuning = reader->ReadFloat(); auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); - instrument.lowNotesSound.sample = static_cast(res ? res->GetPointer() : nullptr); + instrument.lowNotesSound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } else { instrument.lowNotesSound.sample = nullptr; instrument.lowNotesSound.tuning = 0; @@ -144,7 +143,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr std::string sampleFileName = reader->ReadString(); instrument.normalNotesSound.tuning = reader->ReadFloat(); auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); - instrument.normalNotesSound.sample = static_cast(res ? res->GetPointer() : nullptr); + instrument.normalNotesSound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } else { instrument.normalNotesSound.sample = nullptr; instrument.normalNotesSound.tuning = 0; @@ -156,7 +155,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr std::string sampleFileName = reader->ReadString(); instrument.highNotesSound.tuning = reader->ReadFloat(); auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); - instrument.highNotesSound.sample = static_cast(res ? res->GetPointer() : nullptr); + instrument.highNotesSound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } else { instrument.highNotesSound.sample = nullptr; instrument.highNotesSound.tuning = 0; @@ -181,7 +180,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr std::string sampleFileName = reader->ReadString(); soundEffect.tuning = reader->ReadFloat(); auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); - soundEffect.sample = static_cast(res ? res->GetPointer() : nullptr); + soundEffect.sample = static_cast(res ? res->GetRawPointer() : nullptr); } audioSoundFont->soundEffects.push_back(soundEffect); diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.h b/soh/soh/resource/importer/AudioSoundFontFactory.h index dc142a0e7..7dd5bc0d5 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.h +++ b/soh/soh/resource/importer/AudioSoundFontFactory.h @@ -7,14 +7,13 @@ namespace LUS { class AudioSoundFontFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class AudioSoundFontFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/BackgroundFactory.cpp b/soh/soh/resource/importer/BackgroundFactory.cpp index 4359ef952..5b09ce70f 100644 --- a/soh/soh/resource/importer/BackgroundFactory.cpp +++ b/soh/soh/resource/importer/BackgroundFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr BackgroundFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +BackgroundFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Background with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Background with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -25,7 +24,7 @@ std::shared_ptr BackgroundFactory::ReadResource(std::shared_ptr reader, std::shared_ptr resource) { +void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { std::shared_ptr background = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, background); diff --git a/soh/soh/resource/importer/BackgroundFactory.h b/soh/soh/resource/importer/BackgroundFactory.h index 26ac35ee0..9767fdf8b 100644 --- a/soh/soh/resource/importer/BackgroundFactory.h +++ b/soh/soh/resource/importer/BackgroundFactory.h @@ -6,13 +6,12 @@ namespace LUS { class BackgroundFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class BackgroundFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.cpp b/soh/soh/resource/importer/CollisionHeaderFactory.cpp index afca936bc..3707229e3 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/CollisionHeaderFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr CollisionHeaderFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +CollisionHeaderFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr CollisionHeaderFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr collisionHeader = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, collisionHeader); diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.h b/soh/soh/resource/importer/CollisionHeaderFactory.h index 65c4aa424..09d6ba4c5 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.h +++ b/soh/soh/resource/importer/CollisionHeaderFactory.h @@ -6,13 +6,12 @@ namespace LUS { class CollisionHeaderFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class CollisionHeaderFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/CutsceneFactory.cpp b/soh/soh/resource/importer/CutsceneFactory.cpp index 8dccf821a..27c747a6e 100644 --- a/soh/soh/resource/importer/CutsceneFactory.cpp +++ b/soh/soh/resource/importer/CutsceneFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr CutsceneFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +CutsceneFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -81,7 +80,7 @@ static inline uint32_t read_CMD_HH(std::shared_ptr reader) { } void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr cutscene = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, cutscene); diff --git a/soh/soh/resource/importer/CutsceneFactory.h b/soh/soh/resource/importer/CutsceneFactory.h index 92402df99..a5813f6fe 100644 --- a/soh/soh/resource/importer/CutsceneFactory.h +++ b/soh/soh/resource/importer/CutsceneFactory.h @@ -7,14 +7,13 @@ namespace LUS { class CutsceneFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class CutsceneFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/PathFactory.cpp b/soh/soh/resource/importer/PathFactory.cpp index aa227610d..bb4f87eb6 100644 --- a/soh/soh/resource/importer/PathFactory.cpp +++ b/soh/soh/resource/importer/PathFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr PathFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +PathFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Path with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Path with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr PathFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr path = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, path); diff --git a/soh/soh/resource/importer/PathFactory.h b/soh/soh/resource/importer/PathFactory.h index ad1c68e95..3a8c0d595 100644 --- a/soh/soh/resource/importer/PathFactory.h +++ b/soh/soh/resource/importer/PathFactory.h @@ -7,14 +7,13 @@ namespace LUS { class PathFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class PathFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.cpp b/soh/soh/resource/importer/PlayerAnimationFactory.cpp index 0db77d309..ae9457669 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.cpp +++ b/soh/soh/resource/importer/PlayerAnimationFactory.cpp @@ -3,13 +3,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr PlayerAnimationFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +PlayerAnimationFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -17,7 +16,7 @@ std::shared_ptr PlayerAnimationFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -27,7 +26,7 @@ std::shared_ptr PlayerAnimationFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr playerAnimation = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, playerAnimation); diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.h b/soh/soh/resource/importer/PlayerAnimationFactory.h index a0fdf4a1b..b4981f7c6 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.h +++ b/soh/soh/resource/importer/PlayerAnimationFactory.h @@ -6,13 +6,12 @@ namespace LUS { class PlayerAnimationFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class PlayerAnimationFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/SceneFactory.cpp b/soh/soh/resource/importer/SceneFactory.cpp index 3fd1abaf8..01066ffc1 100644 --- a/soh/soh/resource/importer/SceneFactory.cpp +++ b/soh/soh/resource/importer/SceneFactory.cpp @@ -30,9 +30,8 @@ namespace LUS { -std::shared_ptr SceneFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr +SceneFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { if (SceneFactory::sceneCommandFactories.empty()) { SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightingSettings] = std::make_shared(); SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetWind] = std::make_shared(); @@ -61,17 +60,17 @@ std::shared_ptr SceneFactory::ReadResource(std::shared_ptr(); } - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Scene with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Scene with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -81,7 +80,7 @@ std::shared_ptr SceneFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr scene = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, scene); @@ -98,27 +97,27 @@ void SceneFactoryV0::ParseSceneCommands(std::shared_ptr scene, std::share } } -std::shared_ptr SceneFactoryV0::ParseSceneCommand(std::shared_ptr scene, +std::shared_ptr SceneFactoryV0::ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index) { SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32(); reader->Seek(-sizeof(int32_t), SeekOffsetType::Current); - std::shared_ptr result = nullptr; + std::shared_ptr result = nullptr; std::shared_ptr commandFactory = SceneFactory::sceneCommandFactories[cmdID]; if (commandFactory != nullptr) { auto initData = std::make_shared(); - initData->Id = scene->InitData->Id; + initData->Id = scene->GetInitData()->Id; initData->Type = ResourceType::SOH_SceneCommand; - initData->Path = scene->InitData->Path + "/SceneCommand" + std::to_string(index); - initData->ResourceVersion = scene->InitData->ResourceVersion; - result = std::static_pointer_cast(commandFactory->ReadResource(scene->ResourceManager, initData, reader)); + initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index); + initData->ResourceVersion = scene->GetInitData()->ResourceVersion; + result = std::static_pointer_cast(commandFactory->ReadResource(initData, reader)); // Cache the resource? } if (result == nullptr) { - SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, scene->InitData->Path); + SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, scene->GetInitData()->Path); } return result; diff --git a/soh/soh/resource/importer/SceneFactory.h b/soh/soh/resource/importer/SceneFactory.h index 16863edc4..59fe08ddf 100644 --- a/soh/soh/resource/importer/SceneFactory.h +++ b/soh/soh/resource/importer/SceneFactory.h @@ -9,9 +9,8 @@ namespace LUS { class SceneFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; // Doing something very similar to what we do on the ResourceLoader. // Eventually, scene commands should be moved up to the ResourceLoader as well. @@ -22,9 +21,9 @@ class SceneFactory : public ResourceFactory { class SceneFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); protected: - std::shared_ptr ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index); + std::shared_ptr ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index); }; }; // namespace LUS diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index 4741a3f2e..4920d47c9 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -4,20 +4,19 @@ #include namespace LUS { -std::shared_ptr SkeletonFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SkeletonFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,20 +25,19 @@ std::shared_ptr SkeletonFactory::ReadResource(std::shared_ptr SkeletonFactory::ReadResourceXML(std::shared_ptr resourceMgr, - std::shared_ptr initData, - tinyxml2::XMLElement* reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SkeletonFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -49,7 +47,7 @@ std::shared_ptr SkeletonFactory::ReadResourceXML(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr skeleton = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, skeleton); @@ -86,7 +84,7 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, for (size_t i = 0; i < skeleton->limbTable.size(); i++) { std::string limbStr = skeleton->limbTable[i]; auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str()); - skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr); + skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr); } if (skeleton->type == LUS::SkeletonType::Normal) { @@ -99,7 +97,7 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type); } } -void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) +void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { std::shared_ptr skel = std::static_pointer_cast(resource); @@ -143,7 +141,7 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p skel->limbTable.push_back(limbName); auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str()); - skel->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr); + skel->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr); } child = child->NextSiblingElement(); diff --git a/soh/soh/resource/importer/SkeletonFactory.h b/soh/soh/resource/importer/SkeletonFactory.h index 580bff1fb..d64449393 100644 --- a/soh/soh/resource/importer/SkeletonFactory.h +++ b/soh/soh/resource/importer/SkeletonFactory.h @@ -7,19 +7,17 @@ namespace LUS { class SkeletonFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; - std::shared_ptr ReadResourceXML(std::shared_ptr resourceMgr, - std::shared_ptr initData, - tinyxml2::XMLElement* reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; }; class SkeletonFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.cpp b/soh/soh/resource/importer/SkeletonLimbFactory.cpp index f4196c6be..22c18da24 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.cpp +++ b/soh/soh/resource/importer/SkeletonLimbFactory.cpp @@ -4,20 +4,19 @@ #include "libultraship/libultraship.h" namespace LUS { -std::shared_ptr SkeletonLimbFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SkeletonLimbFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,20 +25,19 @@ std::shared_ptr SkeletonLimbFactory::ReadResource(std::shared_ptr SkeletonLimbFactory::ReadResourceXML(std::shared_ptr resourceMgr, - std::shared_ptr initData, - tinyxml2::XMLElement* reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SkeletonLimbFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -49,7 +47,7 @@ std::shared_ptr SkeletonLimbFactory::ReadResourceXML(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr skeletonLimb = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb); @@ -135,14 +133,14 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r if (skeletonLimb->dListPtr != "") { auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); - skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr); + skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); } else { skeletonLimb->limbData.lodLimb.dLists[0] = nullptr; } if (skeletonLimb->dList2Ptr != "") { auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str()); - skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr); + skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); } else { skeletonLimb->limbData.lodLimb.dLists[1] = nullptr; } @@ -156,7 +154,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r if (!skeletonLimb->dListPtr.empty()) { const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); - skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetPointer() : nullptr); + skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); } } else if (skeletonLimb->limbType == LUS::LimbType::Curve) { skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex; @@ -166,12 +164,12 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r if (!skeletonLimb->dListPtr.empty()) { const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); - skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr); + skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); } if (!skeletonLimb->dList2Ptr.empty()) { const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str()); - skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr); + skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); } } else if (skeletonLimb->limbType == LUS::LimbType::Skin) { skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX; @@ -192,13 +190,13 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) { auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList.c_str()); - skeletonLimb->limbData.skinLimb.segment = res ? res->GetPointer() : nullptr; + skeletonLimb->limbData.skinLimb.segment = res ? res->GetRawPointer() : nullptr; } else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) { skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt; skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount; skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data(); auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList2.c_str()); - skeletonLimb->skinAnimLimbData.dlist = (Gfx*)(res ? res->GetPointer() : nullptr); + skeletonLimb->skinAnimLimbData.dlist = (Gfx*)(res ? res->GetRawPointer() : nullptr); for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) { skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size(); @@ -214,7 +212,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r } } } -void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) +void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { std::shared_ptr skelLimb = std::static_pointer_cast(resource); @@ -257,7 +255,7 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar if (skelLimb->dListPtr != "") { auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess((const char*)skelLimb->dListPtr.c_str()); - limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetPointer() : nullptr); + limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetRawPointer() : nullptr); } else { limbData.lodLimb.dLists[0] = nullptr; } diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.h b/soh/soh/resource/importer/SkeletonLimbFactory.h index 1d0204ab8..8480a0126 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.h +++ b/soh/soh/resource/importer/SkeletonLimbFactory.h @@ -7,19 +7,17 @@ namespace LUS { class SkeletonLimbFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; - std::shared_ptr ReadResourceXML(std::shared_ptr resourceMgr, - std::shared_ptr initData, - tinyxml2::XMLElement* reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; }; class SkeletonLimbFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/TextFactory.cpp b/soh/soh/resource/importer/TextFactory.cpp index 9dfb66dda..314dd135c 100644 --- a/soh/soh/resource/importer/TextFactory.cpp +++ b/soh/soh/resource/importer/TextFactory.cpp @@ -3,13 +3,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr TextFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +TextFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -19,7 +18,7 @@ std::shared_ptr TextFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -28,20 +27,19 @@ std::shared_ptr TextFactory::ReadResource(std::shared_ptr TextFactory::ReadResourceXML(std::shared_ptr resourceMgr, - std::shared_ptr initData, - tinyxml2::XMLElement* reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +TextFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Text with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -51,7 +49,7 @@ std::shared_ptr TextFactory::ReadResourceXML(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr text = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, text); @@ -68,7 +66,7 @@ void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr reader, text->messages.push_back(entry); } } -void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { +void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { std::shared_ptr txt = std::static_pointer_cast(resource); auto child = reader->FirstChildElement(); diff --git a/soh/soh/resource/importer/TextFactory.h b/soh/soh/resource/importer/TextFactory.h index 605a92049..7a6ae2841 100644 --- a/soh/soh/resource/importer/TextFactory.h +++ b/soh/soh/resource/importer/TextFactory.h @@ -7,19 +7,17 @@ namespace LUS { class TextFactory : public ResourceFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; - std::shared_ptr ReadResourceXML(std::shared_ptr resourceMgr, - std::shared_ptr initData, - tinyxml2::XMLElement* reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; }; class TextFactoryV0 : public ResourceVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp index 6d0483e73..4134e259a 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr EndMarkerFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +EndMarkerFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr EndMarkerFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr endMarker = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, endMarker); diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h index 606153a95..8cd83b4f6 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h @@ -5,13 +5,12 @@ namespace LUS { class EndMarkerFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class EndMarkerFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp index efa170761..9ad0ba2d3 100644 --- a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp @@ -3,7 +3,7 @@ #include "spdlog/spdlog.h" namespace LUS { -void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr command, std::shared_ptr reader) { +void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr command, std::shared_ptr reader) { command->cmdId = (SceneCommandID)reader->ReadInt32(); } } diff --git a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h index 3ab89c5b7..d9a23818a 100644 --- a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h +++ b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h @@ -10,6 +10,6 @@ class SceneCommandFactory : public ResourceFactory {}; class SceneCommandVersionFactory : public ResourceVersionFactory { protected: - void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); + void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp index 50eeb2247..0451eb4c3 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp @@ -3,13 +3,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetActorListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -17,7 +16,7 @@ std::shared_ptr SetActorListFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -27,7 +26,7 @@ std::shared_ptr SetActorListFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setActorList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setActorList); diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h index fa62241fc..1f4c213bb 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetActorListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetActorListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp index b01b7f1fc..5258d970b 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp @@ -4,13 +4,12 @@ #include "libultraship/libultraship.h" namespace LUS { -std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -18,7 +17,7 @@ std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_p if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -28,7 +27,7 @@ std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_p } void LUS::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setAlternateHeaders = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders); diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h index c9dd3f26c..a534c4392 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetAlternateHeadersFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp index 88f8522d4..14b332d2a 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr } void LUS::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setCameraSettings = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings); diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h index 0271c62f0..ec4dc9e42 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetCameraSettingsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp index aa7a7a104..e1c113ba3 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp @@ -4,20 +4,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -27,7 +26,7 @@ std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_pt } void LUS::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setCollisionHeader = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader); diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h index 361e0636b..96c6ff0a1 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetCollisionHeaderFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp index e83d60749..d24e3b2c3 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetCsCameraFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetCsCameraFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetCsCameraFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setCsCamera = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setCsCamera); diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h index 71a8a6a7d..ec74ed58e 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetCsCameraFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetCsCameraFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp index 37e374282..db9392e7d 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp @@ -4,13 +4,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetCutscenesFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetCutscenesFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -18,7 +17,7 @@ std::shared_ptr SetCutscenesFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -28,7 +27,7 @@ std::shared_ptr SetCutscenesFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setCutscenes = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setCutscenes); diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h index 86987e59e..7963036ba 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetCutscenesFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetCutscenesFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp index 5fa20f12f..530bcb8af 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetEchoSettingsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetEchoSettingsFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setEchoSettings = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings); diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h index 1df65e56b..90bf3222f 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetEchoSettingsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp index e75ccec03..0fd841278 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetEntranceListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetEntranceListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetEntranceListFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setEntranceList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setEntranceList); diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h index 39b76c3c9..ce20db4f7 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetEntranceListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetEntranceListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp index ca49e5f18..04ed0c56b 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetExitListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetExitListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared( initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetExitListFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setExitList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setExitList); diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h index 05afafbc9..351ebe7ca 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetExitListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetExitListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp index 9b6aef5b0..2d2a9afe4 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp @@ -3,13 +3,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetLightListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetLightListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -17,7 +16,7 @@ std::shared_ptr SetLightListFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetLightList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -27,7 +26,7 @@ std::shared_ptr SetLightListFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setLightList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setLightList); diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h index aa4cbeb6c..24292a289 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetLightListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetLightListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp index 9f49d3006..3fdedd0e4 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_p } void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setLightingSettings = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings); diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h index bae13227d..78a624ca6 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetLightingSettingsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetLightingSettingsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp index 85967739d..1398641a7 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp @@ -4,13 +4,12 @@ #include "libultraship/libultraship.h" namespace LUS { -std::shared_ptr SetMeshFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetMeshFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -18,7 +17,7 @@ std::shared_ptr SetMeshFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetMesh with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -28,7 +27,7 @@ std::shared_ptr SetMeshFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setMesh = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setMesh); @@ -67,8 +66,8 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); - dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; - dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; + dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; setMesh->dlists.push_back(dlist); } else if (setMesh->meshHeader.base.type == 1) { @@ -80,8 +79,8 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgOpa.c_str()); auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgXlu.c_str()); - pType.opa = imgOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; - pType.xlu = imgXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; + pType.opa = imgOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + pType.xlu = imgXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; int32_t bgImageCount = reader->ReadUInt32(); setMesh->images.reserve(bgImageCount); @@ -128,8 +127,8 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); - pType.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; - pType.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; + pType.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + pType.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; setMesh->dlists.push_back(pType); } else if (setMesh->meshHeader.base.type == 2) { @@ -146,8 +145,8 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); - dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0; - dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0; + dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; setMesh->dlists2.push_back(dlist); } else { diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h index 17eac6437..8ca086d43 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetMeshFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetMeshFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp index 9a4801dae..27082f6e7 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetObjectListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetObjectListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetObjectListFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setObjectList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setObjectList); diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h index d0cc1ee6f..65725bfb2 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetObjectListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetObjectListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp index 8425e1e97..1f40ab69d 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp @@ -4,20 +4,19 @@ #include namespace LUS { -std::shared_ptr SetPathwaysFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetPathwaysFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -27,7 +26,7 @@ std::shared_ptr SetPathwaysFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setPathways = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setPathways); @@ -37,7 +36,8 @@ void LUS::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr re setPathways->paths.reserve(setPathways->numPaths); for (uint32_t i = 0; i < setPathways->numPaths; i++) { std::string pathFileName = reader->ReadString(); - setPathways->paths.push_back(std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()))); + auto path = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())); + setPathways->paths.push_back(path->GetPointer()); } } diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h index aa7b8a8a4..fc9b2c62d 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetPathwaysFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetPathwaysFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp index 4fde10745..409e3d410 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetRoomBehaviorFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetRoomBehaviorFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setRoomBehavior = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior); diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h index 9478f2125..ef5a77bd4 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetRoomBehaviorFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetRoomBehaviorFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp index 6f949380d..136b410a0 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp @@ -3,13 +3,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetRoomListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetRoomListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; @@ -17,7 +16,7 @@ std::shared_ptr SetRoomListFactory::ReadResource(std::shared_ptrInitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetRoomList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -27,7 +26,7 @@ std::shared_ptr SetRoomListFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setRoomList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setRoomList); diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h index 993835fcd..1ba5e5c1f 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetRoomListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetRoomListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp index 27946c4ec..b68d2e56d 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr } void LUS::SetSkyboxModifierFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setSkyboxModifier = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setSkyboxModifier); diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h index d2089956a..9556b6699 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetSkyboxModifierFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetSkyboxModifierFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp index 4049b333d..3b793c80e 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr } void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setSkyboxSettings = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings); diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h index e91b59b2e..7c2da4bb1 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetSkyboxSettingsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetSkyboxSettingsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp index 195da1e79..1817af81d 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr< } void LUS::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setSoundSettings = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings); diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h index 324e2a835..7195b0fb6 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetSoundSettingsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetSoundSettingsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp index 240fd2532..5f818f1d4 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr){ - SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr } void LUS::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setSpecialObjects = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects); diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h index 41d68fd42..3e3fc77d0 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetSpecialObjectsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetSpecialObjectsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp index a763fa780..bafb0b153 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp @@ -3,13 +3,12 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); @@ -18,7 +17,7 @@ std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -28,7 +27,7 @@ std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ } void LUS::SetStartPositionListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) + std::shared_ptr resource) { std::shared_ptr setStartPositionList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList); diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h index a35e489c7..d2bbcb6a6 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetStartPositionListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetStartPositionListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp index dd7fbf8e2..ab2ac12f0 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetTimeSettingsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetTimeSettingsFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setTimeSettings = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings); diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h index 4d1964eaf..b7ee1083c 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetTimeSettingsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetTimeSettingsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp index 279129667..575151bab 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, +std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetTransitionActorListFactory::ReadResource(std::share } void LUS::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setTransitionActorList = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList); diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h index fcb3cbe60..25343ced8 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetTransitionActorListFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetTransitionActorListFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp index 6b6f5fc87..995045014 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp @@ -3,20 +3,19 @@ #include "spdlog/spdlog.h" namespace LUS { -std::shared_ptr SetWindSettingsFactory::ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(resourceMgr, initData); +std::shared_ptr +SetWindSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto resource = std::make_shared(initData); std::shared_ptr factory = nullptr; - switch (resource->InitData->ResourceVersion) { + switch (resource->GetInitData()->ResourceVersion) { case 0: factory = std::make_shared(); break; } if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->InitData->ResourceVersion); + SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->GetInitData()->ResourceVersion); return nullptr; } @@ -26,7 +25,7 @@ std::shared_ptr SetWindSettingsFactory::ReadResource(std::shared_ptr reader, - std::shared_ptr resource) { + std::shared_ptr resource) { std::shared_ptr setWind = std::static_pointer_cast(resource); ResourceVersionFactory::ParseFileBinary(reader, setWind); diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h index faad34a44..0a783bb9f 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h @@ -5,13 +5,12 @@ namespace LUS { class SetWindSettingsFactory : public SceneCommandFactory { public: - std::shared_ptr ReadResource(std::shared_ptr resourceMgr, - std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; class SetWindSettingsFactoryV0 : public SceneCommandVersionFactory { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; }; }; // namespace LUS diff --git a/soh/soh/resource/type/Animation.cpp b/soh/soh/resource/type/Animation.cpp index 9ffe74ce9..46327c732 100644 --- a/soh/soh/resource/type/Animation.cpp +++ b/soh/soh/resource/type/Animation.cpp @@ -1,7 +1,7 @@ #include "Animation.h" namespace LUS { -void* Animation::GetPointer() { +AnimationData* Animation::GetPointer() { return &animationData; } diff --git a/soh/soh/resource/type/Animation.h b/soh/soh/resource/type/Animation.h index 910b226ed..3d6b810bf 100644 --- a/soh/soh/resource/type/Animation.h +++ b/soh/soh/resource/type/Animation.h @@ -63,11 +63,13 @@ namespace LUS { TransformUpdateIndex transformUpdateIndex; }; - class Animation : public Resource { + class Animation : public Resource { public: using Resource::Resource; - void* GetPointer(); + Animation() : Resource(std::shared_ptr()) {} + + AnimationData* GetPointer(); size_t GetPointerSize(); AnimationType type; diff --git a/soh/soh/resource/type/AudioSample.cpp b/soh/soh/resource/type/AudioSample.cpp index d415cb67d..951aae6c1 100644 --- a/soh/soh/resource/type/AudioSample.cpp +++ b/soh/soh/resource/type/AudioSample.cpp @@ -1,7 +1,7 @@ #include "AudioSample.h" namespace LUS { -void* AudioSample::GetPointer() { +Sample* AudioSample::GetPointer() { return &sample; } diff --git a/soh/soh/resource/type/AudioSample.h b/soh/soh/resource/type/AudioSample.h index 608fad810..eda8aa456 100644 --- a/soh/soh/resource/type/AudioSample.h +++ b/soh/soh/resource/type/AudioSample.h @@ -39,11 +39,13 @@ namespace LUS { s32 sampleRate; // For wav samples only... } Sample; // size = 0x10 - class AudioSample : public Resource { + class AudioSample : public Resource { public: using Resource::Resource; - void* GetPointer(); + AudioSample() : Resource(std::shared_ptr()) {} + + Sample* GetPointer(); size_t GetPointerSize(); Sample sample; diff --git a/soh/soh/resource/type/AudioSequence.cpp b/soh/soh/resource/type/AudioSequence.cpp index d16e64e76..c09514a67 100644 --- a/soh/soh/resource/type/AudioSequence.cpp +++ b/soh/soh/resource/type/AudioSequence.cpp @@ -2,7 +2,7 @@ namespace LUS { -void* AudioSequence::GetPointer() { +Sequence* AudioSequence::GetPointer() { return &sequence; } diff --git a/soh/soh/resource/type/AudioSequence.h b/soh/soh/resource/type/AudioSequence.h index 38bcaebf6..2b2bb8be9 100644 --- a/soh/soh/resource/type/AudioSequence.h +++ b/soh/soh/resource/type/AudioSequence.h @@ -17,11 +17,13 @@ typedef struct { uint8_t fonts[16]; } Sequence; -class AudioSequence : public Resource { +class AudioSequence : public Resource { public: using Resource::Resource; - void* GetPointer(); + AudioSequence() : Resource(std::shared_ptr()) {} + + Sequence* GetPointer(); size_t GetPointerSize(); Sequence sequence; diff --git a/soh/soh/resource/type/AudioSoundFont.cpp b/soh/soh/resource/type/AudioSoundFont.cpp index 857279573..43ac40abf 100644 --- a/soh/soh/resource/type/AudioSoundFont.cpp +++ b/soh/soh/resource/type/AudioSoundFont.cpp @@ -1,7 +1,7 @@ #include "AudioSoundFont.h" namespace LUS { -void* AudioSoundFont::GetPointer() { +SoundFont* AudioSoundFont::GetPointer() { return &soundFont; } diff --git a/soh/soh/resource/type/AudioSoundFont.h b/soh/soh/resource/type/AudioSoundFont.h index ace639a93..c47218090 100644 --- a/soh/soh/resource/type/AudioSoundFont.h +++ b/soh/soh/resource/type/AudioSoundFont.h @@ -52,11 +52,13 @@ typedef struct { s32 fntIndex; } SoundFont; // size = 0x14 -class AudioSoundFont : public Resource { +class AudioSoundFont : public Resource { public: using Resource::Resource; - void* GetPointer(); + AudioSoundFont() : Resource(std::shared_ptr()) {} + + SoundFont* GetPointer(); size_t GetPointerSize(); int8_t medium; diff --git a/soh/soh/resource/type/Background.cpp b/soh/soh/resource/type/Background.cpp index f9379b9c7..bc1047b5c 100644 --- a/soh/soh/resource/type/Background.cpp +++ b/soh/soh/resource/type/Background.cpp @@ -1,7 +1,7 @@ #include "Background.h" namespace LUS { -void* Background::GetPointer() { +uint8_t* Background::GetPointer() { return Data.data(); } diff --git a/soh/soh/resource/type/Background.h b/soh/soh/resource/type/Background.h index 96edde32c..7f22658e0 100644 --- a/soh/soh/resource/type/Background.h +++ b/soh/soh/resource/type/Background.h @@ -3,11 +3,13 @@ #include "resource/Resource.h" namespace LUS { -class Background : public Resource { +class Background : public Resource { public: using Resource::Resource; - void* GetPointer(); + Background() : Resource(std::shared_ptr()) {} + + uint8_t* GetPointer(); size_t GetPointerSize(); std::vector Data; diff --git a/soh/soh/resource/type/CollisionHeader.cpp b/soh/soh/resource/type/CollisionHeader.cpp index 87f5e5198..5625d2b59 100644 --- a/soh/soh/resource/type/CollisionHeader.cpp +++ b/soh/soh/resource/type/CollisionHeader.cpp @@ -1,7 +1,7 @@ #include "CollisionHeader.h" namespace LUS { -void* CollisionHeader::GetPointer() { +CollisionHeaderData* CollisionHeader::GetPointer() { return &collisionHeaderData; } diff --git a/soh/soh/resource/type/CollisionHeader.h b/soh/soh/resource/type/CollisionHeader.h index b830448b2..e401aa7f5 100644 --- a/soh/soh/resource/type/CollisionHeader.h +++ b/soh/soh/resource/type/CollisionHeader.h @@ -67,11 +67,13 @@ typedef struct { size_t cameraDataListLen; // OTRTODO: Added to allow for bounds checking the cameraDataList. } CollisionHeaderData; // original name: BGDataInfo -class CollisionHeader : public Resource { +class CollisionHeader : public Resource { public: using Resource::Resource; - void* GetPointer(); + CollisionHeader() : Resource(std::shared_ptr()) {} + + CollisionHeaderData* GetPointer(); size_t GetPointerSize(); CollisionHeaderData collisionHeaderData; diff --git a/soh/soh/resource/type/Cutscene.cpp b/soh/soh/resource/type/Cutscene.cpp index 2da9e91bd..c7e98062a 100644 --- a/soh/soh/resource/type/Cutscene.cpp +++ b/soh/soh/resource/type/Cutscene.cpp @@ -2,7 +2,7 @@ #include namespace LUS { -void* Cutscene::GetPointer() { +uint32_t* Cutscene::GetPointer() { return commands.data(); } diff --git a/soh/soh/resource/type/Cutscene.h b/soh/soh/resource/type/Cutscene.h index b392c60e5..5bd268e61 100644 --- a/soh/soh/resource/type/Cutscene.h +++ b/soh/soh/resource/type/Cutscene.h @@ -44,11 +44,13 @@ enum class CutsceneCommands { Error = 0xFEAF, }; -class Cutscene : public Resource { +class Cutscene : public Resource { public: using Resource::Resource; - void* GetPointer(); + Cutscene() : Resource(std::shared_ptr()) {} + + uint32_t* GetPointer(); size_t GetPointerSize(); uint32_t numCommands; diff --git a/soh/soh/resource/type/Path.cpp b/soh/soh/resource/type/Path.cpp index 74938307d..535db4e7d 100644 --- a/soh/soh/resource/type/Path.cpp +++ b/soh/soh/resource/type/Path.cpp @@ -1,11 +1,11 @@ #include "Path.h" namespace LUS { -void* Path::GetPointer() { +PathData* Path::GetPointer() { return pathData.data(); } size_t Path::GetPointerSize() { - return pathData.size() * sizeof(PathData); + return pathData.size() * sizeof(PathData); } } // namespace LUS diff --git a/soh/soh/resource/type/Path.h b/soh/soh/resource/type/Path.h index 8c5c0d0ee..5dd16dec9 100644 --- a/soh/soh/resource/type/Path.h +++ b/soh/soh/resource/type/Path.h @@ -13,15 +13,17 @@ typedef struct { /* 0x04 */ Vec3s* points; // Segment Address to the array of points } PathData; // size = 0x8 -class Path : public Resource { +class Path : public Resource { public: using Resource::Resource; - void* GetPointer(); - size_t GetPointerSize(); + Path() : Resource(std::shared_ptr()) {} - uint32_t numPaths; - std::vector pathData; - std::vector> paths; + PathData* GetPointer(); + size_t GetPointerSize(); + + uint32_t numPaths; + std::vector pathData; + std::vector> paths; }; }; // namespace LUS diff --git a/soh/soh/resource/type/PlayerAnimation.cpp b/soh/soh/resource/type/PlayerAnimation.cpp index 8d15140c2..55925f49c 100644 --- a/soh/soh/resource/type/PlayerAnimation.cpp +++ b/soh/soh/resource/type/PlayerAnimation.cpp @@ -2,7 +2,7 @@ #include namespace LUS { -void* PlayerAnimation::GetPointer() { +int16_t* PlayerAnimation::GetPointer() { return limbRotData.data(); } diff --git a/soh/soh/resource/type/PlayerAnimation.h b/soh/soh/resource/type/PlayerAnimation.h index cf85729e4..4eb51b139 100644 --- a/soh/soh/resource/type/PlayerAnimation.h +++ b/soh/soh/resource/type/PlayerAnimation.h @@ -9,11 +9,13 @@ namespace LUS { -class PlayerAnimation : public Resource { +class PlayerAnimation : public Resource { public: using Resource::Resource; - void* GetPointer(); + PlayerAnimation() : Resource(std::shared_ptr()) {} + + int16_t* GetPointer(); size_t GetPointerSize(); std::vector limbRotData; diff --git a/soh/soh/resource/type/Scene.h b/soh/soh/resource/type/Scene.h index e7bb943cf..f726da359 100644 --- a/soh/soh/resource/type/Scene.h +++ b/soh/soh/resource/type/Scene.h @@ -9,13 +9,15 @@ namespace LUS { -class Scene : public Resource { +class Scene : public Resource { public: using Resource::Resource; - void* GetPointer(); + Scene() : Resource(std::shared_ptr()) {} + + void* GetPointer(); size_t GetPointerSize(); - std::vector> commands; + std::vector> commands; }; }; // namespace LUS diff --git a/soh/soh/resource/type/Skeleton.cpp b/soh/soh/resource/type/Skeleton.cpp index 990ecd333..2cb155cf3 100644 --- a/soh/soh/resource/type/Skeleton.cpp +++ b/soh/soh/resource/type/Skeleton.cpp @@ -4,7 +4,7 @@ #include "libultraship/libultraship.h" namespace LUS { -void* Skeleton::GetPointer() { +SkeletonData* Skeleton::GetPointer() { return &skeletonData; } @@ -36,9 +36,9 @@ void SkeletonPatcher::RegisterSkeleton(std::string& path, SkelAnime* skelAnime) } // Determine if we're using an alternate skeleton - if (path.starts_with(LUS::Resource::gAltAssetPrefix)) { - info.vanillaSkeletonPath = path.substr(LUS::Resource::gAltAssetPrefix.length(), - path.size() - LUS::Resource::gAltAssetPrefix.length()); + if (path.starts_with(LUS::IResource::gAltAssetPrefix)) { + info.vanillaSkeletonPath = path.substr(LUS::IResource::gAltAssetPrefix.length(), + path.size() - LUS::IResource::gAltAssetPrefix.length()); } else { info.vanillaSkeletonPath = path; } @@ -70,7 +70,7 @@ void SkeletonPatcher::UpdateSkeletons() { { Skeleton* newSkel = (Skeleton*)LUS::Context::GetInstance()->GetResourceManager() - ->LoadResource((isHD ? LUS::Resource::gAltAssetPrefix : "") + skel.vanillaSkeletonPath, true) + ->LoadResource((isHD ? LUS::IResource::gAltAssetPrefix : "") + skel.vanillaSkeletonPath, true) .get(); if (newSkel != nullptr) diff --git a/soh/soh/resource/type/Skeleton.h b/soh/soh/resource/type/Skeleton.h index aac9c8161..98548d9fd 100644 --- a/soh/soh/resource/type/Skeleton.h +++ b/soh/soh/resource/type/Skeleton.h @@ -49,11 +49,13 @@ union SkeletonData { SkelCurveLimbList skelCurveLimbList; }; -class Skeleton : public Resource { +class Skeleton : public Resource { public: using Resource::Resource; - void* GetPointer(); + Skeleton() : Resource(std::shared_ptr()) {} + + SkeletonData* GetPointer(); size_t GetPointerSize(); SkeletonType type; diff --git a/soh/soh/resource/type/SkeletonLimb.cpp b/soh/soh/resource/type/SkeletonLimb.cpp index 32315ec92..8e5a8ef6d 100644 --- a/soh/soh/resource/type/SkeletonLimb.cpp +++ b/soh/soh/resource/type/SkeletonLimb.cpp @@ -1,7 +1,7 @@ #include "SkeletonLimb.h" namespace LUS { -void* SkeletonLimb::GetPointer() { +SkeletonLimbData* SkeletonLimb::GetPointer() { return &limbData; } diff --git a/soh/soh/resource/type/SkeletonLimb.h b/soh/soh/resource/type/SkeletonLimb.h index 0db219b93..2110b3484 100644 --- a/soh/soh/resource/type/SkeletonLimb.h +++ b/soh/soh/resource/type/SkeletonLimb.h @@ -97,36 +97,38 @@ union SkeletonLimbData { SkinLimb skinLimb; }; -class SkeletonLimb : public Resource { +class SkeletonLimb : public Resource { public: using Resource::Resource; - void* GetPointer(); - size_t GetPointerSize(); + SkeletonLimb() : Resource(std::shared_ptr()) {} - LimbType limbType; - SkeletonLimbData limbData; + SkeletonLimbData* GetPointer(); + size_t GetPointerSize(); - ZLimbSkinType skinSegmentType; - uint16_t skinVtxCnt; - SkinAnimatedLimbData skinAnimLimbData; + LimbType limbType; + SkeletonLimbData limbData; - std::string skinDataDList; - std::string skinDList; - std::string skinDList2; + ZLimbSkinType skinSegmentType; + uint16_t skinVtxCnt; + SkinAnimatedLimbData skinAnimLimbData; - float legTransX, legTransY, legTransZ; // Vec3f - uint16_t rotX, rotY, rotZ; // Vec3s + std::string skinDataDList; + std::string skinDList; + std::string skinDList2; - std::string childPtr, siblingPtr, dListPtr, dList2Ptr; + float legTransX, legTransY, legTransZ; // Vec3f + uint16_t rotX, rotY, rotZ; // Vec3s - int16_t transX, transY, transZ; - uint8_t childIndex, siblingIndex; + std::string childPtr, siblingPtr, dListPtr, dList2Ptr; - uint32_t skinLimbModifCount; - std::vector skinLimbModifArray; + int16_t transX, transY, transZ; + uint8_t childIndex, siblingIndex; - std::vector> skinLimbModifVertexArrays; - std::vector> skinLimbModifTransformationArrays; + uint32_t skinLimbModifCount; + std::vector skinLimbModifArray; + + std::vector> skinLimbModifVertexArrays; + std::vector> skinLimbModifTransformationArrays; }; } // namespace LUS \ No newline at end of file diff --git a/soh/soh/resource/type/Text.cpp b/soh/soh/resource/type/Text.cpp index a8469be36..eee289f8a 100644 --- a/soh/soh/resource/type/Text.cpp +++ b/soh/soh/resource/type/Text.cpp @@ -1,7 +1,7 @@ #include "Text.h" namespace LUS { -void* Text::GetPointer() { +MessageEntry* Text::GetPointer() { return messages.data(); } diff --git a/soh/soh/resource/type/Text.h b/soh/soh/resource/type/Text.h index 5458c7135..db0cb36a0 100644 --- a/soh/soh/resource/type/Text.h +++ b/soh/soh/resource/type/Text.h @@ -16,13 +16,15 @@ public: std::string msg; }; -class Text : public Resource { +class Text : public Resource { public: using Resource::Resource; - void* GetPointer(); - size_t GetPointerSize(); + Text() : Resource(std::shared_ptr()) {} - std::vector messages; + MessageEntry* GetPointer(); + size_t GetPointerSize(); + + std::vector messages; }; }; // namespace LUS diff --git a/soh/soh/resource/type/scenecommand/EndMarker.cpp b/soh/soh/resource/type/scenecommand/EndMarker.cpp index b60fab8ab..9d12c1518 100644 --- a/soh/soh/resource/type/scenecommand/EndMarker.cpp +++ b/soh/soh/resource/type/scenecommand/EndMarker.cpp @@ -1,7 +1,7 @@ #include "EndMarker.h" namespace LUS { -void* EndMarker::GetPointer() { +Marker* EndMarker::GetPointer() { return &endMarker; } diff --git a/soh/soh/resource/type/scenecommand/EndMarker.h b/soh/soh/resource/type/scenecommand/EndMarker.h index f3954467e..9f981f1f9 100644 --- a/soh/soh/resource/type/scenecommand/EndMarker.h +++ b/soh/soh/resource/type/scenecommand/EndMarker.h @@ -12,11 +12,11 @@ typedef struct { } Marker; -class EndMarker : public SceneCommand { +class EndMarker : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + Marker* GetPointer(); size_t GetPointerSize(); Marker endMarker; diff --git a/soh/soh/resource/type/scenecommand/SceneCommand.h b/soh/soh/resource/type/scenecommand/SceneCommand.h index 353f5d910..6fb845568 100644 --- a/soh/soh/resource/type/scenecommand/SceneCommand.h +++ b/soh/soh/resource/type/scenecommand/SceneCommand.h @@ -47,10 +47,20 @@ enum class SceneCommandID : uint8_t { Error = 0xFF }; -class SceneCommand : public Resource { +class ISceneCommand : public IResource { public: - using Resource::Resource; - SceneCommandID cmdId; + using IResource::IResource; + ISceneCommand() : IResource(std::shared_ptr()) {} + SceneCommandID cmdId; +}; + +template class SceneCommand : public ISceneCommand { + public: + using ISceneCommand::ISceneCommand; + virtual T* GetPointer() = 0; + void* GetRawPointer() override { + return static_cast(GetPointer()); + } }; }; // namespace LUS diff --git a/soh/soh/resource/type/scenecommand/SetActorList.cpp b/soh/soh/resource/type/scenecommand/SetActorList.cpp index 4563f9db3..d37ebb148 100644 --- a/soh/soh/resource/type/scenecommand/SetActorList.cpp +++ b/soh/soh/resource/type/scenecommand/SetActorList.cpp @@ -1,7 +1,7 @@ #include "SetActorList.h" namespace LUS { -void* SetActorList::GetPointer() { +ActorEntry* SetActorList::GetPointer() { return actorList.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetActorList.h b/soh/soh/resource/type/scenecommand/SetActorList.h index 7f05f88d1..117175d7d 100644 --- a/soh/soh/resource/type/scenecommand/SetActorList.h +++ b/soh/soh/resource/type/scenecommand/SetActorList.h @@ -17,11 +17,11 @@ typedef struct { /* 0x0E */ s16 params; } ActorEntry; // size = 0x10 -class SetActorList : public SceneCommand { +class SetActorList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + ActorEntry* GetPointer(); size_t GetPointerSize(); uint32_t numActors; diff --git a/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h b/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h index 48c7ed915..dc7272369 100644 --- a/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h +++ b/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h @@ -13,7 +13,7 @@ namespace LUS { -class SetAlternateHeaders : public SceneCommand { +class SetAlternateHeaders : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp b/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp index f88d9683d..e1d2967e7 100644 --- a/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp @@ -1,7 +1,7 @@ #include "SetCameraSettings.h" namespace LUS { -void* SetCameraSettings::GetPointer() { +CameraSettings* SetCameraSettings::GetPointer() { return &settings; } diff --git a/soh/soh/resource/type/scenecommand/SetCameraSettings.h b/soh/soh/resource/type/scenecommand/SetCameraSettings.h index 55491ec43..adbde2e02 100644 --- a/soh/soh/resource/type/scenecommand/SetCameraSettings.h +++ b/soh/soh/resource/type/scenecommand/SetCameraSettings.h @@ -13,11 +13,11 @@ typedef struct { int32_t worldMapArea; } CameraSettings; -class SetCameraSettings : public SceneCommand { +class SetCameraSettings : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + CameraSettings* GetPointer(); size_t GetPointerSize(); CameraSettings settings; diff --git a/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp b/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp index 0f71ac1d9..db8cdcb32 100644 --- a/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp +++ b/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp @@ -1,7 +1,7 @@ #include "SetCollisionHeader.h" namespace LUS { -void* SetCollisionHeader::GetPointer() { +CollisionHeaderData* SetCollisionHeader::GetPointer() { if (collisionHeader == nullptr) { return nullptr; } diff --git a/soh/soh/resource/type/scenecommand/SetCollisionHeader.h b/soh/soh/resource/type/scenecommand/SetCollisionHeader.h index 34c8466bd..79573fe74 100644 --- a/soh/soh/resource/type/scenecommand/SetCollisionHeader.h +++ b/soh/soh/resource/type/scenecommand/SetCollisionHeader.h @@ -10,11 +10,11 @@ // #include namespace LUS { -class SetCollisionHeader : public SceneCommand { +class SetCollisionHeader : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + CollisionHeaderData* GetPointer(); size_t GetPointerSize(); std::string fileName; diff --git a/soh/soh/resource/type/scenecommand/SetCsCamera.cpp b/soh/soh/resource/type/scenecommand/SetCsCamera.cpp index 1c996adda..d3eafb803 100644 --- a/soh/soh/resource/type/scenecommand/SetCsCamera.cpp +++ b/soh/soh/resource/type/scenecommand/SetCsCamera.cpp @@ -1,7 +1,7 @@ #include "SetCsCamera.h" namespace LUS { -void* SetCsCamera::GetPointer() { +CsCamera* SetCsCamera::GetPointer() { return &csCamera; } diff --git a/soh/soh/resource/type/scenecommand/SetCsCamera.h b/soh/soh/resource/type/scenecommand/SetCsCamera.h index b3f1cf860..db0e3d682 100644 --- a/soh/soh/resource/type/scenecommand/SetCsCamera.h +++ b/soh/soh/resource/type/scenecommand/SetCsCamera.h @@ -12,11 +12,11 @@ typedef struct { } CsCamera; -class SetCsCamera : public SceneCommand { +class SetCsCamera : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + CsCamera* GetPointer(); size_t GetPointerSize(); CsCamera csCamera; diff --git a/soh/soh/resource/type/scenecommand/SetCutscenes.cpp b/soh/soh/resource/type/scenecommand/SetCutscenes.cpp index 9dc7e1098..42d1326d5 100644 --- a/soh/soh/resource/type/scenecommand/SetCutscenes.cpp +++ b/soh/soh/resource/type/scenecommand/SetCutscenes.cpp @@ -1,7 +1,7 @@ #include "SetCutscenes.h" namespace LUS { -void* SetCutscenes::GetPointer() { +uint32_t* SetCutscenes::GetPointer() { if (cutscene == nullptr) { return nullptr; } diff --git a/soh/soh/resource/type/scenecommand/SetCutscenes.h b/soh/soh/resource/type/scenecommand/SetCutscenes.h index 98cdbcd54..482553934 100644 --- a/soh/soh/resource/type/scenecommand/SetCutscenes.h +++ b/soh/soh/resource/type/scenecommand/SetCutscenes.h @@ -10,11 +10,11 @@ // #include namespace LUS { -class SetCutscenes : public SceneCommand { +class SetCutscenes : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + uint32_t* GetPointer(); size_t GetPointerSize(); std::string fileName; diff --git a/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp b/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp index 559b807d2..47cfa85ad 100644 --- a/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp @@ -1,7 +1,7 @@ #include "SetEchoSettings.h" namespace LUS { -void* SetEchoSettings::GetPointer() { +EchoSettings* SetEchoSettings::GetPointer() { return &settings; } diff --git a/soh/soh/resource/type/scenecommand/SetEchoSettings.h b/soh/soh/resource/type/scenecommand/SetEchoSettings.h index 7080d8a59..ea2f664d4 100644 --- a/soh/soh/resource/type/scenecommand/SetEchoSettings.h +++ b/soh/soh/resource/type/scenecommand/SetEchoSettings.h @@ -12,11 +12,11 @@ typedef struct { int8_t echo; } EchoSettings; -class SetEchoSettings : public SceneCommand { +class SetEchoSettings : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + EchoSettings* GetPointer(); size_t GetPointerSize(); EchoSettings settings; diff --git a/soh/soh/resource/type/scenecommand/SetEntranceList.cpp b/soh/soh/resource/type/scenecommand/SetEntranceList.cpp index c12247bbf..d33ac189b 100644 --- a/soh/soh/resource/type/scenecommand/SetEntranceList.cpp +++ b/soh/soh/resource/type/scenecommand/SetEntranceList.cpp @@ -1,7 +1,7 @@ #include "SetEntranceList.h" namespace LUS { -void* SetEntranceList::GetPointer() { +EntranceEntry* SetEntranceList::GetPointer() { return entrances.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetEntranceList.h b/soh/soh/resource/type/scenecommand/SetEntranceList.h index 970e0fb5c..d31dda78c 100644 --- a/soh/soh/resource/type/scenecommand/SetEntranceList.h +++ b/soh/soh/resource/type/scenecommand/SetEntranceList.h @@ -14,11 +14,11 @@ typedef struct { /* 0x01 */ u8 room; } EntranceEntry; -class SetEntranceList : public SceneCommand { +class SetEntranceList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + EntranceEntry* GetPointer(); size_t GetPointerSize(); uint32_t numEntrances; diff --git a/soh/soh/resource/type/scenecommand/SetExitList.cpp b/soh/soh/resource/type/scenecommand/SetExitList.cpp index b34ea20ee..99966cdb4 100644 --- a/soh/soh/resource/type/scenecommand/SetExitList.cpp +++ b/soh/soh/resource/type/scenecommand/SetExitList.cpp @@ -1,7 +1,7 @@ #include "SetExitList.h" namespace LUS { -void* SetExitList::GetPointer() { +uint16_t* SetExitList::GetPointer() { return exits.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetExitList.h b/soh/soh/resource/type/scenecommand/SetExitList.h index b3f7f87c9..c6f0b3f42 100644 --- a/soh/soh/resource/type/scenecommand/SetExitList.h +++ b/soh/soh/resource/type/scenecommand/SetExitList.h @@ -8,11 +8,11 @@ #include namespace LUS { -class SetExitList : public SceneCommand { +class SetExitList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + uint16_t* GetPointer(); size_t GetPointerSize(); uint32_t numExits; diff --git a/soh/soh/resource/type/scenecommand/SetLightList.cpp b/soh/soh/resource/type/scenecommand/SetLightList.cpp index 0e69c6f42..c59f75c20 100644 --- a/soh/soh/resource/type/scenecommand/SetLightList.cpp +++ b/soh/soh/resource/type/scenecommand/SetLightList.cpp @@ -1,7 +1,7 @@ #include "SetLightList.h" namespace LUS { -void* SetLightList::GetPointer() { +LightInfo* SetLightList::GetPointer() { return lightList.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetLightList.h b/soh/soh/resource/type/scenecommand/SetLightList.h index 561f80d06..bbc5aad3d 100644 --- a/soh/soh/resource/type/scenecommand/SetLightList.h +++ b/soh/soh/resource/type/scenecommand/SetLightList.h @@ -35,11 +35,11 @@ typedef struct { /* 0x2 */ LightParams params; } LightInfo; // size = 0xE -class SetLightList : public SceneCommand { +class SetLightList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + LightInfo* GetPointer(); size_t GetPointerSize(); uint32_t numLights; diff --git a/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp b/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp index b432d03fb..69127f19c 100644 --- a/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp @@ -1,7 +1,7 @@ #include "SetLightingSettings.h" namespace LUS { -void* SetLightingSettings::GetPointer() { +EnvLightSettings* SetLightingSettings::GetPointer() { return settings.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetLightingSettings.h b/soh/soh/resource/type/scenecommand/SetLightingSettings.h index 4bb3b4f4e..ca894fec3 100644 --- a/soh/soh/resource/type/scenecommand/SetLightingSettings.h +++ b/soh/soh/resource/type/scenecommand/SetLightingSettings.h @@ -19,11 +19,11 @@ typedef struct { /* 0x14 */ s16 fogFar; } EnvLightSettings; // size = 0x16 -class SetLightingSettings : public SceneCommand { +class SetLightingSettings : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + EnvLightSettings* GetPointer(); size_t GetPointerSize(); std::vector settings; diff --git a/soh/soh/resource/type/scenecommand/SetMesh.cpp b/soh/soh/resource/type/scenecommand/SetMesh.cpp index e041bde9c..5ecd2cbfa 100644 --- a/soh/soh/resource/type/scenecommand/SetMesh.cpp +++ b/soh/soh/resource/type/scenecommand/SetMesh.cpp @@ -1,7 +1,7 @@ #include "SetMesh.h" namespace LUS { -void* SetMesh::GetPointer() { +MeshHeader* SetMesh::GetPointer() { return &meshHeader; } diff --git a/soh/soh/resource/type/scenecommand/SetMesh.h b/soh/soh/resource/type/scenecommand/SetMesh.h index 90ec058d5..a3a6c9731 100644 --- a/soh/soh/resource/type/scenecommand/SetMesh.h +++ b/soh/soh/resource/type/scenecommand/SetMesh.h @@ -83,11 +83,11 @@ typedef struct { /* 0x04 */ Gfx* xlu; } PolygonDlist; // size = 0x8 -class SetMesh : public SceneCommand { +class SetMesh : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + MeshHeader* GetPointer(); size_t GetPointerSize(); uint32_t numPoly; diff --git a/soh/soh/resource/type/scenecommand/SetObjectList.cpp b/soh/soh/resource/type/scenecommand/SetObjectList.cpp index ea82a630b..921166675 100644 --- a/soh/soh/resource/type/scenecommand/SetObjectList.cpp +++ b/soh/soh/resource/type/scenecommand/SetObjectList.cpp @@ -1,7 +1,7 @@ #include "SetObjectList.h" namespace LUS { -void* SetObjectList::GetPointer() { +int16_t* SetObjectList::GetPointer() { return objects.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetObjectList.h b/soh/soh/resource/type/scenecommand/SetObjectList.h index b411a35e1..c6f786636 100644 --- a/soh/soh/resource/type/scenecommand/SetObjectList.h +++ b/soh/soh/resource/type/scenecommand/SetObjectList.h @@ -9,11 +9,11 @@ #include namespace LUS { -class SetObjectList : public SceneCommand { +class SetObjectList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + int16_t* GetPointer(); size_t GetPointerSize(); uint32_t numObjects; diff --git a/soh/soh/resource/type/scenecommand/SetPathways.cpp b/soh/soh/resource/type/scenecommand/SetPathways.cpp index 952e26677..b69108ea6 100644 --- a/soh/soh/resource/type/scenecommand/SetPathways.cpp +++ b/soh/soh/resource/type/scenecommand/SetPathways.cpp @@ -1,11 +1,11 @@ #include "SetPathways.h" namespace LUS { -void* SetPathways::GetPointer() { +PathData** SetPathways::GetPointer() { return paths.data(); } size_t SetPathways::GetPointerSize() { - return paths.size() * sizeof(std::shared_ptr); + return paths.size() * sizeof(PathData*); } } // namespace LUS diff --git a/soh/soh/resource/type/scenecommand/SetPathways.h b/soh/soh/resource/type/scenecommand/SetPathways.h index c179cf267..5846c382f 100644 --- a/soh/soh/resource/type/scenecommand/SetPathways.h +++ b/soh/soh/resource/type/scenecommand/SetPathways.h @@ -10,14 +10,14 @@ namespace LUS { -class SetPathways : public SceneCommand { +class SetPathways : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + PathData** GetPointer(); size_t GetPointerSize(); uint32_t numPaths; - std::vector> paths; + std::vector paths; }; }; // namespace LUS diff --git a/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp b/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp index 3afdf54f9..deababc87 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp +++ b/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp @@ -1,7 +1,7 @@ #include "SetRoomBehavior.h" namespace LUS { -void* SetRoomBehavior::GetPointer() { +RoomBehavior* SetRoomBehavior::GetPointer() { return &roomBehavior; } diff --git a/soh/soh/resource/type/scenecommand/SetRoomBehavior.h b/soh/soh/resource/type/scenecommand/SetRoomBehavior.h index 19a58b2f5..c2a28176e 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomBehavior.h +++ b/soh/soh/resource/type/scenecommand/SetRoomBehavior.h @@ -13,11 +13,11 @@ typedef struct { int32_t gameplayFlags2; } RoomBehavior; -class SetRoomBehavior : public SceneCommand { +class SetRoomBehavior : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + RoomBehavior* GetPointer(); size_t GetPointerSize(); RoomBehavior roomBehavior; diff --git a/soh/soh/resource/type/scenecommand/SetRoomList.cpp b/soh/soh/resource/type/scenecommand/SetRoomList.cpp index 069492233..cf8c1d61a 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomList.cpp +++ b/soh/soh/resource/type/scenecommand/SetRoomList.cpp @@ -1,7 +1,7 @@ #include "SetRoomList.h" namespace LUS { -void* SetRoomList::GetPointer() { +RomFile* SetRoomList::GetPointer() { return rooms.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetRoomList.h b/soh/soh/resource/type/scenecommand/SetRoomList.h index 61044a191..66d83dc9c 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomList.h +++ b/soh/soh/resource/type/scenecommand/SetRoomList.h @@ -17,11 +17,11 @@ namespace LUS { // char* fileName; // } RomFile; // size = 0x8 -class SetRoomList : public SceneCommand { +class SetRoomList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + RomFile* GetPointer(); size_t GetPointerSize(); uint32_t numRooms; diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp index 8dee0a9c7..9926ec01a 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp +++ b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp @@ -1,7 +1,7 @@ #include "SetSkyboxModifier.h" namespace LUS { -void* SetSkyboxModifier::GetPointer() { +SkyboxModifier* SetSkyboxModifier::GetPointer() { return &modifier; } diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h index 8098f9e5c..6a54879e6 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h +++ b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h @@ -13,11 +13,11 @@ typedef struct { uint8_t sunMoonDisabled; } SkyboxModifier; -class SetSkyboxModifier : public SceneCommand { +class SetSkyboxModifier : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + SkyboxModifier* GetPointer(); size_t GetPointerSize(); SkyboxModifier modifier; diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp index e8a37e9bd..7f12d4fa3 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp @@ -1,7 +1,7 @@ #include "SetSkyboxSettings.h" namespace LUS { -void* SetSkyboxSettings::GetPointer() { +SkyboxSettings* SetSkyboxSettings::GetPointer() { return &settings; } diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h index 97d3694fd..a2a9593b0 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h +++ b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h @@ -15,11 +15,11 @@ typedef struct { uint8_t indoors; } SkyboxSettings; -class SetSkyboxSettings : public SceneCommand { +class SetSkyboxSettings : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + SkyboxSettings* GetPointer(); size_t GetPointerSize(); SkyboxSettings settings; diff --git a/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp b/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp index 1380cf410..f6f1941d1 100644 --- a/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp @@ -1,7 +1,7 @@ #include "SetSoundSettings.h" namespace LUS { -void* SetSoundSettings::GetPointer() { +SoundSettings* SetSoundSettings::GetPointer() { return &settings; } diff --git a/soh/soh/resource/type/scenecommand/SetSoundSettings.h b/soh/soh/resource/type/scenecommand/SetSoundSettings.h index 3287b4b96..c4ee4668d 100644 --- a/soh/soh/resource/type/scenecommand/SetSoundSettings.h +++ b/soh/soh/resource/type/scenecommand/SetSoundSettings.h @@ -14,11 +14,11 @@ typedef struct { uint8_t reverb; } SoundSettings; -class SetSoundSettings : public SceneCommand { +class SetSoundSettings : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + SoundSettings* GetPointer(); size_t GetPointerSize(); SoundSettings settings; diff --git a/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp b/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp index 36c2dc7f7..3887107da 100644 --- a/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp +++ b/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp @@ -1,7 +1,7 @@ #include "SetSpecialObjects.h" namespace LUS { -void* SetSpecialObjects::GetPointer() { +SpecialObjects* SetSpecialObjects::GetPointer() { return &specialObjects; } diff --git a/soh/soh/resource/type/scenecommand/SetSpecialObjects.h b/soh/soh/resource/type/scenecommand/SetSpecialObjects.h index b1a48f3a2..78cfcd425 100644 --- a/soh/soh/resource/type/scenecommand/SetSpecialObjects.h +++ b/soh/soh/resource/type/scenecommand/SetSpecialObjects.h @@ -13,11 +13,11 @@ typedef struct { int16_t globalObject; } SpecialObjects; -class SetSpecialObjects : public SceneCommand { +class SetSpecialObjects : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + SpecialObjects* GetPointer(); size_t GetPointerSize(); SpecialObjects specialObjects; diff --git a/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp b/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp index 626503791..89fb40049 100644 --- a/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp +++ b/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp @@ -1,7 +1,7 @@ #include "SetStartPositionList.h" namespace LUS { -void* SetStartPositionList::GetPointer() { +ActorEntry* SetStartPositionList::GetPointer() { return startPositions.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetStartPositionList.h b/soh/soh/resource/type/scenecommand/SetStartPositionList.h index 4f914b012..1c5d4242f 100644 --- a/soh/soh/resource/type/scenecommand/SetStartPositionList.h +++ b/soh/soh/resource/type/scenecommand/SetStartPositionList.h @@ -17,11 +17,11 @@ namespace LUS { // /* 0x0E */ s16 params; // } ActorEntry; // size = 0x10 -class SetStartPositionList : public SceneCommand { +class SetStartPositionList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + ActorEntry* GetPointer(); size_t GetPointerSize(); uint32_t numStartPositions; diff --git a/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp b/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp index bcaa19237..9a10fb022 100644 --- a/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp @@ -1,7 +1,7 @@ #include "SetTimeSettings.h" namespace LUS { -void* SetTimeSettings::GetPointer() { +TimeSettings* SetTimeSettings::GetPointer() { return &settings; } diff --git a/soh/soh/resource/type/scenecommand/SetTimeSettings.h b/soh/soh/resource/type/scenecommand/SetTimeSettings.h index fdc4338d8..637398652 100644 --- a/soh/soh/resource/type/scenecommand/SetTimeSettings.h +++ b/soh/soh/resource/type/scenecommand/SetTimeSettings.h @@ -14,11 +14,11 @@ typedef struct { uint8_t timeIncrement; } TimeSettings; -class SetTimeSettings : public SceneCommand { +class SetTimeSettings : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + TimeSettings* GetPointer(); size_t GetPointerSize(); TimeSettings settings; diff --git a/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp b/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp index 3cbb4cae6..86387e682 100644 --- a/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp +++ b/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp @@ -1,7 +1,7 @@ #include "SetTransitionActorList.h" namespace LUS { -void* SetTransitionActorList::GetPointer() { +TransitionActorEntry* SetTransitionActorList::GetPointer() { return transitionActorList.data(); } diff --git a/soh/soh/resource/type/scenecommand/SetTransitionActorList.h b/soh/soh/resource/type/scenecommand/SetTransitionActorList.h index 20eb63c87..bb6fc2ac6 100644 --- a/soh/soh/resource/type/scenecommand/SetTransitionActorList.h +++ b/soh/soh/resource/type/scenecommand/SetTransitionActorList.h @@ -21,11 +21,11 @@ typedef struct { /* 0x0E */ s16 params; } TransitionActorEntry; // size = 0x10 -class SetTransitionActorList : public SceneCommand { +class SetTransitionActorList : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + TransitionActorEntry* GetPointer(); size_t GetPointerSize(); uint32_t numTransitionActors; diff --git a/soh/soh/resource/type/scenecommand/SetWindSettings.cpp b/soh/soh/resource/type/scenecommand/SetWindSettings.cpp index d575b1b69..3aa9ce7a6 100644 --- a/soh/soh/resource/type/scenecommand/SetWindSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetWindSettings.cpp @@ -1,7 +1,7 @@ #include "SetWindSettings.h" namespace LUS { -void* SetWindSettings::GetPointer() { +WindSettings* SetWindSettings::GetPointer() { return &settings; } diff --git a/soh/soh/resource/type/scenecommand/SetWindSettings.h b/soh/soh/resource/type/scenecommand/SetWindSettings.h index 3a193d1b0..e79b445ae 100644 --- a/soh/soh/resource/type/scenecommand/SetWindSettings.h +++ b/soh/soh/resource/type/scenecommand/SetWindSettings.h @@ -15,11 +15,11 @@ typedef struct { uint8_t windSpeed; } WindSettings; -class SetWindSettings : public SceneCommand { +class SetWindSettings : public SceneCommand { public: using SceneCommand::SceneCommand; - void* GetPointer(); + WindSettings* GetPointer(); size_t GetPointerSize(); WindSettings settings; diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 65c849bfa..5454a0d9c 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -13,7 +13,7 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn); s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene); //LUS::OTRResource* OTRPlay_LoadFile(PlayState* play, RomFile* file) { -LUS::Resource* OTRPlay_LoadFile(PlayState* play, const char* fileName) +LUS::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName) { auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(fileName); return res.get(); @@ -82,7 +82,7 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn) { } /* auto data = static_cast(LUS::Context::GetInstance() ->GetResourceManager() - ->LoadResource("object_link_child\\object_link_childVtx_01FE08") + ->ResourceLoad("object_link_child\\object_link_childVtx_01FE08") .get()); auto data2 = ResourceMgr_LoadVtxByCRC(0x68d4ea06044e228f);*/ diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 09dffadd6..349e624d0 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -33,7 +33,7 @@ #include "soh/resource/type/scenecommand/SetEchoSettings.h" #include "soh/resource/type/scenecommand/SetAlternateHeaders.h" -extern LUS::Resource* OTRPlay_LoadFile(PlayState* play, const char* fileName); +extern LUS::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName); extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); extern "C" RomFile sNaviMsgFiles[]; s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene); @@ -50,12 +50,12 @@ std::shared_ptr ResourceMgr_LoadFile(const char* path) { } // Forward Declaration of function declared in OTRGlobals.cpp -std::shared_ptr GetResourceByNameHandlingMQ(const char* path); +std::shared_ptr GetResourceByNameHandlingMQ(const char* path); -bool Scene_CommandSpawnList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandSpawnList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetStartPositionList* cmdStartPos = std::static_pointer_cast(cmd); LUS::SetStartPositionList* cmdStartPos = (LUS::SetStartPositionList*)cmd; - ActorEntry* entries = (ActorEntry*)cmdStartPos->GetPointer(); + ActorEntry* entries = (ActorEntry*)cmdStartPos->GetRawPointer(); play->linkActorEntry = &entries[play->setupEntranceList[play->curSpawn].spawn]; play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); @@ -66,50 +66,50 @@ bool Scene_CommandSpawnList(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandActorList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandActorList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetActorList* cmdActor = std::static_pointer_cast(cmd); LUS::SetActorList* cmdActor = (LUS::SetActorList*)cmd; play->numSetupActors = cmdActor->numActors; - play->setupActorList = (ActorEntry*)cmdActor->GetPointer(); + play->setupActorList = (ActorEntry*)cmdActor->GetRawPointer(); return false; } -bool Scene_CommandUnused2(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandUnused2(PlayState* play, LUS::ISceneCommand* cmd) { // OTRTODO: Do we need to implement this? // play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); return false; } -bool Scene_CommandCollisionHeader(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandCollisionHeader(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetCollisionHeader* cmdCol = std::static_pointer_cast(cmd); LUS::SetCollisionHeader* cmdCol = (LUS::SetCollisionHeader*)cmd; - BgCheck_Allocate(&play->colCtx, play, (CollisionHeader*)cmdCol->GetPointer()); + BgCheck_Allocate(&play->colCtx, play, (CollisionHeader*)cmdCol->GetRawPointer()); return false; } -bool Scene_CommandRoomList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandRoomList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetRoomList* cmdRoomList = std::static_pointer_cast(cmd); LUS::SetRoomList* cmdRoomList = (LUS::SetRoomList*)cmd; play->numRooms = cmdRoomList->numRooms; - play->roomList = (RomFile*)cmdRoomList->GetPointer(); + play->roomList = (RomFile*)cmdRoomList->GetRawPointer(); return false; } -bool Scene_CommandEntranceList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandEntranceList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetEntranceList* otrEntrance = std::static_pointer_cast(cmd); LUS::SetEntranceList* otrEntrance = (LUS::SetEntranceList*)cmd; - play->setupEntranceList = (EntranceEntry*)otrEntrance->GetPointer(); + play->setupEntranceList = (EntranceEntry*)otrEntrance->GetRawPointer(); return false; } -bool Scene_CommandSpecialFiles(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandSpecialFiles(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetSpecialObjects* specialCmd = std::static_pointer_cast(cmd); LUS::SetSpecialObjects* specialCmd = (LUS::SetSpecialObjects*)cmd; @@ -126,7 +126,7 @@ bool Scene_CommandSpecialFiles(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandRoomBehavior(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandRoomBehavior(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetRoomBehavior* cmdRoom = std::static_pointer_cast(cmd); LUS::SetRoomBehavior* cmdRoom = (LUS::SetRoomBehavior*)cmd; @@ -138,17 +138,17 @@ bool Scene_CommandRoomBehavior(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandMeshHeader(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandMeshHeader(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetMesh* otrMesh = static_pointer_cast(cmd); LUS::SetMesh* otrMesh = (LUS::SetMesh*)cmd; - play->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->GetPointer(); + play->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->GetRawPointer(); return false; } extern "C" void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId); -bool Scene_CommandObjectList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetObjectList* cmdObj = static_pointer_cast(cmd); LUS::SetObjectList* cmdObj = (LUS::SetObjectList*)cmd; @@ -159,7 +159,7 @@ bool Scene_CommandObjectList(PlayState* play, LUS::SceneCommand* cmd) { ObjectStatus* status2; ObjectStatus* firstStatus; // s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.segment); - s16* objectEntry = (s16*)cmdObj->GetPointer(); + s16* objectEntry = (s16*)cmdObj->GetRawPointer(); void* nextPtr; k = 0; @@ -210,7 +210,7 @@ bool Scene_CommandObjectList(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandLightList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandLightList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetLightList* cmdLight = static_pointer_cast(cmd); LUS::SetLightList* cmdLight = (LUS::SetLightList*)cmd; @@ -221,20 +221,20 @@ bool Scene_CommandLightList(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandPathList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandPathList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetPathways* cmdPath = static_pointer_cast(cmd); LUS::SetPathways* cmdPath = (LUS::SetPathways*)cmd; - play->setupPathList = (Path*)cmdPath->paths[0]->GetPointer(); + play->setupPathList = (Path*)(cmdPath->GetPointer()[0]); return false; } -bool Scene_CommandTransitionActorList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandTransitionActorList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetTransitionActorList* cmdActor = static_pointer_cast(cmd); LUS::SetTransitionActorList* cmdActor = (LUS::SetTransitionActorList*)cmd; play->transiActorCtx.numActors = cmdActor->numTransitionActors; - play->transiActorCtx.list = (TransitionActorEntry*)cmdActor->GetPointer(); + play->transiActorCtx.list = (TransitionActorEntry*)cmdActor->GetRawPointer(); return false; } @@ -243,14 +243,14 @@ bool Scene_CommandTransitionActorList(PlayState* play, LUS::SceneCommand* cmd) { // transiActorCtx->numActors = 0; //} -bool Scene_CommandLightSettingsList(PlayState* play, LUS::SceneCommand* cmd) { - play->envCtx.lightSettingsList = (EnvLightSettings*)cmd->GetPointer(); +bool Scene_CommandLightSettingsList(PlayState* play, LUS::ISceneCommand* cmd) { + play->envCtx.lightSettingsList = (EnvLightSettings*)cmd->GetRawPointer(); return false; } // Scene Command 0x11: Skybox Settings -bool Scene_CommandSkyboxSettings(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandSkyboxSettings(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetSkyboxSettings* cmdSky = static_pointer_cast(cmd); LUS::SetSkyboxSettings* cmdSky = (LUS::SetSkyboxSettings*)cmd; @@ -261,7 +261,7 @@ bool Scene_CommandSkyboxSettings(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandSkyboxDisables(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandSkyboxDisables(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetSkyboxModifier* cmdSky = static_pointer_cast(cmd); LUS::SetSkyboxModifier* cmdSky = (LUS::SetSkyboxModifier*)cmd; @@ -271,7 +271,7 @@ bool Scene_CommandSkyboxDisables(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandTimeSettings(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandTimeSettings(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetTimeSettings* cmdTime = static_pointer_cast(cmd); LUS::SetTimeSettings* cmdTime = (LUS::SetTimeSettings*)cmd; @@ -311,7 +311,7 @@ bool Scene_CommandTimeSettings(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandWindSettings(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandWindSettings(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetWind* cmdWind = std::static_pointer_cast(cmd); LUS::SetWindSettings* cmdWind = (LUS::SetWindSettings*)cmd; @@ -324,17 +324,17 @@ bool Scene_CommandWindSettings(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandExitList(PlayState* play, LUS::SceneCommand* cmd) { - play->setupExitList = (s16*)cmd->GetPointer(); +bool Scene_CommandExitList(PlayState* play, LUS::ISceneCommand* cmd) { + play->setupExitList = (s16*)cmd->GetRawPointer(); return false; } -bool Scene_CommandUndefined9(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandUndefined9(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandSoundSettings(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandSoundSettings(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetSoundSettings* cmdSnd = static_pointer_cast(cmd); LUS::SetSoundSettings* cmdSnd = (LUS::SetSoundSettings*)cmd; @@ -348,7 +348,7 @@ bool Scene_CommandSoundSettings(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandEchoSettings(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandEchoSettings(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetEchoSettings* cmdEcho = static_pointer_cast(cmd); LUS::SetEchoSettings* cmdEcho = (LUS::SetEchoSettings*)cmd; @@ -357,7 +357,7 @@ bool Scene_CommandEchoSettings(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandAlternateHeaderList(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandAlternateHeaderList(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetAlternateHeaders* cmdHeaders = static_pointer_cast(cmd); LUS::SetAlternateHeaders* cmdHeaders = (LUS::SetAlternateHeaders*)cmd; @@ -396,7 +396,7 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool Scene_CommandCutsceneData(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandCutsceneData(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetCutscenes* cmdCS = std::static_pointer_cast(cmd); LUS::SetCutscenes* cmdCS = (LUS::SetCutscenes*)cmd; @@ -407,7 +407,7 @@ bool Scene_CommandCutsceneData(PlayState* play, LUS::SceneCommand* cmd) { } // Camera & World Map Area -bool Scene_CommandMiscSettings(PlayState* play, LUS::SceneCommand* cmd) { +bool Scene_CommandMiscSettings(PlayState* play, LUS::ISceneCommand* cmd) { // LUS::SetCameraSettings* cmdCam = std::static_pointer_cast(cmd); LUS::SetCameraSettings* cmdCam = (LUS::SetCameraSettings*)cmd; @@ -431,7 +431,7 @@ bool Scene_CommandMiscSettings(PlayState* play, LUS::SceneCommand* cmd) { return false; } -bool (*sceneCommands[])(PlayState*, LUS::SceneCommand*) = { +bool (*sceneCommands[])(PlayState*, LUS::ISceneCommand*) = { Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 diff --git a/soh/src/code/audioMgr.c b/soh/src/code/audioMgr.c index 35c21ab95..d9b215d07 100644 --- a/soh/src/code/audioMgr.c +++ b/soh/src/code/audioMgr.c @@ -84,7 +84,7 @@ void AudioMgr_Unlock(AudioMgr* audioMgr) { } void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr) { - AudioPlayer_Init(); + // AudioPlayer_Init(); memset(audioMgr,0, sizeof(AudioMgr)); @@ -108,7 +108,12 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon AudioLoad_SetDmaHandler(DmaMgr_DmaHandler); Audio_InitSound(); osSendMesgPtr(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK); - Hooks_ExecuteAudioInit(); + + Audio_SetGameVolume(SEQ_PLAYER_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f)); + Audio_SetGameVolume(SEQ_PLAYER_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f)); + Audio_SetGameVolume(SEQ_PLAYER_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f)); + Audio_SetGameVolume(SEQ_PLAYER_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); + // Removed due to crash //IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74); hasInitialized = true; diff --git a/soh/src/code/game.c b/soh/src/code/game.c index 26b26e94c..09e35ea0f 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -466,7 +466,7 @@ void GameState_Destroy(GameState* gameState) { ResourceMgr_ClearSkeletons(); if (CVarGetInteger("gAltAssets", 0)) { - UnloadResourceDirectory("alt/*"); + ResourceUnloadDirectory("alt/*"); gfx_texture_cache_clear(); } } diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index 4271955f2..00d55abdb 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -5,7 +5,6 @@ #include #include "soh/Enhancements/gameconsole.h" -#include "soh/Enhancements/debugger/debugger.h" #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 @@ -279,7 +278,6 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { GameState_ReqPadData(gameState); GameState_Update(gameState); - Debug_Draw(); OPEN_DISPS(gfxCtx); diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c index d98d23e4a..81227f11e 100644 --- a/soh/src/code/padmgr.c +++ b/soh/src/code/padmgr.c @@ -209,6 +209,7 @@ void PadMgr_RumbleSet(PadMgr* padMgr, u8* ctrlrRumbles) { padMgr->rumbleOnFrames = 240; } +#define PAUSE_BUFFER_INPUT_BLOCK_ID 0 void PadMgr_ProcessInputs(PadMgr* padMgr) { s32 i; Input* input; @@ -298,9 +299,9 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) { OTRControllerCallback(rumble); if (CVarGetInteger("gPauseBufferBlockInputFrame", 0)) { - Controller_BlockGameInput(); + ControllerBlockGameInput(PAUSE_BUFFER_INPUT_BLOCK_ID); } else { - Controller_UnblockGameInput(); + ControllerUnblockGameInput(PAUSE_BUFFER_INPUT_BLOCK_ID); } PadMgr_UnlockPadData(padMgr); diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index 0c267af62..5b23d6ed1 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -413,7 +413,7 @@ void Map_InitData(PlayState* play, s16 room) { //gMapData->owMinimapTexSize[mapIndex], __FILE__, __LINE__); if (sEntranceIconMapIndex < 24) { - play->interfaceCtx.mapSegment[0] = GetResourceDataByName(minimapTableOW[sEntranceIconMapIndex]); + play->interfaceCtx.mapSegment[0] = ResourceGetDataByName(minimapTableOW[sEntranceIconMapIndex]); play->interfaceCtx.mapSegmentName[0] = minimapTableOW[sEntranceIconMapIndex]; } @@ -447,7 +447,7 @@ void Map_InitData(PlayState* play, s16 room) { //((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * 0xFF0), //0xFF0, __FILE__, __LINE__); - play->interfaceCtx.mapSegment[0] = GetResourceDataByName( + play->interfaceCtx.mapSegment[0] = ResourceGetDataByName( minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room]); play->interfaceCtx.mapSegmentName[0] = minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room]; R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room]; diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 032191795..b76555b06 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -4,13 +4,14 @@ #include #include "soh/Enhancements/gameconsole.h" -#include #include "soh/frame_interpolation.h" #include "soh/Enhancements/debugconsole.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include +#include + #include void* D_8012D1F0 = NULL; diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 262ac3e91..cb856b870 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -332,8 +332,8 @@ void Player_SetBootData(PlayState* play, Player* this) { // Custom method used to determine if we're using a custom model for link uint8_t Player_IsCustomLinkModel() { - return (LINK_IS_ADULT && GetResourceIsCustomByName(gLinkAdultSkel)) || - (LINK_IS_CHILD && GetResourceIsCustomByName(gLinkChildSkel)); + return (LINK_IS_ADULT && ResourceGetIsCustomByName(gLinkAdultSkel)) || + (LINK_IS_CHILD && ResourceGetIsCustomByName(gLinkChildSkel)); } s32 Player_InBlockingCsMode(PlayState* play, Player* this) { diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 3d5acfe40..1d4b610c5 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -273,7 +273,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h bg->b.imageFlip = 0; if (ResourceMgr_ResourceIsBackground((char*) source)) { - char* blob = (char*) GetResourceDataByName((char *) source); + char* blob = (char*) ResourceGetDataByName((char *) source); swapAndConvertJPEG(blob); bg->b.imagePtr = (uintptr_t) blob; } diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index c35c06149..86820b0df 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -88,7 +88,7 @@ void func_808C12C4(u8* arg1, s16 arg2) { void func_808C1554(void* arg0, void* floorTex, s32 arg2, f32 arg3) { arg0 = GetResourceDataByNameHandlingMQ(arg0); - floorTex = GetResourceDataByName(floorTex); + floorTex = ResourceGetDataByName(floorTex); u16* temp_s3 = SEGMENTED_TO_VIRTUAL(arg0); u16* temp_s1 = SEGMENTED_TO_VIRTUAL(floorTex); @@ -187,8 +187,8 @@ void BossDodongo_Init(Actor* thisx, PlayState* play) { Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->items); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // KD is dead - u16* LavaFloorTex = GetResourceDataByName(gDodongosCavernBossLavaFloorTex); - u16* LavaFloorRockTex = GetResourceDataByName(sLavaFloorRockTex); + u16* LavaFloorTex = ResourceGetDataByName(gDodongosCavernBossLavaFloorTex); + u16* LavaFloorRockTex = ResourceGetDataByName(sLavaFloorRockTex); temp_s1_3 = SEGMENTED_TO_VIRTUAL(LavaFloorTex); temp_s2 = SEGMENTED_TO_VIRTUAL(LavaFloorRockTex); Actor_Kill(&this->actor); @@ -1019,8 +1019,8 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) { } if (this->unk_1C6 != 0) { - u16* ptr1 = GetResourceDataByName(sLavaFloorLavaTex); - u16* ptr2 = GetResourceDataByName(sLavaFloorRockTex); + u16* ptr1 = ResourceGetDataByName(sLavaFloorLavaTex); + u16* ptr2 = ResourceGetDataByName(sLavaFloorRockTex); s16 i2; for (i2 = 0; i2 < 20; i2++) { diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 411596d38..f1f7aebd6 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -1225,7 +1225,7 @@ void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) { void BossGanon_ShatterWindows(u8 windowShatterState) { s16 i; - u8* templateTex = GetResourceDataByName(SEGMENTED_TO_VIRTUAL(gGanondorfWindowShatterTemplateTex)); + u8* templateTex = ResourceGetDataByName(SEGMENTED_TO_VIRTUAL(gGanondorfWindowShatterTemplateTex)); for (i = 0; i < ARRAY_COUNT(sWindowShatterTex); i++) { if ((sWindowShatterTex[i] != 1) && (Rand_ZeroOne() < 0.03f)) { diff --git a/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 306e34100..926787cc3 100644 --- a/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/soh/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -397,7 +397,7 @@ void EnJsjutan_Draw(Actor* thisx, PlayState* play2) { if (this->unk_164) { this->unk_164 = false; - u8* carpTex = GetResourceDataByName(sCarpetTex); + u8* carpTex = ResourceGetDataByName(sCarpetTex); u8* shadTex = sShadowTex; for (i = 0; i < ARRAY_COUNT(sShadowTex); i++) { if (((u16*)carpTex)[i] != 0) { // Hack to bypass ZAPD exporting textures as u64. 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 5f3a09b0a..773f5b6f8 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 @@ -3179,8 +3179,8 @@ void KaleidoScope_LoadDungeonMap(PlayState* play) { interfaceCtx->mapSegmentName[0] = sDungeonMapTexs[R_MAP_TEX_INDEX]; interfaceCtx->mapSegmentName[1] = sDungeonMapTexs[R_MAP_TEX_INDEX + 1]; - interfaceCtx->mapSegment[0] = GetResourceDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX]); - interfaceCtx->mapSegment[1] = GetResourceDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX + 1]); + interfaceCtx->mapSegment[0] = ResourceGetDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX]); + interfaceCtx->mapSegment[1] = ResourceGetDataByName(sDungeonMapTexs[R_MAP_TEX_INDEX + 1]); } void KaleidoScope_UpdateDungeonMap(PlayState* play) {