Move to port-maintainance LUS branch to fix crash on close (#6629)

This commit is contained in:
Pepper0ni
2026-06-06 22:30:55 +01:00
committed by GitHub
parent d4d88de827
commit 8a14cd1096
63 changed files with 495 additions and 447 deletions
+1
View File
@@ -1,6 +1,7 @@
[submodule "libultraship"]
path = libultraship
url = https://github.com/kenix3/libultraship.git
branch = port-maintenance
[submodule "ZAPDTR"]
path = ZAPDTR
url = https://github.com/harbourmasters/ZAPDTR
@@ -65,7 +65,7 @@ static void DeleteFileOnDeath() {
SaveManager::Instance->DeleteZeldaFile(gSaveContext.fileNum);
hasAffectedHealth = false;
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
}
}
@@ -84,7 +84,7 @@ void SohFileSelect_ShowPresetModal() {
return;
}
std::shared_ptr<SohModalWindow> modal = static_pointer_cast<SohModalWindow>(
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Modal Window"));
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Modal Window"));
if (modal->IsPopupOpen("Take a look at our presets!")) {
modal->DismissPopup();
} else {
+2 -2
View File
@@ -104,12 +104,12 @@ void Lang::LoadLangs() {
initData->Type = static_cast<uint32_t>(Ship::ResourceType::Json);
initData->ResourceVersion = 0;
const static std::string folder = "lang/*";
auto langFiles = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folder);
auto langFiles = Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folder);
size_t start = std::string(folder).size() - 1;
for (size_t i = 0; i < langFiles->size(); i++) {
std::string filePath = langFiles->at(i);
auto json = std::static_pointer_cast<Ship::Json>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath, true, initData));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(filePath, true, initData));
std::string fileName = filePath.substr(start, filePath.size() - start - 5); // 5 for length of ".json"
langs.insert_or_assign(fileName, json->Data);
+10 -10
View File
@@ -110,7 +110,7 @@ void applyPreset(std::string presetName, std::vector<PresetSection> includeSecti
} else {
auto block = item.value();
if (sectionStrategy == "merge") {
auto currentJson = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
auto currentJson = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
if (currentJson.contains("CVars") && currentJson["CVars"].contains(item.key())) {
block = currentJson["CVars"][item.key()];
// Recursively merge the two json objects
@@ -118,9 +118,9 @@ void applyPreset(std::string presetName, std::vector<PresetSection> includeSecti
}
}
Ship::Context::GetInstance()->GetConfig()->SetBlock(fmt::format("{}.{}", "CVars", item.key()),
block);
Ship::Context::GetInstance()->GetConsoleVariables()->Load();
Ship::Context::GetRawInstance()->GetConfig()->SetBlock(fmt::format("{}.{}", "CVars", item.key()),
block);
Ship::Context::GetRawInstance()->GetConsoleVariables()->Load();
}
}
if (i == PRESET_SECTION_RANDOMIZER) {
@@ -162,7 +162,7 @@ void DrawPresetSelector(std::vector<PresetSection> includeSections, std::string
if (ImGui::Selectable(iter->c_str(), *iter == currentIndex)) {
CVarSetString(selectorCvar.c_str(), iter->c_str());
currentIndex = *iter;
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
@@ -237,12 +237,12 @@ void LoadPresets() {
initData->Type = static_cast<uint32_t>(Ship::ResourceType::Json);
initData->ResourceVersion = 0;
std::string folder = "presets/*";
auto builtIns = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folder);
auto builtIns = Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folder);
size_t start = std::string(folder).size() - 1;
for (size_t i = 0; i < builtIns->size(); i++) {
std::string filePath = builtIns->at(i);
auto json = std::static_pointer_cast<Ship::Json>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath, true, initData));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(filePath, true, initData));
std::string fileName = filePath.substr(start, filePath.size() - start - 5); // 5 for length of ".json"
ParsePreset(json->Data, fileName);
@@ -256,7 +256,7 @@ void SavePreset(std::string& presetName) {
presets[presetName].presetValues["presetName"] = presetName;
presets[presetName].presetValues["fileType"] = FILE_TYPE_PRESET;
std::ofstream file(
fmt::format("{}/{}.json", Ship::Context::GetInstance()->LocateFileAcrossAppDirs("presets"), presetName));
fmt::format("{}/{}.json", Ship::Context::GetRawInstance()->LocateFileAcrossAppDirs("presets"), presetName));
file << presets[presetName].presetValues.dump(4);
file.close();
LoadPresets();
@@ -296,7 +296,7 @@ void DrawNewPresetPopup() {
.Padding({ 6.0f, 6.0f })
.Color(THEME_COLOR))) {
presets[newPresetName] = {};
auto config = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
auto config = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) {
if (saveSection[i]) {
for (size_t j = 0; j < blockInfo[i].sections.size(); j++) {
@@ -462,7 +462,7 @@ void RegisterPresetsWidgets() {
SohGui::mSohMenu->AddWidget(path, "PresetsWidget", WIDGET_CUSTOM)
.CustomFunction(PresetsCustomWidget)
.HideInSearch(true);
presetFolder = Ship::Context::GetInstance()->GetPathRelativeToAppDirectory("presets");
presetFolder = Ship::Context::GetRawInstance()->GetPathRelativeToAppDirectory("presets");
std::fill_n(saveSection, PRESET_SECTION_MAX, true);
LoadPresets();
}
+1 -1
View File
@@ -22,7 +22,7 @@ static void OnGameStateMainStartResetHotkey() {
CHECK_BTN_ALL(gGameState->input[0].cur.button, mask)) {
auto consoleWin = std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"));
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"));
if (consoleWin) {
consoleWin->Dispatch("reset");
@@ -29,8 +29,10 @@ CollisionHeader* getGraveyardCollisionHeader() {
* dspot02_sceneCollisionHeader_003C54. We have to scroll through the scene cmds to get the header the same way the
* game does.
*/
SOH::Scene* scene =
(SOH::Scene*)Ship::Context::GetInstance()->GetResourceManager()->LoadResource(GRAVEYARD_SCENE_FILEPATH).get();
SOH::Scene* scene = (SOH::Scene*)Ship::Context::GetRawInstance()
->GetResourceManager()
->LoadResource(GRAVEYARD_SCENE_FILEPATH)
.get();
SOH::SetCollisionHeader* sceneCmd = nullptr;
for (size_t i = 0; i < scene->commands.size(); i++) {
auto cmd = scene->commands[i];
@@ -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());
@@ -8,6 +8,8 @@
#include <fast/Fast3dGui.h>
#include <fast/Fast3dGui.h>
extern "C" {
#include "macros.h"
#include "functions.h"
@@ -86,18 +88,21 @@ static void TimeDisplayGetTimer(uint32_t timeID) {
uint32_t timer1 = gSaveContext.timerSeconds;
auto gui = std::dynamic_pointer_cast<Fast::Fast3dGui>(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui()));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui()));
switch (timeID) {
case DISPLAY_IN_GAME_TIMER:
textureDisplay = gui->GetTextureByName("GAMEPLAY_TIMER");
textureDisplay = gui->GetTextureByName("GAMEPLAY_TIMER");
timeDisplayTime = formatTimeDisplay(GAMEPLAYSTAT_TOTAL_TIME).c_str();
break;
case DISPLAY_TIME_OF_DAY:
if (gSaveContext.dayTime >= DAY_BEGINS && gSaveContext.dayTime < NIGHT_BEGINS) {
textureDisplay = gui->GetTextureByName("DAY_TIME_TIMER");
textureDisplay = gui->GetTextureByName("DAY_TIME_TIMER");
} else {
textureDisplay = gui->GetTextureByName("NIGHT_TIME_TIMER");
textureDisplay = gui->GetTextureByName("NIGHT_TIME_TIMER");
}
timeDisplayTime = convertDayTime(gSaveContext.dayTime).c_str();
break;
@@ -114,11 +119,17 @@ static void TimeDisplayGetTimer(uint32_t timeID) {
gui->GetTextureByName(gPlayState->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3
? itemMapping[ITEM_TUNIC_GORON].name
: itemMapping[ITEM_TUNIC_ZORA].name);
textureDisplay =
gui->GetTextureByName(gPlayState->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3
? itemMapping[ITEM_TUNIC_GORON].name
: itemMapping[ITEM_TUNIC_ZORA].name);
}
if (gSaveContext.timerState >= TIMER_STATE_DOWN_PREVIEW) {
textureDisplay = gui->GetTextureByName(itemMapping[ITEM_SWORD_MASTER].name);
textureDisplay = gui->GetTextureByName(itemMapping[ITEM_SWORD_MASTER].name);
}
} else {
textureDisplay = gui->GetTextureByName(itemMapping[ITEM_TUNIC_KOKIRI].name);
textureDisplay = gui->GetTextureByName(itemMapping[ITEM_TUNIC_KOKIRI].name);
timeDisplayTime = "-:--";
}
@@ -134,6 +145,7 @@ static void TimeDisplayGetTimer(uint32_t timeID) {
textColor = COLOR_GREY;
}
textureDisplay = gui->GetTextureByName("NAVI_TIMER");
textureDisplay = gui->GetTextureByName("NAVI_TIMER");
break;
default:
break;
@@ -205,13 +217,13 @@ void TimeDisplayWindow::Draw() {
if (textToDecode[i] == '.') {
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (8.0f * fontScale));
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(
Ship::Context::GetInstance()->GetWindow()->GetGui())
Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(digitList[textureIndex].first),
ImVec2(8.0f * fontScale, 8.0f * fontScale), ImVec2(0, 0.5f), ImVec2(1, 1),
textColor, ImVec4(0, 0, 0, 0));
} else {
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(
Ship::Context::GetInstance()->GetWindow()->GetGui())
Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(digitList[textureIndex].first),
ImVec2(8.0f * fontScale, 16.0f * fontScale), ImVec2(0, 0), ImVec2(1, 1), textColor,
ImVec4(0, 0, 0, 0));
@@ -250,17 +262,17 @@ static void TimeDisplayInitTimers() {
}
void TimeDisplayWindow::InitElement() {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("GAMEPLAY_TIMER", gClockIconTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("DAY_TIME_TIMER", gSunIconTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("NIGHT_TIME_TIMER", gMoonIconTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("NAVI_TIMER", gNaviIconTex, ImVec4(1, 1, 1, 1));
for (auto& load : digitList) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(load.first.c_str(), load.second, ImVec4(1, 1, 1, 1));
}
+4 -4
View File
@@ -30,7 +30,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(WarpPoint, entranceId, roomNum, pos, rotY, bo
std::map<std::string, WarpPoint> warpPoints;
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();
}
@@ -38,10 +38,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) {
@@ -399,7 +399,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) {
@@ -407,7 +407,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() {
+15 -15
View File
@@ -264,7 +264,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
auto currentBGM = func_800FA0B4(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();
@@ -276,7 +276,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
auto currentBGM = func_800FA0B4(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();
@@ -288,7 +288,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
auto currentBGM = func_800FA0B4(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();
@@ -300,7 +300,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
auto currentBGM = func_800FA0B4(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();
@@ -361,7 +361,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
if (ImGui::Selectable(seqData.label.c_str())) {
CVarSetInteger(cvarKey.c_str(), value);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
UpdateCurrentBGM(defaultValue, type);
}
@@ -388,7 +388,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
.Color(THEME_COLOR))) {
CVarClear(cvarKey.c_str());
CVarClear(cvarLockKey.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
UpdateCurrentBGM(defaultValue, seqData.category);
}
ImGui::SameLine();
@@ -412,7 +412,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
if (locked) {
CVarClear(cvarLockKey.c_str());
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
UpdateCurrentBGM(defaultValue, type);
}
}
@@ -429,7 +429,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN
} else {
CVarSetInteger(cvarLockKey.c_str(), 1);
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
ImGui::EndTable();
@@ -816,7 +816,7 @@ void AudioEditor_RandomizeAll() {
RandomizeGroup(type);
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ReplayCurrentBGM();
}
@@ -825,14 +825,14 @@ void AudioEditor_AutoRandomizeAll() {
RandomizeGroup(type, false);
}
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();
}
@@ -841,14 +841,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();
}
@@ -857,7 +857,7 @@ void AudioEditor_LockAll() {
LockGroup(AudioCollection::Instance->GetAllSequences(), type);
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void AudioEditor_UnlockAll() {
@@ -865,7 +865,7 @@ void AudioEditor_UnlockAll() {
UnlockGroup(AudioCollection::Instance->GetAllSequences(), type);
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void RegisterAudioWidgets() {
+50 -47
View File
@@ -15,6 +15,8 @@
#include <fast/Fast3dGui.h>
#include <fast/Fast3dGui.h>
using namespace UIWidgets;
// Text colors
@@ -49,7 +51,7 @@ 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(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(btnOutlineTexture),
size, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -57,7 +59,7 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex
if (state) {
ImGui::SetCursorPos(pos);
ImGui::SetNextItemAllowOverlap();
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(btnTexture),
size, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -76,79 +78,79 @@ void InputViewer::DrawElement() {
if (CVarGetInteger(CVAR_WINDOW("InputViewer"), 0)) {
static bool sButtonTexturesLoaded = false;
if (!sButtonTexturesLoaded) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
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::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadTextureFromRawImage("Right-Stick Outline", "textures/buttons/RightStickOutline.png");
sButtonTexturesLoaded = true;
}
@@ -166,8 +168,9 @@ void InputViewer::DrawElement() {
CVarGetInteger(CVAR_INPUT_VIEWER("ButtonOutlineMode"), BUTTON_OUTLINE_NOT_PRESSED);
const bool useGlobalOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("UseGlobalButtonOutlineMode"), 1);
ImVec2 bgSize = std::dynamic_pointer_cast<Fast::Fast3dGui>(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);
ImGui::SetNextWindowSize(
@@ -186,7 +189,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();
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar |
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground |
@@ -204,7 +207,7 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
// Background
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("Input-Viewer-Background"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -356,7 +359,7 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos);
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("Analog-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -369,7 +372,7 @@ void InputViewer::DrawElement() {
ImVec2(aPos.x + maxStickDistance * ((float)(pads[0].stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxStickDistance * ((float)(pads[0].stick_y) / MAX_AXIS_RANGE) * scale));
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("Analog-Stick"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -383,7 +386,7 @@ void InputViewer::DrawElement() {
ImGui::SetNextItemAllowOverlap();
ImGui::SetCursorPos(aPos);
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("Right-Stick Outline"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -396,7 +399,7 @@ void InputViewer::DrawElement() {
ImVec2(aPos.x + maxRightStickDistance * ((float)(pads[0].right_stick_x) / MAX_AXIS_RANGE) * scale,
aPos.y - maxRightStickDistance * ((float)(pads[0].right_stick_y) / MAX_AXIS_RANGE) * scale));
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("Right-Stick"),
scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f));
}
@@ -77,7 +77,7 @@ void SohInputEditorWindow::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;
@@ -89,24 +89,24 @@ void SohInputEditorWindow::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();
}
}
@@ -245,7 +245,7 @@ void SohInputEditorWindow::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)
@@ -258,7 +258,7 @@ void SohInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, N64Butto
}
void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64ButtonMask bitmask, std::string id) {
auto mapping = Ship::Context::GetInstance()
auto mapping = Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetButton(bitmask)
@@ -308,7 +308,7 @@ void SohInputEditorWindow::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)
@@ -348,7 +348,7 @@ void SohInputEditorWindow::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.");
auto globalSettings = Ship::Context::GetInstance()->GetControlDeck()->GetGlobalSDLDeviceSettings();
auto globalSettings = Ship::Context::GetRawInstance()->GetControlDeck()->GetGlobalSDLDeviceSettings();
if (sdlAxisDirectionToButtonMapping->AxisIsStick()) {
ImGui::Text("Stick axis threshold:");
@@ -443,7 +443,7 @@ void SohInputEditorWindow::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)
@@ -489,7 +489,7 @@ void SohInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port,
}
if (stick == Ship::LEFT) {
if (mMappingInputBlockTimer == INT32_MAX &&
Ship::Context::GetInstance()
Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLeftStick()
@@ -499,7 +499,7 @@ void SohInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port,
}
} else {
if (mMappingInputBlockTimer == INT32_MAX &&
Ship::Context::GetInstance()
Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRightStick()
@@ -515,13 +515,13 @@ void SohInputEditorWindow::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()
@@ -576,7 +576,7 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port,
if (stick == Ship::LEFT) {
if (mMappingInputBlockTimer == INT32_MAX &&
Ship::Context::GetInstance()
Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLeftStick()
@@ -586,7 +586,7 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port,
}
} else {
if (mMappingInputBlockTimer == INT32_MAX &&
Ship::Context::GetInstance()
Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRightStick()
@@ -606,13 +606,13 @@ void SohInputEditorWindow::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()
@@ -646,9 +646,9 @@ void SohInputEditorWindow::DrawStickSection(uint8_t port, uint8_t stick, int32_t
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", id).c_str(), ImVec2(sX, sY));
@@ -790,7 +790,7 @@ void SohInputEditorWindow::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
@@ -806,10 +806,11 @@ void SohInputEditorWindow::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
@@ -829,7 +830,8 @@ void SohInputEditorWindow::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();
}
@@ -852,7 +854,7 @@ void SohInputEditorWindow::DrawAddRumbleMappingButton(uint8_t port) {
ImGui::CloseCurrentPopup();
}
if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRumble()
@@ -869,7 +871,7 @@ bool SohInputEditorWindow::TestingRumble() {
}
void SohInputEditorWindow::DrawRumbleSection(uint8_t port) {
for (auto [id, mapping] : Ship::Context::GetInstance()
for (auto [id, mapping] : Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetRumble()
@@ -1012,7 +1014,7 @@ void SohInputEditorWindow::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();
}
@@ -1035,7 +1037,7 @@ void SohInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) {
ImGui::CloseCurrentPopup();
}
if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetLED()
@@ -1049,7 +1051,7 @@ void SohInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) {
void SohInputEditorWindow::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(
@@ -1105,7 +1107,7 @@ void SohInputEditorWindow::DrawLEDSection(uint8_t port) {
color.b = colorVec.z * 255.0;
CVarSetColor24(CVAR_SETTING("LEDPort1Color"), color);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
ImGui::Text("Custom Color");
@@ -1141,7 +1143,7 @@ void SohInputEditorWindow::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();
}
@@ -1164,7 +1166,7 @@ void SohInputEditorWindow::DrawAddGyroMappingButton(uint8_t port) {
ImGui::CloseCurrentPopup();
}
if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance()
if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetRawInstance()
->GetControlDeck()
->GetControllerByPort(port)
->GetGyro()
@@ -1178,7 +1180,7 @@ void SohInputEditorWindow::DrawAddGyroMappingButton(uint8_t port) {
void SohInputEditorWindow::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();
@@ -1322,7 +1324,7 @@ void SohInputEditorWindow::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();
@@ -1409,7 +1411,7 @@ void SohInputEditorWindow::DrawCameraControlPanel() {
if (!CVarGetInteger(CVAR_SETTING("FirstPersonCameraSensitivity.Enabled"), 0)) {
CVarClear(CVAR_SETTING("FirstPersonCameraSensitivity.X"));
CVarClear(CVAR_SETTING("FirstPersonCameraSensitivity.Y"));
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
if (CVarGetInteger(CVAR_SETTING("FirstPersonCameraSensitivity.Enabled"), 0)) {
@@ -1514,7 +1516,8 @@ void SohInputEditorWindow::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);
@@ -1743,7 +1746,7 @@ void SohInputEditorWindow::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();
}
PopStyleButton();
@@ -1776,11 +1779,11 @@ void SohInputEditorWindow::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();
@@ -1806,11 +1809,11 @@ void SohInputEditorWindow::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();
@@ -1869,7 +1872,7 @@ void RegisterInputEditorWidgets() {
.Callback([](WidgetInfo& info) {
bool enabled =
CVarGetInteger(CVAR_SETTING("EnableMouse"), 0) && CVarGetInteger(CVAR_SETTING("AutoCaptureMouse"), 1);
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
wnd->SetAutoCaptureMouse(enabled);
})
.Options(
@@ -1885,7 +1888,7 @@ void RegisterInputEditorWidgets() {
.Callback([](WidgetInfo& info) {
bool enabled =
CVarGetInteger(CVAR_SETTING("EnableMouse"), 0) && CVarGetInteger(CVAR_SETTING("AutoCaptureMouse"), 1);
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
wnd->SetAutoCaptureMouse(enabled);
})
.Options(CheckboxOptions()
@@ -1639,7 +1639,7 @@ void C_Button_Dropdown(const char* Header_Title, const char* Table_ID, const cha
ImGui::EndTable();
}
std::shared_ptr<Ship::Controller> controller =
Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0);
Ship::Context::GetRawInstance()->GetControlDeck()->GetControllerByPort(0);
for (auto [id, mapping] : controller->GetButton(BTN_DDOWN)->GetAllButtonMappings()) {
controller->GetButton(BTN_CUSTOM_OCARINA_NOTE_F4)->AddButtonMapping(mapping);
}
@@ -2217,7 +2217,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
CVarSetInteger((cosmeticOption.changedCvar), 1);
ApplySideEffects(cosmeticOption);
ApplyOrResetCustomGfxPatches();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
// the longest option name
ImGui::SameLine((ImGui::CalcTextSize("Message Light Blue (None No Shadow)").x * 1.0f) + 60.0f);
@@ -2226,7 +2226,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
UIWidgets::ButtonOptions().Size(ImVec2(80, 31)).Padding(ImVec2(2.0f, 0.0f)).Color(THEME_COLOR))) {
RandomizeColor(cosmeticOption);
ApplyOrResetCustomGfxPatches();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
if (cosmeticOption.supportsRainbow) {
ImGui::SameLine();
@@ -2235,7 +2235,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
CVarSetInteger((cosmeticOption.changedCvar), 1);
ApplySideEffects(cosmeticOption);
ApplyOrResetCustomGfxPatches();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
ImGui::SameLine();
@@ -2249,7 +2249,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
UIWidgets::ButtonOptions().Size(ImVec2(80, 31)).Padding(ImVec2(2.0f, 0.0f)))) {
ResetColor(cosmeticOption);
ApplyOrResetCustomGfxPatches();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
}
@@ -2622,7 +2622,7 @@ void CosmeticsEditorWindow::InitElement() {
cosmeticOption.currentColor.z = cvarColor.b / 255.0f;
cosmeticOption.currentColor.w = cvarColor.a / 255.0f;
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ApplyOrResetCustomGfxPatches();
ApplyAuthenticGfxPatches();
}
@@ -2635,7 +2635,7 @@ void CosmeticsEditor_RandomizeAll() {
}
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ApplyOrResetCustomGfxPatches();
}
@@ -2647,7 +2647,7 @@ void CosmeticsEditor_AutoRandomizeAll() {
}
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ApplyOrResetCustomGfxPatches();
}
@@ -2660,7 +2660,7 @@ void CosmeticsEditor_RandomizeGroup(CosmeticGroup group) {
}
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ApplyOrResetCustomGfxPatches();
}
@@ -2671,7 +2671,7 @@ void CosmeticsEditor_ResetAll() {
}
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ApplyOrResetCustomGfxPatches();
}
@@ -2682,7 +2682,7 @@ void CosmeticsEditor_ResetGroup(CosmeticGroup group) {
}
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ApplyOrResetCustomGfxPatches();
}
+10 -10
View File
@@ -36,15 +36,15 @@ extern PlayState* gPlayState;
#include <libultraship/bridge.h>
#include <libultraship/libultraship.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,
@@ -527,7 +527,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;
}
@@ -1772,7 +1772,7 @@ void DebugConsole_Init(void) {
"Available Checks - Process Undiscovered Exits",
{ { "enable", Ship::ArgumentType::NUMBER, true } } });
Ship::Context::GetInstance()->GetConsole()->AddCommand(
Ship::Context::GetRawInstance()->GetConsole()->AddCommand(
"acr", { AvailableChecksRecalculateHandler,
"Available Checks - Recalculate",
{
@@ -1780,5 +1780,5 @@ void DebugConsole_Init(void) {
{ "ChildDay|ChildNight|AdultDay|AdultNight", Ship::ArgumentType::TEXT, true },
} });
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
@@ -521,7 +521,7 @@ void DrawInfoTab() {
void DrawBGSItemFlag(uint8_t itemID) {
const ItemMapEntry& slotEntry = itemMapping[itemID];
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(slotEntry.name),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
}
@@ -550,7 +550,7 @@ void DrawInventoryTab() {
if (item == ITEM_ROCS_FEATHER) {
auto ret = ImGui::ImageButton(
"ROCS_FEATHER",
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("ROCS_FEATHER"),
ImVec2(48.0f, 48.0f), ImVec2(0, 0), ImVec2(1, 1));
if (ret) {
@@ -561,7 +561,7 @@ void DrawInventoryTab() {
const ItemMapEntry& slotEntry = itemMapping.find(item)->second;
auto ret = ImGui::ImageButton(
slotEntry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(slotEntry.name),
ImVec2(48.0f, 48.0f), ImVec2(0, 0), ImVec2(1, 1));
if (ret) {
@@ -611,11 +611,11 @@ void DrawInventoryTab() {
}
const ItemMapEntry& slotEntry = possibleItems[pickerIndex];
PushStyleButton(Colors::DarkGray);
auto ret = ImGui::ImageButton(
slotEntry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName(slotEntry.name),
ImVec2(IMAGE_SIZE, IMAGE_SIZE), ImVec2(0, 0), ImVec2(1, 1));
auto ret = ImGui::ImageButton(slotEntry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(
Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(slotEntry.name),
ImVec2(IMAGE_SIZE, IMAGE_SIZE), ImVec2(0, 0), ImVec2(1, 1));
PopStyleButton();
if (ret) {
gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
@@ -647,9 +647,10 @@ void DrawInventoryTab() {
ImGui::PushItemWidth(IMAGE_SIZE);
ImGui::BeginGroup();
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName(itemMapping[item].name),
ImVec2(IMAGE_SIZE, IMAGE_SIZE));
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(itemMapping[item].name),
ImVec2(IMAGE_SIZE, IMAGE_SIZE));
PushStyleInput(THEME_COLOR);
ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item));
PopStyleInput();
@@ -1242,7 +1243,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
const ItemMapEntry& slotEntry = itemMapping[item];
if (ImGui::ImageButton(
slotEntry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(slotEntry.name),
ImVec2(IMAGE_SIZE, IMAGE_SIZE), ImVec2(0, 0), ImVec2(1, 1))) {
ImGui::OpenPopup(upgradePopupPicker);
@@ -1273,7 +1274,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
auto ret = ImGui::ImageButton(
slotEntry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(slotEntry.name),
ImVec2(IMAGE_SIZE, IMAGE_SIZE), ImVec2(0, 0), ImVec2(1, 1));
if (ret) {
@@ -1312,7 +1313,7 @@ void DrawEquipmentTab() {
PushStyleButton(Colors::DarkGray);
auto ret = ImGui::ImageButton(
entry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
ImVec2(IMAGE_SIZE, IMAGE_SIZE), ImVec2(0, 0), ImVec2(1, 1));
if (ret) {
@@ -1448,7 +1449,7 @@ void DrawQuestItemButton(uint32_t item) {
PushStyleButton(Colors::DarkGray);
auto ret = ImGui::ImageButton(
entry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(IMAGE_SIZE, IMAGE_SIZE), ImVec2(0, 0), ImVec2(1, 1));
if (ret) {
@@ -1470,7 +1471,7 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) {
PushStyleButton(Colors::DarkGray);
auto ret = ImGui::ImageButton(
entry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasItem ? entry.name : entry.nameFaded),
ImVec2(IMAGE_SIZE, IMAGE_SIZE), ImVec2(0, 0), ImVec2(1, 1));
if (ret) {
@@ -1519,7 +1520,7 @@ void DrawQuestStatusTab() {
PushStyleButton(Colors::DarkGray);
auto ret = ImGui::ImageButton(
entry.name.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 48.0f), ImVec2(0, 0), ImVec2(1, 1));
if (ret) {
@@ -1599,7 +1600,7 @@ void DrawQuestStatusTab() {
if (dungeonItemsScene != SCENE_JABU_JABU_BOSS) {
float lineHeight = ImGui::GetTextLineHeightWithSpacing();
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(itemMapping[ITEM_KEY_SMALL].name),
ImVec2(lineHeight, lineHeight));
ImGui::SameLine();
@@ -1990,6 +1991,6 @@ void SaveEditorWindow::DrawElement() {
}
void SaveEditorWindow::InitElement() {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ROCS_FEATHER", gRocsFeatherTex, ImVec4(1, 1, 1, 1));
}
+2 -2
View File
@@ -67,7 +67,7 @@ std::map<int, std::string> cmdMap = {
};
void PerformDisplayListSearch() {
auto result = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(
auto result = Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(
"*" + std::string(searchString) + "*DL*");
displayListSearchResults.clear();
@@ -130,7 +130,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.");
@@ -69,7 +69,7 @@ std::array<ValueTableElement, VVE_MAX> valueTable = {{
// clang-format on
void LoadValueConfig() {
auto allConfig = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
auto allConfig = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
if (allConfig.find("ValueViewer") == allConfig.end() || !allConfig["ValueViewer"].is_array()) {
allConfig["ValueViewer"] = nlohmann::json::array();
}
@@ -77,10 +77,10 @@ void LoadValueConfig() {
}
void SaveValueConfig() {
auto allConfig = Ship::Context::GetInstance()->GetConfig()->GetNestedJson();
auto allConfig = Ship::Context::GetRawInstance()->GetConfig()->GetNestedJson();
allConfig["ValueViewer"] = valueViewerSettings;
Ship::Context::GetInstance()->GetConfig()->SetBlock("ValueViewer", valueViewerSettings);
Ship::Context::GetInstance()->GetConfig()->Save();
Ship::Context::GetRawInstance()->GetConfig()->SetBlock("ValueViewer", valueViewerSettings);
Ship::Context::GetRawInstance()->GetConfig()->Save();
}
extern "C" void ValueViewer_Draw(GfxPrint* printer) {
+4 -4
View File
@@ -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();
});
}
}
+37 -32
View File
@@ -20,6 +20,8 @@
#include <fast/Fast3dGui.h>
#include <fast/Fast3dGui.h>
extern "C" {
#include "include/z64item.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -308,7 +310,7 @@ ImVec4 plandomizerGetItemColor(Rando::Item randoItem) {
}
if (randoItem.GetItemType() == ITEMTYPE_SONG) {
uint32_t questID = Rando::Logic::RandoGetToQuestItem[randoItem.GetRandomizerGet()];
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(songMapping.at((QuestItem)questID).name);
itemColor = songMapping.at((QuestItem)questID).color;
imageSize = ImVec2(24.0f, 32.0f);
@@ -382,20 +384,21 @@ void PlandomizerItemImageCorrection(Rando::Item randoItem) {
itemColor = plandomizerGetItemColor(randoItem);
if (randoItem.GetItemType() == ITEMTYPE_SMALLKEY || randoItem.GetItemType() == ITEMTYPE_FORTRESS_SMALLKEY) {
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("ITEM_KEY_SMALL");
return;
}
if (randoItem.GetItemType() == ITEMTYPE_BOSSKEY) {
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("ITEM_KEY_BOSS");
return;
}
for (auto& map : itemImageMap) {
if (map.first == randoItem.GetRandomizerGet()) {
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName(map.second.c_str());
textureID =
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(map.second.c_str());
if (map.second.find("ITEM_ARROWS") != std::string::npos) {
textureUV0 = ImVec2(0, 1);
textureUV1 = ImVec2(1, 0);
@@ -409,18 +412,18 @@ void PlandomizerItemImageCorrection(Rando::Item randoItem) {
}
if (randoItem.GetRandomizerGet() >= RG_GOHMA_SOUL && randoItem.GetRandomizerGet() <= RG_GANON_SOUL) {
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("BOSS_SOUL");
}
if (randoItem.GetRandomizerGet() >= RG_OCARINA_A_BUTTON &&
randoItem.GetRandomizerGet() <= RG_OCARINA_C_RIGHT_BUTTON) {
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("ITEM_OCARINA_TIME");
}
if (textureID == 0) {
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(itemMapping[randoItem.GetGIEntry()->itemId].name);
}
}
@@ -980,15 +983,16 @@ void PlandomizerDrawOptions() {
PlandoPushImageButtonStyle();
for (auto& hash : plandoHash) {
ImGui::PushID(index);
textureID =
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName(gSeedTextures[hash].tex);
textureID = std::dynamic_pointer_cast<Fast::Fast3dGui>(
Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(gSeedTextures[hash].tex);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
auto upRet = ImGui::ImageButton(
"HASH_ARROW_UP",
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName("HASH_ARROW_UP"),
ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
auto upRet = ImGui::ImageButton("HASH_ARROW_UP",
std::dynamic_pointer_cast<Fast::Fast3dGui>(
Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("HASH_ARROW_UP"),
ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0),
ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
ImGui::PopStyleVar();
if (upRet) {
if (hash + 1 >= gSeedTextures.size()) {
@@ -999,11 +1003,12 @@ void PlandomizerDrawOptions() {
}
ImGui::Image(textureID, ImVec2(35.0f, 35.0f));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
auto downRet = ImGui::ImageButton(
"HASH_ARROW_DWN",
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName("HASH_ARROW_DWN"),
ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
auto downRet = ImGui::ImageButton("HASH_ARROW_DWN",
std::dynamic_pointer_cast<Fast::Fast3dGui>(
Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("HASH_ARROW_DWN"),
ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1),
ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1));
ImGui::PopStyleVar();
if (downRet) {
if (hash == 0) {
@@ -1181,26 +1186,26 @@ void PlandomizerWindow::DrawElement() {
}
void PlandomizerWindow::InitElement() {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ITEM_RUPEE_GRAYSCALE", gRupeeCounterIconTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ITEM_HEART_GRAYSCALE", gHeartFullTex, ImVec4(0.87f, 0.10f, 0.10f, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ITEM_SEEDS", gItemIconDekuSeedsTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ITEM_ARROWS_SMALL", gDropArrows1Tex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ITEM_ARROWS_MEDIUM", gDropArrows2Tex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ITEM_ARROWS_LARGE", gDropArrows3Tex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("ITEM_ICE_TRAP", gMagicArrowEquipEffectTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("HASH_ARROW_UP", gEmptyCDownArrowTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("HASH_ARROW_DWN", gEmptyCDownArrowTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("BOSS_SOUL", gBossSoulTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("TRIFORCE_PIECE", gTriforcePieceTex, ImVec4(1, 1, 1, 1));
}
+1 -1
View File
@@ -2420,7 +2420,7 @@ const std::vector<uint8_t>& GetDungeonSmallKeyDoors(SceneID sceneId) {
// Load the scene
std::shared_ptr<SOH::Scene> scene = std::dynamic_pointer_cast<SOH::Scene>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(scenePath));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(scenePath));
if (scene == nullptr) {
return emptyVector;
}
+4 -4
View File
@@ -247,7 +247,7 @@ bool Option::RenderCheckbox() {
if (UIWidgets::Checkbox(name.c_str(), &val, widgetOptions)) {
CVarSetInteger(cvarName.c_str(), val);
changed = true;
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
return changed;
}
@@ -259,7 +259,7 @@ bool Option::RenderCombobox() {
selected = static_cast<uint8_t>(options.size());
CVarSetInteger(cvarName.c_str(), selected);
changed = true;
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
UIWidgets::ComboboxOptions widgetOptions =
UIWidgets::ComboboxOptions().Color(THEME_COLOR).Tooltip(description.c_str());
@@ -271,7 +271,7 @@ bool Option::RenderCombobox() {
if (UIWidgets::Combobox(name.c_str(), &selected, options, widgetOptions)) {
CVarSetInteger(cvarName.c_str(), static_cast<int>(selected));
changed = true;
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
return changed;
}
@@ -304,7 +304,7 @@ bool Option::RenderSlider() {
}
if (changed) {
CVarSetInteger(cvarName.c_str(), val);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
return changed;
}
@@ -90,7 +90,7 @@ Randomizer::Randomizer() {
SpoilerfileHintTypeNameToEnum[Rando::StaticData::hintTypeNames[(HintType)c].GetEnglish(MF_CLEAN)] = (HintType)c;
}
Ship::Context::GetInstance()->GetFileDropMgr()->RegisterDropHandler(Rando_HandleSpoilerDrop);
Ship::Context::GetRawInstance()->GetFileDropMgr()->RegisterDropHandler(Rando_HandleSpoilerDrop);
}
Randomizer::~Randomizer() {
@@ -214,7 +214,7 @@ bool Randomizer::SpoilerFileExists(const char* spoilerFileName) {
"\nwas made by a version that doesn't match the currently running version.\n" +
"Loading for this file has been cancelled.");
CVarClear(CVAR_GENERAL("SpoilerLog"));
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
// Update cache
@@ -943,7 +943,7 @@ std::thread randoThread;
void GenerateRandomizerImgui(std::string seed = "") {
CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 1);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
auto ctx = Rando::Context::GetInstance();
// RANDOTODO proper UI for selecting if a spoiler loaded should be used for settings
Rando::Settings::GetInstance()->SetAllToContext();
@@ -980,7 +980,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seed));
CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
generated = true;
@@ -1030,7 +1030,8 @@ void CheckTrackerWindow::DrawElement() {
int comboButton1Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton1"), TRACKER_COMBO_BUTTON_L)];
int comboButton2Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* trackerButtonsPressed =
std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetRawInstance()->GetControlDeck())
->GetPads();
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
trackerButtonsPressed[0].button & comboButton1Mask &&
trackerButtonsPressed[0].button & comboButton2Mask;
@@ -841,7 +841,8 @@ void EntranceTrackerWindow::DrawElement() {
int comboButton2Mask =
buttons[CVarGetInteger(CVAR_TRACKER_ENTRANCE("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* trackerButtonsPressed =
std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetRawInstance()->GetControlDeck())
->GetPads();
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
trackerButtonsPressed[0].button & comboButton1Mask &&
trackerButtonsPressed[0].button & comboButton2Mask;
@@ -808,7 +808,7 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) {
void DrawEquip(ItemTrackerItem item) {
bool hasEquip = HasEquipment(item);
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0.0f, 0.0f), ImVec2(1, 1));
@@ -819,9 +819,10 @@ void DrawQuest(ItemTrackerItem item) {
bool hasQuestItem = HasQuestItem(item);
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
ImGui::BeginGroup();
ImGui::ImageWithBg(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
ImGui::ImageWithBg(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
if (item.id == QUEST_SKULL_TOKEN) {
DrawItemCount(item, false);
@@ -1218,7 +1219,7 @@ void DrawItem(ItemTrackerItem item) {
ImGui::BeginGroup();
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
@@ -1304,7 +1305,7 @@ void DrawBottle(ItemTrackerItem item) {
}
float iconSize = static_cast<float>(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36));
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
@@ -1320,11 +1321,11 @@ void DrawDungeonItem(ItemTrackerItem item) {
bool hasSmallKey = GameInteractor::IsSaveLoaded() ? ((gSaveContext.inventory.dungeonKeys[item.data]) >= 0) : false;
ImGui::BeginGroup();
if (itemId == ITEM_KEY_SMALL) {
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
} else {
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
}
@@ -1370,7 +1371,7 @@ void DrawSong(ItemTrackerItem item) {
ImVec2 p = ImGui::GetCursorScreenPos();
bool hasSong = HasSong(item);
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize / 1.5f, iconSize), ImVec2(0, 0), ImVec2(1, 1));
Tooltip(SohUtils::GetQuestItemName(item.id).c_str());
@@ -1831,7 +1832,7 @@ void ItemTrackerWindow::DrawElement() {
int comboButton1Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton1"), TRACKER_COMBO_BUTTON_L)];
int comboButton2Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton2"), TRACKER_COMBO_BUTTON_R)];
OSContPad* buttonsPressed =
std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetRawInstance()->GetControlDeck())->GetPads();
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask &&
buttonsPressed[0].button & comboButton2Mask;
bool isPaused = CVarGetInteger(CVAR_TRACKER_ITEM("ShowOnlyPaused"), 0) == 0 ||
+1 -1
View File
@@ -2958,7 +2958,7 @@ void Settings::RandomizeAllSettings() {
option.RunCallback();
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
std::shared_ptr<Settings> Settings::GetInstance() {
+6 -6
View File
@@ -818,8 +818,8 @@ extern "C" void ProcessSaveStateRequests(void) {
}
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true,
"slot %u set", slot);
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true,
"slot %u set", slot);
this->currentSlot = slot;
}
@@ -838,13 +838,13 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
}
this->states[request.slot]->Save();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
1.0f, true, "saved state %u", request.slot);
break;
case RequestType::LOAD:
if (this->states.contains(request.slot)) {
this->states[request.slot]->Load();
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
1.0f, true, "loaded state %u", request.slot);
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.slot);
@@ -861,7 +861,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
if (gPlayState == nullptr) {
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
1.0f, true, "states not available here", request.slot);
return SaveStateReturn::FAIL_WRONG_GAMESTATE;
}
@@ -876,7 +876,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
return SaveStateReturn::SUCCESS;
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.slot);
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(
1.0f, true, "state slot %u empty", request.slot);
return SaveStateReturn::FAIL_INVALID_SLOT;
}
@@ -12,6 +12,8 @@
#include <fast/Fast3dGui.h>
#include <fast/Fast3dGui.h>
extern "C" {
#include "z64item.h"
#include "macros.h"
@@ -437,7 +439,7 @@ void TimeSplitsPopUpContext() {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
ImGui::ImageButton(
"QUEST_SKULL_TOKEN",
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName("QUEST_SKULL_TOKEN"),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0));
ImGui::PopStyleVar();
@@ -491,7 +493,7 @@ void TimeSplitsPopUpContext() {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 2.0f));
auto ret = ImGui::ImageButton(
popupObject.splitImage.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(popupObject.splitImage),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), popupObject.splitTint);
ImGui::PopStyleVar();
@@ -668,7 +670,7 @@ void TimeSplitsDrawSplitsList() {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(
split.splitImage.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(split.splitImage),
imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), split.splitTint);
ImGui::PopStyleVar();
@@ -753,7 +755,7 @@ void TimeSplitsDrawItemList(uint32_t type) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(
split.splitImage.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(split.splitImage),
imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), split.splitTint);
ImGui::PopStyleVar();
@@ -897,7 +899,7 @@ void TimeSplitsDrawManageList() {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding));
auto ret = ImGui::ImageButton(
data.splitImage.c_str(),
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(data.splitImage),
imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), data.splitTint);
ImGui::PopStyleVar();
@@ -983,9 +985,9 @@ void TimeSplitWindow::DrawElement() {
void TimeSplitWindow::InitElement() {
TimeSplitsUpdateWindowSize();
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("SPECIAL_TRIFORCE_PIECE_WHITE", gWTriforcePieceTex, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture("SPECIAL_SPLIT_ENTRANCE", gSplitEntranceTex, ImVec4(1, 1, 1, 1));
Color_RGBA8 defaultColour = { 0, 0, 0, 255 };
windowColor = VecFromRGBA8(CVarGetColor(CVAR_ENHANCEMENT("TimeSplits.WindowColor.Value"), defaultColour));
+4 -4
View File
@@ -1124,21 +1124,21 @@ void InitTTSBank() {
initData->Type = static_cast<uint32_t>(Ship::ResourceType::Json);
initData->ResourceVersion = 0;
sceneMap = std::static_pointer_cast<Ship::Json>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(
sceneMap = std::static_pointer_cast<Ship::Json>(Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(
"accessibility/texts/scenes" + languageSuffix, true, initData))
->Data;
miscMap = std::static_pointer_cast<Ship::Json>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(
miscMap = std::static_pointer_cast<Ship::Json>(Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(
"accessibility/texts/misc" + languageSuffix, true, initData))
->Data;
kaleidoMap =
std::static_pointer_cast<Ship::Json>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(
std::static_pointer_cast<Ship::Json>(Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(
"accessibility/texts/kaleidoscope" + languageSuffix, true, initData))
->Data;
fileChooseMap =
std::static_pointer_cast<Ship::Json>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(
std::static_pointer_cast<Ship::Json>(Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(
"accessibility/texts/filechoose" + languageSuffix, true, initData))
->Data;
}
+9 -9
View File
@@ -34,7 +34,7 @@ void AnchorMainMenu(WidgetInfo& info) {
ImVec2((ImGui::GetFontSize() * 5 + ImGui::GetStyle().ItemSpacing.x), 0))
.Color(THEME_COLOR))) {
CVarSetString(CVAR_REMOTE_ANCHOR("Host"), host.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
@@ -42,7 +42,7 @@ void AnchorMainMenu(WidgetInfo& info) {
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 5);
if (ImGui::InputScalar("##Port", ImGuiDataType_U16, &port)) {
CVarSetInteger(CVAR_REMOTE_ANCHOR("Port"), port);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
UIWidgets::PopStyleInput();
@@ -53,20 +53,20 @@ void AnchorMainMenu(WidgetInfo& info) {
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (UIWidgets::InputString("##Name", &anchorName, UIWidgets::InputOptions().Color(THEME_COLOR))) {
CVarSetString(CVAR_REMOTE_ANCHOR("Name"), anchorName.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::Text("Room ID");
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (UIWidgets::InputString("##RoomId", &anchorRoomId,
UIWidgets::InputOptions().IsSecret(anchor->isEnabled).Color(THEME_COLOR))) {
CVarSetString(CVAR_REMOTE_ANCHOR("RoomId"), anchorRoomId.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::Text("Team ID (Items & Flags Shared)");
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (UIWidgets::InputString("##TeamId", &anchorTeamId, UIWidgets::InputOptions().Color(THEME_COLOR))) {
CVarSetString(CVAR_REMOTE_ANCHOR("TeamId"), anchorTeamId.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::Spacing();
@@ -78,7 +78,7 @@ void AnchorMainMenu(WidgetInfo& info) {
CVarSetString(CVAR_REMOTE_ANCHOR("TeamId"), "default");
CVarSetString(CVAR_REMOTE_ANCHOR("RoomId"), "");
CVarSetString(CVAR_REMOTE_ANCHOR("Name"), "");
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::SameLine();
@@ -91,7 +91,7 @@ void AnchorMainMenu(WidgetInfo& info) {
CVarSetInteger(CVAR_REMOTE_ANCHOR("Port"), 43383);
CVarSetString(CVAR_REMOTE_ANCHOR("TeamId"), "default");
CVarSetString(CVAR_REMOTE_ANCHOR("RoomId"), "soh-global");
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
ImGui::EndDisabled();
@@ -105,11 +105,11 @@ void AnchorMainMenu(WidgetInfo& info) {
if (ImGui::Button(buttonLabel, ImVec2(-1.0f, 0.0f))) {
if (anchor->isEnabled) {
CVarClear(CVAR_REMOTE_ANCHOR("Enabled"));
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
anchor->Disable();
} else {
CVarSetInteger(CVAR_REMOTE_ANCHOR("Enabled"), 1);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
anchor->Enable();
}
}
@@ -22,7 +22,7 @@ void Anchor::HandlePacket_AllClientState(nlohmann::json payload) {
if (client.self) {
ownClientId = client.clientId;
CVarSetInteger(CVAR_REMOTE_ANCHOR("LastClientId"), ownClientId);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
clients[client.clientId].self = true;
} else {
clients[client.clientId].self = false;
+2 -2
View File
@@ -56,7 +56,7 @@ void Sail::OnIncomingJson(nlohmann::json payload) {
std::string command = payload["command"].get<std::string>();
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch(command);
responsePayload["status"] = "success";
SendJsonToRemote(responsePayload);
@@ -80,7 +80,7 @@ void Sail::OnIncomingJson(nlohmann::json payload) {
std::string command = payload["effect"]["command"].get<std::string>();
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch(command);
responsePayload["status"] = "success";
SendJsonToRemote(responsePayload);
+6 -3
View File
@@ -5,6 +5,8 @@
#include <fast/Fast3dGui.h>
#include <fast/Fast3dGui.h>
extern "C" {
#include "functions.h"
#include "macros.h"
@@ -90,9 +92,10 @@ void Window::Draw() {
ImGui::SetWindowPos(notificationPos);
if (notification.itemIcon != nullptr) {
ImGui::Image(std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
->GetTextureByName(notification.itemIcon),
ImVec2(24, 24));
ImGui::Image(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetTextureByName(notification.itemIcon),
ImVec2(24, 24));
ImGui::SameLine();
}
if (!notification.prefix.empty()) {
+33 -33
View File
@@ -321,7 +321,7 @@ OTRGlobals::OTRGlobals() {
if (sohArchiveVersionMatch) {
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"));
@@ -781,7 +781,7 @@ void OTRGlobals::RunExtract(int argc, char* argv[]) {
void InitGfxDebugger() {
auto dbg =
std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())->GetGfxDebugger();
std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())->GetGfxDebugger();
if (dbg != nullptr) {
return;
@@ -820,7 +820,7 @@ void OTRGlobals::Initialize() {
auto logLevel =
static_cast<spdlog::level::level_enum>(CVarGetInteger(CVAR_DEVELOPER_TOOLS("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");
InitGfxDebugger();
context->InitFileDropMgr();
@@ -1003,10 +1003,10 @@ bool OTRGlobals::HasOriginal() {
uint32_t OTRGlobals::GetInterpolationFPS() {
if (CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 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(CVAR_SETTING("InterpolationFPS"), 20));
}
return CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20);
@@ -1410,7 +1410,7 @@ extern "C" RandomizerGet RetrieveRandomizerGetFromItemID(ItemID itemID) {
}
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, ".");
@@ -1517,7 +1517,7 @@ extern "C" void InitOTR(int argc, char* argv[]) {
CVarClear(CVAR_GENERAL("RandomizerDroppedFile"));
// #endregion
Ship::Context::GetInstance()->GetFileDropMgr()->RegisterDropHandler(SoH_HandleConfigDrop);
Ship::Context::GetRawInstance()->GetFileDropMgr()->RegisterDropHandler(SoH_HandleConfigDrop);
RegisterImGuiItemIcons();
@@ -1622,7 +1622,7 @@ extern "C" void Graph_StartFrame() {
switch (dwScancode) {
case KbScancode::LUS_KB_F1: {
std::shared_ptr<SohModalWindow> modal = static_pointer_cast<SohModalWindow>(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetGuiWindow("Modal Window"));
if (modal->IsPopupOpen("Menu Moved")) {
modal->DismissPopup();
@@ -1636,7 +1636,7 @@ extern "C" void Graph_StartFrame() {
}
case KbScancode::LUS_KB_F5: {
if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetGameOverlay()
->TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu.");
return;
@@ -1658,7 +1658,7 @@ extern "C" void Graph_StartFrame() {
}
case KbScancode::LUS_KB_F6: {
if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetGameOverlay()
->TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu.");
return;
@@ -1674,7 +1674,7 @@ extern "C" void Graph_StartFrame() {
}
case KbScancode::LUS_KB_F7: {
if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetGameOverlay()
->TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu.");
return;
@@ -1756,7 +1756,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;
@@ -1805,7 +1805,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
bool curAltAssets = CVarGetInteger(CVAR_SETTING("AltAssets"), 1);
if (prevAltAssets != curAltAssets) {
prevAltAssets = curAltAssets;
Ship::Context::GetInstance()->GetResourceManager()->SetAltAssetsEnabled(curAltAssets);
Ship::Context::GetRawInstance()->GetResourceManager()->SetAltAssetsEnabled(curAltAssets);
gfx_texture_cache_clear();
SOH::SkeletonPatcher::UpdateSkeletons();
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAssetAltChange>();
@@ -1817,7 +1817,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
}
extern "C" void OTRGetPixelDepthPrepare(float x, float 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;
}
@@ -1826,7 +1826,7 @@ extern "C" void OTRGetPixelDepthPrepare(float x, float y) {
}
extern "C" uint16_t OTRGetPixelDepth(float x, float 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;
}
@@ -1860,7 +1860,7 @@ ImFont* OTRGlobals::CreateFontWithSize(float size, std::string fontPath, bool is
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;
const ImWchar* glyph_ranges = isJapaneseFont ? mImGuiIo->Fonts->GetGlyphRangesJapanese() : nullptr;
@@ -2120,27 +2120,27 @@ 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<SohInputEditorWindow> controllerConfigWindow = nullptr;
if (controllerConfigWindow == nullptr) {
controllerConfigWindow = std::dynamic_pointer_cast<SohInputEditorWindow>(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetGuiWindow("Controller Configuration"));
} else if (controllerConfigWindow->TestingRumble()) {
return;
}
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) {
@@ -2153,7 +2153,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 = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
@@ -2169,7 +2169,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 = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
@@ -2208,7 +2208,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()
@@ -2218,7 +2218,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)
@@ -2360,7 +2360,7 @@ extern "C" void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex) {
}
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 = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->RegisterBlendedTexture(name, mask, replacement);
@@ -2370,7 +2370,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 = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->UnregisterBlendedTexture(name);
@@ -2390,7 +2390,7 @@ extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) {
texAddr = (const uint8_t*)ResourceMgr_GetResourceDataByNameHandlingMQ(imgName);
}
if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->TextureCacheDelete(texAddr);
@@ -2441,7 +2441,7 @@ bool SoH_HandleConfigDrop(char* filePath) {
}
}
auto gui = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui());
auto gui = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui());
gui->GetGuiWindow("Console")->Hide();
gui->GetGuiWindow("Actor Viewer")->Hide();
gui->GetGuiWindow("Collision Viewer")->Hide();
@@ -2449,7 +2449,7 @@ bool SoH_HandleConfigDrop(char* filePath) {
gui->GetGuiWindow("Display List Viewer")->Hide();
gui->GetGuiWindow("Stats")->Hide();
std::dynamic_pointer_cast<Ship::ConsoleWindow>(
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->GetGuiWindow("Console"))
->ClearBindings();
@@ -2462,12 +2462,12 @@ bool SoH_HandleConfigDrop(char* filePath) {
return true;
} catch (std::exception& e) {
SPDLOG_ERROR("Failed to load config file: {}", e.what());
auto gui = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui());
auto gui = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui());
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file");
return false;
} catch (...) {
SPDLOG_ERROR("Failed to load config file");
auto gui = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui());
auto gui = std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui());
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file");
return false;
}
+1 -1
View File
@@ -47,7 +47,7 @@ class OTRGlobals {
public:
static OTRGlobals* Instance;
std::shared_ptr<Ship::Context> context;
Ship::Context* context;
std::shared_ptr<SaveStateMgr> gSaveStateMgr;
std::shared_ptr<Randomizer> gRandomizer;
std::shared_ptr<Rando::Context> gRandoContext;
+14 -14
View File
@@ -21,16 +21,16 @@
extern "C" PlayState* gPlayState;
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 OOT_NTSC_US_10:
@@ -55,7 +55,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 OOT_NTSC_US_10:
@@ -130,11 +130,11 @@ extern "C" uint32_t ResourceMgr_IsGameMasterQuest() {
}
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) {
@@ -142,13 +142,13 @@ extern "C" void ResourceMgr_UnloadResource(const char* resName) {
if (path.substr(0, 7) == "__OTR__") {
path = path.substr(7);
}
auto res = Ship::Context::GetInstance()->GetResourceManager()->UnloadResource(path);
auto res = Ship::Context::GetRawInstance()->GetResourceManager()->UnloadResource(path);
}
// OTRTODO: There is probably a more elegant way to go about this...
// Caller must free each string and the array itself when done.
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++) {
@@ -185,7 +185,7 @@ extern "C" uint8_t ResourceMgr_FileAltExists(const char* filePath) {
}
extern "C" bool ResourceMgr_IsAltAssetsEnabled() {
return Ship::Context::GetInstance()->GetResourceManager()->IsAltAssetsEnabled();
return Ship::Context::GetRawInstance()->GetResourceManager()->IsAltAssetsEnabled();
}
// Unloads a resource if an alternate version exists when alt assets are enabled
@@ -204,7 +204,7 @@ std::shared_ptr<Ship::IResource> ResourceMgr_GetResourceByNameHandlingMQ(const c
Path.replace(pos, 7, "/mq/");
}
}
return Ship::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str());
return Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(Path.c_str());
}
extern "C" char* ResourceMgr_GetResourceDataByNameHandlingMQ(const char* path) {
@@ -328,7 +328,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));
if (res == nullptr || static_cast<size_t>(index) >= res->Instructions.size()) {
return;
@@ -371,7 +371,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));
if (res == nullptr || static_cast<size_t>(destinationIndex) >= res->Instructions.size() ||
static_cast<size_t>(sourceIndex) >= res->Instructions.size()) {
@@ -396,7 +396,7 @@ extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const ch
extern "C" void ResourceMgr_PatchCustomGfxByName(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));
if (res == nullptr || static_cast<size_t>(index) >= res->Instructions.size()) {
return;
@@ -415,7 +415,7 @@ extern "C" void ResourceMgr_PatchCustomGfxByName(const char* path, const char* p
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));
// If the resource is unavailable (e.g. swapped out when toggling alt assets), clean up the record and bail.
if (res == nullptr) {
+19 -17
View File
@@ -7,6 +7,8 @@
#include <fast/Fast3dGui.h>
#include <fast/Fast3dGui.h>
std::map<uint32_t, ItemMapEntry> itemMapping = {
ITEM_MAP_ENTRY(ITEM_STICK),
ITEM_MAP_ENTRY(ITEM_NUT),
@@ -217,9 +219,9 @@ const char* GetTextureForItemId(uint32_t itemId) {
void RegisterImGuiItemIcons() {
for (const auto& entry : itemMapping) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
}
@@ -227,9 +229,9 @@ void RegisterImGuiItemIcons() {
ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f);
ImVec4 gregFadedGreen = gregGreen;
gregFadedGreen.w = 0.3f;
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.name, entry.second.texturePath, gregGreen);
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen);
}
@@ -237,53 +239,53 @@ void RegisterImGuiItemIcons() {
ImVec4 aButtonBlue = ImVec4(90.f / 255.f, 90.f / 250.f, 255.f / 255.f, 255.f / 255.f);
ImVec4 aButtonBlueFaded = aButtonBlue;
aButtonBlueFaded.w = 0.3f;
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.name, entry.second.texturePath, aButtonBlue);
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, aButtonBlueFaded);
}
for (const auto& entry : customItemsMapping) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
}
for (const auto& entry : jabbernutMapping) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
}
for (const auto& entry : questMapping) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
}
for (const auto& [quest, entry] : songMapping) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.name, gSongNoteTex, entry.color);
ImVec4 fadedCol = entry.color;
fadedCol.w = 0.3f;
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol);
}
for (const auto& entry : vanillaSongMapping) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.name, gSongNoteTex, entry.color);
ImVec4 fadedCol = entry.color;
fadedCol.w = 0.3f;
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol);
}
for (const auto& entry : gSeedTextures) {
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetInstance()->GetWindow()->GetGui())
std::dynamic_pointer_cast<Fast::Fast3dGui>(Ship::Context::GetRawInstance()->GetWindow()->GetGui())
->LoadGuiTexture(entry.tex, entry.tex, ImVec4(1, 1, 1, 1));
}
}
+18 -17
View File
@@ -100,15 +100,15 @@ void Menu::RemoveSidebarSearch() {
void Menu::UpdateWindowBackendObjects() {
Fast::WindowBackend runningWindowBackend =
(Fast::WindowBackend)Ship::Context::GetInstance()->GetWindow()->GetWindowBackend();
int32_t configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
if (Ship::Context::GetInstance()->GetWindow()->IsAvailableWindowBackend(configWindowBackendId)) {
(Fast::WindowBackend)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;
}
availableWindowBackends = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends();
availableWindowBackends = Ship::Context::GetRawInstance()->GetWindow()->GetAvailableWindowBackends();
for (auto& backend : *availableWindowBackends) {
availableWindowBackendsMap[(Fast::WindowBackend)backend] = windowBackendsMap.at((Fast::WindowBackend)backend);
}
@@ -337,14 +337,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: {
@@ -355,11 +356,11 @@ 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",
(int32_t)(configWindowBackend));
Ship::Context::GetRawInstance()->GetConfig()->SetString("Window.Backend.Name",
windowBackendsMap.at(configWindowBackend));
Ship::Context::GetRawInstance()->GetConfig()->Save();
UpdateWindowBackendObjects();
}
} break;
@@ -490,7 +491,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);
@@ -766,11 +767,11 @@ void Menu::DrawElement() {
"Quit SoH", "Are you sure you want to quit SoH?", "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);
}
@@ -790,7 +791,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();
@@ -803,7 +804,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;
+11 -11
View File
@@ -121,7 +121,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();
// Horizontal Resolution, if visibility is enabled for it.
@@ -191,7 +191,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
@@ -225,7 +225,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();
@@ -255,7 +255,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);
}
@@ -306,7 +306,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();
}
}
@@ -336,7 +336,7 @@ void ResolutionCustomWidget(WidgetInfo& info) {
if (UIWidgets::Button("Click to reset a console variable that may be causing this.",
UIWidgets::ButtonOptions().Color(THEME_COLOR))) {
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
} else {
@@ -374,12 +374,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 };
@@ -421,7 +421,7 @@ void RegisterResolutionWidgets() {
.PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_LOW_RES_MODE, 0); })
.Callback([](WidgetInfo& info) {
CVarSetInteger(CVAR_LOW_RES_MODE, 0);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
});
// Aspect Ratio
@@ -466,7 +466,7 @@ void RegisterResolutionWidgets() {
CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", aspectRatioY);
}
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", item_aspectRatio);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
})
.Options(ComboboxOptions().ComboMap(aspectRatioPresetLabels));
mSohMenu->AddWidget(path, "AspectRatioCustom", WIDGET_CUSTOM)
@@ -543,7 +543,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++) {
+3 -3
View File
@@ -101,7 +101,7 @@ std::shared_ptr<SohMenu> GetSohMenu() {
}
void SetupMenu() {
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
auto gui = Ship::Context::GetRawInstance()->GetWindow()->GetGui();
mSohMenu = std::make_shared<SohMenu>(CVAR_WINDOW("Menu"), "Port Menu");
gui->SetMenu(mSohMenu);
@@ -115,7 +115,7 @@ void SetupMenuElements() {
}
void SetupGuiElements() {
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
auto gui = Ship::Context::GetRawInstance()->GetWindow()->GetGui();
mConsoleWindow = std::make_shared<SohConsoleWindow>(CVAR_WINDOW("SohConsole"), "Console##SoH", ImVec2(820, 630));
gui->AddGuiWindow(mConsoleWindow);
@@ -200,7 +200,7 @@ void SetupGuiElements() {
}
void Destroy() {
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
auto gui = Ship::Context::GetRawInstance()->GetWindow()->GetGui();
gui->RemoveAllGuiWindows();
mNotificationWindow = nullptr;
+5 -5
View File
@@ -108,28 +108,28 @@ void SohMenu::InitElement() {
disabledMap = {
{ 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() !=
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() ==
return Ship::Context::GetRawInstance()->GetWindow()->GetWindowBackend() ==
Fast::WindowBackend::FAST3D_DXGI_DX11;
},
"Not Available on DirectX" } },
+1 -1
View File
@@ -120,7 +120,7 @@ void SohMenu::AddMenuDevTools() {
.ComboMap(logLevels)
.DefaultIndex(defaultLogLevel))
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetLogger()->set_level(
Ship::Context::GetRawInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), defaultLogLevel));
});
+7 -7
View File
@@ -362,7 +362,7 @@ void SohMenu::AddMenuEnhancements() {
CVAR_INT_SHIP_INIT(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), true);
CVAR_INT_SHIP_INIT(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), true);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
});
AddWidget(path, "None##Skips", WIDGET_BUTTON)
.SameLine(true)
@@ -379,7 +379,7 @@ void SohMenu::AddMenuEnhancements() {
CVAR_INT_SHIP_INIT(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), false);
CVAR_INT_SHIP_INIT(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), false);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
});
AddWidget(path, "Skip Intro", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"))
@@ -1856,7 +1856,7 @@ void SohMenu::AddMenuEnhancements() {
.CVar(CVAR_CHEAT("SaveStatePromise"))
.Callback([](WidgetInfo& info) {
CVarSetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
});
AddWidget(path, "I understand, enable save states", WIDGET_CVAR_CHECKBOX)
.PreFunc([](WidgetInfo& info) { info.isHidden = CVarGetInteger(CVAR_CHEAT("SaveStatePromise"), 0) == 0; })
@@ -1874,9 +1874,9 @@ void SohMenu::AddMenuEnhancements() {
CVarSetInteger(CVAR_CHEAT("BetaQuestWorld"), 0);
}
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
})
.Options(CheckboxOptions().Tooltip("Turns on OoT Beta Quest. *WARNING*: This will reset your game!"));
AddWidget(path, "Beta Quest World: %d", WIDGET_CVAR_SLIDER_INT)
@@ -1886,9 +1886,9 @@ void SohMenu::AddMenuEnhancements() {
})
.Callback([](WidgetInfo& info) {
std::reinterpret_pointer_cast<Ship::ConsoleWindow>(
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
})
.Options(IntSliderOptions().DefaultValue(0).Min(0).Max(8).Tooltip(
"Set the Beta Quest world to explore. *WARNING*: Changing this will reset your game!\n"
+4 -4
View File
@@ -88,11 +88,11 @@ void SohMenu::AddMenuNetwork() {
.Callback([](WidgetInfo& info) {
if (Sail::Instance->isEnabled) {
CVarClear(CVAR_REMOTE_SAIL("Enabled"));
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Sail::Instance->Disable();
} else {
CVarSetInteger(CVAR_REMOTE_SAIL("Enabled"), 1);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Sail::Instance->Enable();
}
});
@@ -154,11 +154,11 @@ void SohMenu::AddMenuNetwork() {
.Callback([](WidgetInfo& info) {
if (CrowdControl::Instance->isEnabled) {
CVarClear(CVAR_REMOTE_CROWD_CONTROL("Enabled"));
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
CrowdControl::Instance->Disable();
} else {
CVarSetInteger(CVAR_REMOTE_CROWD_CONTROL("Enabled"), 1);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
CrowdControl::Instance->Enable();
}
});
+3 -3
View File
@@ -41,7 +41,7 @@ void SaveEnabledTricks() {
} else {
CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str());
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
tricksDirty = false;
return;
}
@@ -111,7 +111,7 @@ void DrawLocationsMenu(WidgetInfo& info) {
}
CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"),
excludedLocationString.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
locationsDirty = true;
}
UIWidgets::PopStyleButton();
@@ -162,7 +162,7 @@ void DrawLocationsMenu(WidgetInfo& info) {
CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"),
excludedLocationString.c_str());
}
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
locationsDirty = true;
}
UIWidgets::PopStyleButton();
+8 -7
View File
@@ -167,7 +167,7 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_SETTING("CursorVisibility"))
.RaceDisable(false)
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetWindow()->SetForceCursorVisibility(
Ship::Context::GetRawInstance()->GetWindow()->SetForceCursorVisibility(
CVarGetInteger(CVAR_SETTING("CursorVisibility"), 0));
})
.Options(CheckboxOptions().Tooltip("Makes the cursor always visible, even in full screen."));
@@ -195,7 +195,7 @@ void SohMenu::AddMenuSettings() {
AddWidget(path, "Open App Files Folder", WIDGET_BUTTON)
.RaceDisable(false)
.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."));
@@ -334,13 +334,13 @@ void SohMenu::AddMenuSettings() {
AddWidget(path, "Graphics Options", WIDGET_SEPARATOR_TEXT);
AddWidget(path, "Toggle Fullscreen", WIDGET_BUTTON)
.RaceDisable(false)
.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", WIDGET_CVAR_SLIDER_FLOAT)
.CVar(CVAR_INTERNAL_RESOLUTION)
.RaceDisable(false)
.Callback([](WidgetInfo& info) {
Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(
Ship::Context::GetRawInstance()->GetWindow()->SetResolutionMultiplier(
CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1));
})
.PreFunc([](WidgetInfo& info) {
@@ -365,7 +365,7 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_MSAA_VALUE)
.RaceDisable(false)
.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()
@@ -441,9 +441,10 @@ void SohMenu::AddMenuSettings() {
"This will completely erase the controls config, including registered devices.\nContinue?", "Clear",
"Cancel",
[]() {
Ship::Context::GetInstance()->GetConsoleVariables()->ClearBlock(CVAR_PREFIX_SETTING ".Controllers");
Ship::Context::GetRawInstance()->GetConsoleVariables()->ClearBlock(CVAR_PREFIX_SETTING
".Controllers");
uint8_t bits = 0;
Ship::Context::GetInstance()->GetControlDeck()->Init(&bits);
Ship::Context::GetRawInstance()->GetControlDeck()->Init(&bits);
},
nullptr);
})
+10 -10
View File
@@ -384,7 +384,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;
}
@@ -615,7 +615,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;
}
@@ -746,7 +746,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;
}
@@ -822,7 +822,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;
}
@@ -874,7 +874,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;
}
@@ -919,7 +919,7 @@ bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaul
CVarClear((std::string(cvarName) + ".A").c_str());
CVarClear((std::string(cvarName) + ".Type").c_str());
CVarClearBlock(valueCVar.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
if (showRandom) {
@@ -936,7 +936,7 @@ bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaul
CVarSetColor(valueCVar.c_str(), color);
CVarSetInteger(rainbowCVar.c_str(), 0); // On click disable rainbow mode.
ShipInit::Init(rainbowCVar.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
}
if (showRainbow) {
@@ -964,7 +964,7 @@ bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaul
color.b = (uint8_t)(colorVec.z * 255.0f);
color.a = (uint8_t)(colorVec.w * 255.0f);
CVarSetColor(valueCVar.c_str(), color);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Ship::Context::GetRawInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
ShipInit::Init(valueCVar.c_str());
changed = true;
}
@@ -1039,7 +1039,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();
@@ -1246,7 +1246,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;
}
+3 -3
View File
@@ -1027,7 +1027,7 @@ bool CVarCombobox(const char* label, const char* cvarName, const std::map<T, con
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;
}
@@ -1041,7 +1041,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;
}
@@ -1055,7 +1055,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;
}
@@ -87,17 +87,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) {
@@ -290,7 +290,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).
@@ -342,7 +342,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) {
@@ -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);
}
@@ -232,7 +237,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;
@@ -308,7 +313,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;
}
@@ -322,7 +327,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;
}
@@ -336,7 +341,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;
}
@@ -376,7 +381,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;
}
@@ -431,7 +436,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));
@@ -46,7 +46,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);
}
@@ -116,7 +116,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);
}
@@ -19,7 +19,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())));
setAlternateHeaders->headerFileNames.push_back(headerName);
} else {
setAlternateHeaders->headers.push_back(nullptr);
@@ -49,7 +49,8 @@ SetAlternateHeadersFactoryXML::ReadResource(std::shared_ptr<Ship::ResourceInitDa
auto headerName = std::string(child->Attribute("Path"));
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);
}
@@ -15,7 +15,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()));
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) {
LogSetCollisionHeaderAsXML(setCollisionHeader);
@@ -33,7 +34,8 @@ SetCollisionHeaderFactoryXML::ReadResource(std::shared_ptr<Ship::ResourceInitDat
setCollisionHeader->fileName = reader->Attribute("FileName");
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;
}
@@ -14,7 +14,7 @@ std::shared_ptr<Ship::IResource> SetCutscenesFactory::ReadResource(std::shared_p
setCutscenes->fileName = reader->ReadString();
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str()));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str()));
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) {
LogCutscenesAsXML(setCutscenes);
@@ -31,7 +31,7 @@ std::shared_ptr<Ship::IResource> SetCutscenesFactoryXML::ReadResource(std::share
setCutscenes->fileName = reader->Attribute("FileName");
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str()));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str()));
return setCutscenes;
}
@@ -17,7 +17,7 @@ std::shared_ptr<Ship::IResource> SetPathwaysFactory::ReadResource(std::shared_pt
for (uint32_t i = 0; i < setPathways->numPaths; i++) {
std::string pathFileName = reader->ReadString();
auto path = std::static_pointer_cast<Path>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()));
setPathways->paths.push_back(path->GetPointer());
setPathways->pathFileNames.push_back(pathFileName);
}
@@ -42,7 +42,7 @@ std::shared_ptr<Ship::IResource> SetPathwaysFactoryXML::ReadResource(std::shared
if (childName == "Pathway") {
std::string pathFileName = child->Attribute("FilePath");
auto path = std::static_pointer_cast<Path>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str()));
setPathways->paths.push_back(path->GetPointer());
setPathways->pathFileNames.push_back(pathFileName);
}
+5 -4
View File
@@ -106,7 +106,7 @@ void SkeletonPatcher::ClearSkeletons() {
}
void SkeletonPatcher::UpdateSkeletons() {
auto resourceMgr = Ship::Context::GetInstance()->GetResourceManager();
auto resourceMgr = Ship::Context::GetRawInstance()->GetResourceManager();
bool isAlt = resourceMgr->IsAltAssetsEnabled();
for (auto skel : skeletons) {
Skeleton* newSkel =
@@ -177,12 +177,12 @@ void SkeletonPatcher::UpdateTunicSkeletons(SkeletonPatchInfo& skel) {
void SkeletonPatcher::UpdateCustomSkeletonFromPath(const std::string& skeletonPath, SkeletonPatchInfo& skel) {
Skeleton* newSkel = nullptr;
Skeleton* altSkel = nullptr;
auto resourceMgr = Ship::Context::GetInstance()->GetResourceManager();
auto resourceMgr = Ship::Context::GetRawInstance()->GetResourceManager();
bool isAlt = resourceMgr->IsAltAssetsEnabled();
// If alt assets are on, look for alt tagged skeletons
if (isAlt) {
altSkel = (Skeleton*)Ship::Context::GetInstance()
altSkel = (Skeleton*)Ship::Context::GetRawInstance()
->GetResourceManager()
->LoadResource(Ship::IResource::gAltAssetPrefix + skeletonPath, true)
.get();
@@ -195,7 +195,8 @@ void SkeletonPatcher::UpdateCustomSkeletonFromPath(const std::string& skeletonPa
// Load new skeleton based on the custom model if it exists
if (altSkel == nullptr) {
newSkel = (Skeleton*)Ship::Context::GetInstance()->GetResourceManager()->LoadResource(skeletonPath, true).get();
newSkel =
(Skeleton*)Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(skeletonPath, true).get();
}
// Change back to the original skeleton if no skeleton's were found
+5 -5
View File
@@ -23,11 +23,11 @@ static void SetMessageEntry(MessageTableEntry& entry, const SOH::MessageEntry& m
}
static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEntry*& table, size_t tableSize) {
auto lst = *Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folderPath).get();
auto lst = *Ship::Context::GetRawInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folderPath).get();
for (auto& tPath : lst) {
auto file = std::static_pointer_cast<SOH::Text>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(tPath));
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(tPath));
for (size_t j = 0; j < file->messages.size(); ++j) {
// Check if same text ID exists already
@@ -44,8 +44,8 @@ static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEnt
}
MessageTableEntry* OTRMessage_LoadTable(const std::string& filePath, bool isNES) {
auto file =
std::static_pointer_cast<SOH::Text>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath));
auto file = std::static_pointer_cast<SOH::Text>(
Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(filePath));
if (file == nullptr)
return nullptr;
@@ -95,7 +95,7 @@ extern "C" void OTRMessage_Init() {
if (sStaffMessageEntryTablePtr == NULL) {
auto file2 =
std::static_pointer_cast<SOH::Text>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(
std::static_pointer_cast<SOH::Text>(Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(
"text/staff_message_data_static/staff_message_data_static"));
// OTRTODO: Should not be malloc'ing here. It's fine for now since we check that the message table is already
// null.
+2 -2
View File
@@ -14,7 +14,7 @@ s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene);
// LUS::OTRResource* OTRPlay_LoadFile(PlayState* play, RomFile* file) {
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();
}
@@ -81,7 +81,7 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn) {
GameInteractor_ExecuteAfterSceneCommands(play->sceneNum);
Play_InitEnvironment(play, play->skyboxId);
/* auto data = static_cast<LUS::Vertex*>(Ship::Context::GetInstance()
/* auto data = static_cast<LUS::Vertex*>(Ship::Context::GetRawInstance()
->GetResourceManager()
->ResourceLoad("object_link_child\\object_link_childVtx_01FE08")
.get());