summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJameriquiah <42100286+Jameriquiah@users.noreply.github.com>2026-07-21 22:22:35 -0400
committerGitHub <noreply@github.com>2026-07-21 22:22:35 -0400
commit65fb1b6e3cc49780057208f4050a160d1a4bdfc7 (patch)
treec0f2434ea2ee47c51cbb47ede559d4d5b318ec23
parentf86e04b4d5492906718aa7bacf5b92d55756006c (diff)
Bump LUS to port-maintenance (#1801)
* bump lus to port-maintenance * clang * remove redundant cast * clang again * update lus commit
m---------libultraship0
-rw-r--r--mm/2s2h/BenGui/BenGui.cpp8
-rw-r--r--mm/2s2h/BenGui/BenInputEditorWindow.cpp83
-rw-r--r--mm/2s2h/BenGui/BenMenu.cpp34
-rw-r--r--mm/2s2h/BenGui/BenMenuBar.cpp23
-rw-r--r--mm/2s2h/BenGui/CosmeticEditor.cpp14
-rw-r--r--mm/2s2h/BenGui/DynamicCosmeticEditor.cpp16
-rw-r--r--mm/2s2h/BenGui/HudEditor.cpp6
-rw-r--r--mm/2s2h/BenGui/InputViewer.cpp187
-rw-r--r--mm/2s2h/BenGui/Menu.cpp40
-rw-r--r--mm/2s2h/BenGui/Menu.h6
-rw-r--r--mm/2s2h/BenGui/MenuTypes.h10
-rw-r--r--mm/2s2h/BenGui/Notification.cpp5
-rw-r--r--mm/2s2h/BenGui/ResolutionEditor.cpp16
-rw-r--r--mm/2s2h/BenGui/UIWidgets.cpp16
-rw-r--r--mm/2s2h/BenGui/UIWidgets.hpp8
-rw-r--r--mm/2s2h/BenPort.cpp102
-rw-r--r--mm/2s2h/BenPort.h2
-rw-r--r--mm/2s2h/DeveloperTools/CollisionViewer.cpp2
-rw-r--r--mm/2s2h/DeveloperTools/DLViewer.cpp6
-rw-r--r--mm/2s2h/DeveloperTools/DebugConsole.cpp16
-rw-r--r--mm/2s2h/DeveloperTools/DeveloperTools.cpp2
-rw-r--r--mm/2s2h/DeveloperTools/EventLog.cpp4
-rw-r--r--mm/2s2h/DeveloperTools/SaveEditor.cpp66
-rw-r--r--mm/2s2h/DeveloperTools/WarpPoint.cpp8
-rw-r--r--mm/2s2h/Enhancements/Audio/AudioCollection.cpp4
-rw-r--r--mm/2s2h/Enhancements/Audio/AudioEditor.cpp28
-rw-r--r--mm/2s2h/Enhancements/Audio/AudioSeqQueue.cpp2
-rw-r--r--mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp2
-rw-r--r--mm/2s2h/Enhancements/ModMenu/ModMenu.cpp8
-rw-r--r--mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp10
-rw-r--r--mm/2s2h/Enhancements/Restorations/N64WeirdFrames/WeirdAnimation.cpp2
-rw-r--r--mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp18
-rw-r--r--mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTracker.cpp36
-rw-r--r--mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTrackerSettings.cpp6
-rw-r--r--mm/2s2h/Enhancements/Trackers/TimeSplits/TimeSplitsActions.cpp24
-rw-r--r--mm/2s2h/Enhancements/Trackers/TimeSplits/Timesplits.cpp10
-rw-r--r--mm/2s2h/Enhancements/Trackers/TimeSplits/TimesplitsSettings.cpp30
-rw-r--r--mm/2s2h/PresetManager/PresetManager.cpp4
-rw-r--r--mm/2s2h/Rando/CheckTracker/CheckTracker.cpp13
-rw-r--r--mm/2s2h/Rando/Menu.cpp16
-rw-r--r--mm/2s2h/Rando/MiscBehavior/SariasSongHint.cpp6
-rw-r--r--mm/2s2h/Rando/Rando.cpp2
-rw-r--r--mm/2s2h/Rando/StartingItems.cpp8
-rw-r--r--mm/2s2h/ShipUtils.cpp17
-rw-r--r--mm/2s2h/config/ConfigUpdaters.cpp2
-rw-r--r--mm/2s2h/resource/importer/AnimationFactory.cpp6
-rw-r--r--mm/2s2h/resource/importer/AudioSampleFactory.cpp2
-rw-r--r--mm/2s2h/resource/importer/AudioSequenceFactory.cpp2
-rw-r--r--mm/2s2h/resource/importer/AudioSoundFontFactory.cpp27
-rw-r--r--mm/2s2h/resource/importer/KeyFrameFactory.cpp4
-rw-r--r--mm/2s2h/resource/importer/SkeletonFactory.cpp4
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp2
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp2
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp3
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp2
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp2
-rw-r--r--mm/2s2h/resource/type/Skeleton.cpp2
-rw-r--r--mm/2s2h/z_message_OTR.cpp7
-rw-r--r--mm/2s2h/z_play_2SH.cpp2
60 files changed, 551 insertions, 444 deletions
diff --git a/libultraship b/libultraship
-Subproject 7f2baa104108af3fca9f094754ea974a4973bde
+Subproject 8a67fa4b9c6d8302cba4aeecd02411d16d28d81
diff --git a/mm/2s2h/BenGui/BenGui.cpp b/mm/2s2h/BenGui/BenGui.cpp
index df6a744da..b1de7f1a7 100644
--- a/mm/2s2h/BenGui/BenGui.cpp
+++ b/mm/2s2h/BenGui/BenGui.cpp
@@ -75,7 +75,7 @@ UIWidgets::Colors GetMenuThemeColor() {
}
void SetupMenu() {
- auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
+ auto gui = Ship::Context::GetRawInstance()->GetWindow()->GetGui();
mBenMenu = std::make_shared<BenMenu>("gWindows.Menu", "Settings Menu");
gui->SetMenu(mBenMenu);
@@ -90,7 +90,7 @@ void SetupMenu() {
}
void SetupGuiElements() {
- auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
+ auto gui = Ship::Context::GetRawInstance()->GetWindow()->GetGui();
mStatsWindow = gui->GetGuiWindow("Stats");
if (mStatsWindow == nullptr) {
@@ -185,7 +185,7 @@ void SetupGuiElements() {
}
void Destroy() {
- auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
+ auto gui = Ship::Context::GetRawInstance()->GetWindow()->GetGui();
gui->RemoveAllGuiWindows();
mBenMenuBar = nullptr;
@@ -243,7 +243,7 @@ void SetDisplayOverlayVisibility(bool visible) {
} else {
CVarSetInteger("gWindows.DisplayOverlay", visible ? 1 : 0);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
} // namespace BenGui
diff --git a/mm/2s2h/BenGui/BenInputEditorWindow.cpp b/mm/2s2h/BenGui/BenInputEditorWindow.cpp
index 9f9264878..73779aab6 100644
--- a/mm/2s2h/BenGui/BenInputEditorWindow.cpp
+++ b/mm/2s2h/BenGui/BenInputEditorWindow.cpp
@@ -72,7 +72,7 @@ void BenInputEditorWindow::UpdateElement() {
}
if (mInputEditorPopupOpen && ImGui::IsPopupOpen("", ImGuiPopupFlags_AnyPopupId)) {
- Ship::Context::GetInstance()->GetControlDeck()->BlockGameInput(INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID);
+ Ship::Context::GetRawInstance()->GetControlDeck()->BlockGameInput(INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID);
// continue to block input for a third of a second after getting the mapping
mGameInputBlockTimer = ImGui::GetIO().Framerate / 3;
@@ -84,24 +84,24 @@ void BenInputEditorWindow::UpdateElement() {
}
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->BlockGamepadNavigation();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->BlockGamepadNavigation();
} else {
if (mGameInputBlockTimer != INT32_MAX) {
mGameInputBlockTimer--;
if (mGameInputBlockTimer <= 0) {
- Ship::Context::GetInstance()->GetControlDeck()->UnblockGameInput(
+ Ship::Context::GetRawInstance()->GetControlDeck()->UnblockGameInput(
INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID);
mGameInputBlockTimer = INT32_MAX;
}
}
- if (Ship::Context::GetInstance()->GetWindow()->GetGui()->GamepadNavigationEnabled()) {
+ if (Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GamepadNavigationEnabled()) {
mMappingInputBlockTimer = ImGui::GetIO().Framerate / 3;
} else {
mMappingInputBlockTimer = INT32_MAX;
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->UnblockGamepadNavigation();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->UnblockGamepadNavigation();
}
}
@@ -241,7 +241,7 @@ void BenInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, N64Butto
ImGui::CloseCurrentPopup();
}
// todo: figure out why optional params (using id = "" in the definition) wasn't working
- if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
+ if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetButton(bitmask)
@@ -254,7 +254,7 @@ void BenInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, N64Butto
}
void BenInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64ButtonMask bitmask, std::string id) {
- auto mapping = Ship::Context::GetInstance()
+ auto mapping = Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetButton(bitmask)
@@ -304,7 +304,7 @@ void BenInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
mInputEditorPopupOpen = false;
ImGui::CloseCurrentPopup();
}
- if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
+ if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetButton(bitmask)
@@ -345,7 +345,7 @@ void BenInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
ImGui::Text("Axis Threshold\n\nThe extent to which the joystick\nmust be moved or the trigger\npressed to "
"initiate the assigned\nbutton action.\n\n");
- auto globalSettings = Ship::Context::GetInstance()->GetControlDeck()->GetGlobalSDLDeviceSettings();
+ auto globalSettings = Ship::Context::GetRawInstance()->GetControlDeck()->GetGlobalSDLDeviceSettings();
if (sdlAxisDirectionToButtonMapping->AxisIsStick()) {
ImGui::Text("Stick axis threshold:");
@@ -440,7 +440,7 @@ void BenInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64Butt
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f));
if (ImGui::Button(StringHelper::Sprintf("%s###removeButtonMappingButton%s", ICON_FA_TIMES, id.c_str()).c_str(),
ImVec2(ImGui::CalcTextSize(ICON_FA_TIMES).x + SCALE_IMGUI_SIZE(10.0f), 0.0f))) {
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetButton(bitmask)
@@ -490,7 +490,7 @@ void BenInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port,
}
if (stick == Ship::LEFT) {
if (mMappingInputBlockTimer == INT32_MAX &&
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLeftStick()
@@ -500,7 +500,7 @@ void BenInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port,
}
} else {
if (mMappingInputBlockTimer == INT32_MAX &&
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRightStick()
@@ -516,13 +516,13 @@ void BenInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port,
Ship::Direction direction, std::string id) {
std::shared_ptr<Ship::ControllerAxisDirectionMapping> mapping = nullptr;
if (stick == Ship::LEFT) {
- mapping = Ship::Context::GetInstance()
+ mapping = Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLeftStick()
->GetAxisDirectionMappingById(direction, id);
} else {
- mapping = Ship::Context::GetInstance()
+ mapping = Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRightStick()
@@ -578,7 +578,7 @@ void BenInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port,
if (stick == Ship::LEFT) {
if (mMappingInputBlockTimer == INT32_MAX &&
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLeftStick()
@@ -588,7 +588,7 @@ void BenInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port,
}
} else {
if (mMappingInputBlockTimer == INT32_MAX &&
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRightStick()
@@ -608,13 +608,13 @@ void BenInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port,
StringHelper::Sprintf("%s###removeStickDirectionMappingButton%s", ICON_FA_TIMES, id.c_str()).c_str(),
ImVec2(ImGui::CalcTextSize(ICON_FA_TIMES).x + SCALE_IMGUI_SIZE(10.0f), 0.0f))) {
if (stick == Ship::LEFT) {
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLeftStick()
->ClearAxisDirectionMapping(direction, id);
} else {
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRightStick()
@@ -647,9 +647,9 @@ void BenInputEditorWindow::DrawStickSection(uint8_t port, uint8_t stick, ImVec4
static int8_t sX, sY;
std::shared_ptr<Ship::ControllerStick> controllerStick = nullptr;
if (stick == Ship::LEFT) {
- controllerStick = Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick();
+ controllerStick = Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick();
} else {
- controllerStick = Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick();
+ controllerStick = Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick();
}
controllerStick->Process(sX, sY);
DrawAnalogPreview(StringHelper::Sprintf("##AnalogPreview%d", stick).c_str(), ImVec2(sX, sY));
@@ -791,7 +791,7 @@ void BenInputEditorWindow::UpdateBitmaskToMappingIds(uint8_t port) {
// todo: do we need this now that ControllerButton exists?
for (auto [bitmask, button] :
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetAllButtons()) {
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetAllButtons()) {
for (auto [id, mapping] : button->GetAllButtonMappings()) {
// using a vector here instead of a set because i want newly added mappings
// to go to the end of the list instead of autosorting
@@ -807,10 +807,11 @@ void BenInputEditorWindow::UpdateStickDirectionToMappingIds(uint8_t port) {
// todo: do we need this?
for (auto stick :
{ std::make_pair<uint8_t, std::shared_ptr<Ship::ControllerStick>>(
- Ship::LEFT, Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick()),
+ Ship::LEFT,
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick()),
std::make_pair<uint8_t, std::shared_ptr<Ship::ControllerStick>>(
Ship::RIGHT,
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick()) }) {
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick()) }) {
for (auto direction : { Ship::LEFT, Ship::RIGHT, Ship::UP, Ship::DOWN }) {
for (auto [id, mapping] : stick.second->GetAllAxisDirectionMappingByDirection(direction)) {
// using a vector here instead of a set because i want newly added mappings
@@ -830,7 +831,8 @@ void BenInputEditorWindow::DrawRemoveRumbleMappingButton(uint8_t port, std::stri
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f));
if (ImGui::Button(StringHelper::Sprintf("%s###removeRumbleMapping%s", ICON_FA_TIMES, id.c_str()).c_str(),
ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) {
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRumble()->ClearRumbleMapping(id);
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetRumble()->ClearRumbleMapping(
+ id);
}
ImGui::PopStyleVar();
}
@@ -854,7 +856,7 @@ void BenInputEditorWindow::DrawAddRumbleMappingButton(uint8_t port) {
ImGui::CloseCurrentPopup();
}
- if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
+ if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRumble()
@@ -871,7 +873,7 @@ bool BenInputEditorWindow::TestingRumble() {
}
void BenInputEditorWindow::DrawRumbleSection(uint8_t port) {
- for (auto [id, mapping] : Ship::Context::GetInstance()
+ for (auto [id, mapping] : Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRumble()
@@ -1014,7 +1016,7 @@ void BenInputEditorWindow::DrawRemoveLEDMappingButton(uint8_t port, std::string
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f));
if (ImGui::Button(StringHelper::Sprintf("%s###removeLEDMapping%s", ICON_FA_TIMES, id.c_str()).c_str(),
ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) {
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->ClearLEDMapping(id);
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->ClearLEDMapping(id);
}
ImGui::PopStyleVar();
}
@@ -1038,7 +1040,7 @@ void BenInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) {
ImGui::CloseCurrentPopup();
}
- if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
+ if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLED()
@@ -1052,7 +1054,7 @@ void BenInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) {
void BenInputEditorWindow::DrawLEDSection(uint8_t port) {
for (auto [id, mapping] :
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->GetAllLEDMappings()) {
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->GetAllLEDMappings()) {
ImGui::AlignTextToFramePadding();
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
auto open = ImGui::TreeNode(
@@ -1094,7 +1096,7 @@ void BenInputEditorWindow::DrawRemoveGyroMappingButton(uint8_t port, std::string
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f));
if (ImGui::Button(StringHelper::Sprintf("%s###removeGyroMapping%s", ICON_FA_TIMES, id.c_str()).c_str(),
ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) {
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->ClearGyroMapping();
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->ClearGyroMapping();
}
ImGui::PopStyleVar();
}
@@ -1118,7 +1120,7 @@ void BenInputEditorWindow::DrawAddGyroMappingButton(uint8_t port) {
ImGui::CloseCurrentPopup();
}
- if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
+ if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetGyro()
@@ -1132,7 +1134,7 @@ void BenInputEditorWindow::DrawAddGyroMappingButton(uint8_t port) {
void BenInputEditorWindow::DrawGyroSection(uint8_t port) {
auto mapping =
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->GetGyroMapping();
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->GetGyroMapping();
if (mapping != nullptr) {
auto id = mapping->GetGyroMappingId();
ImGui::AlignTextToFramePadding();
@@ -1277,7 +1279,7 @@ void BenInputEditorWindow::DrawMapping(CustomButtonMap& mapping, float labelWidt
}
if (ImGui::Selectable(i->second, i->first == currentButton)) {
CVarSetInteger(mapping.cVarName, i->first);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
ImGui::EndCombo();
@@ -1308,7 +1310,8 @@ void BenInputEditorWindow::DrawDeviceToggles(uint8_t portIndex) {
ImGui::PopItemFlag();
- auto connectedDeviceManager = Ship::Context::GetInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager();
+ auto connectedDeviceManager =
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetConnectedPhysicalDeviceManager();
for (const auto& [instanceId, name] : connectedDeviceManager->GetConnectedSDLGamepadNames()) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
auto buttonColor = ImGui::GetStyleColorVec4(ImGuiCol_Button);
@@ -1344,7 +1347,7 @@ void BenInputEditorWindow::DrawClearAllButton(uint8_t portIndex) {
ImGui::CloseCurrentPopup();
}
if (ImGui::Button("Clear All")) {
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->ClearAllMappings();
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(portIndex)->ClearAllMappings();
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
@@ -1426,7 +1429,7 @@ void BenInputEditorWindow::DrawPortTabContents(uint8_t portIndex) {
bool customOcarinaEnabled = CVarGetInteger("gEnhancements.Playback.CustomizeOcarinaControls", 0);
if (ImGui::Checkbox("Enable Custom Ocarina Controls", &customOcarinaEnabled)) {
CVarSetInteger("gEnhancements.Playback.CustomizeOcarinaControls", customOcarinaEnabled);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
UIWidgets::Tooltip("Allow customization of which physical buttons are used for ocarina playback.\nWARNING: "
"This disables the normal ocarina controls (A and C buttons).");
@@ -1487,11 +1490,11 @@ void BenInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) {
ImGui::CloseCurrentPopup();
}
if (ImGui::Button("Set defaults")) {
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(portIndex)
->ClearAllMappingsForDeviceType(Ship::PhysicalDeviceType::Keyboard);
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings(
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings(
Ship::PhysicalDeviceType::Keyboard);
shouldClose = true;
ImGui::CloseCurrentPopup();
@@ -1517,11 +1520,11 @@ void BenInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) {
ImGui::CloseCurrentPopup();
}
if (ImGui::Button("Set defaults")) {
- Ship::Context::GetInstance()
+ Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(portIndex)
->ClearAllMappingsForDeviceType(Ship::PhysicalDeviceType::SDLGamepad);
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings(
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings(
Ship::PhysicalDeviceType::SDLGamepad);
shouldClose = true;
ImGui::CloseCurrentPopup();
diff --git a/mm/2s2h/BenGui/BenMenu.cpp b/mm/2s2h/BenGui/BenMenu.cpp
index 2e143c126..81537b383 100644
--- a/mm/2s2h/BenGui/BenMenu.cpp
+++ b/mm/2s2h/BenGui/BenMenu.cpp
@@ -21,6 +21,9 @@
#include "2s2h/Rando/Rando.h"
#include "build.h"
+#include <fast/Fast3dGui.h>
+#include <fast/Fast3dWindow.h>
+
extern "C" {
#include "z64.h"
#include "functions.h"
@@ -356,7 +359,7 @@ void BenMenu::AddSettings() {
AddWidget(path, "Cursor Always Visible", WIDGET_CVAR_CHECKBOX)
.CVar("gSettings.CursorVisibility")
.Callback([](WidgetInfo& info) {
- Ship::Context::GetInstance()->GetWindow()->SetForceCursorVisibility(
+ Ship::Context::GetRawInstance()->GetWindow()->SetForceCursorVisibility(
CVarGetInteger("gSettings.CursorVisibility", 0));
})
.Options(CheckboxOptions().Tooltip("Makes the cursor always visible, even in full screen."));
@@ -385,7 +388,7 @@ void BenMenu::AddSettings() {
.Options(BtnSelectorOptions().DefaultValue(BTN_CUSTOM_MODIFIER2));
AddWidget(path, "Open App Files Folder", WIDGET_BUTTON)
.Callback([](WidgetInfo& info) {
- std::string filesPath = Ship::Context::GetInstance()->GetAppDirectoryPath();
+ std::string filesPath = Ship::Context::GetRawInstance()->GetAppDirectoryPath();
SDL_OpenURL(std::string("file:///" + std::filesystem::absolute(filesPath).string()).c_str());
})
.Options(ButtonOptions().Tooltip("Opens the folder that contains the save and mods folders, etc."));
@@ -414,8 +417,9 @@ void BenMenu::AddSettings() {
ImGui::SeparatorText("Thank You");
ImGui::PopStyleColor();
ImGui::SameLine();
- ImTextureID heartTextureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gQuestIconHeartContainer2Tex);
+ ImTextureID heartTextureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gQuestIconHeartContainer2Tex);
ImGui::Image(heartTextureId, ImVec2(25.0f, 25.0f));
ImGui::TextWrapped("Special thanks to our contributors, playtesters, artists, moderators, helpers, and "
"everyone in the larger decomp & N64 communities who make this project possible.\n\n");
@@ -523,12 +527,12 @@ void BenMenu::AddSettings() {
AddSidebarEntry("Settings", "Graphics", 3);
AddWidget(path, "Graphics Options", WIDGET_SEPARATOR_TEXT);
AddWidget(path, "Toggle Fullscreen", WIDGET_BUTTON)
- .Callback([](WidgetInfo& info) { Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen(); })
+ .Callback([](WidgetInfo& info) { Ship::Context::GetRawInstance()->GetWindow()->ToggleFullscreen(); })
.Options(ButtonOptions().Tooltip("Toggles Fullscreen On/Off."));
AddWidget(path, "Internal Resolution: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar(CVAR_INTERNAL_RESOLUTION)
.Callback([](WidgetInfo& info) {
- Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(
+ Ship::Context::GetRawInstance()->GetWindow()->SetResolutionMultiplier(
CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1));
})
.PreFunc([](WidgetInfo& info) {
@@ -553,7 +557,7 @@ void BenMenu::AddSettings() {
AddWidget(path, "Anti-aliasing (MSAA): %d", WIDGET_CVAR_SLIDER_INT)
.CVar(CVAR_MSAA_VALUE)
.Callback([](WidgetInfo& info) {
- Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1));
+ Ship::Context::GetRawInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1));
})
.Options(
IntSliderOptions()
@@ -2051,7 +2055,7 @@ void BenMenu::AddDevTools() {
.ComboVec(&logLevels)
.DefaultIndex(defaultLogLevel))
.Callback([](WidgetInfo& info) {
- Ship::Context::GetInstance()->GetLogger()->set_level(
+ Ship::Context::GetRawInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", defaultLogLevel));
})
.PreFunc([](WidgetInfo& info) { info.isHidden = mBenMenu->disabledMap.at(DISABLE_FOR_DEBUG_MODE_OFF).active; });
@@ -2227,29 +2231,29 @@ void BenMenu::InitElement() {
"Debug Mode is Disabled" } },
{ DISABLE_FOR_NO_VSYNC,
{ [](disabledInfo& info) -> bool {
- return !Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync();
+ return !Ship::Context::GetRawInstance()->GetWindow()->CanDisableVerticalSync();
},
"Disabling VSync not supported" } },
{ DISABLE_FOR_NO_WINDOWED_FULLSCREEN,
{ [](disabledInfo& info) -> bool {
- return !Ship::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen();
+ return !Ship::Context::GetRawInstance()->GetWindow()->SupportsWindowedFullscreen();
},
"Windowed Fullscreen not supported" } },
{ DISABLE_FOR_NO_MULTI_VIEWPORT,
{ [](disabledInfo& info) -> bool {
- return !Ship::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports();
+ return !Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SupportsViewports();
},
"Multi-viewports not supported" } },
{ DISABLE_FOR_NOT_DIRECTX,
{ [](disabledInfo& info) -> bool {
- return Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() !=
- Ship::WindowBackend::FAST3D_DXGI_DX11;
+ return Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() !=
+ Fast::WindowBackend::FAST3D_DXGI_DX11;
},
"Available Only on DirectX" } },
{ DISABLE_FOR_DIRECTX,
{ [](disabledInfo& info) -> bool {
- return Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() ==
- Ship::WindowBackend::FAST3D_DXGI_DX11;
+ return Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() ==
+ Fast::WindowBackend::FAST3D_DXGI_DX11;
},
"Not Available on DirectX" } },
{ DISABLE_FOR_MATCH_REFRESH_RATE_ON,
diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp
index 8361a6392..ff0eac2df 100644
--- a/mm/2s2h/BenGui/BenMenuBar.cpp
+++ b/mm/2s2h/BenGui/BenMenuBar.cpp
@@ -3,17 +3,20 @@
#include "UIWidgets.hpp"
#include <string>
+#include <fast/Fast3dGui.h>
+
namespace BenGui {
void DrawMenuBarIcon() {
static bool gameIconLoaded = false;
if (!gameIconLoaded) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Game_Icon",
- "textures/icons/g2ShipIcon.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Game_Icon", "textures/icons/g2ShipIcon.png");
gameIconLoaded = true;
}
- if (Ship::Context::GetInstance()->GetWindow()->GetGui()->HasTextureByName("Game_Icon")) {
+ if (std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->HasTextureByName("Game_Icon")) {
#ifdef __SWITCH__
ImVec2 iconSize = ImVec2(20.0f, 20.0f);
float posScale = 1.0f;
@@ -25,7 +28,9 @@ void DrawMenuBarIcon() {
float posScale = 1.0f;
#endif
ImGui::SetCursorPos(ImVec2(5, 5) * posScale);
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), iconSize);
+ ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Game_Icon"),
+ iconSize);
ImGui::SameLine();
ImGui::SetCursorPos(ImVec2(25, 0) * posScale);
}
@@ -40,11 +45,11 @@ void DrawBenMenu() {
"[-]"
#endif
)) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuBar()->ToggleVisibility();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetMenuBar()->ToggleVisibility();
}
#if !defined(__SWITCH__) && !defined(__WIIU__)
if (UIWidgets::MenuItem("Toggle Fullscreen", "F11")) {
- Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen();
+ Ship::Context::GetRawInstance()->GetWindow()->ToggleFullscreen();
}
#endif
if (UIWidgets::MenuItem("Reset",
@@ -57,17 +62,17 @@ void DrawBenMenu() {
#endif
)) {
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
}
#if !defined(__SWITCH__) && !defined(__WIIU__)
if (UIWidgets::MenuItem("Open App Files Folder")) {
- std::string filesPath = Ship::Context::GetInstance()->GetAppDirectoryPath();
+ std::string filesPath = Ship::Context::GetRawInstance()->GetAppDirectoryPath();
SDL_OpenURL(std::string("file:///" + std::filesystem::absolute(filesPath).string()).c_str());
}
if (UIWidgets::MenuItem("Quit")) {
- Ship::Context::GetInstance()->GetWindow()->Close();
+ Ship::Context::GetRawInstance()->GetWindow()->Close();
}
#endif
ImGui::EndMenu();
diff --git a/mm/2s2h/BenGui/CosmeticEditor.cpp b/mm/2s2h/BenGui/CosmeticEditor.cpp
index 7300125be..81bd46dba 100644
--- a/mm/2s2h/BenGui/CosmeticEditor.cpp
+++ b/mm/2s2h/BenGui/CosmeticEditor.cpp
@@ -140,7 +140,7 @@ typedef struct {
std::unordered_map<std::string, std::unordered_map<int, OriginalRGB>> originalRGB;
void PatchPalette(const char* path, int index, uint8_t r, uint8_t g, uint8_t b) {
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path);
auto data = (uint8_t*)res->GetRawPointer();
if (!originalRGB.contains(path) || !originalRGB[path].contains(index)) {
@@ -160,7 +160,7 @@ void UnpatchPalette(const char* path, int index) {
return;
}
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path);
auto data = (uint8_t*)res->GetRawPointer();
data[index * 2] = originalRGB[path][index].data1;
@@ -195,7 +195,7 @@ Gfx disableGrayscale[] = {
// difference between the average color and the target color. It then colors the range according to newBase,
// and shades it lighter or darker based on the difference between the average color and the target color.
void ShadePaletteNewBase(const char* path, uint32_t begin, uint32_t end, Color_RGBA8 newBase, SHADE_MODE mode) {
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path);
auto data = (uint8_t*)res->GetRawPointer();
uint32_t maxR = 0;
@@ -313,7 +313,7 @@ void ShadePaletteGradient(const char* path, uint32_t begin, uint32_t end, Color_
oldBase.b >>= 3;
oldBase.a >>= 3;
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path);
auto data = (uint8_t*)res->GetRawPointer();
for (int i = begin; i <= end; i++) {
uint16_t col16 = (data[i * 2] << 8) | data[i * 2 + 1];
@@ -330,7 +330,7 @@ void ShadePaletteGradient(const char* path, uint32_t begin, uint32_t end, Color_
// Patches a single pixel in a raw RGBA16 (RGBA5551) texture, preserving the original alpha bit.
void PatchRGBA16Pixel(const char* path, int index, uint8_t r, uint8_t g, uint8_t b) {
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path);
auto data = (uint8_t*)res->GetRawPointer();
if (!originalRGB.contains(path) || !originalRGB[path].contains(index)) {
@@ -353,7 +353,7 @@ void PatchRGBA16Pixel(const char* path, int index, uint8_t r, uint8_t g, uint8_t
* so transparent background areas are left untouched.
*/
void ShadeRGBA16NewBase(const char* path, uint32_t begin, uint32_t end, Color_RGBA8 newBase, SHADE_MODE mode) {
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path);
auto data = (uint8_t*)res->GetRawPointer();
uint32_t maxR = 0;
@@ -605,7 +605,7 @@ const char* kCosmeticRandomizeOnSeedGenCvar = "gCosmetics.RandomizeOnSeedGen";
int sCosmeticRainbowHue = 0;
void CosmeticEditorSave() {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
Color_RGBA8 CosmeticEditorGetDefaultColor(const CosmeticOption& option) {
diff --git a/mm/2s2h/BenGui/DynamicCosmeticEditor.cpp b/mm/2s2h/BenGui/DynamicCosmeticEditor.cpp
index 955a88582..a1bf95d32 100644
--- a/mm/2s2h/BenGui/DynamicCosmeticEditor.cpp
+++ b/mm/2s2h/BenGui/DynamicCosmeticEditor.cpp
@@ -236,7 +236,7 @@ static void ClearCustomCosmeticValueCvars(const char* valuesCvar) {
}
static std::string BuildDynamicCosmeticsStateSignature() {
- auto resourceManager = Ship::Context::GetInstance()->GetResourceManager();
+ auto resourceManager = Ship::Context::GetRawInstance()->GetResourceManager();
auto archiveManager = resourceManager->GetArchiveManager();
std::string signature = std::to_string(CVarGetInteger("gEnhancements.Mods.AlternateAssets", 0));
@@ -326,7 +326,7 @@ bool IsCustomKafeiModelActive() {
}
void ApplyDynamicCosmetics() {
- auto resourceManager = Ship::Context::GetInstance()->GetResourceManager();
+ auto resourceManager = Ship::Context::GetRawInstance()->GetResourceManager();
auto archiveManager = resourceManager->GetArchiveManager();
for (const auto& entry : customCosmeticEntries) {
@@ -362,13 +362,13 @@ static void SetCustomCosmeticColor(const CustomCosmeticEntry& entry, Color_RGBA8
ShipInit::Init(entry.option.rainbowCvar);
ShipInit::Init(entry.option.changedCvar);
ApplyDynamicCosmetics();
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
static void ResetCustomCosmeticColor(const CustomCosmeticEntry& entry) {
CosmeticEditorResetElement(const_cast<CosmeticOption&>(entry.option), false);
ApplyDynamicCosmetics();
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
static void RandomizeCustomCosmeticColor(const CustomCosmeticEntry& entry) {
@@ -422,7 +422,7 @@ void ScanDynamicCosmetics() {
customFierceDeityCosmeticsAvailable = false;
customKafeiCosmeticsAvailable = false;
- auto resourceManager = Ship::Context::GetInstance()->GetResourceManager();
+ auto resourceManager = Ship::Context::GetRawInstance()->GetResourceManager();
auto archiveManager = resourceManager->GetArchiveManager();
RefreshCustomModelActiveFlags(archiveManager.get());
auto archives = archiveManager->GetArchives();
@@ -618,14 +618,14 @@ static void DrawCustomCosmeticRow(const CustomCosmeticEntry& entry) {
ShipInit::Init(entry.option.rainbowCvar);
ShipInit::Init(entry.option.changedCvar);
ApplyDynamicCosmetics();
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
},
[&entry]() { RandomizeCustomCosmeticColor(entry); },
[&entry]() {
CVarSetInteger(entry.option.changedCvar, 1);
ShipInit::Init(entry.option.changedCvar);
ApplyDynamicCosmetics();
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
},
[&entry]() { ResetCustomCosmeticColor(entry); });
}
@@ -639,7 +639,7 @@ static void DrawCustomCosmeticCategory(const char* label, const std::vector<cons
for (const auto* entry : entries) {
RandomizeCustomCosmeticColor(*entry);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ApplyDynamicCosmetics();
}
ImGui::SameLine();
diff --git a/mm/2s2h/BenGui/HudEditor.cpp b/mm/2s2h/BenGui/HudEditor.cpp
index a02b395b4..1031b54df 100644
--- a/mm/2s2h/BenGui/HudEditor.cpp
+++ b/mm/2s2h/BenGui/HudEditor.cpp
@@ -247,7 +247,7 @@ void HudEditorWindow::DrawElement() {
break;
}
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
for (int i = HUD_EDITOR_ELEMENT_B; i < HUD_EDITOR_ELEMENT_MAX; i++) {
@@ -283,7 +283,7 @@ void HudEditorWindow::DrawElement() {
CVarSetInteger(cosmeticElement.colorChangedCvar, true);
ShipInit::Init(cosmeticElement.colorCvar);
ShipInit::Init(cosmeticElement.colorChangedCvar);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
if (ImGui::Button(ICON_FA_REFRESH)) {
@@ -291,7 +291,7 @@ void HudEditorWindow::DrawElement() {
CVarClear(cosmeticElement.colorChangedCvar);
ShipInit::Init(cosmeticElement.colorCvar);
ShipInit::Init(cosmeticElement.colorChangedCvar);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
} else {
// Disabled color picker for elements without cosmetic mappings
diff --git a/mm/2s2h/BenGui/InputViewer.cpp b/mm/2s2h/BenGui/InputViewer.cpp
index c77157f53..7db978c3b 100644
--- a/mm/2s2h/BenGui/InputViewer.cpp
+++ b/mm/2s2h/BenGui/InputViewer.cpp
@@ -11,6 +11,8 @@
#include "2s2h/BenGui/UIWidgets.hpp"
#include "2s2h/BenGui/BenGui.hpp"
+#include <fast/Fast3dGui.h>
+
using namespace UIWidgets;
// Text colors
@@ -42,15 +44,17 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex
// Render Outline based on settings
if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) ||
(outlineMode == BUTTON_OUTLINE_PRESSED && state)) {
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size,
- ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(btnOutlineTexture),
+ size, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
// Render button if pressed
if (state) {
ImGui::SetCursorPos(pos);
ImGui::SetNextItemAllowOverlap();
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size,
- ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(btnTexture),
+ size, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
}
@@ -67,80 +71,80 @@ void InputViewer::DrawElement() {
if (CVarGetInteger("gWindows.InputViewer", 0)) {
static bool sButtonTexturesLoaded = false;
if (!sButtonTexturesLoaded) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Input-Viewer-Background", "textures/buttons/InputViewerBackground.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn",
- "textures/buttons/ABtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn",
- "textures/buttons/BBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn",
- "textures/buttons/LBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn",
- "textures/buttons/RBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn",
- "textures/buttons/ZBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Start-Btn", "textures/buttons/StartBtn.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left",
- "textures/buttons/CLeft.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right",
- "textures/buttons/CRight.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up",
- "textures/buttons/CUp.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down",
- "textures/buttons/CDown.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Analog-Stick", "textures/buttons/AnalogStick.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Left", "textures/buttons/DPadLeft.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Right", "textures/buttons/DPadRight.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up",
- "textures/buttons/DPadUp.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Down", "textures/buttons/DPadDown.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Modifier-1",
- "textures/buttons/Mod1.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Modifier-2",
- "textures/buttons/Mod2.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Right-Stick", "textures/buttons/RightStick.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "A-Btn Outline", "textures/buttons/ABtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "B-Btn Outline", "textures/buttons/BBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "L-Btn Outline", "textures/buttons/LBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "R-Btn Outline", "textures/buttons/RBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Z-Btn Outline", "textures/buttons/ZBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Start-Btn Outline", "textures/buttons/StartBtnOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Left Outline", "textures/buttons/CLeftOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Right Outline", "textures/buttons/CRightOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Up Outline", "textures/buttons/CUpOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "C-Down Outline", "textures/buttons/CDownOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Analog-Stick Outline", "textures/buttons/AnalogStickOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Left Outline", "textures/buttons/DPadLeftOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Right Outline", "textures/buttons/DPadRightOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Up Outline", "textures/buttons/DPadUpOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Dpad-Down Outline", "textures/buttons/DPadDownOutline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Modifier-1 Outline", "textures/buttons/Mod1Outline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Modifier-2 Outline", "textures/buttons/Mod2Outline.png");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage(
- "Right-Stick Outline", "textures/buttons/RightStickOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Input-Viewer-Background", "textures/buttons/InputViewerBackground.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("A-Btn", "textures/buttons/ABtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("B-Btn", "textures/buttons/BBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("L-Btn", "textures/buttons/LBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("R-Btn", "textures/buttons/RBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Z-Btn", "textures/buttons/ZBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Start-Btn", "textures/buttons/StartBtn.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Left", "textures/buttons/CLeft.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Right", "textures/buttons/CRight.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Up", "textures/buttons/CUp.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Down", "textures/buttons/CDown.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Analog-Stick", "textures/buttons/AnalogStick.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Left", "textures/buttons/DPadLeft.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Right", "textures/buttons/DPadRight.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Up", "textures/buttons/DPadUp.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Down", "textures/buttons/DPadDown.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-1", "textures/buttons/Mod1.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-2", "textures/buttons/Mod2.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Right-Stick", "textures/buttons/RightStick.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("A-Btn Outline", "textures/buttons/ABtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("B-Btn Outline", "textures/buttons/BBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("L-Btn Outline", "textures/buttons/LBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("R-Btn Outline", "textures/buttons/RBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Z-Btn Outline", "textures/buttons/ZBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Start-Btn Outline", "textures/buttons/StartBtnOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Left Outline", "textures/buttons/CLeftOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Right Outline", "textures/buttons/CRightOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Up Outline", "textures/buttons/CUpOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("C-Down Outline", "textures/buttons/CDownOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Analog-Stick Outline", "textures/buttons/AnalogStickOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Left Outline", "textures/buttons/DPadLeftOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Right Outline", "textures/buttons/DPadRightOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Up Outline", "textures/buttons/DPadUpOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Dpad-Down Outline", "textures/buttons/DPadDownOutline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-1 Outline", "textures/buttons/Mod1Outline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Modifier-2 Outline", "textures/buttons/Mod2Outline.png");
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadTextureFromRawImage("Right-Stick Outline", "textures/buttons/RightStickOutline.png");
sButtonTexturesLoaded = true;
}
@@ -158,7 +162,9 @@ void InputViewer::DrawElement() {
CVarGetInteger(CVAR_INPUT_VIEWER("ButtonOutlineMode"), BUTTON_OUTLINE_NOT_PRESSED);
const bool useGlobalOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("UseGlobalButtonOutlineMode"), 1);
- ImVec2 bgSize = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureSize("Input-Viewer-Background");
+ ImVec2 bgSize =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureSize("Input-Viewer-Background");
ImVec2 scaledBGSize = ImVec2(bgSize.x * scale, bgSize.y * scale);
float maxScale = std::max(CVarGetFloat(CVAR_INPUT_VIEWER("LeftAnalogAngles.Scale"), 1.0f),
@@ -192,7 +198,7 @@ void InputViewer::DrawElement() {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f));
OSContPad* pads =
- std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
+ std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetRawInstance()->GetControlDeck())->GetPads();
OSContPad pad = pads[0];
@@ -212,7 +218,8 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
// Background
ImGui::Image(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Input-Viewer-Background"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -363,7 +370,8 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos);
ImGui::Image(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Analog-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
const int analogStickMode =
@@ -374,8 +382,10 @@ void InputViewer::DrawElement() {
ImGui::SetCursorPos(
ImVec2(aPos.x + maxStickDistance * ((float)(pad.stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxStickDistance * ((float)(pad.stick_y) / MAX_AXIS_RANGE) * scale));
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"),
- scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Analog-Stick"),
+ scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
// Right Stick
@@ -387,7 +397,8 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos);
ImGui::Image(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Right-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
const int rightStickMode =
@@ -398,8 +409,10 @@ void InputViewer::DrawElement() {
ImGui::SetCursorPos(
ImVec2(aPos.x + maxRightStickDistance * ((float)(pad.right_stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxRightStickDistance * ((float)(pad.right_stick_y) / MAX_AXIS_RANGE) * scale));
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"),
- scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
+ ImGui::Image(
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName("Right-Stick"),
+ scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
// Left Analog stick angle text
diff --git a/mm/2s2h/BenGui/Menu.cpp b/mm/2s2h/BenGui/Menu.cpp
index 39cb423ff..0f0fd5bd6 100644
--- a/mm/2s2h/BenGui/Menu.cpp
+++ b/mm/2s2h/BenGui/Menu.cpp
@@ -11,6 +11,8 @@
#include <tuple>
#include <ship/config/Config.h>
+#include <fast/Fast3dWindow.h>
+
extern "C" {
#include "z64.h"
#include "functions.h"
@@ -95,15 +97,15 @@ void Menu::RemoveSidebarSearch() {
}
void Menu::UpdateWindowBackendObjects() {
- Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend();
- int32_t configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
- if (Ship::Context::GetInstance()->GetWindow()->IsAvailableWindowBackend(configWindowBackendId)) {
- configWindowBackend = static_cast<Ship::WindowBackend>(configWindowBackendId);
+ int32_t runningWindowBackend = Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend();
+ int32_t configWindowBackendId = Ship::Context::GetRawInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
+ if (Ship::Context::GetRawInstance()->GetWindow()->IsAvailableWindowBackend(configWindowBackendId)) {
+ configWindowBackend = static_cast<Fast::WindowBackend>(configWindowBackendId);
} else {
- configWindowBackend = runningWindowBackend;
+ configWindowBackend = static_cast<Fast::WindowBackend>(runningWindowBackend);
}
- availableWindowBackends = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends();
+ availableWindowBackends = Ship::Context::GetRawInstance()->GetWindow()->GetAvailableWindowBackends();
for (auto& backend : *availableWindowBackends) {
availableWindowBackendsMap[backend] = windowBackendsMap.at(backend);
}
@@ -304,14 +306,15 @@ void Menu::MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors me
};
} break;
case WIDGET_AUDIO_BACKEND: {
- auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetCurrentAudioBackend();
+ auto currentAudioBackend = Ship::Context::GetRawInstance()->GetAudio()->GetCurrentAudioBackend();
UIWidgets::ComboboxOptions options = {};
options.color = menuThemeIndex;
options.tooltip = "Sets the audio API used by the game. Requires a relaunch to take effect.";
- options.disabled = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1;
+ options.disabled =
+ Ship::Context::GetRawInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1;
options.disabledTooltip = "Only one audio API is available on this platform.";
if (UIWidgets::Combobox("Audio API", &currentAudioBackend, &audioBackendsMap, options)) {
- Ship::Context::GetInstance()->GetAudio()->SetCurrentAudioBackend(currentAudioBackend);
+ Ship::Context::GetRawInstance()->GetAudio()->SetCurrentAudioBackend(currentAudioBackend);
}
} break;
case WIDGET_VIDEO_BACKEND: {
@@ -322,11 +325,10 @@ void Menu::MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors me
options.disabledTooltip = "Only one renderer API is available on this platform.";
if (UIWidgets::Combobox("Renderer API (Needs reload)", &configWindowBackend,
&availableWindowBackendsMap, options)) {
- Ship::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id",
- (int32_t)(configWindowBackend));
- Ship::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name",
- windowBackendsMap.at(configWindowBackend));
- Ship::Context::GetInstance()->GetConfig()->Save();
+ Ship::Context::GetRawInstance()->GetConfig()->SetInt("Window.Backend.Id", configWindowBackend);
+ Ship::Context::GetRawInstance()->GetConfig()->SetString("Window.Backend.Name",
+ windowBackendsMap.at(configWindowBackend));
+ Ship::Context::GetRawInstance()->GetConfig()->Save();
UpdateWindowBackendObjects();
}
} break;
@@ -471,7 +473,7 @@ void Menu::MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors me
SPDLOG_ERROR(msg.c_str());
break;
}
- auto window = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow(widget.windowName);
+ auto window = Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow(widget.windowName);
if (!window) {
std::string msg =
fmt::format("Error drawing window contents: windowName {} does not exist", widget.windowName);
@@ -718,11 +720,11 @@ void Menu::DrawElement() {
"Quit 2S2H", "Are you sure you want to quit 2S2H?", "Quit", "Cancel",
[]() {
std::shared_ptr<Menu> menu =
- static_pointer_cast<Menu>(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenu());
+ static_pointer_cast<Menu>(Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetMenu());
if (!menu->IsMenuPopped()) {
menu->ToggleVisibility();
}
- Ship::Context::GetInstance()->GetWindow()->Close();
+ Ship::Context::GetRawInstance()->GetWindow()->Close();
},
nullptr);
}
@@ -742,7 +744,7 @@ void Menu::DrawElement() {
;
if (UIWidgets::Button(ICON_FA_UNDO, options2)) {
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
}
ImGui::SameLine();
@@ -755,7 +757,7 @@ void Menu::DrawElement() {
// Update gamepad navigation after close based on if other menus are still visible
auto mImGuiIo = &ImGui::GetIO();
if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) &&
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) {
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetMenuOrMenubarVisible()) {
mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
} else {
mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
diff --git a/mm/2s2h/BenGui/Menu.h b/mm/2s2h/BenGui/Menu.h
index eb65490c1..84e1b94ea 100644
--- a/mm/2s2h/BenGui/Menu.h
+++ b/mm/2s2h/BenGui/Menu.h
@@ -42,9 +42,9 @@ class Menu : public GuiWindow {
ImGuiTextFilter menuSearch;
uint8_t searchSidebarIndex;
UIWidgets::Colors defaultThemeIndex;
- std::shared_ptr<std::vector<Ship::WindowBackend>> availableWindowBackends;
- std::unordered_map<Ship::WindowBackend, const char*> availableWindowBackendsMap;
- Ship::WindowBackend configWindowBackend;
+ std::shared_ptr<std::vector<int32_t>> availableWindowBackends;
+ std::unordered_map<int32_t, const char*> availableWindowBackendsMap;
+ int32_t configWindowBackend;
std::unordered_map<uint32_t, disabledInfo> disabledMap;
std::vector<disabledInfo> disabledVector;
diff --git a/mm/2s2h/BenGui/MenuTypes.h b/mm/2s2h/BenGui/MenuTypes.h
index 921a199fd..b2aff14c9 100644
--- a/mm/2s2h/BenGui/MenuTypes.h
+++ b/mm/2s2h/BenGui/MenuTypes.h
@@ -3,6 +3,8 @@
#include "UIWidgets.hpp"
+#include <fast/Fast3dWindow.h>
+
typedef enum {
DISABLE_FOR_CAMERAS_OFF,
DISABLE_FOR_DEBUG_CAM_ON,
@@ -292,10 +294,10 @@ static const std::unordered_map<Ship::AudioBackend, const char*> audioBackendsMa
{ Ship::AudioBackend::NUL, "Null" },
};
-static const std::unordered_map<Ship::WindowBackend, const char*> windowBackendsMap = {
- { Ship::WindowBackend::FAST3D_DXGI_DX11, "DirectX" },
- { Ship::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" },
- { Ship::WindowBackend::FAST3D_SDL_METAL, "Metal" },
+static const std::unordered_map<int32_t, const char*> windowBackendsMap = {
+ { Fast::WindowBackend::FAST3D_DXGI_DX11, "DirectX" },
+ { Fast::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL" },
+ { Fast::WindowBackend::FAST3D_SDL_METAL, "Metal" },
};
struct MenuInit {
diff --git a/mm/2s2h/BenGui/Notification.cpp b/mm/2s2h/BenGui/Notification.cpp
index 619351a54..5abbc9a8c 100644
--- a/mm/2s2h/BenGui/Notification.cpp
+++ b/mm/2s2h/BenGui/Notification.cpp
@@ -7,6 +7,8 @@ extern "C" {
#include "variables.h"
}
+#include <fast/Fast3dGui.h>
+
namespace Notification {
static uint32_t nextId = 0;
@@ -89,7 +91,8 @@ void Window::Draw() {
if (notification.itemIcon != nullptr) {
ImGui::Image(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(notification.itemIcon),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(notification.itemIcon),
ImVec2(22 * CVarGetFloat("gNotifications.Size", 1.8f), 22 * CVarGetFloat("gNotifications.Size", 1.8f)));
ImGui::SameLine();
}
diff --git a/mm/2s2h/BenGui/ResolutionEditor.cpp b/mm/2s2h/BenGui/ResolutionEditor.cpp
index d4ab55d9c..7a55b82c2 100644
--- a/mm/2s2h/BenGui/ResolutionEditor.cpp
+++ b/mm/2s2h/BenGui/ResolutionEditor.cpp
@@ -115,7 +115,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
}
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", verticalPixelCount);
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
UIWidgets::PopStyleCombobox();
@@ -187,7 +187,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
.Color(THEME_COLOR));
if (disabled_pixelCount && CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0)) {
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
// Integer Scaling
@@ -220,7 +220,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
// This is just here to update the value shown on the slider.
// The function in LUS to handle this setting will ignore IntegerScaleFactor while active.
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", integerScale_maximumBounds);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
} // End of integer scaling settings
UIWidgets::PopStyleHeader();
@@ -250,7 +250,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
" If the image is stretched and you don't know why, click this.");
if (ImGui::Button("Click to reenable aspect correction.")) {
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", 0);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
UIWidgets::Spacer(2);
}
@@ -298,7 +298,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
// Initialise the (currently unused) "Exceed Bounds By" cvar if it's been changed.
if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0)) {
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
@@ -356,12 +356,12 @@ void ResolutionCustomWidget(WidgetInfo& info) {
}
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", item_aspectRatio);
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
void RegisterResolutionWidgets() {
- auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
mInterpreter = fastWnd->GetInterpreterWeak();
WidgetPath path = { "Settings", "Graphics", SECTION_COLUMN_2 };
@@ -512,7 +512,7 @@ void UpdateResolutionVars() {
}
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", item_aspectRatio);
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
// Initialise update flags.
for (uint8_t i = 0; i < sizeof(update); i++) {
diff --git a/mm/2s2h/BenGui/UIWidgets.cpp b/mm/2s2h/BenGui/UIWidgets.cpp
index a76247c74..c6c4c2ea7 100644
--- a/mm/2s2h/BenGui/UIWidgets.cpp
+++ b/mm/2s2h/BenGui/UIWidgets.cpp
@@ -501,7 +501,7 @@ bool CVarCheckbox(const char* label, const char* cvarName, const CheckboxOptions
bool value = (bool)CVarGetInteger(cvarName, options.defaultValue);
if (Checkbox(label, &value, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
@@ -743,7 +743,7 @@ bool CVarSliderInt(const char* label, const char* cvarName, const IntSliderOptio
int32_t value = CVarGetInteger(cvarName, options.defaultValue);
if (SliderInt(label, &value, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
@@ -885,7 +885,7 @@ bool CVarSliderFloat(const char* label, const char* cvarName, const FloatSliderO
float value = CVarGetFloat(cvarName, options.defaultValue);
if (SliderFloat(label, &value, options)) {
CVarSetFloat(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
@@ -959,7 +959,7 @@ bool CVarInputString(const char* label, const char* cvarName, const InputOptions
std::string value = CVarGetString(cvarName, options.defaultValue.c_str());
if (InputString(label, &value, options)) {
CVarSetString(cvarName, value.c_str());
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
@@ -1011,7 +1011,7 @@ bool CVarInputInt(const char* label, const char* cvarName, const InputOptions& o
int32_t value = CVarGetInteger(cvarName, defaultValue);
if (InputInt(label, &value, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
@@ -1041,7 +1041,7 @@ bool CVarColorPicker(const char* label, const char* valueCvar, Color_RGBA8 defau
color.b = (uint8_t)(colorVec.z * 255.0f);
color.a = (uint8_t)(colorVec.w * 255.0f);
CVarSetColor(valueCvar, color);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(valueCvar);
}
@@ -1115,7 +1115,7 @@ bool CVarRadioButton(const char* text, const char* cvarName, int32_t id, const R
PushStyleCheckbox(options.color);
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
CVarSetInteger(cvarName, id);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ret = true;
}
ImGui::SameLine();
@@ -1386,7 +1386,7 @@ bool CVarBtnSelector(const char* label, const char* cvarName, const BtnSelectorO
int32_t value = CVarGetInteger(cvarName, options.defaultValue);
if (BtnSelector(label, &value, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
diff --git a/mm/2s2h/BenGui/UIWidgets.hpp b/mm/2s2h/BenGui/UIWidgets.hpp
index e622a5005..2c37969df 100644
--- a/mm/2s2h/BenGui/UIWidgets.hpp
+++ b/mm/2s2h/BenGui/UIWidgets.hpp
@@ -1012,7 +1012,7 @@ bool CVarCombobox(const char* label, const char* cvarName, const std::unordered_
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
if (Combobox<T>(label, &value, comboMap, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
@@ -1026,7 +1026,7 @@ bool CVarCombobox(const char* label, const char* cvarName, const std::vector<std
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
if (Combobox<T>(label, &value, comboVector, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
dirty = true;
}
return dirty;
@@ -1039,7 +1039,7 @@ bool CVarCombobox(const char* label, const char* cvarName, const std::vector<con
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
if (Combobox<T>(label, &value, comboVector, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
@@ -1157,7 +1157,7 @@ bool CVarCombobox(const char* label, const char* cvarName, const char* (&comboAr
int32_t value = CVarGetInteger(cvarName, options.defaultIndex);
if (Combobox<T>(label, &value, comboArray, options)) {
CVarSetInteger(cvarName, value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(cvarName);
dirty = true;
}
diff --git a/mm/2s2h/BenPort.cpp b/mm/2s2h/BenPort.cpp
index b2a26163f..faaaa1006 100644
--- a/mm/2s2h/BenPort.cpp
+++ b/mm/2s2h/BenPort.cpp
@@ -26,9 +26,11 @@
#include <ship/utils/StringHelper.h>
#include <nlohmann/json.hpp>
#include "build.h"
+#include <stb_image.h>
#include <fast/interpreter.h>
#include <fast/backends/gfx_rendering_api.h>
+#include <fast/Fast3dWindow.h>
#ifdef __APPLE__
#include <SDL_scancode.h>
@@ -177,7 +179,7 @@ OTRGlobals::OTRGlobals() {
if (shipArchiveVersionMatch) {
- auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
+ auto overlay = context->GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay();
overlay->LoadFont("Press Start 2P", 12.0f, "fonts/PressStart2P-Regular.ttf");
overlay->LoadFont("Fipps", 32.0f, "fonts/Fipps-Regular.otf");
overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P"));
@@ -612,9 +614,9 @@ void OTRGlobals::Initialize() {
context->InitConsoleVariables();
auto logLevel = static_cast<spdlog::level::level_enum>(CVarGetInteger("gDeveloperTools.LogLevel", defaultLogLevel));
context->InitLogging(logLevel, logLevel);
- Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%^%l%$] %v");
+ Ship::Context::GetRawInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%^%l%$] %v");
- context->InitGfxDebugger();
+ std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())->GetGfxDebugger();
context->InitFileDropMgr();
// tell LUS to reserve 3 2S2H specific threads (Game, Audio, Save)
@@ -777,10 +779,10 @@ ImFont* OTRGlobals::CreateDefaultFontWithSize(float size) {
uint32_t OTRGlobals::GetInterpolationFPS() {
if (CVarGetInteger("gMatchRefreshRate", 0)) {
- return Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
+ return Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate();
} else if (CVarGetInteger(CVAR_VSYNC_ENABLED, 1) ||
- !Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) {
- return std::min<uint32_t>(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(),
+ !Ship::Context::GetRawInstance()->GetWindow()->CanDisableVerticalSync()) {
+ return std::min<uint32_t>(Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate(),
CVarGetInteger("gInterpolationFPS", 20));
}
return CVarGetInteger("gInterpolationFPS", 20);
@@ -883,7 +885,7 @@ extern "C" void OTRAudio_Exit() {
}
extern "C" void OTRExtScanner() {
- auto lst = *Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*").get();
+ auto lst = *Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*").get();
for (auto& rPath : lst) {
std::vector<std::string> raw = StringHelper::Split(rPath, ".");
@@ -959,7 +961,7 @@ extern "C" void InitOTR(int argc, char* argv[]) {
std::shared_ptr<Ship::Config> conf = OTRGlobals::Instance->context->GetConfig();
conf->RegisterVersionUpdater(std::make_shared<Ben::ConfigVersion1Updater>());
conf->RunVersionUpdates();
- Ship::Context::GetInstance()->GetConsoleVariables()->Save();
+ Ship::Context::GetRawInstance()->GetConsoleVariables()->Save();
GameInteractor::Instance = new GameInteractor();
AudioCollection::Instance = new AudioCollection();
@@ -1002,8 +1004,8 @@ extern "C" void InitOTR(int argc, char* argv[]) {
}
#endif
- Ship::Context::GetInstance()->GetFileDropMgr()->RegisterDropHandler(BinarySaveConverter_HandleFileDropped);
- Ship::Context::GetInstance()->GetFileDropMgr()->RegisterDropHandler(SaveManager_HandleFileDropped);
+ Ship::Context::GetRawInstance()->GetFileDropMgr()->RegisterDropHandler(BinarySaveConverter_HandleFileDropped);
+ Ship::Context::GetRawInstance()->GetFileDropMgr()->RegisterDropHandler(SaveManager_HandleFileDropped);
}
extern "C" void SaveManager_ThreadPoolWait() {
@@ -1076,7 +1078,7 @@ extern "C" void Graph_StartFrame() {
#if 0
case KbScancode::LUS_KB_F5: {
if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
6.0f, true, "Save states not enabled. Check Cheats Menu.");
return;
}
@@ -1097,7 +1099,7 @@ extern "C" void Graph_StartFrame() {
}
case KbScancode::LUS_KB_F6: {
if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
6.0f, true, "Save states not enabled. Check Cheats Menu.");
return;
}
@@ -1112,7 +1114,7 @@ extern "C" void Graph_StartFrame() {
}
case KbScancode::LUS_KB_F7: {
if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
6.0f, true, "Save states not enabled. Check Cheats Menu.");
return;
}
@@ -1196,7 +1198,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
static int time;
int fps = target_fps;
int original_fps = 60 / R_UPDATE_RATE;
- auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
if (target_fps == 20 || original_fps > target_fps) {
fps = original_fps;
@@ -1245,7 +1247,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
bool curAltAssets = CVarGetInteger("gEnhancements.Mods.AlternateAssets", 0);
if (prevAltAssets != curAltAssets) {
prevAltAssets = curAltAssets;
- Ship::Context::GetInstance()->GetResourceManager()->SetAltAssetsEnabled(curAltAssets);
+ Ship::Context::GetRawInstance()->GetResourceManager()->SetAltAssetsEnabled(curAltAssets);
gfx_texture_cache_clear();
PlayerCustomFlipbooks_Patch();
SOH::SkeletonPatcher::UpdateSkeletons();
@@ -1264,7 +1266,7 @@ extern "C" void OTRGetPixelDepthPrepare(float x, float y) {
// Invert the Y value to match the origin values used in the renderer
float adjustedY = SCREEN_HEIGHT - y;
- auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
if (wnd == nullptr) {
return;
}
@@ -1276,7 +1278,7 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
// Invert the Y value to match the origin values used in the renderer
float adjustedY = SCREEN_HEIGHT - y;
- auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
if (wnd == nullptr) {
return 0;
}
@@ -1285,20 +1287,20 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
}
extern "C" bool ResourceMgr_IsAltAssetsEnabled() {
- return Ship::Context::GetInstance()->GetResourceManager()->IsAltAssetsEnabled();
+ return Ship::Context::GetRawInstance()->GetResourceManager()->IsAltAssetsEnabled();
}
extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
- return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size();
+ return Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size();
}
extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
- return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
+ return Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
}
extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
uint32_t version =
- Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
+ Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
switch (version) {
case MM_NTSC_US_10:
@@ -1310,7 +1312,7 @@ extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
uint32_t version =
- Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
+ Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
switch (version) {
case MM_NTSC_US_10:
@@ -1320,10 +1322,10 @@ extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
}
extern "C" void ResourceMgr_LoadDirectory(const char* resName) {
- Ship::Context::GetInstance()->GetResourceManager()->LoadResources(resName);
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResources(resName);
}
extern "C" void ResourceMgr_DirtyDirectory(const char* resName) {
- Ship::Context::GetInstance()->GetResourceManager()->DirtyResources(resName);
+ Ship::Context::GetRawInstance()->GetResourceManager()->DirtyResources(resName);
}
extern "C" void ResourceMgr_UnloadResource(const char* resName) {
@@ -1331,7 +1333,7 @@ extern "C" void ResourceMgr_UnloadResource(const char* resName) {
if (path.starts_with("__OTR__")) {
path = path.substr(7);
}
- Ship::Context::GetInstance()->GetResourceManager()->UnloadResource(path);
+ Ship::Context::GetRawInstance()->GetResourceManager()->UnloadResource(path);
}
static void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) {
@@ -1348,7 +1350,7 @@ static void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) {
// OTRTODO: There is probably a more elegant way to go about this...
// Kenix: This is definitely leaking memory when it's called.
extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) {
- auto lst = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask);
+ auto lst = Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask);
char** result = (char**)malloc(lst->size() * sizeof(char*));
for (size_t i = 0; i < lst->size(); i++) {
@@ -1372,11 +1374,11 @@ extern "C" uint8_t ResourceMgr_FileExists(const char* filePath) {
}
extern "C" void ResourceMgr_LoadFile(const char* resName) {
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(resName);
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(resName);
}
std::shared_ptr<Ship::IResource> GetResourceByName(const char* path) {
- return Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path);
+ return Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path);
}
extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) {
@@ -1492,7 +1494,7 @@ std::unordered_map<std::string, std::unordered_map<std::string, GfxPatch>> origi
// using OTRs instead (When that is available). Index can be found using the commented out section below.
extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) {
auto res = std::static_pointer_cast<Fast::DisplayList>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path));
// Leaving this here for people attempting to find the correct Dlist index to patch
/*if (strcmp("__OTR__objects/object_gi_longsword/gGiBiggoronSwordDL", path) == 0) {
@@ -1530,7 +1532,7 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa
extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex,
int sourceIndex) {
auto res = std::static_pointer_cast<Fast::DisplayList>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path));
// Do not patch custom assets as they most likely do not have the same instructions as authentic assets
if (res->GetInitData()->IsCustom) {
@@ -1550,7 +1552,7 @@ extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const ch
extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) {
if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) {
auto res = std::static_pointer_cast<Fast::DisplayList>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path));
Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index];
*gfx = originalGfx[path][patchName].instruction;
@@ -1572,7 +1574,7 @@ extern "C" void ResourceMgr_ResetAllPatchesForDL(const char* path) {
}
auto res = std::static_pointer_cast<Fast::DisplayList>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path));
// Iterate through all patches and restore original instructions
auto& patches = originalGfx[path];
@@ -1693,7 +1695,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
ExtensionEntry entry = ExtensionCache[path];
- auto sampleRaw = Ship::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path);
+ auto sampleRaw = Ship::Context::GetRawInstance()->GetResourceManager()->LoadFile(entry.path);
uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get();
uint8_t* strem2 = (uint8_t*)strem;
@@ -1875,7 +1877,7 @@ ImFont* OTRGlobals::CreateFontWithSize(float size, std::string fontPath) {
initData->ResourceVersion = 0;
initData->Path = fontPath;
std::shared_ptr<Ship::Font> fontData = std::static_pointer_cast<Ship::Font>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fontPath, false, initData));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(fontPath, false, initData));
ImFontConfig fontConf;
fontConf.FontDataOwnedByAtlas = false;
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontData->Data, fontData->DataSize, size, &fontConf, nullptr);
@@ -2086,13 +2088,13 @@ Color_RGB8 GetColorForControllerLED() {
extern "C" void OTRControllerCallback(uint8_t rumble) {
// We call this every tick, SDL accounts for this use and prevents driver spam
// https://github.com/libsdl-org/SDL/blob/f17058b562c8a1090c0c996b42982721ace90903/src/joystick/SDL_joystick.c#L1114-L1144
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetLED()->SetLEDColor(
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(0)->GetLED()->SetLEDColor(
GetColorForControllerLED());
static std::shared_ptr<BenInputEditorWindow> controllerConfigWindow = nullptr;
if (controllerConfigWindow == nullptr) {
controllerConfigWindow = std::dynamic_pointer_cast<BenInputEditorWindow>(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("2S2H Input Editor"));
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("2S2H Input Editor"));
// note: the current implementation may not be desired in LUS, as "true" rumble support
// using osMotor calls is planned: https://github.com/Kenix3/libultraship/issues/9
}
@@ -2102,18 +2104,18 @@ extern "C" void OTRControllerCallback(uint8_t rumble) {
// TODO: other ports?
if (rumble) {
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StartRumble();
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StartRumble();
} else {
- Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StopRumble();
+ Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StopRumble();
}
}
extern "C" float OTRGetAspectRatio() {
- return Ship::Context::GetInstance()->GetWindow()->GetAspectRatio();
+ return Ship::Context::GetRawInstance()->GetWindow()->GetAspectRatio();
}
extern "C" float OTRGetDimensionFromLeftEdge(float v) {
- auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto fastWnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
@@ -2127,7 +2129,7 @@ extern "C" float OTRGetDimensionFromLeftEdge(float v) {
}
extern "C" float OTRGetDimensionFromRightEdge(float v) {
- auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto fastWnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
@@ -2143,7 +2145,7 @@ extern "C" float OTRGetDimensionFromRightEdge(float v) {
// Gets the width of the current render target area
extern "C" uint32_t OTRGetGameRenderWidth() {
- auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto fastWnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
@@ -2159,7 +2161,7 @@ extern "C" uint32_t OTRGetGameRenderWidth() {
// Gets the height of the current render target area
extern "C" uint32_t OTRGetGameRenderHeight() {
- auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto fastWnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
@@ -2200,7 +2202,7 @@ Calling with Y (1,1) will return 10
. . . _ _ _ _ _ _ _ _ . . .
*/
extern "C" int32_t OTRConvertHUDXToScreenX(int32_t v) {
- auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto fastWnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
@@ -2227,7 +2229,7 @@ extern "C" int32_t OTRConvertHUDXToScreenX(int32_t v) {
}
extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement) {
- if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
+ if (auto intP = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->RegisterBlendedTexture(name, mask, replacement);
@@ -2237,7 +2239,7 @@ extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* repla
}
extern "C" void Gfx_UnregisterBlendedTexture(const char* name) {
- if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
+ if (auto intP = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->UnregisterBlendedTexture(name);
@@ -2257,7 +2259,7 @@ extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) {
texAddr = (const uint8_t*)ResourceGetDataByName(imgName);
}
- if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
+ if (auto intP = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->TextureCacheDelete(texAddr);
@@ -2280,7 +2282,7 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
extern "C" int Controller_ShouldRumble(size_t slot) {
// don't rumble if we don't have rumble mappings
- if (Ship::Context::GetInstance()
+ if (Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(static_cast<uint8_t>(slot))
->GetRumble()
@@ -2290,7 +2292,7 @@ extern "C" int Controller_ShouldRumble(size_t slot) {
}
// don't rumble if we don't have connected gamepads
- if (Ship::Context::GetInstance()
+ if (Ship::Context::GetRawInstance()
->GetControlDeck()
->GetConnectedPhysicalDeviceManager()
->GetConnectedSDLGamepadsForPort(slot)
@@ -2310,7 +2312,7 @@ extern "C" bool Ship_HandleConsoleCrashAsReset() {
}
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
Notification::Emit({
diff --git a/mm/2s2h/BenPort.h b/mm/2s2h/BenPort.h
index 7aaae7cf5..36f0e04f2 100644
--- a/mm/2s2h/BenPort.h
+++ b/mm/2s2h/BenPort.h
@@ -54,7 +54,7 @@ class OTRGlobals {
ImFont* fontMonoLarger = nullptr;
ImFont* fontMonoLargest = nullptr;
- std::shared_ptr<Ship::Context> context;
+ Ship::Context* context = nullptr;
OTRGlobals();
~OTRGlobals();
diff --git a/mm/2s2h/DeveloperTools/CollisionViewer.cpp b/mm/2s2h/DeveloperTools/CollisionViewer.cpp
index ce1710430..a0870e6f6 100644
--- a/mm/2s2h/DeveloperTools/CollisionViewer.cpp
+++ b/mm/2s2h/DeveloperTools/CollisionViewer.cpp
@@ -61,7 +61,7 @@ void CollisionViewerWindow::DrawElement() {
CVarClear("gCollisionViewer.ATCollisionColor");
CVarClear("gCollisionViewer.SpecialSurfaceColor");
CVarClear("gCollisionViewer.InteractableColor");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SeparatorText("Collision Types");
diff --git a/mm/2s2h/DeveloperTools/DLViewer.cpp b/mm/2s2h/DeveloperTools/DLViewer.cpp
index 58260d14a..97503f292 100644
--- a/mm/2s2h/DeveloperTools/DLViewer.cpp
+++ b/mm/2s2h/DeveloperTools/DLViewer.cpp
@@ -146,7 +146,7 @@ CommandCategory GetCommandCategory(int cmd) {
void PerformDisplayListSearch() {
// Get all DL files using broad pattern (glob_match is case-sensitive, so we filter manually)
- static auto result = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*DL*");
+ static auto result = Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*DL*");
displayListSearchResults.clear();
@@ -275,7 +275,7 @@ void DrawInstructionFilters() {
CVarSetInteger("gDeveloperTools.DLViewer.Filter.Sync", value);
CVarSetInteger("gDeveloperTools.DLViewer.Filter.Other", value);
CVarSetInteger("gDeveloperTools.DLViewer.Filter.Unknown", value);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
g->CurrentItemFlags = backup_item_flags;
@@ -783,7 +783,7 @@ void DLViewerWindow::DrawElement() {
try {
auto res = std::static_pointer_cast<Fast::DisplayList>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(activeDisplayList));
if (res->GetInitData()->Type != static_cast<uint32_t>(Fast::ResourceType::DisplayList)) {
ImGui::Text("Resource type is not a Display List. Please choose another.");
diff --git a/mm/2s2h/DeveloperTools/DebugConsole.cpp b/mm/2s2h/DeveloperTools/DebugConsole.cpp
index 56dd33bdd..2b284e62b 100644
--- a/mm/2s2h/DeveloperTools/DebugConsole.cpp
+++ b/mm/2s2h/DeveloperTools/DebugConsole.cpp
@@ -17,15 +17,15 @@ extern "C" {
#include "overlays/gamestates/ovl_title/z_title.h"
}
-#define CMD_REGISTER Ship::Context::GetInstance()->GetConsole()->AddCommand
+#define CMD_REGISTER Ship::Context::GetRawInstance()->GetConsole()->AddCommand
// TODO: Commands should be using the output passed in.
-#define ERROR_MESSAGE \
- std::reinterpret_pointer_cast<Ship::ConsoleWindow>( \
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console")) \
+#define ERROR_MESSAGE \
+ std::reinterpret_pointer_cast<Ship::ConsoleWindow>( \
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console")) \
->SendErrorMessage
-#define INFO_MESSAGE \
- std::reinterpret_pointer_cast<Ship::ConsoleWindow>( \
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console")) \
+#define INFO_MESSAGE \
+ std::reinterpret_pointer_cast<Ship::ConsoleWindow>( \
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console")) \
->SendInfoMessage
static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args,
@@ -255,7 +255,7 @@ static bool FileSelectHandler(std::shared_ptr<Ship::Console> Console, const std:
static bool QuitHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args,
std::string* output) {
- Ship::Context::GetInstance()->GetWindow()->Close();
+ Ship::Context::GetRawInstance()->GetWindow()->Close();
return 0;
}
diff --git a/mm/2s2h/DeveloperTools/DeveloperTools.cpp b/mm/2s2h/DeveloperTools/DeveloperTools.cpp
index 3b650b772..bd45f0564 100644
--- a/mm/2s2h/DeveloperTools/DeveloperTools.cpp
+++ b/mm/2s2h/DeveloperTools/DeveloperTools.cpp
@@ -185,7 +185,7 @@ void RegisterDebugMode() {
if (CHECK_BTN_ANY(gGameState->input[0].press.button, mask) &&
CHECK_BTN_ALL(gGameState->input[0].cur.button, mask)) {
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
}
});
diff --git a/mm/2s2h/DeveloperTools/EventLog.cpp b/mm/2s2h/DeveloperTools/EventLog.cpp
index f61804295..bc83982da 100644
--- a/mm/2s2h/DeveloperTools/EventLog.cpp
+++ b/mm/2s2h/DeveloperTools/EventLog.cpp
@@ -311,7 +311,7 @@ void EventLogWindow::DrawElement() {
CVarSetInteger("gEventLog.Filter.OpenText", 0);
CVarSetInteger("gEventLog.Filter.ItemGive", 0);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
g->CurrentItemFlags = backup_item_flags;
@@ -340,7 +340,7 @@ void EventLogWindow::DrawElement() {
s32 maxEntries = CVarGetInteger("gEventLog.MaxEntries", 1000);
if (ImGui::InputScalar("##maxEntriesInput", ImGuiDataType_S32, &maxEntries)) {
CVarSetInteger("gEventLog.MaxEntries", MAX(0, maxEntries));
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
TrimEventLog();
}
ImGui::PopItemWidth();
diff --git a/mm/2s2h/DeveloperTools/SaveEditor.cpp b/mm/2s2h/DeveloperTools/SaveEditor.cpp
index 0a1de5f73..aebf90c3a 100644
--- a/mm/2s2h/DeveloperTools/SaveEditor.cpp
+++ b/mm/2s2h/DeveloperTools/SaveEditor.cpp
@@ -12,6 +12,9 @@
#include "interface/icon_item_dungeon_static/icon_item_dungeon_static.h"
#include "archives/icon_item_24_static/icon_item_24_static_yar.h"
+#include <fast/Fast3dGui.h>
+#include <fast/Fast3dWindow.h>
+
extern "C" {
#include <z64.h>
#include <z64save.h>
@@ -769,12 +772,13 @@ void DrawSlot(InventorySlot slot) {
}
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 2.0f);
- ImTextureID textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[safeItemsForInventorySlot[slot][0]]);
+ ImTextureID textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[safeItemsForInventorySlot[slot][0]]);
if (currentItemId != ITEM_NONE) {
- textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[currentItemId]);
+ textureId = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[currentItemId]);
}
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
@@ -816,7 +820,8 @@ void DrawSlot(InventorySlot slot) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
bool buttonPressed = ImGui::ImageButton(
(const char*)gItemIcons[id],
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName((const char*)gItemIcons[id]),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[id]),
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE));
ImGui::PopStyleVar();
if (buttonPressed) {
@@ -1176,8 +1181,9 @@ void DrawQuestSlot(QuestItem slot) {
ImGui::SetCursorPos(
ImVec2(x * INV_GRID_WIDTH + INV_GRID_PADDING, y * INV_GRID_HEIGHT + INV_GRID_TOP_MARGIN + INV_GRID_PADDING));
- ImTextureID textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[questToItemMap[slot]]);
+ ImTextureID textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[questToItemMap[slot]]);
if (ImGui::ImageButton(std::to_string(slot).c_str(), textureId, ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE),
ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
ImVec4(1, 1, 1, CHECK_QUEST_ITEM(slot) ? 1.0f : 0.4f))) {
@@ -1189,11 +1195,12 @@ void DrawQuestSlot(QuestItem slot) {
ImVec2 DrawSong(QuestItem slot) {
SongInfo(slot);
- if (ImGui::ImageButton(std::to_string(slot).c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[questToItemMap[(QuestItem)slot]]),
- ImVec2(INV_GRID_ICON_SIZE / 1.5f, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1),
- ImVec4(0, 0, 0, 0), colorTint)) {
+ if (ImGui::ImageButton(
+ std::to_string(slot).c_str(),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[questToItemMap[(QuestItem)slot]]),
+ ImVec2(INV_GRID_ICON_SIZE / 1.5f, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
+ colorTint)) {
NextQuestInSlot(slot);
}
ImVec2 itemSize = ImGui::GetItemRectSize();
@@ -1272,8 +1279,9 @@ void DrawQuestStatusTab() {
drawSongRange(QUEST_SONG_SONATA, QUEST_SONG_SARIA);
ImGui::SeparatorText("Equipment");
if (GET_PLAYER_FORM == PLAYER_FORM_FIERCE_DEITY) {
- ImTextureID swordTextureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[ITEM_SWORD_DEITY]);
+ ImTextureID swordTextureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[ITEM_SWORD_DEITY]);
ImGui::ImageButton(std::to_string(ITEM_SWORD_DEITY).c_str(), swordTextureId,
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1),
ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
@@ -1282,8 +1290,9 @@ void DrawQuestStatusTab() {
if (swordValue == EQUIP_VALUE_SWORD_NONE) {
swordValue = EQUIP_VALUE_SWORD_KOKIRI;
}
- ImTextureID swordTextureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[ITEM_SWORD_KOKIRI + swordValue - EQUIP_VALUE_SWORD_KOKIRI]);
+ ImTextureID swordTextureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[ITEM_SWORD_KOKIRI + swordValue - EQUIP_VALUE_SWORD_KOKIRI]);
if (ImGui::ImageButton(std::to_string(ITEM_SWORD_KOKIRI).c_str(), swordTextureId,
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1),
@@ -1296,8 +1305,9 @@ void DrawQuestStatusTab() {
if (shieldValue == EQUIP_VALUE_SHIELD_NONE) {
shieldValue = EQUIP_VALUE_SHIELD_HERO;
}
- ImTextureID shieldTextureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[ITEM_SHIELD_HERO + shieldValue - EQUIP_VALUE_SHIELD_HERO]);
+ ImTextureID shieldTextureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[ITEM_SHIELD_HERO + shieldValue - EQUIP_VALUE_SHIELD_HERO]);
if (ImGui::ImageButton(std::to_string(ITEM_SHIELD_HERO).c_str(), shieldTextureId,
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1),
@@ -1305,8 +1315,9 @@ void DrawQuestStatusTab() {
NextQuestInSlot(QUEST_SHIELD);
}
ImGui::SameLine();
- ImTextureID textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[ITEM_BOMBERS_NOTEBOOK]);
+ ImTextureID textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[ITEM_BOMBERS_NOTEBOOK]);
if (ImGui::ImageButton(std::to_string(ITEM_BOMBERS_NOTEBOOK).c_str(), textureId,
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1),
ImVec4(0, 0, 0, 0),
@@ -1383,7 +1394,8 @@ void DrawDungeonItemTab() {
ImGui::Text("%s", dungeonNames[i]);
if (ImGui::ImageButton(
stray_id.c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(fairyIcons[dungeonId]),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(fairyIcons[dungeonId]),
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
ImVec4(1, 1, 1, gSaveContext.save.saveInfo.inventory.strayFairies[dungeonId] ? 1.0f : 0.4f))) {
ImGui::OpenPopup("strayFairies");
@@ -1391,7 +1403,8 @@ void DrawDungeonItemTab() {
ImGui::SameLine();
if (ImGui::ImageButton(
map_id.c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gQuestIconDungeonMapTex),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gQuestIconDungeonMapTex),
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
ImVec4(1, 1, 1, CHECK_DUNGEON_ITEM(DUNGEON_MAP, i) ? 1.0f : 0.4f))) {
SetDungeonItems(DUNGEON_MAP, i);
@@ -1399,7 +1412,8 @@ void DrawDungeonItemTab() {
ImGui::SameLine();
if (ImGui::ImageButton(
comp_id.c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gQuestIconCompassTex),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gQuestIconCompassTex),
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
ImVec4(1, 1, 1, CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, i) ? 1.0f : 0.4f))) {
SetDungeonItems(DUNGEON_COMPASS, i);
@@ -1407,7 +1421,8 @@ void DrawDungeonItemTab() {
ImGui::SameLine();
if (ImGui::ImageButton(
sKey_id.c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gQuestIconSmallKeyTex),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gQuestIconSmallKeyTex),
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
ImVec4(1, 1, 1, DUNGEON_KEY_COUNT(i) + 1 ? 1.0f : 0.4f))) {
ImGui::OpenPopup("smallKeys");
@@ -1415,7 +1430,8 @@ void DrawDungeonItemTab() {
ImGui::SameLine();
if (ImGui::ImageButton(
bKey_id.c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gQuestIconBossKeyTex),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gQuestIconBossKeyTex),
ImVec2(INV_GRID_ICON_SIZE, INV_GRID_ICON_SIZE), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
ImVec4(1, 1, 1, CHECK_DUNGEON_ITEM(DUNGEON_BOSS_KEY, i) ? 1.0f : 0.4f))) {
SetDungeonItems(DUNGEON_BOSS_KEY, i);
diff --git a/mm/2s2h/DeveloperTools/WarpPoint.cpp b/mm/2s2h/DeveloperTools/WarpPoint.cpp
index 62d1b02eb..6e019cf71 100644
--- a/mm/2s2h/DeveloperTools/WarpPoint.cpp
+++ b/mm/2s2h/DeveloperTools/WarpPoint.cpp
@@ -31,7 +31,7 @@ std::map<std::string, WarpPoint> warpPoints;
#define CVAR_BOOT_TO_FILE_SELECT ((bool)CVarGetInteger(CVAR_BOOT_TO_FILE_SELECT_NAME, 0))
void LoadConfig() {
- auto allConfig = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
+ auto allConfig = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
if (allConfig.find("WarpPoints") == allConfig.end() || !allConfig["WarpPoints"].is_object()) {
allConfig["WarpPoints"] = nlohmann::json::object();
}
@@ -39,10 +39,10 @@ void LoadConfig() {
}
void SaveConfig() {
- auto allConfig = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
+ auto allConfig = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
allConfig["WarpPoints"] = warpPoints;
- Ship::Context::GetInstance()->GetConfig()->SetBlock("WarpPoints", warpPoints);
- Ship::Context::GetInstance()->GetConfig()->Save();
+ Ship::Context::GetRawInstance()->GetConfig()->SetBlock("WarpPoints", warpPoints);
+ Ship::Context::GetRawInstance()->GetConfig()->Save();
}
void Warp(WarpPoint& warpPoint) {
diff --git a/mm/2s2h/Enhancements/Audio/AudioCollection.cpp b/mm/2s2h/Enhancements/Audio/AudioCollection.cpp
index 611671f9b..7ec11a909 100644
--- a/mm/2s2h/Enhancements/Audio/AudioCollection.cpp
+++ b/mm/2s2h/Enhancements/Audio/AudioCollection.cpp
@@ -300,7 +300,7 @@ void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) {
excludedSequences.insert(seqInfo);
includedSequences.erase(seqInfo);
CVarSetInteger(cvarKey.c_str(), 1);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
@@ -308,7 +308,7 @@ void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
includedSequences.insert(seqInfo);
excludedSequences.erase(seqInfo);
CVarClear(cvarKey.c_str());
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void AudioCollection::InitializeShufflePool() {
diff --git a/mm/2s2h/Enhancements/Audio/AudioEditor.cpp b/mm/2s2h/Enhancements/Audio/AudioEditor.cpp
index 0be4a51ef..56b98b917 100644
--- a/mm/2s2h/Enhancements/Audio/AudioEditor.cpp
+++ b/mm/2s2h/Enhancements/Audio/AudioEditor.cpp
@@ -315,7 +315,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
ResetGroup(map, type);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM();
@@ -326,7 +326,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
RandomizeGroup(type);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM();
@@ -337,7 +337,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
LockGroup(map, type);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM();
@@ -348,7 +348,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto currentBGM = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
UnlockGroup(map, type);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM);
if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) {
ReplayCurrentBGM();
@@ -416,7 +416,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
hiddenKey.c_str(), &tempValue, mapToUse,
{ .labelPosition = UIWidgets::LabelPosition::None, .color = THEME_COLOR, .width = -FLT_MIN })) {
CVarSetInteger(cvarKey.c_str(), tempValue);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
UpdateCurrentBGM(defaultValue, type);
}
@@ -433,7 +433,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
if (ImGui::Button(resetButton.c_str())) {
CVarClear(cvarKey.c_str());
CVarClear(cvarLockKey.c_str());
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
UpdateCurrentBGM(defaultValue, seqData.category);
}
UIWidgets::Tooltip("Reset to default");
@@ -454,7 +454,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
if (locked) {
CVarClear(cvarLockKey.c_str());
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
UpdateCurrentBGM(defaultValue, type);
}
}
@@ -467,7 +467,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
} else {
CVarSetInteger(cvarLockKey.c_str(), 1);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
UIWidgets::Tooltip(locked ? "Sound locked" : "Sound unlocked");
UIWidgets::PopStyleButton();
@@ -832,14 +832,14 @@ void AudioEditor_RandomizeAll() {
RandomizeGroup(type);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ReplayCurrentBGM();
}
void AudioEditor_RandomizeGroup(SeqType group) {
RandomizeGroup(group);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ReplayCurrentBGM();
}
@@ -848,14 +848,14 @@ void AudioEditor_ResetAll() {
ResetGroup(AudioCollection::Instance->GetAllSequences(), type);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ReplayCurrentBGM();
}
void AudioEditor_ResetGroup(SeqType group) {
ResetGroup(AudioCollection::Instance->GetAllSequences(), group);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ReplayCurrentBGM();
}
@@ -864,7 +864,7 @@ void AudioEditor_LockAll() {
LockGroup(AudioCollection::Instance->GetAllSequences(), type);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void AudioEditor_UnlockAll() {
@@ -872,7 +872,7 @@ void AudioEditor_UnlockAll() {
UnlockGroup(AudioCollection::Instance->GetAllSequences(), type);
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void AddAudioSearchWidget(WidgetInfo& widgetInfo) {
diff --git a/mm/2s2h/Enhancements/Audio/AudioSeqQueue.cpp b/mm/2s2h/Enhancements/Audio/AudioSeqQueue.cpp
index caac6c904..d3dc4f4e8 100644
--- a/mm/2s2h/Enhancements/Audio/AudioSeqQueue.cpp
+++ b/mm/2s2h/Enhancements/Audio/AudioSeqQueue.cpp
@@ -23,7 +23,7 @@ int32_t AudioQueue_IsEmpty(void) {
void AudioQueue_GetSeqInfo(const char* path, uint64_t* numFrames, uint32_t* numChannels, uint32_t* sampleRate,
int16_t** sampleData) {
auto seqData =
- static_pointer_cast<SOH::AudioSequence>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
+ static_pointer_cast<SOH::AudioSequence>(Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(path));
if (numFrames != nullptr) {
*numFrames = seqData->sequence.seqDataSize / sizeof(uint16_t);
}
diff --git a/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp b/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp
index a841961c5..a8ab34717 100644
--- a/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp
+++ b/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp
@@ -40,7 +40,7 @@ void RegisterDeleteFileOnDeath() {
if (resetTimer >= 20) { // Completely black
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
}
}
diff --git a/mm/2s2h/Enhancements/ModMenu/ModMenu.cpp b/mm/2s2h/Enhancements/ModMenu/ModMenu.cpp
index 9c9cd733a..b08830c32 100644
--- a/mm/2s2h/Enhancements/ModMenu/ModMenu.cpp
+++ b/mm/2s2h/Enhancements/ModMenu/ModMenu.cpp
@@ -54,7 +54,7 @@ void SetEnabledModsCVarValue() {
}
CVarSetString(CVAR_ENABLED_MODS_NAME, s.c_str());
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void AfterModChange() {
@@ -105,7 +105,7 @@ std::vector<std::string>& GetModFiles(bool enabled) {
}
std::shared_ptr<Ship::ArchiveManager> GetArchiveManager() {
- return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager();
+ return Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager();
}
bool IsValidExtension(std::string extension) {
@@ -334,8 +334,8 @@ void ModMenuWindow::DrawElement() {
gfx_texture_cache_clear();
SOH::SkeletonPatcher::ClearSkeletons();
*/
- Ship::Context::GetInstance()->GetConsoleVariables()->Save();
- Ship::Context::GetInstance()->GetWindow()->Close();
+ Ship::Context::GetRawInstance()->GetConsoleVariables()->Save();
+ Ship::Context::GetRawInstance()->GetWindow()->Close();
});
}
}
diff --git a/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp b/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp
index 18cd16733..620043f17 100644
--- a/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp
+++ b/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp
@@ -23,7 +23,8 @@ static SkeletonHeader gKafeiSkelBackup;
void UpdatePlayAsKafei() {
if (CVAR) {
- auto gLinkHumanSkelResource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(gLinkHumanSkel);
+ auto gLinkHumanSkelResource =
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(gLinkHumanSkel);
SkeletonHeader* gLinkHumanSkelPtr = (SkeletonHeader*)gLinkHumanSkelResource->GetRawPointer();
memcpy(gLinkHumanSkelPtr, &gKafeiSkelBackup, sizeof(SkeletonHeader));
@@ -45,7 +46,8 @@ void UpdatePlayAsKafei() {
sPlayerMouthTextures[PLAYER_FORM_HUMAN][2] = (TexturePtr)gKafeiMouthOpenTex;
sPlayerMouthTextures[PLAYER_FORM_HUMAN][3] = (TexturePtr)gKafeiMouthSmileTex;
} else {
- auto gLinkHumanSkelResource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(gLinkHumanSkel);
+ auto gLinkHumanSkelResource =
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(gLinkHumanSkel);
SkeletonHeader* gLinkHumanSkelPtr = (SkeletonHeader*)gLinkHumanSkelResource->GetRawPointer();
memcpy(gLinkHumanSkelPtr, &gLinkHumanSkelBackup, sizeof(SkeletonHeader));
@@ -77,8 +79,8 @@ void RegisterPlayAsKafei() {
}
initialized = true;
- auto gLinkHumanSkelResource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(gLinkHumanSkel);
- auto gKafeiSkelResource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(gKafeiSkel);
+ auto gLinkHumanSkelResource = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(gLinkHumanSkel);
+ auto gKafeiSkelResource = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(gKafeiSkel);
SkeletonHeader* gLinkHumanSkelPtr = (SkeletonHeader*)gLinkHumanSkelResource->GetRawPointer();
SkeletonHeader* gKafeiSkelPtr = (SkeletonHeader*)gKafeiSkelResource->GetRawPointer();
diff --git a/mm/2s2h/Enhancements/Restorations/N64WeirdFrames/WeirdAnimation.cpp b/mm/2s2h/Enhancements/Restorations/N64WeirdFrames/WeirdAnimation.cpp
index c4cbc4bfe..4fd642723 100644
--- a/mm/2s2h/Enhancements/Restorations/N64WeirdFrames/WeirdAnimation.cpp
+++ b/mm/2s2h/Enhancements/Restorations/N64WeirdFrames/WeirdAnimation.cpp
@@ -36,7 +36,7 @@ void WeirdAnimation::Build() {
auto& animation = animationData.emplace();
for (const auto& neighborName : neighborAnimations) {
- const auto neighbor = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(neighborName);
+ const auto neighbor = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(neighborName);
const auto prevSize = animation.size();
animation.resize(prevSize + neighbor->GetPointerSize());
diff --git a/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp b/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp
index f52948ac3..a5782b6e5 100644
--- a/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp
+++ b/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp
@@ -14,6 +14,8 @@ uint64_t GetUnixTimestamp();
#include "interface/parameter_static/parameter_static.h"
#include "2s2h/Enhancements/Enhancements.h"
+#include <fast/Fast3dGui.h>
+
float windowScale = 1.0f;
ImVec4 windowBG = ImVec4(0, 0, 0, 0.5f);
static constexpr ImVec4 tintColor = {};
@@ -31,12 +33,15 @@ void DrawInGameTimer(uint32_t timer, ImVec4 color = ImVec4(1, 1, 1, 1)) {
}
if (c == '.') {
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (8.0f * windowScale));
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(digitList[textureIndex]),
- ImVec2(8.0f * windowScale, 8.0f * windowScale), ImVec2(0, 0.5f), ImVec2(1, 1), color,
- tintColor);
+ ImGui::Image(
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(digitList[textureIndex]),
+ ImVec2(8.0f * windowScale, 8.0f * windowScale), ImVec2(0, 0.5f), ImVec2(1, 1), color, tintColor);
} else {
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(digitList[textureIndex]),
- ImVec2(8.0f * windowScale, 16.0f * windowScale), ImVec2(0, 0), ImVec2(1, 1), color, tintColor);
+ ImGui::Image(
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(digitList[textureIndex]),
+ ImVec2(8.0f * windowScale, 16.0f * windowScale), ImVec2(0, 0), ImVec2(1, 1), color, tintColor);
}
ImGui::SameLine(0, 0);
}
@@ -64,7 +69,8 @@ void DisplayOverlayWindow::Draw() {
ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar);
ImGui::SetWindowFontScale(windowScale);
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gTimerClockIconTex),
+ ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gTimerClockIconTex),
ImVec2(16.0f * windowScale, 16.0f * windowScale));
ImGui::SameLine(0, 10.0f);
diff --git a/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTracker.cpp b/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTracker.cpp
index e8b28a91f..f603af0ac 100644
--- a/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTracker.cpp
+++ b/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTracker.cpp
@@ -19,6 +19,8 @@ extern "C" {
#include "overlays/actors/ovl_En_Si/z_en_si.h"
}
+#include <fast/Fast3dGui.h>
+
namespace BenGui {
extern std::shared_ptr<ItemTrackerWindow> mItemTrackerWindow;
}
@@ -94,7 +96,8 @@ TrackerImageObject GetImageObject(TrackerItemType itemType, u32 itemId) {
const char* texturePath = Rando::StaticData::GetIconTexturePath(randoItemId);
if (texturePath != nullptr) {
trackerImageObject.textureId =
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(texturePath);
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(texturePath);
}
if (randoItemId >= RI_OWL_CLOCK_TOWN_SOUTH && randoItemId <= RI_OWL_ZORA_CAPE) {
trackerImageObject.textureDimensions.y = 24.0f;
@@ -109,8 +112,9 @@ TrackerImageObject GetImageObject(TrackerItemType itemType, u32 itemId) {
vanillaItemId = safeItemsForInventorySlot[itemId][0];
}
- trackerImageObject.textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[vanillaItemId]);
+ trackerImageObject.textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[vanillaItemId]);
} break;
case TRACKER_ITEM_SWORD: {
if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) > EQUIP_VALUE_SWORD_NONE) {
@@ -121,8 +125,9 @@ TrackerImageObject GetImageObject(TrackerItemType itemType, u32 itemId) {
vanillaItemId = ITEM_SWORD_KOKIRI + GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) - EQUIP_VALUE_SWORD_KOKIRI;
}
- trackerImageObject.textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[vanillaItemId]);
+ trackerImageObject.textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[vanillaItemId]);
} break;
case TRACKER_ITEM_SHIELD: {
if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) > EQUIP_VALUE_SHIELD_NONE) {
@@ -133,8 +138,9 @@ TrackerImageObject GetImageObject(TrackerItemType itemType, u32 itemId) {
vanillaItemId = ITEM_SHIELD_MIRROR;
}
- trackerImageObject.textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[vanillaItemId]);
+ trackerImageObject.textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[vanillaItemId]);
} break;
case TRACKER_ITEM_WALLET: {
if (CUR_UPG_VALUE(UPG_WALLET) >= 1) {
@@ -145,8 +151,9 @@ TrackerImageObject GetImageObject(TrackerItemType itemType, u32 itemId) {
vanillaItemId = ITEM_WALLET_GIANT;
}
- trackerImageObject.textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[vanillaItemId]);
+ trackerImageObject.textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[vanillaItemId]);
} break;
case TRACKER_ITEM_MAGIC: {
if (gSaveContext.save.saveInfo.playerData.isMagicAcquired) {
@@ -157,8 +164,9 @@ TrackerImageObject GetImageObject(TrackerItemType itemType, u32 itemId) {
vanillaItemId = ITEM_MAGIC_JAR_BIG;
}
- trackerImageObject.textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- (const char*)gItemIcons[vanillaItemId]);
+ trackerImageObject.textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName((const char*)gItemIcons[vanillaItemId]);
} break;
default:
break;
@@ -342,7 +350,8 @@ bool DrawItemTrackerSlot(TrackerItemType itemType, u32 itemId, float scale, bool
tintColor = ImVec4(0.0f, 209.0f / 256.0f, 231.0f / 256.0f, imageObject.textureColor.w); // Ocean tint
}
auto textureId =
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gMagicArrowEquipEffectTex);
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gMagicArrowEquipEffectTex);
// Draw texture behind the actual item icon
ImGui::GetWindowDrawList()->AddImage(textureId, p0 + offset - ImVec2(8.0f, 8.0f),
@@ -354,7 +363,8 @@ bool DrawItemTrackerSlot(TrackerItemType itemType, u32 itemId, float scale, bool
ImVec4 tintColor =
ImVec4(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, imageObject.textureColor.w); // Swamp tint
auto textureId =
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gMagicArrowEquipEffectTex);
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gMagicArrowEquipEffectTex);
// Draw texture behind the actual item icon
ImGui::GetWindowDrawList()->AddImage(textureId, p0 + offset - ImVec2(8.0f, 8.0f),
diff --git a/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTrackerSettings.cpp b/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTrackerSettings.cpp
index fef401d4b..6ae272278 100644
--- a/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTrackerSettings.cpp
+++ b/mm/2s2h/Enhancements/Trackers/ItemTracker/ItemTrackerSettings.cpp
@@ -471,12 +471,12 @@ void SaveItemTrackerLayout() {
});
itemTrackerLayout.push_back(groupJson);
}
- Ship::Context::GetInstance()->GetConfig()->SetBlock("CVars.ItemTrackerLayout", itemTrackerLayout);
- Ship::Context::GetInstance()->GetConfig()->Save();
+ Ship::Context::GetRawInstance()->GetConfig()->SetBlock("CVars.ItemTrackerLayout", itemTrackerLayout);
+ Ship::Context::GetRawInstance()->GetConfig()->Save();
}
void LoadItemTrackerConfig() {
- auto allConfig = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
+ auto allConfig = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
// Verify that the config has CVars.ItemTrackerLayout and its an array
if (allConfig.find("CVars") != allConfig.end() && allConfig["CVars"].is_object() &&
diff --git a/mm/2s2h/Enhancements/Trackers/TimeSplits/TimeSplitsActions.cpp b/mm/2s2h/Enhancements/Trackers/TimeSplits/TimeSplitsActions.cpp
index 4982fa56c..003590a88 100644
--- a/mm/2s2h/Enhancements/Trackers/TimeSplits/TimeSplitsActions.cpp
+++ b/mm/2s2h/Enhancements/Trackers/TimeSplits/TimeSplitsActions.cpp
@@ -17,6 +17,8 @@ extern "C" {
uint64_t GetUnixTimestamp();
}
+#include <fast/Fast3dGui.h>
+
#define CVAR_NAME "gSettings.TimeSplits.Enable"
#define CVAR CVarGetInteger(CVAR_NAME, 0)
@@ -99,7 +101,8 @@ void HandlePopUpContext(uint32_t popupId) {
SplitsPushImageButtonStyle();
if (ImGui::ImageButton(
std::to_string(list).c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(GetItemImageById(list)),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(GetItemImageById(list)),
GetItemImageSizeById(list) * 1.5f, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
Ship_GetItemColorTint(list))) {
AddSplitEntryById(list);
@@ -123,15 +126,16 @@ void HandlePopUpContext(uint32_t popupId) {
void HandleDragAndDrop(size_t i) {
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) {
ImGui::SetDragDropPayload("SPLIT_DRAG", &i, sizeof(size_t));
- ImGui::ImageButton(std::to_string(splitList[i].splitId).c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageById(splitList[i].splitId)
- : gPauseUnusedCursorTex),
- splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageSizeById(splitList[i].splitId)
- : ImVec2(32.0f, 32.0f),
- ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
- splitList[i].splitType == SPLIT_TYPE_NORMAL ? Ship_GetItemColorTint(splitList[i].splitId)
- : ImVec4(1, 1, 1, 1));
+ ImGui::ImageButton(
+ std::to_string(splitList[i].splitId).c_str(),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageById(splitList[i].splitId)
+ : gPauseUnusedCursorTex),
+ splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageSizeById(splitList[i].splitId)
+ : ImVec2(32.0f, 32.0f),
+ ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
+ splitList[i].splitType == SPLIT_TYPE_NORMAL ? Ship_GetItemColorTint(splitList[i].splitId)
+ : ImVec4(1, 1, 1, 1));
ImGui::EndDragDropSource();
}
diff --git a/mm/2s2h/Enhancements/Trackers/TimeSplits/Timesplits.cpp b/mm/2s2h/Enhancements/Trackers/TimeSplits/Timesplits.cpp
index 53f3f7de5..a060c5549 100644
--- a/mm/2s2h/Enhancements/Trackers/TimeSplits/Timesplits.cpp
+++ b/mm/2s2h/Enhancements/Trackers/TimeSplits/Timesplits.cpp
@@ -15,6 +15,8 @@ uint64_t GetUnixTimestamp();
#include "assets/archives/icon_item_static/icon_item_static_yar.h"
#include "GameInteractor/GameInteractor.h"
+#include <fast/Fast3dGui.h>
+
#define BLANK_SPLIT "--:--:--.-"
// ImVec4 Colors
@@ -193,9 +195,11 @@ void DrawSplitsList(bool isMain) {
SplitsPushImageButtonStyle();
if (ImGui::ImageButton(
std::to_string(i).c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageById(splitList[i].splitId)
- : gPauseUnusedCursorTex),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(splitList[i].splitType == SPLIT_TYPE_NORMAL
+ ? GetItemImageById(splitList[i].splitId)
+ : gPauseUnusedCursorTex),
splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageSizeById(splitList[i].splitId)
: ImVec2(32.0f, 32.0f),
ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
diff --git a/mm/2s2h/Enhancements/Trackers/TimeSplits/TimesplitsSettings.cpp b/mm/2s2h/Enhancements/Trackers/TimeSplits/TimesplitsSettings.cpp
index 130de5c76..b1e19362c 100644
--- a/mm/2s2h/Enhancements/Trackers/TimeSplits/TimesplitsSettings.cpp
+++ b/mm/2s2h/Enhancements/Trackers/TimeSplits/TimesplitsSettings.cpp
@@ -18,6 +18,8 @@ extern "C" {
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "GameInteractor/GameInteractor.h"
+#include <fast/Fast3dGui.h>
+
IndexRangeObject sceneRange = { 0, 98 };
uint32_t sceneFilterIndex = 0;
@@ -558,10 +560,11 @@ void DrawEntranceList() {
ImGui::PushID(sceneObjectList[i].splitId);
SplitsPushImageButtonStyle();
- if (ImGui::ImageButton(
- std::to_string(sceneObjectList[i].splitId).c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(gPauseUnusedCursorTex),
- ImVec2(32.0f, 32.0f))) {
+ if (ImGui::ImageButton(std::to_string(sceneObjectList[i].splitId).c_str(),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(gPauseUnusedCursorTex),
+ ImVec2(32.0f, 32.0f))) {
AddSplitEntryBySceneId(sceneObjectList[i].splitId);
};
ImGui::SameLine();
@@ -583,11 +586,12 @@ void DrawItemList(const char* tableName, IndexRangeObject range, uint32_t tableS
for (int i = range.startIndex; i <= range.endIndex; i++) {
ImGui::TableNextColumn();
SplitsPushImageButtonStyle();
- if (ImGui::ImageButton(std::to_string(splitObjectList[i].splitId).c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- GetItemImageById(splitObjectList[i].splitId)),
- GetItemImageSizeById(splitObjectList[i].splitId) * 1.5f, ImVec2(0, 0), ImVec2(1, 1),
- ImVec4(0, 0, 0, 0), Ship_GetItemColorTint(splitObjectList[i].splitId))) {
+ if (ImGui::ImageButton(
+ std::to_string(splitObjectList[i].splitId).c_str(),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(GetItemImageById(splitObjectList[i].splitId)),
+ GetItemImageSizeById(splitObjectList[i].splitId) * 1.5f, ImVec2(0, 0), ImVec2(1, 1),
+ ImVec4(0, 0, 0, 0), Ship_GetItemColorTint(splitObjectList[i].splitId))) {
if (itemSubMenuList.contains(splitObjectList[i].splitId)) {
shouldPopUpOpen = true;
popupItem = splitObjectList[i].splitId;
@@ -645,9 +649,11 @@ void TimesplitsSettingsWindow::DrawElement() {
SplitsPushImageButtonStyle();
if (ImGui::ImageButton(
std::to_string(i).c_str(),
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageById(splitList[i].splitId)
- : gPauseUnusedCursorTex),
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(splitList[i].splitType == SPLIT_TYPE_NORMAL
+ ? GetItemImageById(splitList[i].splitId)
+ : gPauseUnusedCursorTex),
splitList[i].splitType == SPLIT_TYPE_NORMAL ? GetItemImageSizeById(splitList[i].splitId)
: ImVec2(32.0f, 32.0f),
ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0),
diff --git a/mm/2s2h/PresetManager/PresetManager.cpp b/mm/2s2h/PresetManager/PresetManager.cpp
index 0571655fe..12b74d8e3 100644
--- a/mm/2s2h/PresetManager/PresetManager.cpp
+++ b/mm/2s2h/PresetManager/PresetManager.cpp
@@ -675,7 +675,7 @@ void PresetManager_ApplyPreset(nlohmann::json j) {
}
}
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init("*");
Notification::Emit({ .message = "Preset Loaded" });
}
@@ -848,7 +848,7 @@ void PresetManager_Draw() {
}
void PresetManager_RegisterHooks() {
- Ship::Context::GetInstance()->GetFileDropMgr()->RegisterDropHandler(PresetManager_HandleFileDropped);
+ Ship::Context::GetRawInstance()->GetFileDropMgr()->RegisterDropHandler(PresetManager_HandleFileDropped);
PresetManager_RefreshPresets();
}
diff --git a/mm/2s2h/Rando/CheckTracker/CheckTracker.cpp b/mm/2s2h/Rando/CheckTracker/CheckTracker.cpp
index e9f63a95e..fc7bedf36 100644
--- a/mm/2s2h/Rando/CheckTracker/CheckTracker.cpp
+++ b/mm/2s2h/Rando/CheckTracker/CheckTracker.cpp
@@ -22,6 +22,8 @@ extern "C" {
s16 Play_GetOriginalSceneId(s16 sceneId);
}
+#include <fast/Fast3dGui.h>
+
namespace BenGui {
extern std::shared_ptr<Rando::CheckTracker::CheckTrackerWindow> mRandoCheckTrackerWindow;
}
@@ -163,7 +165,8 @@ std::string GetTotalCheckCount() {
void DrawCheckTypeIcon(RandoCheckId randoCheckId) {
RandoCheckType checkType = Rando::StaticData::Checks[randoCheckId].randoCheckType;
- ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(checkTypeIconList[checkType]),
+ ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(checkTypeIconList[checkType]),
checkType == RCTYPE_SONG ? ImVec2(12.0f * trackerScale, 18.0f * trackerScale)
: checkType == RCTYPE_OWL ? ImVec2(18.0f * trackerScale, 9.0f * trackerScale)
: ImVec2(18.0f * trackerScale, 18.0f * trackerScale),
@@ -570,9 +573,11 @@ void CheckTrackerWindow::Draw() {
ImGui::PushStyleColor(ImGuiCol_Button, buttonCol);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 1.0f, 1.0f, 0.2f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 1.0f, 1.0f, 0.1f));
- TexturePtr textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(
- randoCheckType == RCTYPE_UNKNOWN ? (const char*)gShootingGalleryOctorokCrossTex
- : checkTypeIconList[randoCheckType]);
+ TexturePtr textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(randoCheckType == RCTYPE_UNKNOWN
+ ? (const char*)gShootingGalleryOctorokCrossTex
+ : checkTypeIconList[randoCheckType]);
if (randoCheckType == RCTYPE_OWL) {
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 4.0f);
} else if (randoCheckType == RCTYPE_SONG) {
diff --git a/mm/2s2h/Rando/Menu.cpp b/mm/2s2h/Rando/Menu.cpp
index 2f5b43a09..af0b08561 100644
--- a/mm/2s2h/Rando/Menu.cpp
+++ b/mm/2s2h/Rando/Menu.cpp
@@ -14,6 +14,8 @@ extern "C" {
#include "overlays/actors/ovl_En_Sth/z_en_sth.h"
}
+#include <fast/Fast3dGui.h>
+
// TODO: This block should come from elsewhere, tied to data in Rando::StaticData::Options
std::unordered_map<int32_t, const char*> logicOptions = {
{ RO_LOGIC_GLITCHLESS, "Glitchless" },
@@ -156,7 +158,7 @@ void SaveExcludedChecks() {
excludedString += ",";
}
CVarSetString("gRando.ExcludedChecks", excludedString.c_str());
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init("gRando.ExcludedChecks");
}
@@ -610,7 +612,8 @@ static void DrawPriorityItemsPopup() {
ImGui::TableNextColumn();
const char* texturePath = Rando::StaticData::GetIconTexturePath(itemId);
ImTextureID textureId =
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(texturePath);
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(texturePath);
float iconOffsetY = (ImGui::GetFrameHeight() - PRIORITY_BUTTON_SIZE) * 0.5f;
if (iconOffsetY > 0.0f) {
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + iconOffsetY);
@@ -941,7 +944,9 @@ static void DrawStartingItemsTab() {
Rando::StaticData::RandoStaticItem randoStaticItem = Rando::StaticData::Items[startingItem];
const char* texturePath = Rando::StaticData::GetIconTexturePath(startingItem);
- ImTextureID textureId = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(texturePath);
+ ImTextureID textureId =
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(texturePath);
ImVec4 tintColor =
Ship_GetItemColorTint(startingItem == RI_PROGRESSIVE_LULLABY ? ITEM_SONG_LULLABY : randoStaticItem.itemId);
@@ -1006,8 +1011,9 @@ static void DrawStartingItemsTab() {
Rando::StaticData::RandoStaticItem randoStaticItem = Rando::StaticData::Items[item];
const char* texturePath = Rando::StaticData::GetIconTexturePath(item);
- ImTextureID textureId =
- Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(texturePath);
+ ImTextureID textureId = std::dynamic_pointer_cast<Fast::Fast3dGui>(
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->GetTextureByName(texturePath);
// Force new row for Song of Time, first frog, and first time item
if (item == RI_SONG_TIME || item == RI_FROG_BLUE || item == RI_TIME_DAY_1) {
diff --git a/mm/2s2h/Rando/MiscBehavior/SariasSongHint.cpp b/mm/2s2h/Rando/MiscBehavior/SariasSongHint.cpp
index 1271ce7f2..b7bc78773 100644
--- a/mm/2s2h/Rando/MiscBehavior/SariasSongHint.cpp
+++ b/mm/2s2h/Rando/MiscBehavior/SariasSongHint.cpp
@@ -72,7 +72,7 @@ void Rando::SetSariaPriorityItemsInSave(RandoSaveInfo& randoSaveInfo, std::vecto
}
std::vector<RandoItemId> Rando::GetSariaPriorityItemsFromConfig() {
- auto allConfig = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
+ auto allConfig = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
std::vector<RandoItemId> priorityItems = Rando::GetDefaultSariaPriorityItems();
if (allConfig.find("CVars") != allConfig.end() && allConfig["CVars"].is_object() &&
@@ -92,7 +92,7 @@ std::vector<RandoItemId> Rando::GetSariaPriorityItemsFromConfig() {
}
} else if (allConfig["CVars"]["gRando"]["SariaPriorityItems"].is_string()) {
CVarClear("gRando.SariaPriorityItems");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
} else if (allConfig["CVars"]["gRando"]["SariaPriorityItems"].is_null()) {
priorityItems.clear();
}
@@ -109,7 +109,7 @@ void Rando::SetSariaPriorityItemsInConfig(std::vector<RandoItemId>& priorityItem
}
}
// SetBlock() already persists to disk internally - no separate Save() call needed here.
- Ship::Context::GetInstance()->GetConfig()->SetBlock("CVars.gRando.SariaPriorityItems", priorityItemsJson);
+ Ship::Context::GetRawInstance()->GetConfig()->SetBlock("CVars.gRando.SariaPriorityItems", priorityItemsJson);
}
static bool IsExcludedFromSariaPriorityItemCandidates(RandoItemId randoItemId) {
diff --git a/mm/2s2h/Rando/Rando.cpp b/mm/2s2h/Rando/Rando.cpp
index 7accf5be5..1212f5cfe 100644
--- a/mm/2s2h/Rando/Rando.cpp
+++ b/mm/2s2h/Rando/Rando.cpp
@@ -26,7 +26,7 @@ void Rando::Init() {
Rando::MiscBehavior::Init();
Rando::ActorBehavior::Init();
Rando::CheckTracker::Init();
- Ship::Context::GetInstance()->GetFileDropMgr()->RegisterDropHandler(Rando::Spoiler::HandleFileDropped);
+ Ship::Context::GetRawInstance()->GetFileDropMgr()->RegisterDropHandler(Rando::Spoiler::HandleFileDropped);
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSaveLoad>(OnSaveLoadHandler);
}
diff --git a/mm/2s2h/Rando/StartingItems.cpp b/mm/2s2h/Rando/StartingItems.cpp
index 69b55a7c2..cf43e6f17 100644
--- a/mm/2s2h/Rando/StartingItems.cpp
+++ b/mm/2s2h/Rando/StartingItems.cpp
@@ -153,7 +153,7 @@ void SetStartingItemsInSave(RandoSaveInfo& randoSaveInfo, std::vector<RandoItemI
}
std::vector<RandoItemId> GetStartingItemsFromConfig() {
- auto allConfig = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
+ auto allConfig = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
std::vector<RandoItemId> startingItems = { RI_PROGRESSIVE_SWORD, RI_SHIELD_HERO, RI_OCARINA, RI_SONG_TIME };
// Verify that the config has CVars.gRando.StartingItems and its an array
@@ -173,7 +173,7 @@ std::vector<RandoItemId> GetStartingItemsFromConfig() {
}
} else if (allConfig["CVars"]["gRando"]["StartingItems"].is_string()) {
CVarClear("gRando.StartingItems");
- Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
+ Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
} else if (allConfig["CVars"]["gRando"]["StartingItems"].is_null()) {
startingItems.clear();
}
@@ -189,8 +189,8 @@ void SetStartingItemsInConfig(std::vector<RandoItemId>& startingItems) {
startingItemsJson.push_back(Rando::StaticData::Items[randoItemId].spoilerName);
}
}
- Ship::Context::GetInstance()->GetConfig()->SetBlock("CVars.gRando.StartingItems", startingItemsJson);
- Ship::Context::GetInstance()->GetConfig()->Save();
+ Ship::Context::GetRawInstance()->GetConfig()->SetBlock("CVars.gRando.StartingItems", startingItemsJson);
+ Ship::Context::GetRawInstance()->GetConfig()->Save();
}
} // namespace Rando
diff --git a/mm/2s2h/ShipUtils.cpp b/mm/2s2h/ShipUtils.cpp
index c92d2b9b8..b6d1cd2b9 100644
--- a/mm/2s2h/ShipUtils.cpp
+++ b/mm/2s2h/ShipUtils.cpp
@@ -17,6 +17,8 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/overlays/ovl_En_Syateki_Okuta/ovl_En_Syateki_Okuta.h"
+#include <fast/Fast3dGui.h>
+
extern "C" {
#include "z64.h"
#include "functions.h"
@@ -348,21 +350,26 @@ extern uint32_t Ship_Hash(std::string str) {
void LoadGuiTextures() {
for (const TexturePtr entry : gItemIcons) {
auto path = static_cast<const char*>(entry);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(path, path, ImVec4(1, 1, 1, 1));
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadGuiTexture(path, path, ImVec4(1, 1, 1, 1));
}
for (const TexturePtr entry : gQuestIcons) {
auto path = static_cast<const char*>(entry);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(path, path, ImVec4(1, 1, 1, 1));
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadGuiTexture(path, path, ImVec4(1, 1, 1, 1));
}
for (const TexturePtr entry : gBombersNotebookPhotos) {
auto path = static_cast<const char*>(entry);
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(path, path, ImVec4(1, 1, 1, 1));
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadGuiTexture(path, path, ImVec4(1, 1, 1, 1));
}
for (const auto entry : miscellaneousTextures) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry, entry, ImVec4(1, 1, 1, 1));
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadGuiTexture(entry, entry, ImVec4(1, 1, 1, 1));
}
for (const auto entry : digitList) {
- Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry, entry, ImVec4(1, 1, 1, 1));
+ std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
+ ->LoadGuiTexture(entry, entry, ImVec4(1, 1, 1, 1));
}
}
diff --git a/mm/2s2h/config/ConfigUpdaters.cpp b/mm/2s2h/config/ConfigUpdaters.cpp
index b02e0f73f..6bad54953 100644
--- a/mm/2s2h/config/ConfigUpdaters.cpp
+++ b/mm/2s2h/config/ConfigUpdaters.cpp
@@ -68,7 +68,7 @@ static void MigrateWarpPoints(Ship::Config* conf) {
{ "rotY", rotY },
{ "bootToPoint", bootToPoint } };
- Ship::Context::GetInstance()->GetConfig()->SetBlock("WarpPoints", warpPoints);
+ Ship::Context::GetRawInstance()->GetConfig()->SetBlock("WarpPoints", warpPoints);
}
}
}
diff --git a/mm/2s2h/resource/importer/AnimationFactory.cpp b/mm/2s2h/resource/importer/AnimationFactory.cpp
index 5f6d2e3b4..7ae6a16a4 100644
--- a/mm/2s2h/resource/importer/AnimationFactory.cpp
+++ b/mm/2s2h/resource/importer/AnimationFactory.cpp
@@ -89,17 +89,17 @@ ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr<Ship::File> file,
// Read the segment pointer (always 32 bit, doesn't adjust for system pointer size)
std::string path = reader->ReadString();
auto animData = std::static_pointer_cast<Animation>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path.c_str()));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(path.c_str()));
// If direct load failed and alt assets are enabled, try with alt/ prefix
- if (animData == nullptr && Ship::Context::GetInstance()->GetResourceManager()->IsAltAssetsEnabled()) {
+ if (animData == nullptr && Ship::Context::GetRawInstance()->GetResourceManager()->IsAltAssetsEnabled()) {
std::string altPath = path;
if (altPath.find("__OTR__") == 0) {
altPath = altPath.substr(7); // Strip __OTR__
}
altPath = "alt/" + altPath;
animData = std::static_pointer_cast<Animation>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(altPath.c_str()));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(altPath.c_str()));
}
if (animData != nullptr) {
diff --git a/mm/2s2h/resource/importer/AudioSampleFactory.cpp b/mm/2s2h/resource/importer/AudioSampleFactory.cpp
index 2263dced2..8948a6793 100644
--- a/mm/2s2h/resource/importer/AudioSampleFactory.cpp
+++ b/mm/2s2h/resource/importer/AudioSampleFactory.cpp
@@ -291,7 +291,7 @@ ResourceFactoryXMLAudioSampleV0::ReadResource(std::shared_ptr<Ship::File> file,
const char* path = child->Attribute("Path");
- auto sampleFile = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFile(path);
+ auto sampleFile = Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->LoadFile(path);
audioSample->sample.fileSize = sampleFile->Buffer.get()->size();
if (customFormatStr != nullptr) {
// Compressed files can take a really long time to decode (~250ms per).
diff --git a/mm/2s2h/resource/importer/AudioSequenceFactory.cpp b/mm/2s2h/resource/importer/AudioSequenceFactory.cpp
index d036106f2..8db7faa71 100644
--- a/mm/2s2h/resource/importer/AudioSequenceFactory.cpp
+++ b/mm/2s2h/resource/importer/AudioSequenceFactory.cpp
@@ -341,7 +341,7 @@ ResourceFactoryXMLAudioSequenceV0::ReadResource(std::shared_ptr<Ship::File> file
const char* path = child->Attribute("Path");
std::shared_ptr<Ship::File> seqFile;
if (path != nullptr) {
- seqFile = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFile(path);
+ seqFile = Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->LoadFile(path);
}
if (!streamed) {
diff --git a/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp b/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp
index 0dd6db9f0..71e01f65d 100644
--- a/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp
+++ b/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp
@@ -65,7 +65,8 @@ ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<Ship::File>
if (sampleFileName.empty()) {
drum->sound.sample = nullptr;
} else {
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
+ auto res =
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
drum->sound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
}
@@ -109,7 +110,8 @@ ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<Ship::File>
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
instrument->lowNotesSound.tuning = reader->ReadFloat();
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
+ auto res =
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument->lowNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} else {
instrument->lowNotesSound.sample = nullptr;
@@ -122,7 +124,8 @@ ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<Ship::File>
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
instrument->normalNotesSound.tuning = reader->ReadFloat();
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
+ auto res =
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument->normalNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} else {
instrument->normalNotesSound.sample = nullptr;
@@ -134,7 +137,8 @@ ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<Ship::File>
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
instrument->highNotesSound.tuning = reader->ReadFloat();
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
+ auto res =
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument->highNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} else {
instrument->highNotesSound.sample = nullptr;
@@ -161,7 +165,8 @@ ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<Ship::File>
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
soundEffect.tuning = reader->ReadFloat();
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
+ auto res =
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
soundEffect.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
}
@@ -234,7 +239,7 @@ void ResourceFactoryXMLSoundFontV0::ParseDrums(AudioSoundFont* soundFont, tinyxm
const char* sampleStr = element->Attribute("SampleRef");
if (sampleStr != nullptr && sampleStr[0] != 0) {
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleStr);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleStr);
drum->sound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
} else {
drum->sound.sample = nullptr;
@@ -310,7 +315,7 @@ void ResourceFactoryXMLSoundFontV0::ParseInstruments(AudioSoundFont* soundFont,
const char* sampleStr = instrumentElement->Attribute("SampleRef");
if (sampleStr != nullptr && sampleStr[0] != 0) {
std::shared_ptr<SOH::AudioSample> res = static_pointer_cast<SOH::AudioSample>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
if (res->tuning != -1.0f) {
instrument->lowNotesSound.tuning = res->tuning;
}
@@ -324,7 +329,7 @@ void ResourceFactoryXMLSoundFontV0::ParseInstruments(AudioSoundFont* soundFont,
const char* sampleStr = instrumentElement->Attribute("SampleRef");
if (sampleStr != nullptr && sampleStr[0] != 0) {
std::shared_ptr<SOH::AudioSample> res = static_pointer_cast<SOH::AudioSample>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
if (res->tuning != -1.0f) {
instrument->normalNotesSound.tuning = res->tuning;
}
@@ -338,7 +343,7 @@ void ResourceFactoryXMLSoundFontV0::ParseInstruments(AudioSoundFont* soundFont,
const char* sampleStr = instrumentElement->Attribute("SampleRef");
if (sampleStr != nullptr && sampleStr[0] != 0) {
std::shared_ptr<SOH::AudioSample> res = static_pointer_cast<SOH::AudioSample>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
if (res->tuning != -1.0f) {
instrument->highNotesSound.tuning = res->tuning;
}
@@ -378,7 +383,7 @@ void ResourceFactoryXMLSoundFontV0::ParseSfxTable(AudioSoundFont* soundFont, tin
sound.tuning = element->FloatAttribute("Tuning");
if (sampleStr[0] != 0) {
auto res = static_pointer_cast<SOH::AudioSample>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(sampleStr));
if (res->tuning != -1.0f) {
sound.tuning = res->tuning;
}
@@ -433,7 +438,7 @@ ResourceFactoryXMLSoundFontV0::ReadResource(std::shared_ptr<Ship::File> file,
std::string origName = "audio/fonts/";
origName += patch;
audioSoundFont = dynamic_pointer_cast<AudioSoundFont>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(origName));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(origName));
} else {
audioSoundFont = std::make_shared<AudioSoundFont>(initData);
memset(&audioSoundFont->soundFont, 0, sizeof(audioSoundFont->soundFont));
diff --git a/mm/2s2h/resource/importer/KeyFrameFactory.cpp b/mm/2s2h/resource/importer/KeyFrameFactory.cpp
index b0ac93ffb..3beb64000 100644
--- a/mm/2s2h/resource/importer/KeyFrameFactory.cpp
+++ b/mm/2s2h/resource/importer/KeyFrameFactory.cpp
@@ -24,7 +24,7 @@ ResourceFactoryBinaryKeyFrameSkel::ReadResource(std::shared_ptr<Ship::File> file
for (uint32_t i = 0; i < numLimbs; i++) {
std::string dlStr = reader->ReadString();
- auto dl = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(dlStr.c_str());
+ auto dl = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(dlStr.c_str());
limbs[i].dList = nullptr;
if (dl != nullptr) {
limbs[i].dList = dl->GetRawPointer();
@@ -41,7 +41,7 @@ ResourceFactoryBinaryKeyFrameSkel::ReadResource(std::shared_ptr<Ship::File> file
for (uint32_t i = 0; i < numLimbs; i++) {
std::string dlStr = reader->ReadString();
- auto dl = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(dlStr.c_str());
+ auto dl = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(dlStr.c_str());
limbs[i].dList = nullptr;
if (dl != nullptr) {
limbs[i].dList = dl->GetRawPointer();
diff --git a/mm/2s2h/resource/importer/SkeletonFactory.cpp b/mm/2s2h/resource/importer/SkeletonFactory.cpp
index a14e50988..647f28c82 100644
--- a/mm/2s2h/resource/importer/SkeletonFactory.cpp
+++ b/mm/2s2h/resource/importer/SkeletonFactory.cpp
@@ -57,7 +57,7 @@ ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr<Ship::File> file,
for (size_t i = 0; i < skeleton->limbTable.size(); i++) {
std::string limbStr = skeleton->limbTable[i];
- auto limb = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str());
+ auto limb = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str());
skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr);
}
@@ -117,7 +117,7 @@ ResourceFactoryXMLSkeletonV0::ReadResource(std::shared_ptr<Ship::File> file,
std::string limbName = child->Attribute("Path");
skel->limbTable.push_back(limbName);
- auto limb = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str());
+ auto limb = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str());
skel->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr);
}
diff --git a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp
index 0a9e5ade4..8abd5b651 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp
@@ -17,7 +17,7 @@ SetAlternateHeadersFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData>
auto headerName = reader->ReadString();
if (!headerName.empty()) {
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Scene>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
} else {
setAlternateHeaders->headers.push_back(nullptr);
}
diff --git a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp
index 5ccbfc5bc..9e7df4376 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp
@@ -15,7 +15,7 @@ SetAnimatedMaterialListFactory::ReadResource(std::shared_ptr<Ship::ResourceInitD
std::string str = reader->ReadString();
const auto data = std::static_pointer_cast<TextureAnimation>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(str.c_str()));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(str.c_str()));
AnimatedMaterial* res = data->GetPointer();
setAnimatedMat->mat = res;
diff --git a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp
index bc85af445..ef876ab3b 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp
@@ -13,7 +13,8 @@ SetCollisionHeaderFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData>
setCollisionHeader->fileName = reader->ReadString();
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str()));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(
+ setCollisionHeader->fileName.c_str()));
return setCollisionHeader;
}
diff --git a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp
index d308fe95a..c38767088 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp
@@ -20,7 +20,7 @@ std::shared_ptr<Ship::IResource> SetCutsceneFactoryMM::ReadResource(std::shared_
entry.entrance = reader->ReadUByte();
entry.flag = reader->ReadUByte();
entry.data = std::static_pointer_cast<Cutscene>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path.c_str()))
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(path.c_str()))
->GetPointer();
setCutscenes->entries.emplace_back(entry);
}
diff --git a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp
index 8aac0b133..100027042 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp
@@ -15,7 +15,7 @@ std::shared_ptr<Ship::IResource> SetPathwaysMMFactory::ReadResource(std::shared_
for (uint32_t i = 0; i < setPathways->numPaths; i++) {
std::string pathFileName = reader->ReadString();
auto path = std::static_pointer_cast<PathMM>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()));
setPathways->paths.push_back(path->GetPointer());
}
return setPathways;
diff --git a/mm/2s2h/resource/type/Skeleton.cpp b/mm/2s2h/resource/type/Skeleton.cpp
index 8a25c3e4b..594011fd4 100644
--- a/mm/2s2h/resource/type/Skeleton.cpp
+++ b/mm/2s2h/resource/type/Skeleton.cpp
@@ -69,7 +69,7 @@ void SkeletonPatcher::ClearSkeletons() {
}
void SkeletonPatcher::UpdateSkeletons() {
- auto resourceMgr = Ship::Context::GetInstance()->GetResourceManager();
+ auto resourceMgr = Ship::Context::GetRawInstance()->GetResourceManager();
bool isAlt = resourceMgr->IsAltAssetsEnabled();
for (const auto& skel : skeletons) {
diff --git a/mm/2s2h/z_message_OTR.cpp b/mm/2s2h/z_message_OTR.cpp
index 2d9a63e15..9ae01ec93 100644
--- a/mm/2s2h/z_message_OTR.cpp
+++ b/mm/2s2h/z_message_OTR.cpp
@@ -10,7 +10,7 @@ extern "C" MessageTableEntry* sMessageTableCredits;
MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) {
auto file = std::static_pointer_cast<SOH::TextMM>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(filePath));
if (file == nullptr)
return nullptr;
@@ -53,8 +53,9 @@ MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) {
extern "C" void OTRMessage_Init() {
sMessageTableNES = OTRMessage_LoadTable("text/message_data_static/message_data_static", true);
- auto file2 = std::static_pointer_cast<SOH::TextMM>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(
- "text/staff_message_data_static/staff_message_data_static"));
+ auto file2 =
+ std::static_pointer_cast<SOH::TextMM>(Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(
+ "text/staff_message_data_static/staff_message_data_static"));
sMessageTableCredits = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file2->messages.size());
for (size_t i = 0; i < file2->messages.size(); i++) {
diff --git a/mm/2s2h/z_play_2SH.cpp b/mm/2s2h/z_play_2SH.cpp
index eec1b9b31..26d8ab878 100644
--- a/mm/2s2h/z_play_2SH.cpp
+++ b/mm/2s2h/z_play_2SH.cpp
@@ -10,7 +10,7 @@ extern uintptr_t gSegments[NUM_SEGMENTS];
}
Ship::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName) {
- auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fileName);
+ auto res = Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(fileName);
return res.get();
}