mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 10:50:29 -05:00
build soh with LUS 1.0.0 (#2881)
* Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
parent
d922b91e15
commit
2308ab8823
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 932 B |
@ -1 +1 @@
|
|||||||
Subproject commit 57660fbb186d85923a1f771bfaafe241c209e579
|
Subproject commit 31189cc9b3891a6049478e955a47589ce964265d
|
@ -356,17 +356,24 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/
|
${CMAKE_CURRENT_SOURCE_DIR}/src/
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/include
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/binarytools
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/log
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/log
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/debug
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/debug
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/menu
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/menu
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/misc
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/utils
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/core
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/utils/binarytools
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/config
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource/type
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource/type
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/resource/factory
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/audio
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/audio
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/window
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/window/gui
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/config
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/public
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/public/libultra
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/public/bridge
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/Mercury
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/tinyxml2
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/tinyxml2
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/
|
${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
namespace LUS
|
namespace LUS
|
||||||
{
|
{
|
||||||
class Resource;
|
class IResource;
|
||||||
class Scene;
|
class Scene;
|
||||||
class DisplayList;
|
class DisplayList;
|
||||||
};
|
};
|
||||||
|
@ -229,7 +229,7 @@ void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) {
|
|||||||
excludedSequences.insert(seqInfo);
|
excludedSequences.insert(seqInfo);
|
||||||
includedSequences.erase(seqInfo);
|
includedSequences.erase(seqInfo);
|
||||||
CVarSetInteger(cvarKey.c_str(), 1);
|
CVarSetInteger(cvarKey.c_str(), 1);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
|
void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
|
||||||
@ -237,7 +237,7 @@ void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
|
|||||||
includedSequences.insert(seqInfo);
|
includedSequences.insert(seqInfo);
|
||||||
excludedSequences.erase(seqInfo);
|
excludedSequences.erase(seqInfo);
|
||||||
CVarClear(cvarKey.c_str());
|
CVarClear(cvarKey.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCollection::InitializeShufflePool() {
|
void AudioCollection::InitializeShufflePool() {
|
||||||
@ -287,4 +287,4 @@ extern "C" bool AudioCollection_HasSequenceNum(uint16_t seqId) {
|
|||||||
|
|
||||||
extern "C" size_t AudioCollection_SequenceMapSize() {
|
extern "C" size_t AudioCollection_SequenceMapSize() {
|
||||||
return AudioCollection::Instance->SequenceMapSize();
|
return AudioCollection::Instance->SequenceMapSize();
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/libultraship.h>
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include "../randomizer/3drando/random.hpp"
|
#include "../randomizer/3drando/random.hpp"
|
||||||
#include "../../OTRGlobals.h"
|
#include "../../OTRGlobals.h"
|
||||||
@ -158,7 +157,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
|
|||||||
const std::string randomizeAllButton = "Randomize All" + hiddenTabId;
|
const std::string randomizeAllButton = "Randomize All" + hiddenTabId;
|
||||||
if (ImGui::Button(resetAllButton.c_str())) {
|
if (ImGui::Button(resetAllButton.c_str())) {
|
||||||
ResetGroup(map, type);
|
ResetGroup(map, type);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
if (type == SEQ_BGM_WORLD) {
|
if (type == SEQ_BGM_WORLD) {
|
||||||
ReplayCurrentBGM();
|
ReplayCurrentBGM();
|
||||||
}
|
}
|
||||||
@ -166,7 +165,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(randomizeAllButton.c_str())) {
|
if (ImGui::Button(randomizeAllButton.c_str())) {
|
||||||
RandomizeGroup(type);
|
RandomizeGroup(type);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
if (type == SEQ_BGM_WORLD) {
|
if (type == SEQ_BGM_WORLD) {
|
||||||
ReplayCurrentBGM();
|
ReplayCurrentBGM();
|
||||||
}
|
}
|
||||||
@ -205,7 +204,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
|
|||||||
|
|
||||||
if (ImGui::Selectable(seqData.label.c_str())) {
|
if (ImGui::Selectable(seqData.label.c_str())) {
|
||||||
CVarSetInteger(cvarKey.c_str(), value);
|
CVarSetInteger(cvarKey.c_str(), value);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
UpdateCurrentBGM(defaultValue, type);
|
UpdateCurrentBGM(defaultValue, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +218,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
|
|||||||
ImGui::PushItemWidth(-FLT_MIN);
|
ImGui::PushItemWidth(-FLT_MIN);
|
||||||
if (ImGui::Button(resetButton.c_str())) {
|
if (ImGui::Button(resetButton.c_str())) {
|
||||||
CVarSetInteger(cvarKey.c_str(), defaultValue);
|
CVarSetInteger(cvarKey.c_str(), defaultValue);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
UpdateCurrentBGM(defaultValue, seqData.category);
|
UpdateCurrentBGM(defaultValue, seqData.category);
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -236,7 +235,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
|
|||||||
auto it = validSequences.begin();
|
auto it = validSequences.begin();
|
||||||
const auto& seqData = *std::next(it, rand() % validSequences.size());
|
const auto& seqData = *std::next(it, rand() % validSequences.size());
|
||||||
CVarSetInteger(cvarKey.c_str(), seqData->sequenceId);
|
CVarSetInteger(cvarKey.c_str(), seqData->sequenceId);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
UpdateCurrentBGM(seqData->sequenceId, type);
|
UpdateCurrentBGM(seqData->sequenceId, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,19 +305,11 @@ void DrawTypeChip(SeqType type) {
|
|||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSfxEditor(bool& open) {
|
void AudioEditor::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gAudioEditor.WindowOpen", 0)) {
|
|
||||||
CVarClear("gAudioEditor.WindowOpen");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioCollection::Instance->InitializeShufflePool();
|
AudioCollection::Instance->InitializeShufflePool();
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(820, 630), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(820, 630), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Audio Editor", &open)) {
|
if (!ImGui::Begin("Audio Editor", &mIsVisible)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -381,7 +372,7 @@ void DrawSfxEditor(bool& open) {
|
|||||||
const std::string resetButton = "Reset##linkVoiceFreqMultiplier";
|
const std::string resetButton = "Reset##linkVoiceFreqMultiplier";
|
||||||
if (ImGui::Button(resetButton.c_str())) {
|
if (ImGui::Button(resetButton.c_str())) {
|
||||||
CVarSetFloat("gLinkVoiceFreqMultiplier", 1.0f);
|
CVarSetFloat("gLinkVoiceFreqMultiplier", 1.0f);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
@ -553,11 +544,6 @@ void DrawSfxEditor(bool& open) {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitAudioEditor() {
|
|
||||||
//Draw the bar in the menu.
|
|
||||||
LUS::AddWindow("Enhancements", "Audio Editor", DrawSfxEditor, CVarGetInteger("gAudioEditor.WindowOpen", 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<SeqType> allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX };
|
std::vector<SeqType> allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX };
|
||||||
|
|
||||||
void AudioEditor_RandomizeAll() {
|
void AudioEditor_RandomizeAll() {
|
||||||
@ -565,7 +551,7 @@ void AudioEditor_RandomizeAll() {
|
|||||||
RandomizeGroup(type);
|
RandomizeGroup(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
ReplayCurrentBGM();
|
ReplayCurrentBGM();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,6 +560,6 @@ void AudioEditor_ResetAll() {
|
|||||||
ResetGroup(AudioCollection::Instance->GetAllSequences(), type);
|
ResetGroup(AudioCollection::Instance->GetAllSequences(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
ReplayCurrentBGM();
|
ReplayCurrentBGM();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
|
||||||
void InitAudioEditor();
|
#include <libultraship/libultraship.h>
|
||||||
|
#include <ImGui/imgui.h>
|
||||||
|
|
||||||
|
class AudioEditor : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using LUS::GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void DrawElement() override;
|
||||||
|
void InitElement() override {};
|
||||||
|
void UpdateElement() override {};
|
||||||
|
~AudioEditor() {};
|
||||||
|
};
|
||||||
|
|
||||||
void AudioEditor_RandomizeAll();
|
void AudioEditor_RandomizeAll();
|
||||||
void AudioEditor_ResetAll();
|
void AudioEditor_ResetAll();
|
||||||
|
@ -10,11 +10,10 @@
|
|||||||
#include <ImGui/imgui.h>
|
#include <ImGui/imgui.h>
|
||||||
#include <ImGui/imgui_internal.h>
|
#include <ImGui/imgui_internal.h>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <libultraship/libultraship.h>
|
#include <libultraship/libultra/controller.h>
|
||||||
#include <Utils/StringHelper.h>
|
#include <Utils/StringHelper.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
#include "Window.h"
|
|
||||||
#include "../../UIWidgets.hpp"
|
#include "../../UIWidgets.hpp"
|
||||||
|
|
||||||
namespace GameControlEditor {
|
namespace GameControlEditor {
|
||||||
@ -86,11 +85,7 @@ namespace GameControlEditor {
|
|||||||
static CustomButtonMap ocarinaSharp = {"Pitch up", "gOcarinaSharpBtnMap", BTN_R};
|
static CustomButtonMap ocarinaSharp = {"Pitch up", "gOcarinaSharpBtnMap", BTN_R};
|
||||||
static CustomButtonMap ocarinaFlat = {"Pitch down", "gOcarinaFlatBtnMap", BTN_Z};
|
static CustomButtonMap ocarinaFlat = {"Pitch down", "gOcarinaFlatBtnMap", BTN_Z};
|
||||||
|
|
||||||
void DrawUI(bool&);
|
void GameControlEditorWindow::InitElement() {
|
||||||
|
|
||||||
void Init() {
|
|
||||||
LUS::AddWindow("Enhancements", "Additional Controller Options", DrawUI, CVarGetInteger("gControllerOptionsEnabled", 0));
|
|
||||||
|
|
||||||
addButtonName(BTN_A, "A");
|
addButtonName(BTN_A, "A");
|
||||||
addButtonName(BTN_B, "B");
|
addButtonName(BTN_B, "B");
|
||||||
addButtonName(BTN_CUP, "C Up");
|
addButtonName(BTN_CUP, "C Up");
|
||||||
@ -137,7 +132,7 @@ namespace GameControlEditor {
|
|||||||
}
|
}
|
||||||
if (ImGui::Selectable(i->second, i->first == currentButton)) {
|
if (ImGui::Selectable(i->second, i->first == currentButton)) {
|
||||||
CVarSetInteger(mapping.cVarName, i->first);
|
CVarSetInteger(mapping.cVarName, i->first);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
@ -145,7 +140,7 @@ namespace GameControlEditor {
|
|||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawOcarinaControlPanel() {
|
void DrawOcarinaControlPanel(GameControlEditorWindow* window) {
|
||||||
if (!ImGui::CollapsingHeader("Ocarina Controls")) {
|
if (!ImGui::CollapsingHeader("Ocarina Controls")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -173,7 +168,7 @@ namespace GameControlEditor {
|
|||||||
ImGui::TableSetupColumn("Modifiers##CustomOcaranaModifiers", PANEL_TABLE_COLUMN_FLAGS);
|
ImGui::TableSetupColumn("Modifiers##CustomOcaranaModifiers", PANEL_TABLE_COLUMN_FLAGS);
|
||||||
TableHelper::InitHeader(false);
|
TableHelper::InitHeader(false);
|
||||||
|
|
||||||
LUS::BeginGroupPanel("Notes", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("Notes", ImGui::GetContentRegionAvail());
|
||||||
labelWidth = ImGui::CalcTextSize("D5").x + 10;
|
labelWidth = ImGui::CalcTextSize("D5").x + 10;
|
||||||
DrawMapping(ocarinaD5, labelWidth, disableMask);
|
DrawMapping(ocarinaD5, labelWidth, disableMask);
|
||||||
DrawMapping(ocarinaB4, labelWidth, disableMask);
|
DrawMapping(ocarinaB4, labelWidth, disableMask);
|
||||||
@ -182,16 +177,16 @@ namespace GameControlEditor {
|
|||||||
DrawMapping(ocarinaD4, labelWidth, disableMask);
|
DrawMapping(ocarinaD4, labelWidth, disableMask);
|
||||||
ImGui::Dummy(ImVec2(0, 5));
|
ImGui::Dummy(ImVec2(0, 5));
|
||||||
float cursorY = ImGui::GetCursorPosY();
|
float cursorY = ImGui::GetCursorPosY();
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
|
|
||||||
TableHelper::NextCol();
|
TableHelper::NextCol();
|
||||||
|
|
||||||
LUS::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("Modifiers", ImGui::GetContentRegionAvail());
|
||||||
labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10;
|
labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10;
|
||||||
DrawMapping(ocarinaSongDisable, labelWidth, disableMask);
|
DrawMapping(ocarinaSongDisable, labelWidth, disableMask);
|
||||||
DrawMapping(ocarinaSharp, labelWidth, disableMask);
|
DrawMapping(ocarinaSharp, labelWidth, disableMask);
|
||||||
DrawMapping(ocarinaFlat, labelWidth, disableMask);
|
DrawMapping(ocarinaFlat, labelWidth, disableMask);
|
||||||
LUS::EndGroupPanel(cursorY - ImGui::GetCursorPosY() + 2);
|
window->EndGroupPanelPublic(cursorY - ImGui::GetCursorPosY() + 2);
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
@ -202,7 +197,7 @@ namespace GameControlEditor {
|
|||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LUS::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("Alternate controls", ImGui::GetContentRegionAvail());
|
||||||
if (ImGui::BeginTable("tableOcarinaAlternateControls", 2, ImGuiTableFlags_SizingFixedSame)) {
|
if (ImGui::BeginTable("tableOcarinaAlternateControls", 2, ImGuiTableFlags_SizingFixedSame)) {
|
||||||
ImGui::TableSetupColumn("D-pad", PANEL_TABLE_COLUMN_FLAGS);
|
ImGui::TableSetupColumn("D-pad", PANEL_TABLE_COLUMN_FLAGS);
|
||||||
ImGui::TableSetupColumn("Right stick", PANEL_TABLE_COLUMN_FLAGS);
|
ImGui::TableSetupColumn("Right stick", PANEL_TABLE_COLUMN_FLAGS);
|
||||||
@ -214,27 +209,28 @@ namespace GameControlEditor {
|
|||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// CurrentPort is indexed started at 1 here due to the Generic tab, instead of 0 like in InputEditor
|
// CurrentPort is indexed started at 1 here due to the Generic tab, instead of 0 like in InputEditorWindow
|
||||||
// Therefore CurrentPort - 1 must always be used inside this function instead of CurrentPort
|
// Therefore CurrentPort - 1 must always be used inside this function instead of CurrentPort
|
||||||
void DrawCustomButtons() {
|
void DrawCustomButtons() {
|
||||||
LUS::GetInputEditor()->DrawControllerSelect(CurrentPort - 1);
|
auto inputEditorWindow = std::reinterpret_pointer_cast<LUS::InputEditorWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Input Editor"));
|
||||||
|
inputEditorWindow->DrawControllerSelect(CurrentPort - 1);
|
||||||
|
|
||||||
LUS::GetInputEditor()->DrawButton("Modifier 1", BTN_MODIFIER1, CurrentPort - 1, &BtnReading);
|
inputEditorWindow->DrawButton("Modifier 1", BTN_MODIFIER1, CurrentPort - 1, &BtnReading);
|
||||||
LUS::GetInputEditor()->DrawButton("Modifier 2", BTN_MODIFIER2, CurrentPort - 1, &BtnReading);
|
inputEditorWindow->DrawButton("Modifier 2", BTN_MODIFIER2, CurrentPort - 1, &BtnReading);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawCameraControlPanel() {
|
void DrawCameraControlPanel(GameControlEditorWindow* window) {
|
||||||
if (!ImGui::CollapsingHeader("Camera Controls")) {
|
if (!ImGui::CollapsingHeader("Camera Controls")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
LUS::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
|
UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
|
||||||
DrawHelpIcon("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
DrawHelpIcon("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis");
|
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis");
|
||||||
@ -255,10 +251,10 @@ namespace GameControlEditor {
|
|||||||
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true);
|
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true);
|
||||||
}
|
}
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
|
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
LUS::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("Third-Person Camera", ImGui::GetContentRegionAvail());
|
||||||
|
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera");
|
UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera");
|
||||||
DrawHelpIcon("Enables free camera control\nNote: You must remap C buttons off of the right stick in the "
|
DrawHelpIcon("Enables free camera control\nNote: You must remap C buttons off of the right stick in the "
|
||||||
@ -276,17 +272,17 @@ namespace GameControlEditor {
|
|||||||
"gFreeCameraDistMax", 100, 900, "", 185, true, false, true);
|
"gFreeCameraDistMax", 100, 900, "", 185, true, false, true);
|
||||||
UIWidgets::PaddedEnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed",
|
UIWidgets::PaddedEnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed",
|
||||||
"gFreeCameraTransitionSpeed", 0, 900, "", 25, true, false, true);
|
"gFreeCameraTransitionSpeed", 0, 900, "", 25, true, false, true);
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawDpadControlPanel() {
|
void DrawDpadControlPanel(GameControlEditorWindow* window) {
|
||||||
if (!ImGui::CollapsingHeader("D-Pad Controls")) {
|
if (!ImGui::CollapsingHeader("D-Pad Controls")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 cursor = ImGui::GetCursorPos();
|
ImVec2 cursor = ImGui::GetCursorPos();
|
||||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||||
LUS::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("D-Pad Options", ImGui::GetContentRegionAvail());
|
||||||
UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", "gDpadPause");
|
UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", "gDpadPause");
|
||||||
DrawHelpIcon("Navigate Pause with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up to equip instead of navigate\n"
|
DrawHelpIcon("Navigate Pause with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up to equip instead of navigate\n"
|
||||||
"To make the cursor only move a single space no matter how long a direction is held, manually set gDpadHoldChange to 0");
|
"To make the cursor only move a single space no matter how long a direction is held, manually set gDpadHoldChange to 0");
|
||||||
@ -295,17 +291,17 @@ namespace GameControlEditor {
|
|||||||
"To make the cursor only move a single space during name entry no matter how long a direction is held, manually set gDpadHoldChange to 0");
|
"To make the cursor only move a single space during name entry no matter how long a direction is held, manually set gDpadHoldChange to 0");
|
||||||
UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
|
UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
|
||||||
DrawHelpIcon("Equip items and equipment on the D-pad\nIf used with D-pad on Pause Screen, you must hold C-Up to equip instead of navigate");
|
DrawHelpIcon("Equip items and equipment on the D-pad\nIf used with D-pad on Pause Screen, you must hold C-Up to equip instead of navigate");
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawMiscControlPanel() {
|
void DrawMiscControlPanel(GameControlEditorWindow* window) {
|
||||||
if (!ImGui::CollapsingHeader("Miscellaneous Controls")) {
|
if (!ImGui::CollapsingHeader("Miscellaneous Controls")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 cursor = ImGui::GetCursorPos();
|
ImVec2 cursor = ImGui::GetCursorPos();
|
||||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||||
LUS::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("Misc Controls", ImGui::GetContentRegionAvail());
|
||||||
UIWidgets::PaddedText("Allow the cursor to be on any slot");
|
UIWidgets::PaddedText("Allow the cursor to be on any slot");
|
||||||
static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" };
|
static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" };
|
||||||
UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY);
|
UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY);
|
||||||
@ -316,20 +312,20 @@ namespace GameControlEditor {
|
|||||||
DrawHelpIcon("Hold the assigned button to change the maximum walking speed\nTo change the assigned button, go into the Ports tabs above");
|
DrawHelpIcon("Hold the assigned button to change the maximum walking speed\nTo change the assigned button, go into the Ports tabs above");
|
||||||
if (CVarGetInteger("gEnableWalkModify", 0)) {
|
if (CVarGetInteger("gEnableWalkModify", 0)) {
|
||||||
UIWidgets::Spacer(5);
|
UIWidgets::Spacer(5);
|
||||||
LUS::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("Walk Modifier", ImGui::GetContentRegionAvail());
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
|
||||||
UIWidgets::PaddedEnhancementSliderFloat("Modifier 1: %d %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
UIWidgets::PaddedEnhancementSliderFloat("Modifier 1: %d %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||||
UIWidgets::PaddedEnhancementSliderFloat("Modifier 2: %d %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
UIWidgets::PaddedEnhancementSliderFloat("Modifier 2: %d %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
}
|
}
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL");
|
UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL");
|
||||||
DrawHelpIcon("Speak to Navi with L but enter first-person camera with C-Up");
|
DrawHelpIcon("Speak to Navi with L but enter first-person camera with C-Up");
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawLEDControlPanel() {
|
void DrawLEDControlPanel(GameControlEditorWindow* window) {
|
||||||
LUS::BeginGroupPanel("LED Colors", ImGui::GetContentRegionAvail());
|
window->BeginGroupPanelPublic("LED Colors", ImGui::GetContentRegionAvail());
|
||||||
static const char* ledSources[4] = { "Original Tunic Colors", "Cosmetics Tunic Colors", "Health Colors", "Custom" };
|
static const char* ledSources[4] = { "Original Tunic Colors", "Cosmetics Tunic Colors", "Health Colors", "Custom" };
|
||||||
UIWidgets::PaddedText("Source");
|
UIWidgets::PaddedText("Source");
|
||||||
UIWidgets::EnhancementCombobox("gLedColorSource", ledSources, LED_SOURCE_TUNIC_ORIGINAL);
|
UIWidgets::EnhancementCombobox("gLedColorSource", ledSources, LED_SOURCE_TUNIC_ORIGINAL);
|
||||||
@ -347,7 +343,7 @@ namespace GameControlEditor {
|
|||||||
color.b = colorVec.z * 255.0;
|
color.b = colorVec.z * 255.0;
|
||||||
|
|
||||||
CVarSetColor24("gLedPort1Color", color);
|
CVarSetColor24("gLedPort1Color", color);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("Custom Color");
|
ImGui::Text("Custom Color");
|
||||||
@ -359,20 +355,12 @@ namespace GameControlEditor {
|
|||||||
CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL) == LED_SOURCE_HEALTH, "Override redundant for health source.",
|
CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL) == LED_SOURCE_HEALTH, "Override redundant for health source.",
|
||||||
UIWidgets::CheckboxGraphics::Cross, true);
|
UIWidgets::CheckboxGraphics::Cross, true);
|
||||||
DrawHelpIcon("Shows red color when health is critical, otherwise displays according to color source.");
|
DrawHelpIcon("Shows red color when health is critical, otherwise displays according to color source.");
|
||||||
LUS::EndGroupPanel();
|
window->EndGroupPanelPublic(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawUI(bool& open) {
|
void GameControlEditorWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gControllerOptionsEnabled", 0)) {
|
|
||||||
CVarClear("gControllerOptionsEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver);
|
||||||
if (ImGui::Begin("Game Controls Configuration", &open)) {
|
if (ImGui::Begin("Game Controls Configuration", &mIsVisible)) {
|
||||||
ImGui::BeginTabBar("##CustomControllers");
|
ImGui::BeginTabBar("##CustomControllers");
|
||||||
if (ImGui::BeginTabItem("Generic")) {
|
if (ImGui::BeginTabItem("Generic")) {
|
||||||
CurrentPort = 0;
|
CurrentPort = 0;
|
||||||
@ -389,17 +377,25 @@ namespace GameControlEditor {
|
|||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
|
|
||||||
if (CurrentPort == 0) {
|
if (CurrentPort == 0) {
|
||||||
DrawOcarinaControlPanel();
|
DrawOcarinaControlPanel(this);
|
||||||
DrawCameraControlPanel();
|
DrawCameraControlPanel(this);
|
||||||
DrawDpadControlPanel();
|
DrawDpadControlPanel(this);
|
||||||
DrawMiscControlPanel();
|
DrawMiscControlPanel(this);
|
||||||
} else {
|
} else {
|
||||||
DrawCustomButtons();
|
DrawCustomButtons();
|
||||||
if (CurrentPort == 1 && LUS::Context::GetInstance()->GetControlDeck()->GetDeviceFromPortIndex(0)->CanSetLed()) {
|
if (CurrentPort == 1 && LUS::Context::GetInstance()->GetControlDeck()->GetDeviceFromPortIndex(0)->CanSetLed()) {
|
||||||
DrawLEDControlPanel();
|
DrawLEDControlPanel(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameControlEditorWindow::BeginGroupPanelPublic(const char* name, const ImVec2& size) {
|
||||||
|
BeginGroupPanel(name, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameControlEditorWindow::EndGroupPanelPublic(float minHeight) {
|
||||||
|
EndGroupPanel(minHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,21 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
namespace GameControlEditor {
|
namespace GameControlEditor {
|
||||||
static int CurrentPort = 0;
|
class GameControlEditorWindow : public LUS::GuiWindow {
|
||||||
static int BtnReading = -1;
|
public:
|
||||||
void Init();
|
using LUS::GuiWindow::GuiWindow;
|
||||||
}
|
|
||||||
|
void BeginGroupPanelPublic(const char* name, const ImVec2& size);
|
||||||
|
void EndGroupPanelPublic(float minHeight);
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
||||||
|
|
||||||
|
static int CurrentPort = 0;
|
||||||
|
static int BtnReading = -1;
|
||||||
|
|
||||||
|
} // namespace GameControlEditor
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "CosmeticsEditor.h"
|
#include "CosmeticsEditor.h"
|
||||||
#include "authenticGfxPatches.h"
|
#include "authenticGfxPatches.h"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -10,6 +9,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <libultraship/libultra/types.h>
|
#include <libultraship/libultra/types.h>
|
||||||
#include "soh/Enhancements/randomizer/3drando/random.hpp"
|
#include "soh/Enhancements/randomizer/3drando/random.hpp"
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
#include "soh/UIWidgets.hpp"
|
#include "soh/UIWidgets.hpp"
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ typedef struct {
|
|||||||
# Silly Options
|
# Silly Options
|
||||||
Lets get this one out of the way, probably the only thing that will be consistent between silly options is how they are rendered
|
Lets get this one out of the way, probably the only thing that will be consistent between silly options is how they are rendered
|
||||||
on the ImGui tab. So when adding one just make sure it follows the same general pattern as the rest. Notably:
|
on the ImGui tab. So when adding one just make sure it follows the same general pattern as the rest. Notably:
|
||||||
- Make sure to RequestCvarSaveOnNextTick(), forgetting this will not persist your changes
|
- Make sure to SaveConsoleVariablesOnNextTick(), forgetting this will not persist your changes
|
||||||
- Make sure reset properly resets the value
|
- Make sure reset properly resets the value
|
||||||
- Depending on your use case you may or may not have to split the cvar into two values (cvar.Changed & cvar.Value)
|
- Depending on your use case you may or may not have to split the cvar into two values (cvar.Changed & cvar.Value)
|
||||||
|
|
||||||
@ -1424,7 +1424,7 @@ void Draw_Placements(){
|
|||||||
void DrawSillyTab() {
|
void DrawSillyTab() {
|
||||||
if (CVarGetInteger("gLetItSnow", 0)) {
|
if (CVarGetInteger("gLetItSnow", 0)) {
|
||||||
if (UIWidgets::EnhancementCheckbox("Let It Snow", "gLetItSnow")) {
|
if (UIWidgets::EnhancementCheckbox("Let It Snow", "gLetItSnow")) {
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (UIWidgets::EnhancementSliderFloat("Link Body Scale: %f", "##Link_BodyScale", "gCosmetics.Link_BodyScale.Value", 0.001f, 0.025f, "", 0.01f, false)) {
|
if (UIWidgets::EnhancementSliderFloat("Link Body Scale: %f", "##Link_BodyScale", "gCosmetics.Link_BodyScale.Value", 0.001f, 0.025f, "", 0.01f, false)) {
|
||||||
@ -1434,7 +1434,7 @@ void DrawSillyTab() {
|
|||||||
if (ImGui::Button("Reset##Link_BodyScale")) {
|
if (ImGui::Button("Reset##Link_BodyScale")) {
|
||||||
CVarClear("gCosmetics.Link_BodyScale.Value");
|
CVarClear("gCosmetics.Link_BodyScale.Value");
|
||||||
CVarClear("gCosmetics.Link_BodyScale.Changed");
|
CVarClear("gCosmetics.Link_BodyScale.Changed");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
static Player* player = GET_PLAYER(gPlayState);
|
static Player* player = GET_PLAYER(gPlayState);
|
||||||
player->actor.scale.x = 0.01f;
|
player->actor.scale.x = 0.01f;
|
||||||
player->actor.scale.y = 0.01f;
|
player->actor.scale.y = 0.01f;
|
||||||
@ -1447,7 +1447,7 @@ void DrawSillyTab() {
|
|||||||
if (ImGui::Button("Reset##Link_HeadScale")) {
|
if (ImGui::Button("Reset##Link_HeadScale")) {
|
||||||
CVarClear("gCosmetics.Link_HeadScale.Value");
|
CVarClear("gCosmetics.Link_HeadScale.Value");
|
||||||
CVarClear("gCosmetics.Link_HeadScale.Changed");
|
CVarClear("gCosmetics.Link_HeadScale.Changed");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %f", "##Link_SwordScale", "gCosmetics.Link_SwordScale.Value", 1.0f, 2.5f, "", 1.0f, false)) {
|
if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %f", "##Link_SwordScale", "gCosmetics.Link_SwordScale.Value", 1.0f, 2.5f, "", 1.0f, false)) {
|
||||||
CVarSetInteger("gCosmetics.Link_SwordScale.Changed", 1);
|
CVarSetInteger("gCosmetics.Link_SwordScale.Changed", 1);
|
||||||
@ -1456,44 +1456,44 @@ void DrawSillyTab() {
|
|||||||
if (ImGui::Button("Reset##Link_SwordScale")) {
|
if (ImGui::Button("Reset##Link_SwordScale")) {
|
||||||
CVarClear("gCosmetics.Link_SwordScale.Value");
|
CVarClear("gCosmetics.Link_SwordScale.Value");
|
||||||
CVarClear("gCosmetics.Link_SwordScale.Changed");
|
CVarClear("gCosmetics.Link_SwordScale.Changed");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %f", "##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength", -300.0f, 1000.0f, "", 0.0f, false);
|
UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %f", "##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength", -300.0f, 1000.0f, "", 0.0f, false);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Reset##BunnyHood_EarLength")) {
|
if (ImGui::Button("Reset##BunnyHood_EarLength")) {
|
||||||
CVarClear("gCosmetics.BunnyHood_EarLength");
|
CVarClear("gCosmetics.BunnyHood_EarLength");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread", -300.0f, 500.0f, "", 0.0f, false);
|
UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread", -300.0f, 500.0f, "", 0.0f, false);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Reset##BunnyHood_EarSpread")) {
|
if (ImGui::Button("Reset##BunnyHood_EarSpread")) {
|
||||||
CVarClear("gCosmetics.BunnyHood_EarSpread");
|
CVarClear("gCosmetics.BunnyHood_EarSpread");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 1000.0f, "", 0.0f, false);
|
UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 1000.0f, "", 0.0f, false);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Reset##Goron_NeckLength")) {
|
if (ImGui::Button("Reset##Goron_NeckLength")) {
|
||||||
CVarClear("gCosmetics.Goron_NeckLength");
|
CVarClear("gCosmetics.Goron_NeckLength");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
UIWidgets::EnhancementCheckbox("Unfix Goron Spin", "gUnfixGoronSpin");
|
UIWidgets::EnhancementCheckbox("Unfix Goron Spin", "gUnfixGoronSpin");
|
||||||
UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", "gCosmetics.Fairies_Size", 0.25f, 5.0f, "", 1.0f, false);
|
UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", "gCosmetics.Fairies_Size", 0.25f, 5.0f, "", 1.0f, false);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Reset##Fairies_Size")) {
|
if (ImGui::Button("Reset##Fairies_Size")) {
|
||||||
CVarClear("gCosmetics.Fairies_Size");
|
CVarClear("gCosmetics.Fairies_Size");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %f", "##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed", 0.25f, 5.0f, "", 1.0f, false);
|
UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %f", "##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed", 0.25f, 5.0f, "", 1.0f, false);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Reset##N64Logo_SpinSpeed")) {
|
if (ImGui::Button("Reset##N64Logo_SpinSpeed")) {
|
||||||
CVarClear("gCosmetics.N64Logo_SpinSpeed");
|
CVarClear("gCosmetics.N64Logo_SpinSpeed");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
UIWidgets::EnhancementSliderFloat("Moon Size: %f", "##Moon_Size", "gCosmetics.Moon_Size", 0.5f, 2.0f, "", 1.0f, false);
|
UIWidgets::EnhancementSliderFloat("Moon Size: %f", "##Moon_Size", "gCosmetics.Moon_Size", 0.5f, 2.0f, "", 1.0f, false);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Reset##Moon_Size")) {
|
if (ImGui::Button("Reset##Moon_Size")) {
|
||||||
CVarClear("gCosmetics.Moon_Size");
|
CVarClear("gCosmetics.Moon_Size");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %f", "##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed.Value", 100.0f, 6000.0f, "", 100.0f, false)) {
|
if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %f", "##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed.Value", 100.0f, 6000.0f, "", 100.0f, false)) {
|
||||||
CVarSetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 1);
|
CVarSetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 1);
|
||||||
@ -1502,7 +1502,7 @@ void DrawSillyTab() {
|
|||||||
if (ImGui::Button("Reset##Kak_Windmill_Speed")) {
|
if (ImGui::Button("Reset##Kak_Windmill_Speed")) {
|
||||||
CVarClear("gCosmetics.Kak_Windmill_Speed.Value");
|
CVarClear("gCosmetics.Kak_Windmill_Speed.Value");
|
||||||
CVarClear("gCosmetics.Kak_Windmill_Speed.Changed");
|
CVarClear("gCosmetics.Kak_Windmill_Speed.Changed");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1610,7 +1610,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
|
|||||||
CVarSetInteger((cosmeticOption.rainbowCvar), 0);
|
CVarSetInteger((cosmeticOption.rainbowCvar), 0);
|
||||||
CVarSetInteger((cosmeticOption.changedCvar), 1);
|
CVarSetInteger((cosmeticOption.changedCvar), 1);
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text(cosmeticOption.label.c_str());
|
ImGui::Text(cosmeticOption.label.c_str());
|
||||||
@ -1618,7 +1618,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
|
|||||||
if (ImGui::Button(("Random##" + cosmeticOption.label).c_str())) {
|
if (ImGui::Button(("Random##" + cosmeticOption.label).c_str())) {
|
||||||
RandomizeColor(cosmeticOption);
|
RandomizeColor(cosmeticOption);
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool isRainbow = (bool)CVarGetInteger((cosmeticOption.rainbowCvar), 0);
|
bool isRainbow = (bool)CVarGetInteger((cosmeticOption.rainbowCvar), 0);
|
||||||
@ -1626,20 +1626,20 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
|
|||||||
CVarSetInteger((cosmeticOption.rainbowCvar), isRainbow);
|
CVarSetInteger((cosmeticOption.rainbowCvar), isRainbow);
|
||||||
CVarSetInteger((cosmeticOption.changedCvar), 1);
|
CVarSetInteger((cosmeticOption.changedCvar), 1);
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool isLocked = (bool)CVarGetInteger((cosmeticOption.lockedCvar), 0);
|
bool isLocked = (bool)CVarGetInteger((cosmeticOption.lockedCvar), 0);
|
||||||
if (ImGui::Checkbox(("Locked##" + cosmeticOption.label).c_str(), &isLocked)) {
|
if (ImGui::Checkbox(("Locked##" + cosmeticOption.label).c_str(), &isLocked)) {
|
||||||
CVarSetInteger((cosmeticOption.lockedCvar), isLocked);
|
CVarSetInteger((cosmeticOption.lockedCvar), isLocked);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
if (CVarGetInteger((cosmeticOption.changedCvar), 0)) {
|
if (CVarGetInteger((cosmeticOption.changedCvar), 0)) {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(("Reset##" + cosmeticOption.label).c_str())) {
|
if (ImGui::Button(("Reset##" + cosmeticOption.label).c_str())) {
|
||||||
ResetColor(cosmeticOption);
|
ResetColor(cosmeticOption);
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1655,7 +1655,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(("Reset##" + label).c_str())) {
|
if (ImGui::Button(("Reset##" + label).c_str())) {
|
||||||
@ -1665,7 +1665,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||||
if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0))) {
|
if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0))) {
|
||||||
@ -1679,17 +1679,9 @@ static const char* colorSchemes[2] = {
|
|||||||
"Gamecube",
|
"Gamecube",
|
||||||
};
|
};
|
||||||
|
|
||||||
void DrawCosmeticsEditor(bool& open) {
|
void CosmeticsEditorWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gCosmeticsEditorEnabled", 0)) {
|
|
||||||
CVarClear("gCosmeticsEditorEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(480, 520), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(480, 520), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Cosmetics Editor", &open)) {
|
if (!ImGui::Begin("Cosmetics Editor", &mIsVisible)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1705,7 +1697,7 @@ void DrawCosmeticsEditor(bool& open) {
|
|||||||
CVarSetInteger(cosmeticOption.lockedCvar, 1);
|
CVarSetInteger(cosmeticOption.lockedCvar, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Unlock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
if (ImGui::Button("Unlock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
||||||
@ -1714,7 +1706,7 @@ void DrawCosmeticsEditor(bool& open) {
|
|||||||
CVarSetInteger(cosmeticOption.lockedCvar, 0);
|
CVarSetInteger(cosmeticOption.lockedCvar, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIWidgets::EnhancementCheckbox("Sync Rainbow colors", "gCosmetics.RainbowSync");
|
UIWidgets::EnhancementCheckbox("Sync Rainbow colors", "gCosmetics.RainbowSync");
|
||||||
@ -1726,7 +1718,7 @@ void DrawCosmeticsEditor(bool& open) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Reset All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
if (ImGui::Button("Reset All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
||||||
@ -1736,7 +1728,7 @@ void DrawCosmeticsEditor(bool& open) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Lock All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) {
|
if (ImGui::Button("Lock All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) {
|
||||||
@ -1745,7 +1737,7 @@ void DrawCosmeticsEditor(bool& open) {
|
|||||||
CVarSetInteger(cosmeticOption.lockedCvar, 1);
|
CVarSetInteger(cosmeticOption.lockedCvar, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Unlock All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
if (ImGui::Button("Unlock All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
|
||||||
@ -1754,7 +1746,7 @@ void DrawCosmeticsEditor(bool& open) {
|
|||||||
CVarSetInteger(cosmeticOption.lockedCvar, 0);
|
CVarSetInteger(cosmeticOption.lockedCvar, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTabBar("CosmeticsContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
|
if (ImGui::BeginTabBar("CosmeticsContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
|
||||||
@ -1779,7 +1771,7 @@ void DrawCosmeticsEditor(bool& open) {
|
|||||||
if (ImGui::Button("Reset##Trails_Duration")) {
|
if (ImGui::Button("Reset##Trails_Duration")) {
|
||||||
CVarClear("gCosmetics.Trails_Duration.Value");
|
CVarClear("gCosmetics.Trails_Duration.Value");
|
||||||
CVarClear("gCosmetics.Trails_Duration.Changed");
|
CVarClear("gCosmetics.Trails_Duration.Changed");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
@ -1819,9 +1811,7 @@ void RegisterOnGameFrameUpdateHook() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitCosmeticsEditor() {
|
void CosmeticsEditorWindow::InitElement() {
|
||||||
// Draw the bar in the menu.
|
|
||||||
LUS::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor, CVarGetInteger("gCosmeticsEditorEnabled", 0));
|
|
||||||
// Convert the `current color` into the format that the ImGui color picker expects
|
// Convert the `current color` into the format that the ImGui color picker expects
|
||||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||||
Color_RGBA8 defaultColor = {cosmeticOption.defaultColor.x, cosmeticOption.defaultColor.y, cosmeticOption.defaultColor.z, cosmeticOption.defaultColor.w};
|
Color_RGBA8 defaultColor = {cosmeticOption.defaultColor.x, cosmeticOption.defaultColor.y, cosmeticOption.defaultColor.z, cosmeticOption.defaultColor.w};
|
||||||
@ -1832,7 +1822,7 @@ void InitCosmeticsEditor() {
|
|||||||
cosmeticOption.currentColor.z = cvarColor.b / 255.0;
|
cosmeticOption.currentColor.z = cvarColor.b / 255.0;
|
||||||
cosmeticOption.currentColor.w = cvarColor.a / 255.0;
|
cosmeticOption.currentColor.w = cvarColor.a / 255.0;
|
||||||
}
|
}
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
ApplyAuthenticGfxPatches();
|
ApplyAuthenticGfxPatches();
|
||||||
|
|
||||||
@ -1848,7 +1838,7 @@ void CosmeticsEditor_RandomizeAll() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1859,6 +1849,6 @@ void CosmeticsEditor_ResetAll() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <ImGuiImpl.h>
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
#define PATCH_GFX(path, name, cvar, index, instruction) \
|
#define PATCH_GFX(path, name, cvar, index, instruction) \
|
||||||
if (CVarGetInteger(cvar, 0)) { \
|
if (CVarGetInteger(cvar, 0)) { \
|
||||||
@ -28,3 +28,12 @@ ImVec4 GetRandomValue(int MaximumPossible);
|
|||||||
void CosmeticsEditor_RandomizeAll();
|
void CosmeticsEditor_RandomizeAll();
|
||||||
void CosmeticsEditor_ResetAll();
|
void CosmeticsEditor_ResetAll();
|
||||||
void ApplyOrResetCustomGfxPatches(bool manualChange = true);
|
void ApplyOrResetCustomGfxPatches(bool manualChange = true);
|
||||||
|
|
||||||
|
class CosmeticsEditorWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
@ -3,8 +3,7 @@
|
|||||||
#include "CrowdControl.h"
|
#include "CrowdControl.h"
|
||||||
#include "CrowdControlTypes.h"
|
#include "CrowdControlTypes.h"
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Console.h>
|
#include <libultraship/libultraship.h>
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <spdlog/fmt/fmt.h>
|
#include <spdlog/fmt/fmt.h>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,6 @@
|
|||||||
#include "actorViewer.h"
|
#include "actorViewer.h"
|
||||||
#include "../../util.h"
|
#include "../../util.h"
|
||||||
#include "../../UIWidgets.hpp"
|
#include "../../UIWidgets.hpp"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "soh/ActorDB.h"
|
#include "soh/ActorDB.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -9,6 +8,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -97,17 +97,9 @@ void PopulateActorDropdown(int i, std::vector<Actor*>& data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawActorViewer(bool& open) {
|
void ActorViewerWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gActorViewerEnabled", 0)) {
|
|
||||||
CVarClear("gActorViewerEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Actor Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Actor Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -352,7 +344,3 @@ void DrawActorViewer(bool& open) {
|
|||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitActorViewer() {
|
|
||||||
LUS::AddWindow("Developer Tools", "Actor Viewer", DrawActorViewer, CVarGetInteger("gActorViewerEnabled", 0));
|
|
||||||
}
|
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void InitActorViewer();
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
|
class ActorViewerWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void DrawElement() override;
|
||||||
|
void InitElement() override {};
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
@ -1,5 +1,4 @@
|
|||||||
#include "colViewer.h"
|
#include "colViewer.h"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "../../frame_interpolation.h"
|
#include "../../frame_interpolation.h"
|
||||||
#include "../../UIWidgets.hpp"
|
#include "../../UIWidgets.hpp"
|
||||||
|
|
||||||
@ -7,6 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -51,17 +51,9 @@ static std::vector<Gfx> sphereGfx;
|
|||||||
static std::vector<Vtx> sphereVtx;
|
static std::vector<Vtx> sphereVtx;
|
||||||
|
|
||||||
// Draws the ImGui window for the collision viewer
|
// Draws the ImGui window for the collision viewer
|
||||||
void DrawColViewerWindow(bool& open) {
|
void ColViewerWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gCollisionViewerEnabled", 0)) {
|
|
||||||
CVarClear("gCollisionViewerEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Collision Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Collision Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -290,9 +282,7 @@ void CreateSphereData() {
|
|||||||
sphereGfx.push_back(gsSPEndDisplayList());
|
sphereGfx.push_back(gsSPEndDisplayList());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitColViewer() {
|
void ColViewerWindow::InitElement() {
|
||||||
LUS::AddWindow("Developer Tools", "Collision Viewer", DrawColViewerWindow, CVarGetInteger("gCollisionViewerEnabled", 0));
|
|
||||||
|
|
||||||
CreateCylinderData();
|
CreateCylinderData();
|
||||||
CreateSphereData();
|
CreateSphereData();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void InitColViewer();
|
#include <libultraship/libultraship.h>
|
||||||
void DrawColViewer();
|
|
||||||
|
void DrawColViewer();
|
||||||
|
|
||||||
|
class ColViewerWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
@ -1,7 +1,6 @@
|
|||||||
#include "debugSaveEditor.h"
|
#include "debugSaveEditor.h"
|
||||||
#include "../../util.h"
|
#include "../../util.h"
|
||||||
#include "../../OTRGlobals.h"
|
#include "../../OTRGlobals.h"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "../../UIWidgets.hpp"
|
#include "../../UIWidgets.hpp"
|
||||||
|
|
||||||
#include <spdlog/fmt/fmt.h>
|
#include <spdlog/fmt/fmt.h>
|
||||||
@ -10,6 +9,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -605,7 +605,7 @@ void DrawInfoTab() {
|
|||||||
|
|
||||||
void DrawBGSItemFlag(uint8_t itemID) {
|
void DrawBGSItemFlag(uint8_t itemID) {
|
||||||
const ItemMapEntry& slotEntry = itemMapping[itemID];
|
const ItemMapEntry& slotEntry = itemMapping[itemID];
|
||||||
ImGui::Image(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
int tradeIndex = itemID - ITEM_POCKET_EGG;
|
int tradeIndex = itemID - ITEM_POCKET_EGG;
|
||||||
bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0;
|
bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0;
|
||||||
@ -647,7 +647,7 @@ void DrawInventoryTab() {
|
|||||||
uint8_t item = gSaveContext.inventory.items[index];
|
uint8_t item = gSaveContext.inventory.items[index];
|
||||||
if (item != ITEM_NONE) {
|
if (item != ITEM_NONE) {
|
||||||
const ItemMapEntry& slotEntry = itemMapping.find(item)->second;
|
const ItemMapEntry& slotEntry = itemMapping.find(item)->second;
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
|
||||||
ImVec2(1, 1), 0)) {
|
ImVec2(1, 1), 0)) {
|
||||||
selectedIndex = index;
|
selectedIndex = index;
|
||||||
ImGui::OpenPopup(itemPopupPicker);
|
ImGui::OpenPopup(itemPopupPicker);
|
||||||
@ -695,7 +695,7 @@ void DrawInventoryTab() {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
const ItemMapEntry& slotEntry = possibleItems[pickerIndex];
|
const ItemMapEntry& slotEntry = possibleItems[pickerIndex];
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
|
||||||
ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
||||||
gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
|
gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
|
||||||
// Set adult trade item flag if you're playing adult trade shuffle in rando
|
// Set adult trade item flag if you're playing adult trade shuffle in rando
|
||||||
@ -733,7 +733,7 @@ void DrawInventoryTab() {
|
|||||||
ImGui::PushItemWidth(32.0f);
|
ImGui::PushItemWidth(32.0f);
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
|
|
||||||
ImGui::Image(LUS::GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f));
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f));
|
||||||
ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item));
|
ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item));
|
||||||
|
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
@ -1148,7 +1148,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
|
|||||||
uint8_t item = items[CUR_UPG_VALUE(categoryId)];
|
uint8_t item = items[CUR_UPG_VALUE(categoryId)];
|
||||||
if (item != ITEM_NONE) {
|
if (item != ITEM_NONE) {
|
||||||
const ItemMapEntry& slotEntry = itemMapping[item];
|
const ItemMapEntry& slotEntry = itemMapping[item];
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
|
||||||
ImVec2(1, 1), 0)) {
|
ImVec2(1, 1), 0)) {
|
||||||
ImGui::OpenPopup(upgradePopupPicker);
|
ImGui::OpenPopup(upgradePopupPicker);
|
||||||
}
|
}
|
||||||
@ -1176,7 +1176,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
|
|||||||
UIWidgets::SetLastItemHoverText("None");
|
UIWidgets::SetLastItemHoverText("None");
|
||||||
} else {
|
} else {
|
||||||
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
|
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
|
||||||
ImVec2(1, 1), 0)) {
|
ImVec2(1, 1), 0)) {
|
||||||
Inventory_ChangeUpgrade(categoryId, pickerIndex);
|
Inventory_ChangeUpgrade(categoryId, pickerIndex);
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
@ -1213,7 +1213,7 @@ void DrawEquipmentTab() {
|
|||||||
bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0;
|
bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0;
|
||||||
const ItemMapEntry& entry = itemMapping[equipmentValues[i]];
|
const ItemMapEntry& entry = itemMapping[equipmentValues[i]];
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
|
||||||
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
||||||
if (hasEquip) {
|
if (hasEquip) {
|
||||||
gSaveContext.inventory.equipment &= ~bitMask;
|
gSaveContext.inventory.equipment &= ~bitMask;
|
||||||
@ -1312,7 +1312,7 @@ void DrawQuestItemButton(uint32_t item) {
|
|||||||
uint32_t bitMask = 1 << entry.id;
|
uint32_t bitMask = 1 << entry.id;
|
||||||
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
|
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
|
||||||
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
||||||
if (hasQuestItem) {
|
if (hasQuestItem) {
|
||||||
gSaveContext.inventory.questItems &= ~bitMask;
|
gSaveContext.inventory.questItems &= ~bitMask;
|
||||||
@ -1330,7 +1330,7 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) {
|
|||||||
uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
|
uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
|
||||||
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0;
|
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0;
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(hasItem ? entry.name : entry.nameFaded),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded),
|
||||||
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
||||||
if (hasItem) {
|
if (hasItem) {
|
||||||
gSaveContext.inventory.dungeonItems[scene] &= ~bitMask;
|
gSaveContext.inventory.dungeonItems[scene] &= ~bitMask;
|
||||||
@ -1377,7 +1377,7 @@ void DrawQuestStatusTab() {
|
|||||||
uint32_t bitMask = 1 << entry.id;
|
uint32_t bitMask = 1 << entry.id;
|
||||||
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
|
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
|
||||||
if (ImGui::ImageButton(LUS::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
|
if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
|
||||||
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
|
||||||
if (hasQuestItem) {
|
if (hasQuestItem) {
|
||||||
gSaveContext.inventory.questItems &= ~bitMask;
|
gSaveContext.inventory.questItems &= ~bitMask;
|
||||||
@ -1440,7 +1440,7 @@ void DrawQuestStatusTab() {
|
|||||||
|
|
||||||
if (dungeonItemsScene != SCENE_BDAN_BOSS) {
|
if (dungeonItemsScene != SCENE_BDAN_BOSS) {
|
||||||
float lineHeight = ImGui::GetTextLineHeightWithSpacing();
|
float lineHeight = ImGui::GetTextLineHeightWithSpacing();
|
||||||
ImGui::Image(LUS::GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight));
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::InputScalar("##Keys", ImGuiDataType_S8, gSaveContext.inventory.dungeonKeys + dungeonItemsScene)) {
|
if (ImGui::InputScalar("##Keys", ImGuiDataType_S8, gSaveContext.inventory.dungeonKeys + dungeonItemsScene)) {
|
||||||
gSaveContext.sohStats.dungeonKeys[dungeonItemsScene] = gSaveContext.inventory.dungeonKeys[dungeonItemsScene];
|
gSaveContext.sohStats.dungeonKeys[dungeonItemsScene] = gSaveContext.inventory.dungeonKeys[dungeonItemsScene];
|
||||||
@ -1733,17 +1733,9 @@ void DrawPlayerTab() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSaveEditor(bool& open) {
|
void SaveEditorWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gSaveEditorEnabled", 0)) {
|
|
||||||
CVarClear("gSaveEditorEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Save Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Save Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1785,35 +1777,33 @@ void DrawSaveEditor(bool& open) {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitSaveEditor() {
|
void SaveEditorWindow::InitElement() {
|
||||||
LUS::AddWindow("Developer Tools", "Save Editor", DrawSaveEditor, CVarGetInteger("gSaveEditorEnabled", 0));
|
|
||||||
|
|
||||||
// Load item icons into ImGui
|
// Load item icons into ImGui
|
||||||
for (const auto& entry : itemMapping) {
|
for (const auto& entry : itemMapping) {
|
||||||
LUS::LoadResource(entry.second.name, entry.second.texturePath);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
|
||||||
LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
|
||||||
}
|
}
|
||||||
for (const auto& entry : gregMapping) {
|
for (const auto& entry : gregMapping) {
|
||||||
ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f);
|
ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f);
|
||||||
ImVec4 gregFadedGreen = gregGreen;
|
ImVec4 gregFadedGreen = gregGreen;
|
||||||
gregFadedGreen.w = 0.3f;
|
gregFadedGreen.w = 0.3f;
|
||||||
LUS::LoadResource(entry.second.name, entry.second.texturePath, gregGreen);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, gregGreen);
|
||||||
LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen);
|
||||||
}
|
}
|
||||||
for (const auto& entry : questMapping) {
|
for (const auto& entry : questMapping) {
|
||||||
LUS::LoadResource(entry.second.name, entry.second.texturePath);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1));
|
||||||
LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
|
||||||
}
|
}
|
||||||
for (const auto& entry : songMapping) {
|
for (const auto& entry : songMapping) {
|
||||||
LUS::LoadResource(entry.name, gSongNoteTex, entry.color);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color);
|
||||||
ImVec4 fadedCol = entry.color;
|
ImVec4 fadedCol = entry.color;
|
||||||
fadedCol.w = 0.3f;
|
fadedCol.w = 0.3f;
|
||||||
LUS::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol);
|
||||||
}
|
}
|
||||||
for (const auto& entry : vanillaSongMapping) {
|
for (const auto& entry : vanillaSongMapping) {
|
||||||
LUS::LoadResource(entry.name, gSongNoteTex, entry.color);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color);
|
||||||
ImVec4 fadedCol = entry.color;
|
ImVec4 fadedCol = entry.color;
|
||||||
fadedCol.w = 0.3f;
|
fadedCol.w = 0.3f;
|
||||||
LUS::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <soh/Enhancements/randomizer/randomizer_inf.h>
|
#include <soh/Enhancements/randomizer/randomizer_inf.h>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
void InitSaveEditor();
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EVENT_CHECK_INF,
|
EVENT_CHECK_INF,
|
||||||
@ -583,4 +582,13 @@ const std::vector<std::string> state3 = {
|
|||||||
"Force Pull Ocarina",
|
"Force Pull Ocarina",
|
||||||
"Restore Nayru's Love",
|
"Restore Nayru's Love",
|
||||||
"Travelling to Hook Target"
|
"Travelling to Hook Target"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SaveEditorWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#include "debugger.h"
|
|
||||||
#include "debugSaveEditor.h"
|
|
||||||
#include "colViewer.h"
|
|
||||||
#include "actorViewer.h"
|
|
||||||
#include "dlViewer.h"
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void Debug_Init(void) {
|
|
||||||
InitSaveEditor();
|
|
||||||
InitColViewer();
|
|
||||||
InitActorViewer();
|
|
||||||
InitDLViewer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Debug_Draw(void) {
|
|
||||||
DrawColViewer();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Debug_Init(void);
|
|
||||||
void Debug_Draw(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,7 +1,6 @@
|
|||||||
#include "actorViewer.h"
|
#include "actorViewer.h"
|
||||||
#include "../../util.h"
|
#include "../../util.h"
|
||||||
#include "../../UIWidgets.hpp"
|
#include "../../UIWidgets.hpp"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
#include "DisplayList.h"
|
#include "DisplayList.h"
|
||||||
#include "../../OTRGlobals.h"
|
#include "../../OTRGlobals.h"
|
||||||
@ -11,6 +10,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <libultraship/libultraship.h>
|
#include <libultraship/libultraship.h>
|
||||||
|
#include "dlViewer.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -38,17 +38,9 @@ std::map<int, std::string> cmdMap = {
|
|||||||
{ G_ENDDL, "gsSPEndDisplayList" },
|
{ G_ENDDL, "gsSPEndDisplayList" },
|
||||||
};
|
};
|
||||||
|
|
||||||
void DrawDLViewer(bool& open) {
|
void DLViewerWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gDLViewerEnabled", 0)) {
|
|
||||||
CVarClear("gDLViewerEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Display List Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Display List Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -140,8 +132,6 @@ void DrawDLViewer(bool& open) {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitDLViewer() {
|
void DLViewerWindow::InitElement() {
|
||||||
LUS::AddWindow("Developer Tools", "Display List Viewer", DrawDLViewer, CVarGetInteger("gDLViewerEnabled", 0));
|
|
||||||
|
|
||||||
displayListsSearchResults = ResourceMgr_ListFiles("*DL", &displayListsSearchResultsCount);
|
displayListsSearchResults = ResourceMgr_ListFiles("*DL", &displayListsSearchResultsCount);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void InitDLViewer();
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
|
class DLViewerWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
||||||
|
@ -335,7 +335,7 @@ void GameInteractor::RawAction::SetCosmeticsColor(uint8_t cosmeticCategory, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
ApplyOrResetCustomGfxPatches();
|
ApplyOrResetCustomGfxPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#include "gameplaystats.h"
|
#include "gameplaystats.h"
|
||||||
}
|
}
|
||||||
|
#include "gameplaystatswindow.h"
|
||||||
|
|
||||||
#include "soh/SaveManager.h"
|
#include "soh/SaveManager.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "ImGuiImpl.h"
|
|
||||||
#include "../UIWidgets.hpp"
|
#include "../UIWidgets.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <Hooks.h>
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -623,17 +623,9 @@ void DrawGameplayStatsOptionsTab() {
|
|||||||
UIWidgets::PaddedEnhancementCheckbox("Show Debug Info", "gGameplayStats.ShowDebugInfo");
|
UIWidgets::PaddedEnhancementCheckbox("Show Debug Info", "gGameplayStats.ShowDebugInfo");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawStatsTracker(bool& open) {
|
void GameplayStatsWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gGameplayStats.Enabled", 0)) {
|
|
||||||
CVarClear("gGameplayStats.Enabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(480, 550), ImGuiCond_Appearing);
|
ImGui::SetNextWindowSize(ImVec2(480, 550), ImGuiCond_Appearing);
|
||||||
if (!ImGui::Begin("Gameplay Stats", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Gameplay Stats", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -862,8 +854,7 @@ void SetupDisplayColors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void InitStatTracker() {
|
void GameplayStatsWindow::InitElement() {
|
||||||
LUS::AddWindow("Enhancements", "Gameplay Stats", DrawStatsTracker, CVarGetInteger("gGameplayStats.Enabled", 0));
|
|
||||||
SetupDisplayNames();
|
SetupDisplayNames();
|
||||||
SetupDisplayColors();
|
SetupDisplayColors();
|
||||||
|
|
||||||
|
11
soh/soh/Enhancements/gameplaystatswindow.h
Normal file
11
soh/soh/Enhancements/gameplaystatswindow.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
#include "gameplaystats.h"
|
||||||
|
|
||||||
|
class GameplayStatsWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
@ -2,9 +2,9 @@
|
|||||||
#include <variant>
|
#include <variant>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
#include "soh/UIWidgets.hpp"
|
#include "soh/UIWidgets.hpp"
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
void clearCvars(std::vector<const char*> cvarsToClear) {
|
void clearCvars(std::vector<const char*> cvarsToClear) {
|
||||||
for(const char* cvar : cvarsToClear) {
|
for(const char* cvar : cvarsToClear) {
|
||||||
@ -59,7 +59,7 @@ void DrawPresetSelector(PresetType presetTypeId) {
|
|||||||
if (selectedPresetId != 0) {
|
if (selectedPresetId != 0) {
|
||||||
applyPreset(selectedPresetDef.entries);
|
applyPreset(selectedPresetDef.entries);
|
||||||
}
|
}
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar(1);
|
ImGui::PopStyleVar(1);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <textures/icon_item_static/icon_item_static.h>
|
#include <textures/icon_item_static/icon_item_static.h>
|
||||||
#include <textures/icon_item_24_static/icon_item_24_static.h>
|
#include <textures/icon_item_24_static/icon_item_24_static.h>
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include "3drando/rando_main.hpp"
|
#include "3drando/rando_main.hpp"
|
||||||
#include "3drando/random.hpp"
|
#include "3drando/random.hpp"
|
||||||
@ -28,6 +27,8 @@
|
|||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "rando_hash.h"
|
#include "rando_hash.h"
|
||||||
#include <boost_custom/container_hash/hash_32.hpp>
|
#include <boost_custom/container_hash/hash_32.hpp>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
#include "randomizer_settings_window.h"
|
||||||
|
|
||||||
extern "C" uint32_t ResourceMgr_IsGameMasterQuest();
|
extern "C" uint32_t ResourceMgr_IsGameMasterQuest();
|
||||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||||
@ -3148,20 +3149,12 @@ bool GenerateRandomizer(std::string seed /*= ""*/) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawRandoEditor(bool& open) {
|
void RandomizerSettingsWindow::DrawElement() {
|
||||||
if (generated) {
|
if (generated) {
|
||||||
generated = 0;
|
generated = 0;
|
||||||
randoThread.join();
|
randoThread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gRandomizerSettingsEnabled", 0)) {
|
|
||||||
CVarClear("gRandomizerSettingsEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Randomizer settings
|
// Randomizer settings
|
||||||
// Logic Settings
|
// Logic Settings
|
||||||
static const char* randoLogicRules[2] = { "Glitchless", "No logic" };
|
static const char* randoLogicRules[2] = { "Glitchless", "No logic" };
|
||||||
@ -3228,7 +3221,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
static bool disableGFKeyring = false;
|
static bool disableGFKeyring = false;
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(920, 600), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(920, 600), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Randomizer Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Randomizer Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4664,7 +4657,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
excludedLocationString += ",";
|
excludedLocationString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text(rcObject->rcShortName.c_str());
|
ImGui::Text(rcObject->rcShortName.c_str());
|
||||||
@ -4705,7 +4698,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
excludedLocationString += ",";
|
excludedLocationString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text(rcObject->rcShortName.c_str());
|
ImGui::Text(rcObject->rcShortName.c_str());
|
||||||
@ -4883,7 +4876,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
enabledTrickString += ",";
|
enabledTrickString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Enable All")) {
|
if (ImGui::Button("Enable All")) {
|
||||||
@ -4900,7 +4893,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
enabledTrickString += ",";
|
enabledTrickString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::BeginTable("trickTags", showTag.size(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) {
|
if (ImGui::BeginTable("trickTags", showTag.size(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) {
|
||||||
@ -4977,7 +4970,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
enabledTrickString += ",";
|
enabledTrickString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::BeginChild("ChildTricksDisabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar);
|
ImGui::BeginChild("ChildTricksDisabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
@ -5013,7 +5006,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
enabledTrickString += ",";
|
enabledTrickString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
DrawTagChips(*rtObject.rtTags);
|
DrawTagChips(*rtObject.rtTags);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -5087,7 +5080,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
enabledTrickString += ",";
|
enabledTrickString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::BeginChild("ChildTricksEnabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar);
|
ImGui::BeginChild("ChildTricksEnabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
@ -5125,7 +5118,7 @@ void DrawRandoEditor(bool& open) {
|
|||||||
enabledTrickString += ",";
|
enabledTrickString += ",";
|
||||||
}
|
}
|
||||||
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
DrawTagChips(*rtObject.rtTags);
|
DrawTagChips(*rtObject.rtTags);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -6131,17 +6124,8 @@ void InitRandoItemTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitRando() {
|
void RandomizerSettingsWindow::InitElement() {
|
||||||
LUS::AddWindow("Randomizer", "Randomizer Settings", DrawRandoEditor, CVarGetInteger("gRandomizerSettingsEnabled", 0));
|
|
||||||
Randomizer::CreateCustomMessages();
|
Randomizer::CreateCustomMessages();
|
||||||
seedString = (char*)calloc(MAX_SEED_STRING_SIZE, sizeof(char));
|
seedString = (char*)calloc(MAX_SEED_STRING_SIZE, sizeof(char));
|
||||||
InitRandoItemTable();
|
InitRandoItemTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void Rando_Init(void) {
|
|
||||||
InitRando();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -102,7 +102,6 @@ class Randomizer {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Rando_Init(void);
|
|
||||||
bool GenerateRandomizer(std::string seed = "");
|
bool GenerateRandomizer(std::string seed = "");
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "randomizer_check_tracker.h"
|
#include "randomizer_check_tracker.h"
|
||||||
#include "../../OTRGlobals.h"
|
#include "../../OTRGlobals.h"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "../../UIWidgets.hpp"
|
#include "../../UIWidgets.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/libultraship.h>
|
||||||
#include <Hooks.h>
|
|
||||||
#include "3drando/item_location.hpp"
|
#include "3drando/item_location.hpp"
|
||||||
|
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
@ -103,20 +103,11 @@ bool optExpandAll; // A bool that will expand all checks once
|
|||||||
RandomizerCheck lastLocationChecked = RC_UNKNOWN_CHECK;
|
RandomizerCheck lastLocationChecked = RC_UNKNOWN_CHECK;
|
||||||
RandomizerCheckArea previousArea = RCAREA_INVALID;
|
RandomizerCheckArea previousArea = RCAREA_INVALID;
|
||||||
RandomizerCheckArea currentArea = RCAREA_INVALID;
|
RandomizerCheckArea currentArea = RCAREA_INVALID;
|
||||||
OSContPad* trackerButtonsPressed;
|
|
||||||
|
|
||||||
std::vector<uint32_t> buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT, BTN_CRIGHT, BTN_L,
|
std::vector<uint32_t> buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT, BTN_CRIGHT, BTN_L,
|
||||||
BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT };
|
BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT };
|
||||||
|
|
||||||
void DrawCheckTracker(bool& open) {
|
void CheckTrackerWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gCheckTrackerEnabled", 0)) {
|
|
||||||
CVarClear("gCheckTrackerEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
if (doInitialize) {
|
if (doInitialize) {
|
||||||
@ -135,6 +126,7 @@ void DrawCheckTracker(bool& open) {
|
|||||||
if (CVarGetInteger("gCheckTrackerDisplayType", 0) == 1) {
|
if (CVarGetInteger("gCheckTrackerDisplayType", 0) == 1) {
|
||||||
int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", 6)];
|
int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", 6)];
|
||||||
int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", 8)];
|
int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", 8)];
|
||||||
|
OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads();
|
||||||
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
|
bool comboButtonsHeld = trackerButtonsPressed != nullptr &&
|
||||||
trackerButtonsPressed[0].button & comboButton1Mask &&
|
trackerButtonsPressed[0].button & comboButton1Mask &&
|
||||||
trackerButtonsPressed[0].button & comboButton2Mask;
|
trackerButtonsPressed[0].button & comboButton2Mask;
|
||||||
@ -143,7 +135,7 @@ void DrawCheckTracker(bool& open) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BeginFloatWindows("Check Tracker", open, ImGuiWindowFlags_NoScrollbar);
|
BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar);
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
ImGui::Text("Waiting for file load..."); //TODO Language
|
ImGui::Text("Waiting for file load..."); //TODO Language
|
||||||
@ -963,18 +955,10 @@ static const char* windowType[] = { "Floating", "Window" };
|
|||||||
static const char* displayType[] = { "Always", "Combo Button Hold" };
|
static const char* displayType[] = { "Always", "Combo Button Hold" };
|
||||||
static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
|
static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
|
||||||
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
|
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
|
||||||
void DrawCheckTrackerOptions(bool& open) {
|
void CheckTrackerSettingsWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gCheckTrackerSettingsEnabled", 0)) {
|
|
||||||
CVarClear("gCheckTrackerSettingsEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
if (!ImGui::Begin("Check Tracker Settings", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Check Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1028,9 +1012,7 @@ void DrawCheckTrackerOptions(bool& open) {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitCheckTracker() {
|
void CheckTrackerWindow::InitElement() {
|
||||||
LUS::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVarGetInteger("gCheckTrackerEnabled", 0));
|
|
||||||
LUS::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions, CVarGetInteger("gCheckTrackerSettingsEnabled", 0));
|
|
||||||
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
|
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
|
||||||
Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
|
Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
|
||||||
Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
|
Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
|
||||||
@ -1051,13 +1033,10 @@ void InitCheckTracker() {
|
|||||||
Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default);
|
Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default);
|
||||||
Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
|
Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
|
||||||
|
|
||||||
LUS::RegisterHook<LUS::ControllerRead>([](OSContPad* cont_pad) {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadFile>([](uint32_t fileNum) {
|
||||||
trackerButtonsPressed = cont_pad;
|
|
||||||
});
|
|
||||||
LUS::RegisterHook<LUS::LoadFile>([](uint32_t fileNum) {
|
|
||||||
doInitialize = true;
|
doInitialize = true;
|
||||||
});
|
});
|
||||||
LUS::RegisterHook<LUS::DeleteFile>([](uint32_t fileNum) {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnDeleteFile>([](uint32_t fileNum) {
|
||||||
Teardown();
|
Teardown();
|
||||||
});
|
});
|
||||||
LocationTable_Init();
|
LocationTable_Init();
|
||||||
|
@ -1,7 +1,31 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
namespace CheckTracker {
|
namespace CheckTracker {
|
||||||
|
|
||||||
|
class CheckTrackerSettingsWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using LUS::GuiWindow::GuiWindow;
|
||||||
|
~CheckTrackerSettingsWindow() {};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InitElement() override {};
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
||||||
|
|
||||||
|
class CheckTrackerWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using LUS::GuiWindow::GuiWindow;
|
||||||
|
~CheckTrackerWindow() {};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
||||||
|
|
||||||
// Check tracker check visibility categories
|
// Check tracker check visibility categories
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RCSHOW_UNCHECKED,
|
RCSHOW_UNCHECKED,
|
||||||
@ -27,7 +51,6 @@ typedef enum {
|
|||||||
//repeat...
|
//repeat...
|
||||||
#define INDEX_TO_16BIT_LITTLE_ENDIAN_BITMASK(idx) (0x8000 >> (7 - (idx % 8) + ((idx % 16) / 8) * 8))
|
#define INDEX_TO_16BIT_LITTLE_ENDIAN_BITMASK(idx) (0x8000 >> (7 - (idx % 8) + ((idx % 16) / 8) * 8))
|
||||||
|
|
||||||
void InitCheckTracker();
|
|
||||||
void DrawCheckTracker(bool& open);
|
|
||||||
|
|
||||||
} // namespace CheckTracker
|
} // namespace CheckTracker
|
@ -40,12 +40,16 @@ typedef struct {
|
|||||||
int16_t overrideDestination;
|
int16_t overrideDestination;
|
||||||
} EntranceOverride;
|
} EntranceOverride;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void Entrance_Init(void);
|
void Entrance_Init(void);
|
||||||
void Entrance_ResetEntranceTable(void);
|
void Entrance_ResetEntranceTable(void);
|
||||||
uint8_t Entrance_EntranceIsNull(EntranceOverride* entranceOverride);
|
uint8_t Entrance_EntranceIsNull(EntranceOverride* entranceOverride);
|
||||||
int16_t Entrance_GetOverride(int16_t index);
|
int16_t Entrance_GetOverride(int16_t index);
|
||||||
int16_t Entrance_OverrideNextIndex(int16_t nextEntranceIndex);
|
int16_t Entrance_OverrideNextIndex(int16_t nextEntranceIndex);
|
||||||
int16_t Entrance_OverrideDynamicExit(int16_t dynamicExitIndex);
|
int16_t Entrance_OverrideDynamicExit(int16_t dynamicExitIndex);
|
||||||
uint32_t Entrance_SceneAndSpawnAre(uint8_t scene, uint8_t spawn);
|
uint32_t Entrance_SceneAndSpawnAre(uint8_t scene, uint8_t spawn);
|
||||||
void Entrance_SetGameOverEntrance(void);
|
void Entrance_SetGameOverEntrance(void);
|
||||||
void Entrance_SetSavewarpEntrance(void);
|
void Entrance_SetSavewarpEntrance(void);
|
||||||
@ -60,5 +64,8 @@ int32_t Entrance_OverrideSpawnSceneRoom(int32_t sceneNum, int32_t spawn, int32_t
|
|||||||
void Entrance_EnableFW(void);
|
void Entrance_EnableFW(void);
|
||||||
uint8_t Entrance_GetIsEntranceDiscovered(uint16_t entranceIndex);
|
uint8_t Entrance_GetIsEntranceDiscovered(uint16_t entranceIndex);
|
||||||
void Entrance_SetEntranceDiscovered(uint16_t entranceIndex);
|
void Entrance_SetEntranceDiscovered(uint16_t entranceIndex);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //_RANDO_ENTRANCE_H_
|
#endif //_RANDO_ENTRANCE_H_
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
#include "randomizer_entrance_tracker.h"
|
#include "randomizer_entrance_tracker.h"
|
||||||
#include "soh/OTRGlobals.h"
|
#include "soh/OTRGlobals.h"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "soh/UIWidgets.hpp"
|
#include "soh/UIWidgets.hpp"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/libultraship.h>
|
||||||
#include <Hooks.h>
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <z64.h>
|
#include <z64.h>
|
||||||
@ -621,18 +619,10 @@ void InitEntranceTrackingData() {
|
|||||||
SortEntranceListByType(destListSortedByType, 1);
|
SortEntranceListByType(destListSortedByType, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawEntranceTracker(bool& open) {
|
void EntranceTrackerWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gEntranceTrackerEnabled", 0)) {
|
|
||||||
CVarClear("gEntranceTrackerEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
if (!ImGui::Begin("Entrance Tracker", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -921,9 +911,7 @@ void DrawEntranceTracker(bool& open) {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitEntranceTracker() {
|
void EntranceTrackerWindow::InitElement() {
|
||||||
LUS::AddWindow("Randomizer", "Entrance Tracker", DrawEntranceTracker, CVarGetInteger("gEntranceTrackerEnabled", 0));
|
|
||||||
|
|
||||||
// Setup hooks for loading and clearing the entrance tracker data
|
// Setup hooks for loading and clearing the entrance tracker data
|
||||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) {
|
||||||
InitEntranceTrackingData();
|
InitEntranceTrackingData();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
// ENTRANCE_GROUP_NO_GROUP,
|
// ENTRANCE_GROUP_NO_GROUP,
|
||||||
@ -79,5 +80,12 @@ void SetCurrentGrottoIDForTracker(int16_t entranceIndex);
|
|||||||
void SetLastEntranceOverrideForTracker(int16_t entranceIndex);
|
void SetLastEntranceOverrideForTracker(int16_t entranceIndex);
|
||||||
void ClearEntranceTrackingData();
|
void ClearEntranceTrackingData();
|
||||||
void InitEntranceTrackingData();
|
void InitEntranceTrackingData();
|
||||||
void DrawEntranceTracker(bool& open);
|
|
||||||
void InitEntranceTracker();
|
class EntranceTrackerWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
@ -1,14 +1,13 @@
|
|||||||
#include "randomizer_item_tracker.h"
|
#include "randomizer_item_tracker.h"
|
||||||
#include "../../util.h"
|
#include "../../util.h"
|
||||||
#include "../../OTRGlobals.h"
|
#include "../../OTRGlobals.h"
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "../../UIWidgets.hpp"
|
#include "../../UIWidgets.hpp"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/libultraship.h>
|
||||||
#include <Hooks.h>
|
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -30,8 +29,6 @@ void DrawBottle(ItemTrackerItem item);
|
|||||||
void DrawQuest(ItemTrackerItem item);
|
void DrawQuest(ItemTrackerItem item);
|
||||||
void DrawSong(ItemTrackerItem item);
|
void DrawSong(ItemTrackerItem item);
|
||||||
|
|
||||||
OSContPad* buttonsPressed;
|
|
||||||
|
|
||||||
bool shouldUpdateVectors = true;
|
bool shouldUpdateVectors = true;
|
||||||
|
|
||||||
std::vector<ItemTrackerItem> mainWindowItems = {};
|
std::vector<ItemTrackerItem> mainWindowItems = {};
|
||||||
@ -452,7 +449,7 @@ void DrawItemCount(ItemTrackerItem item) {
|
|||||||
void DrawEquip(ItemTrackerItem item) {
|
void DrawEquip(ItemTrackerItem item) {
|
||||||
bool hasEquip = (item.data & gSaveContext.inventory.equipment) != 0;
|
bool hasEquip = (item.data & gSaveContext.inventory.equipment) != 0;
|
||||||
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::Image(LUS::GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
|
||||||
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
|
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
|
||||||
@ -462,7 +459,7 @@ void DrawQuest(ItemTrackerItem item) {
|
|||||||
bool hasQuestItem = (item.data & gSaveContext.inventory.questItems) != 0;
|
bool hasQuestItem = (item.data & gSaveContext.inventory.questItems) != 0;
|
||||||
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::Image(LUS::GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
|
||||||
if (item.id == QUEST_SKULL_TOKEN) {
|
if (item.id == QUEST_SKULL_TOKEN) {
|
||||||
@ -524,7 +521,7 @@ void DrawItem(ItemTrackerItem item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
|
||||||
DrawItemCount(item);
|
DrawItemCount(item);
|
||||||
@ -542,7 +539,7 @@ void DrawBottle(ItemTrackerItem item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
|
|
||||||
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
|
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
|
||||||
@ -557,11 +554,11 @@ void DrawDungeonItem(ItemTrackerItem item) {
|
|||||||
bool hasSmallKey = (gSaveContext.inventory.dungeonKeys[item.data]) >= 0;
|
bool hasSmallKey = (gSaveContext.inventory.dungeonKeys[item.data]) >= 0;
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
if (itemId == ITEM_KEY_SMALL) {
|
if (itemId == ITEM_KEY_SMALL) {
|
||||||
ImGui::Image(LUS::GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +598,7 @@ void DrawSong(ItemTrackerItem item) {
|
|||||||
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
|
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
|
||||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
|
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
|
||||||
ImGui::Image(LUS::GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
|
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
|
||||||
ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
|
||||||
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(item.id));
|
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(item.id));
|
||||||
}
|
}
|
||||||
@ -637,7 +634,7 @@ void DrawNotes(bool resizeable = false) {
|
|||||||
ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput);
|
ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput);
|
||||||
if (ImGui::IsItemDeactivatedAfterEdit() && IsValidSaveFile()) {
|
if (ImGui::IsItemDeactivatedAfterEdit() && IsValidSaveFile()) {
|
||||||
CVarSetString(("gItemTrackerNotes" + std::to_string(gSaveContext.fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str());
|
CVarSetString(("gItemTrackerNotes" + std::to_string(gSaveContext.fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str());
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
}
|
}
|
||||||
@ -848,19 +845,14 @@ void UpdateVectors() {
|
|||||||
shouldUpdateVectors = false;
|
shouldUpdateVectors = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawItemTracker(bool& open) {
|
void ItemTrackerWindow::DrawElement() {
|
||||||
UpdateVectors();
|
UpdateVectors();
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gItemTrackerEnabled", 0)) {
|
|
||||||
CVarClear("gItemTrackerEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
|
||||||
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12);
|
int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12);
|
||||||
int comboButton1Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton1", 6)];
|
int comboButton1Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton1", 6)];
|
||||||
int comboButton2Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton2", 8)];
|
int comboButton2Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton2", 8)];
|
||||||
|
OSContPad* buttonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads();
|
||||||
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask;
|
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask;
|
||||||
bool isPaused = CVarGetInteger("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0;
|
bool isPaused = CVarGetInteger("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0;
|
||||||
|
|
||||||
@ -960,18 +952,10 @@ static const char* buttons[14] = { "A", "B", "C-Up", "C-Down", "C-Left", "C-Righ
|
|||||||
static const char* displayTypes[3] = { "Hidden", "Main Window", "Seperate" };
|
static const char* displayTypes[3] = { "Hidden", "Main Window", "Seperate" };
|
||||||
static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Seperate" };
|
static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Seperate" };
|
||||||
|
|
||||||
void DrawItemTrackerOptions(bool& open) {
|
void ItemTrackerSettingsWindow::DrawElement() {
|
||||||
if (!open) {
|
|
||||||
if (CVarGetInteger("gItemTrackerSettingsEnabled", 0)) {
|
|
||||||
CVarClear("gItemTrackerSettingsEnabled");
|
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(600,375), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(600,375), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
if (!ImGui::Begin("Item Tracker Settings", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (!ImGui::Begin("Item Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -991,7 +975,7 @@ void DrawItemTrackerOptions(bool& open) {
|
|||||||
CVarSetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y);
|
CVarSetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y);
|
||||||
CVarSetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z);
|
CVarSetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z);
|
||||||
CVarSetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w);
|
CVarSetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
@ -1086,9 +1070,7 @@ void DrawItemTrackerOptions(bool& open) {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitItemTracker() {
|
void ItemTrackerWindow::InitElement() {
|
||||||
LUS::AddWindow("Randomizer", "Item Tracker", DrawItemTracker, CVarGetInteger("gItemTrackerEnabled", 0));
|
|
||||||
LUS::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions, CVarGetInteger("gItemTrackerSettingsEnabled", 0));
|
|
||||||
float trackerBgR = CVarGetFloat("gItemTrackerBgColorR", 0);
|
float trackerBgR = CVarGetFloat("gItemTrackerBgColorR", 0);
|
||||||
float trackerBgG = CVarGetFloat("gItemTrackerBgColorG", 0);
|
float trackerBgG = CVarGetFloat("gItemTrackerBgColorG", 0);
|
||||||
float trackerBgB = CVarGetFloat("gItemTrackerBgColorB", 0);
|
float trackerBgB = CVarGetFloat("gItemTrackerBgColorB", 0);
|
||||||
@ -1103,16 +1085,14 @@ void InitItemTracker() {
|
|||||||
if (itemTrackerNotes.empty()) {
|
if (itemTrackerNotes.empty()) {
|
||||||
itemTrackerNotes.push_back(0);
|
itemTrackerNotes.push_back(0);
|
||||||
}
|
}
|
||||||
LUS::RegisterHook<LUS::ControllerRead>([](OSContPad* cont_pad) {
|
|
||||||
buttonsPressed = cont_pad;
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadFile>([](uint32_t fileNum) {
|
||||||
});
|
|
||||||
LUS::RegisterHook<LUS::LoadFile>([](uint32_t fileNum) {
|
|
||||||
const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||||
itemTrackerNotes.resize(strlen(initialTrackerNotes) + 1);
|
itemTrackerNotes.resize(strlen(initialTrackerNotes) + 1);
|
||||||
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
|
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
|
||||||
});
|
});
|
||||||
LUS::RegisterHook<LUS::DeleteFile>([](uint32_t fileNum) {
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnDeleteFile>([](uint32_t fileNum) {
|
||||||
CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
void InitItemTracker();
|
|
||||||
void DrawItemTracker(bool& open);
|
|
||||||
void DrawItemAmmo(int itemId);
|
void DrawItemAmmo(int itemId);
|
||||||
|
|
||||||
typedef struct ItemTrackerItem {
|
typedef struct ItemTrackerItem {
|
||||||
@ -25,3 +24,23 @@ typedef struct ItemTrackerDungeon {
|
|||||||
uint32_t id;
|
uint32_t id;
|
||||||
std::vector<uint32_t> items;
|
std::vector<uint32_t> items;
|
||||||
} ItemTrackerDungeon;
|
} ItemTrackerDungeon;
|
||||||
|
|
||||||
|
class ItemTrackerSettingsWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InitElement() override {};
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
||||||
|
|
||||||
|
class ItemTrackerWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
10
soh/soh/Enhancements/randomizer/randomizer_settings_window.h
Normal file
10
soh/soh/Enhancements/randomizer/randomizer_settings_window.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
|
class RandomizerSettingsWindow : public LUS::GuiWindow {
|
||||||
|
public:
|
||||||
|
using GuiWindow::GuiWindow;
|
||||||
|
|
||||||
|
void InitElement() override;
|
||||||
|
void DrawElement() override;
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
@ -2,7 +2,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <libultraship/bridge.h>
|
#include <libultraship/bridge.h>
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
|
|
||||||
//Difficulty base tag vectors:
|
//Difficulty base tag vectors:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "randomizerTypes.h"
|
#include "randomizerTypes.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <unordered_map>
|
||||||
#include <ImGuiImpl.h>
|
#include <vector>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RTAREA_GENERAL,
|
RTAREA_GENERAL,
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
#include <soh/OTRGlobals.h>
|
#include <soh/OTRGlobals.h>
|
||||||
#include <soh/OTRAudio.h>
|
#include <soh/OTRAudio.h>
|
||||||
|
|
||||||
#include <ImGuiImpl.h>
|
|
||||||
|
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
#include "z64save.h"
|
#include "z64save.h"
|
||||||
#include <variables.h>
|
#include <variables.h>
|
||||||
@ -23,6 +21,8 @@
|
|||||||
#include "../../src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h"
|
#include "../../src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h"
|
||||||
#include "../../src/overlays/actors/ovl_En_Fr/z_en_fr.h"
|
#include "../../src/overlays/actors/ovl_En_Fr/z_en_fr.h"
|
||||||
|
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
extern "C" PlayState* gPlayState;
|
extern "C" PlayState* gPlayState;
|
||||||
|
|
||||||
template <> struct fmt::formatter<RequestType> {
|
template <> struct fmt::formatter<RequestType> {
|
||||||
@ -837,7 +837,7 @@ extern "C" void ProcessSaveStateRequests(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
|
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
|
||||||
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot);
|
||||||
this->currentSlot = slot;
|
this->currentSlot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,12 +855,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
|
|||||||
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
|
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
|
||||||
}
|
}
|
||||||
this->states[request.slot]->Save();
|
this->states[request.slot]->Save();
|
||||||
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
|
||||||
break;
|
break;
|
||||||
case RequestType::LOAD:
|
case RequestType::LOAD:
|
||||||
if (this->states.contains(request.slot)) {
|
if (this->states.contains(request.slot)) {
|
||||||
this->states[request.slot]->Load();
|
this->states[request.slot]->Load();
|
||||||
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
|
||||||
} else {
|
} else {
|
||||||
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
||||||
}
|
}
|
||||||
@ -876,7 +876,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
|
|||||||
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
|
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
|
||||||
if (gPlayState == nullptr) {
|
if (gPlayState == nullptr) {
|
||||||
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
|
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
|
||||||
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot);
|
||||||
return SaveStateReturn::FAIL_WRONG_GAMESTATE;
|
return SaveStateReturn::FAIL_WRONG_GAMESTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +890,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
|
|||||||
return SaveStateReturn::SUCCESS;
|
return SaveStateReturn::SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
||||||
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
|
||||||
return SaveStateReturn::FAIL_INVALID_SLOT;
|
return SaveStateReturn::FAIL_INVALID_SLOT;
|
||||||
}
|
}
|
||||||
[[unlikely]] default:
|
[[unlikely]] default:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@
|
|||||||
//
|
|
||||||
// GameMenuBar.hpp
|
|
||||||
// soh
|
|
||||||
//
|
|
||||||
// Created by David Chavez on 24.08.22.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef GameMenuBar_hpp
|
|
||||||
#define GameMenuBar_hpp
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
void enableBetaQuest();
|
|
||||||
void disableBetaQuest();
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace GameMenuBar {
|
|
||||||
void SetupHooks();
|
|
||||||
void Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* GameMenuBar_hpp */
|
|
@ -16,10 +16,9 @@ int32_t OTRGetLastScancode();
|
|||||||
void ResourceMgr_LoadDirectory(const char* resName);
|
void ResourceMgr_LoadDirectory(const char* resName);
|
||||||
void ResourceMgr_LoadFile(const char* resName);
|
void ResourceMgr_LoadFile(const char* resName);
|
||||||
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
||||||
char* GetResourceDataByName(char* texPath);
|
|
||||||
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||||
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||||
size_t GetResourceTexSizeByName(const char* name);
|
size_t ResourceGetTexSizeByName(const char* name);
|
||||||
char* ResourceMgr_LoadTexOrDListByName(char* filePath);
|
char* ResourceMgr_LoadTexOrDListByName(char* filePath);
|
||||||
char* ResourceMgr_LoadIfDListByName(char* filePath);
|
char* ResourceMgr_LoadIfDListByName(char* filePath);
|
||||||
char* ResourceMgr_LoadPlayerAnimByName(char* animPath);
|
char* ResourceMgr_LoadPlayerAnimByName(char* animPath);
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "Enhancements/audio/AudioCollection.h"
|
#include "Enhancements/audio/AudioCollection.h"
|
||||||
#include "Enhancements/audio/AudioEditor.h"
|
#include "Enhancements/audio/AudioEditor.h"
|
||||||
#include "Enhancements/debugconsole.h"
|
#include "Enhancements/debugconsole.h"
|
||||||
#include "Enhancements/debugger/debugger.h"
|
|
||||||
#include "Enhancements/randomizer/randomizer.h"
|
#include "Enhancements/randomizer/randomizer.h"
|
||||||
#include "Enhancements/randomizer/randomizer_entrance_tracker.h"
|
#include "Enhancements/randomizer/randomizer_entrance_tracker.h"
|
||||||
#include "Enhancements/randomizer/randomizer_item_tracker.h"
|
#include "Enhancements/randomizer/randomizer_item_tracker.h"
|
||||||
@ -47,7 +46,6 @@
|
|||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include <Utils/StringHelper.h>
|
#include <Utils/StringHelper.h>
|
||||||
#include <Hooks.h>
|
|
||||||
#include "Enhancements/custom-message/CustomMessageManager.h"
|
#include "Enhancements/custom-message/CustomMessageManager.h"
|
||||||
|
|
||||||
#if not defined (__SWITCH__) && not defined(__WIIU__)
|
#if not defined (__SWITCH__) && not defined(__WIIU__)
|
||||||
@ -73,7 +71,7 @@
|
|||||||
#include "Enhancements/custom-message/CustomMessageTypes.h"
|
#include "Enhancements/custom-message/CustomMessageTypes.h"
|
||||||
#include <functions.h>
|
#include <functions.h>
|
||||||
#include "Enhancements/item-tables/ItemTableManager.h"
|
#include "Enhancements/item-tables/ItemTableManager.h"
|
||||||
#include "GameMenuBar.hpp"
|
#include "SohGui.hpp"
|
||||||
#include "ActorDB.h"
|
#include "ActorDB.h"
|
||||||
|
|
||||||
#ifdef ENABLE_CROWD_CONTROL
|
#ifdef ENABLE_CROWD_CONTROL
|
||||||
@ -247,7 +245,7 @@ OTRGlobals::OTRGlobals() {
|
|||||||
OOT_PAL_GC_DBG2
|
OOT_PAL_GC_DBG2
|
||||||
};
|
};
|
||||||
// tell LUS to reserve 3 SoH specific threads (Game, Audio, Save)
|
// tell LUS to reserve 3 SoH specific threads (Game, Audio, Save)
|
||||||
context = LUS::Context::CreateInstance("Ship of Harkinian", "soh", OTRFiles, {}, 3);
|
context = LUS::Context::CreateInstance("Ship of Harkinian", "soh", "shipofharkinian.json", OTRFiles, {}, 3);
|
||||||
|
|
||||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Animation, "Animation", std::make_shared<LUS::AnimationFactory>());
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Animation, "Animation", std::make_shared<LUS::AnimationFactory>());
|
||||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared<LUS::PlayerAnimationFactory>());
|
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared<LUS::PlayerAnimationFactory>());
|
||||||
@ -331,7 +329,7 @@ bool OTRGlobals::HasOriginal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t OTRGlobals::GetInterpolationFPS() {
|
uint32_t OTRGlobals::GetInterpolationFPS() {
|
||||||
if (LUS::WindowBackend() == LUS::Backend::DX11) {
|
if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) {
|
||||||
return CVarGetInteger("gInterpolationFPS", 20);
|
return CVarGetInteger("gInterpolationFPS", 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,13 +744,12 @@ extern "C" void InitOTR() {
|
|||||||
#elif defined(__WIIU__)
|
#elif defined(__WIIU__)
|
||||||
LUS::WiiU::Init();
|
LUS::WiiU::Init();
|
||||||
#endif
|
#endif
|
||||||
LUS::AddSetupHooksDelegate(GameMenuBar::SetupHooks);
|
|
||||||
LUS::RegisterMenuDrawMethod(GameMenuBar::Draw);
|
|
||||||
|
|
||||||
OTRGlobals::Instance = new OTRGlobals();
|
OTRGlobals::Instance = new OTRGlobals();
|
||||||
SaveManager::Instance = new SaveManager();
|
|
||||||
CustomMessageManager::Instance = new CustomMessageManager();
|
CustomMessageManager::Instance = new CustomMessageManager();
|
||||||
ItemTableManager::Instance = new ItemTableManager();
|
ItemTableManager::Instance = new ItemTableManager();
|
||||||
|
SaveManager::Instance = new SaveManager();
|
||||||
|
SohGui::SetupGuiElements();
|
||||||
GameInteractor::Instance = new GameInteractor();
|
GameInteractor::Instance = new GameInteractor();
|
||||||
AudioCollection::Instance = new AudioCollection();
|
AudioCollection::Instance = new AudioCollection();
|
||||||
ActorDB::Instance = new ActorDB();
|
ActorDB::Instance = new ActorDB();
|
||||||
@ -763,22 +760,13 @@ extern "C" void InitOTR() {
|
|||||||
SpeechSynthesizer::Instance = new SAPISpeechSynthesizer();
|
SpeechSynthesizer::Instance = new SAPISpeechSynthesizer();
|
||||||
SpeechSynthesizer::Instance->Init();
|
SpeechSynthesizer::Instance->Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clearMtx = (uintptr_t)&gMtxClear;
|
clearMtx = (uintptr_t)&gMtxClear;
|
||||||
OTRMessage_Init();
|
OTRMessage_Init();
|
||||||
OTRAudio_Init();
|
OTRAudio_Init();
|
||||||
InitCosmeticsEditor();
|
|
||||||
GameControlEditor::Init();
|
|
||||||
InitAudioEditor();
|
|
||||||
DebugConsole_Init();
|
|
||||||
Debug_Init();
|
|
||||||
Rando_Init();
|
|
||||||
InitItemTracker();
|
|
||||||
InitEntranceTracker();
|
|
||||||
InitStatTracker();
|
|
||||||
CheckTracker::InitCheckTracker();
|
|
||||||
OTRExtScanner();
|
OTRExtScanner();
|
||||||
VanillaItemTable_Init();
|
VanillaItemTable_Init();
|
||||||
|
DebugConsole_Init();
|
||||||
|
|
||||||
InitMods();
|
InitMods();
|
||||||
ActorDB::AddBuiltInCustomActors();
|
ActorDB::AddBuiltInCustomActors();
|
||||||
@ -803,12 +791,22 @@ extern "C" void InitOTR() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void SaveManager_ThreadPoolWait() {
|
||||||
|
SaveManager::Instance->ThreadPoolWait();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void DeinitOTR() {
|
extern "C" void DeinitOTR() {
|
||||||
|
SaveManager_ThreadPoolWait();
|
||||||
OTRAudio_Exit();
|
OTRAudio_Exit();
|
||||||
#ifdef ENABLE_CROWD_CONTROL
|
#ifdef ENABLE_CROWD_CONTROL
|
||||||
CrowdControl::Instance->Disable();
|
CrowdControl::Instance->Disable();
|
||||||
CrowdControl::Instance->Shutdown();
|
CrowdControl::Instance->Shutdown();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Destroying gui here because we have shared ptrs to LUS objects which output to SPDLOG which is destroyed before these shared ptrs.
|
||||||
|
SohGui::Destroy();
|
||||||
|
|
||||||
|
OTRGlobals::Instance->context = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -1108,7 +1106,7 @@ extern "C" void ResourceMgr_LoadFile(const char* resName) {
|
|||||||
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(resName);
|
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(resName);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<LUS::Resource> GetResourceByNameHandlingMQ(const char* path) {
|
std::shared_ptr<LUS::IResource> GetResourceByNameHandlingMQ(const char* path) {
|
||||||
std::string Path = path;
|
std::string Path = path;
|
||||||
if (ResourceMgr_IsGameMasterQuest()) {
|
if (ResourceMgr_IsGameMasterQuest()) {
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
@ -1126,7 +1124,7 @@ extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char*)res->GetPointer();
|
return (char*)res->GetRawPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) {
|
extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) {
|
||||||
@ -1145,7 +1143,7 @@ extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) {
|
|||||||
|
|
||||||
extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) {
|
extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) {
|
||||||
auto res = GetResourceByNameHandlingMQ(texPath);
|
auto res = GetResourceByNameHandlingMQ(texPath);
|
||||||
return res->InitData->Type == LUS::ResourceType::SOH_Background;
|
return res->GetInitData()->Type == LUS::ResourceType::SOH_Background;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize)
|
extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize)
|
||||||
@ -1193,9 +1191,9 @@ extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
|||||||
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
||||||
auto res = GetResourceByNameHandlingMQ(filePath);
|
auto res = GetResourceByNameHandlingMQ(filePath);
|
||||||
|
|
||||||
if (res->InitData->Type == LUS::ResourceType::DisplayList)
|
if (res->GetInitData()->Type == LUS::ResourceType::DisplayList)
|
||||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||||
else if (res->InitData->Type == LUS::ResourceType::Array)
|
else if (res->GetInitData()->Type == LUS::ResourceType::Array)
|
||||||
return (char*)(std::static_pointer_cast<LUS::Array>(res))->Vertices.data();
|
return (char*)(std::static_pointer_cast<LUS::Array>(res))->Vertices.data();
|
||||||
else {
|
else {
|
||||||
return (char*)GetResourceDataByNameHandlingMQ(filePath);
|
return (char*)GetResourceDataByNameHandlingMQ(filePath);
|
||||||
@ -1205,7 +1203,7 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
|||||||
extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) {
|
extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) {
|
||||||
auto res = GetResourceByNameHandlingMQ(filePath);
|
auto res = GetResourceByNameHandlingMQ(filePath);
|
||||||
|
|
||||||
if (res->InitData->Type == LUS::ResourceType::DisplayList)
|
if (res->GetInitData()->Type == LUS::ResourceType::DisplayList)
|
||||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1316,15 +1314,15 @@ extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) {
|
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) {
|
||||||
return (CollisionHeader*) GetResourceDataByName(path);
|
return (CollisionHeader*) ResourceGetDataByName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) {
|
extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) {
|
||||||
return (Vtx*) GetResourceDataByName(path);
|
return (Vtx*) ResourceGetDataByName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
||||||
SequenceData* sequence = (SequenceData*) GetResourceDataByName(path);
|
SequenceData* sequence = (SequenceData*) ResourceGetDataByName(path);
|
||||||
return *sequence;
|
return *sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1389,11 +1387,11 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
||||||
return (SoundFontSample*) GetResourceDataByName(path);
|
return (SoundFontSample*) ResourceGetDataByName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
||||||
return (SoundFont*) GetResourceDataByName(path);
|
return (SoundFont*) ResourceGetDataByName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
||||||
@ -1415,7 +1413,7 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
||||||
return (AnimationHeaderCommon*) GetResourceDataByName(path);
|
return (AnimationHeaderCommon*) ResourceGetDataByName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) {
|
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) {
|
||||||
@ -1429,14 +1427,14 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel
|
|||||||
bool isAlt = CVarGetInteger("gAltAssets", 0);
|
bool isAlt = CVarGetInteger("gAltAssets", 0);
|
||||||
|
|
||||||
if (isAlt) {
|
if (isAlt) {
|
||||||
pathStr = LUS::Resource::gAltAssetPrefix + pathStr;
|
pathStr = LUS::IResource::gAltAssetPrefix + pathStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonHeader* skelHeader = (SkeletonHeader*) GetResourceDataByName(pathStr.c_str());
|
SkeletonHeader* skelHeader = (SkeletonHeader*) ResourceGetDataByName(pathStr.c_str());
|
||||||
|
|
||||||
// If there isn't an alternate model, load the regular one
|
// If there isn't an alternate model, load the regular one
|
||||||
if (isAlt && skelHeader == NULL) {
|
if (isAlt && skelHeader == NULL) {
|
||||||
skelHeader = (SkeletonHeader*) GetResourceDataByName(path);
|
skelHeader = (SkeletonHeader*) ResourceGetDataByName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is only called when a skeleton is initialized.
|
// This function is only called when a skeleton is initialized.
|
||||||
@ -1463,8 +1461,8 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
|
|||||||
return (s32*)GetResourceDataByNameHandlingMQ(path);
|
return (s32*)GetResourceDataByNameHandlingMQ(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path GetSaveFile(std::shared_ptr<Mercury> Conf) {
|
std::filesystem::path GetSaveFile(std::shared_ptr<LUS::Config> Conf) {
|
||||||
const std::string fileName = Conf->getString("Game.SaveName", LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav"));
|
const std::string fileName = Conf->GetString("Game.SaveName", LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav"));
|
||||||
std::filesystem::path saveFile = std::filesystem::absolute(fileName);
|
std::filesystem::path saveFile = std::filesystem::absolute(fileName);
|
||||||
|
|
||||||
if (!exists(saveFile.parent_path())) {
|
if (!exists(saveFile.parent_path())) {
|
||||||
@ -1475,13 +1473,13 @@ std::filesystem::path GetSaveFile(std::shared_ptr<Mercury> Conf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path GetSaveFile() {
|
std::filesystem::path GetSaveFile() {
|
||||||
const std::shared_ptr<Mercury> pConf = OTRGlobals::Instance->context->GetConfig();
|
const std::shared_ptr<LUS::Config> pConf = OTRGlobals::Instance->context->GetConfig();
|
||||||
|
|
||||||
return GetSaveFile(pConf);
|
return GetSaveFile(pConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OTRGlobals::CheckSaveFile(size_t sramSize) const {
|
void OTRGlobals::CheckSaveFile(size_t sramSize) const {
|
||||||
const std::shared_ptr<Mercury> pConf = Instance->context->GetConfig();
|
const std::shared_ptr<LUS::Config> pConf = Instance->context->GetConfig();
|
||||||
|
|
||||||
std::filesystem::path savePath = GetSaveFile(pConf);
|
std::filesystem::path savePath = GetSaveFile(pConf);
|
||||||
std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
|
std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary);
|
||||||
@ -1595,11 +1593,11 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" uint32_t OTRGetCurrentWidth() {
|
extern "C" uint32_t OTRGetCurrentWidth() {
|
||||||
return OTRGlobals::Instance->context->GetWindow()->GetCurrentWidth();
|
return OTRGlobals::Instance->context->GetWindow()->GetWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" uint32_t OTRGetCurrentHeight() {
|
extern "C" uint32_t OTRGetCurrentHeight() {
|
||||||
return OTRGlobals::Instance->context->GetWindow()->GetCurrentHeight();
|
return OTRGlobals::Instance->context->GetWindow()->GetHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color_RGB8 GetColorForControllerLED() {
|
Color_RGB8 GetColorForControllerLED() {
|
||||||
@ -1684,10 +1682,6 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
|
|||||||
return ((int)ceilf(OTRGetDimensionFromRightEdge(v)));
|
return ((int)ceilf(OTRGetDimensionFromRightEdge(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" bool AudioPlayer_Init(void) {
|
|
||||||
return AudioPlayerInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int AudioPlayer_Buffered(void) {
|
extern "C" int AudioPlayer_Buffered(void) {
|
||||||
return AudioPlayerBuffered();
|
return AudioPlayerBuffered();
|
||||||
}
|
}
|
||||||
@ -1714,22 +1708,6 @@ extern "C" int Controller_ShouldRumble(size_t slot) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Controller_BlockGameInput() {
|
|
||||||
auto controlDeck = LUS::Context::GetInstance()->GetControlDeck();
|
|
||||||
|
|
||||||
controlDeck->BlockGameInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void Controller_UnblockGameInput() {
|
|
||||||
auto controlDeck = LUS::Context::GetInstance()->GetControlDeck();
|
|
||||||
|
|
||||||
controlDeck->UnblockGameInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void Hooks_ExecuteAudioInit() {
|
|
||||||
LUS::ExecuteHooks<LUS::AudioInit>();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void* getN64WeirdFrame(s32 i) {
|
extern "C" void* getN64WeirdFrame(s32 i) {
|
||||||
char* weirdFrameBytes = reinterpret_cast<char*>(n64WeirdFrames);
|
char* weirdFrameBytes = reinterpret_cast<char*>(n64WeirdFrames);
|
||||||
return &weirdFrameBytes[i + sizeof(n64WeirdFrames)];
|
return &weirdFrameBytes[i + sizeof(n64WeirdFrames)];
|
||||||
@ -2049,29 +2027,29 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
|||||||
if (textId == TEXT_RANDO_SAVE_VERSION_WARNING) {
|
if (textId == TEXT_RANDO_SAVE_VERSION_WARNING) {
|
||||||
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_RANDO_SAVE_VERSION_WARNING);
|
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_RANDO_SAVE_VERSION_WARNING);
|
||||||
}
|
}
|
||||||
font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition();
|
font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition();
|
||||||
switch (gSaveContext.language) {
|
switch (gSaveContext.language) {
|
||||||
case LANGUAGE_FRA:
|
case LANGUAGE_FRA:
|
||||||
return msgCtx->msgLength = font->msgLength =
|
return msgCtx->msgLength = font->msgLength =
|
||||||
CopyStringToCharBuffer(messageEntry.GetFrench(), buffer, maxBufferSize);
|
CopyStringToCharBuffer(messageEntry.GetFrench(), buffer, maxBufferSize);
|
||||||
case LANGUAGE_GER:
|
case LANGUAGE_GER:
|
||||||
return msgCtx->msgLength = font->msgLength =
|
return msgCtx->msgLength = font->msgLength =
|
||||||
CopyStringToCharBuffer(messageEntry.GetGerman(), buffer, maxBufferSize);
|
CopyStringToCharBuffer(messageEntry.GetGerman(), buffer, maxBufferSize);
|
||||||
case LANGUAGE_ENG:
|
case LANGUAGE_ENG:
|
||||||
default:
|
default:
|
||||||
return msgCtx->msgLength = font->msgLength =
|
return msgCtx->msgLength = font->msgLength =
|
||||||
CopyStringToCharBuffer(messageEntry.GetEnglish(), buffer, maxBufferSize);
|
CopyStringToCharBuffer(messageEntry.GetEnglish(), buffer, maxBufferSize);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Overlay_DisplayText(float duration, const char* text) {
|
extern "C" void Overlay_DisplayText(float duration, const char* text) {
|
||||||
LUS::GetGameOverlay()->TextDrawNotification(duration, true, text);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) {
|
extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) {
|
||||||
float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05;
|
float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05;
|
||||||
LUS::GetGameOverlay()->TextDrawNotification(duration, true, text);
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Entrance_ClearEntranceTrackingData(void) {
|
extern "C" void Entrance_ClearEntranceTrackingData(void) {
|
||||||
@ -2093,7 +2071,3 @@ extern "C" void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex) {
|
|||||||
extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement) {
|
extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement) {
|
||||||
gfx_register_blended_texture(name, mask, replacement);
|
gfx_register_blended_texture(name, mask, replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void SaveManager_ThreadPoolWait() {
|
|
||||||
SaveManager::Instance->ThreadPoolWait();
|
|
||||||
}
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <soh/Enhancements/item-tables/ItemTableTypes.h>
|
#include <soh/Enhancements/item-tables/ItemTableTypes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <Window.h>
|
#include <Context.h>
|
||||||
#include "Enhancements/savestates.h"
|
#include "Enhancements/savestates.h"
|
||||||
#include "Enhancements/randomizer/randomizer.h"
|
#include "Enhancements/randomizer/randomizer.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -103,7 +103,6 @@ float OTRGetDimensionFromLeftEdge(float v);
|
|||||||
float OTRGetDimensionFromRightEdge(float v);
|
float OTRGetDimensionFromRightEdge(float v);
|
||||||
int16_t OTRGetRectDimensionFromLeftEdge(float v);
|
int16_t OTRGetRectDimensionFromLeftEdge(float v);
|
||||||
int16_t OTRGetRectDimensionFromRightEdge(float v);
|
int16_t OTRGetRectDimensionFromRightEdge(float v);
|
||||||
bool AudioPlayer_Init(void);
|
|
||||||
int AudioPlayer_Buffered(void);
|
int AudioPlayer_Buffered(void);
|
||||||
int AudioPlayer_GetDesiredBuffered(void);
|
int AudioPlayer_GetDesiredBuffered(void);
|
||||||
void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
|
void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
|
||||||
@ -111,7 +110,6 @@ void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
|||||||
int Controller_ShouldRumble(size_t slot);
|
int Controller_ShouldRumble(size_t slot);
|
||||||
void Controller_BlockGameInput();
|
void Controller_BlockGameInput();
|
||||||
void Controller_UnblockGameInput();
|
void Controller_UnblockGameInput();
|
||||||
void Hooks_ExecuteAudioInit();
|
|
||||||
void* getN64WeirdFrame(s32 i);
|
void* getN64WeirdFrame(s32 i);
|
||||||
int GetEquipNowMessage(char* buffer, char* src, const int maxBufferSize);
|
int GetEquipNowMessage(char* buffer, char* src, const int maxBufferSize);
|
||||||
u32 SpoilerFileExists(const char* spoilerFileName);
|
u32 SpoilerFileExists(const char* spoilerFileName);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include <variables.h>
|
#include <variables.h>
|
||||||
#include <Hooks.h>
|
|
||||||
#include "soh/Enhancements/boss-rush/BossRush.h"
|
#include "soh/Enhancements/boss-rush/BossRush.h"
|
||||||
#include <libultraship/libultraship.h>
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
@ -354,7 +353,6 @@ void SaveManager::Init() {
|
|||||||
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
|
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
|
||||||
auto sOldSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav");
|
auto sOldSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav");
|
||||||
auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.bak");
|
auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.bak");
|
||||||
LUS::RegisterHook<LUS::ExitGame>([this]() { ThreadPoolWait(); });
|
|
||||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnExitGame>([this](uint32_t fileNum) { ThreadPoolWait(); });
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnExitGame>([this](uint32_t fileNum) { ThreadPoolWait(); });
|
||||||
|
|
||||||
// If the save directory does not exist, create it
|
// If the save directory does not exist, create it
|
||||||
@ -838,7 +836,9 @@ void SaveManager::LoadFile(int fileNum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::ThreadPoolWait() {
|
void SaveManager::ThreadPoolWait() {
|
||||||
smThreadPool->wait_for_tasks();
|
if (smThreadPool) {
|
||||||
|
smThreadPool->wait_for_tasks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SaveManager::SaveFile_Exist(int fileNum) {
|
bool SaveManager::SaveFile_Exist(int fileNum) {
|
||||||
@ -2334,7 +2334,6 @@ extern "C" void Save_SaveGlobal(void) {
|
|||||||
|
|
||||||
extern "C" void Save_LoadFile(void) {
|
extern "C" void Save_LoadFile(void) {
|
||||||
SaveManager::Instance->LoadFile(gSaveContext.fileNum);
|
SaveManager::Instance->LoadFile(gSaveContext.fileNum);
|
||||||
LUS::ExecuteHooks<LUS::LoadFile>(gSaveContext.fileNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Save_AddLoadFunction(char* name, int version, SaveManager::LoadFunc func) {
|
extern "C" void Save_AddLoadFunction(char* name, int version, SaveManager::LoadFunc func) {
|
||||||
@ -2355,7 +2354,6 @@ extern "C" void Save_CopyFile(int from, int to) {
|
|||||||
|
|
||||||
extern "C" void Save_DeleteFile(int fileNum) {
|
extern "C" void Save_DeleteFile(int fileNum) {
|
||||||
SaveManager::Instance->DeleteZeldaFile(fileNum);
|
SaveManager::Instance->DeleteZeldaFile(fileNum);
|
||||||
LUS::ExecuteHooks<LUS::DeleteFile>(fileNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" u32 Save_Exist(int fileNum) {
|
extern "C" u32 Save_Exist(int fileNum) {
|
||||||
|
@ -31,9 +31,7 @@ typedef struct {
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include "thread-pool/BS_thread_pool.hpp"
|
#include "thread-pool/BS_thread_pool.hpp"
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "z64save.h"
|
#include "z64save.h"
|
||||||
}
|
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
208
soh/soh/SohGui.cpp
Normal file
208
soh/soh/SohGui.cpp
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
//
|
||||||
|
// SohGui.cpp
|
||||||
|
// soh
|
||||||
|
//
|
||||||
|
// Created by David Chavez on 24.08.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "SohGui.hpp"
|
||||||
|
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
#include <ImGui/imgui.h>
|
||||||
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
|
#include <ImGui/imgui_internal.h>
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
#include <Fast3D/gfx_pc.h>
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include "graphic/Fast3D/gfx_metal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __SWITCH__
|
||||||
|
#include <port/switch/SwitchImpl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "UIWidgets.hpp"
|
||||||
|
#include "include/global.h"
|
||||||
|
#include "include/z64audio.h"
|
||||||
|
#include "soh/SaveManager.h"
|
||||||
|
#include "OTRGlobals.h"
|
||||||
|
#include "soh/Enhancements/presets.h"
|
||||||
|
#include "soh/resource/type/Skeleton.h"
|
||||||
|
#include "libultraship/libultraship.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_CROWD_CONTROL
|
||||||
|
#include "Enhancements/crowd-control/CrowdControl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "Enhancements/game-interactor/GameInteractor.h"
|
||||||
|
#include "Enhancements/cosmetics/authenticGfxPatches.h"
|
||||||
|
|
||||||
|
bool ShouldClearTextureCacheAtEndOfFrame = false;
|
||||||
|
bool isBetaQuestEnabled = false;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void enableBetaQuest() { isBetaQuestEnabled = true; }
|
||||||
|
void disableBetaQuest() { isBetaQuestEnabled = false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace SohGui {
|
||||||
|
|
||||||
|
// MARK: - Properties
|
||||||
|
|
||||||
|
static const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" };
|
||||||
|
static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" };
|
||||||
|
static const char* allPowers[9] = {
|
||||||
|
"Vanilla (1x)",
|
||||||
|
"Double (2x)",
|
||||||
|
"Quadruple (4x)",
|
||||||
|
"Octuple (8x)",
|
||||||
|
"Foolish (16x)",
|
||||||
|
"Ridiculous (32x)",
|
||||||
|
"Merciless (64x)",
|
||||||
|
"Pure Torture (128x)",
|
||||||
|
"OHKO (256x)" };
|
||||||
|
static const char* subPowers[8] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6], allPowers[7] };
|
||||||
|
static const char* subSubPowers[7] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6] };
|
||||||
|
static const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" };
|
||||||
|
static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" };
|
||||||
|
static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" };
|
||||||
|
static const char* bonkDamageValues[8] = {
|
||||||
|
"No Damage",
|
||||||
|
"0.25 Heart",
|
||||||
|
"0.5 Heart",
|
||||||
|
"1 Heart",
|
||||||
|
"2 Hearts",
|
||||||
|
"4 Hearts",
|
||||||
|
"8 Hearts",
|
||||||
|
"OHKO"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const inline std::vector<std::pair<const char*, const char*>> audioBackends = {
|
||||||
|
#ifdef _WIN32
|
||||||
|
{ "wasapi", "Windows Audio Session API" },
|
||||||
|
#endif
|
||||||
|
#if defined(__linux)
|
||||||
|
{ "pulse", "PulseAudio" },
|
||||||
|
#endif
|
||||||
|
{ "sdl", "SDL Audio" }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
std::string GetWindowButtonText(const char* text, bool menuOpen) {
|
||||||
|
char buttonText[100] = "";
|
||||||
|
if (menuOpen) {
|
||||||
|
strcat(buttonText, ICON_FA_CHEVRON_RIGHT " ");
|
||||||
|
}
|
||||||
|
strcat(buttonText, text);
|
||||||
|
if (!menuOpen) { strcat(buttonText, " "); }
|
||||||
|
return buttonText;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: - Delegates
|
||||||
|
|
||||||
|
std::shared_ptr<SohMenuBar> mSohMenuBar;
|
||||||
|
|
||||||
|
std::shared_ptr<LUS::GuiWindow> mConsoleWindow;
|
||||||
|
std::shared_ptr<LUS::GuiWindow> mStatsWindow;
|
||||||
|
std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;
|
||||||
|
|
||||||
|
std::shared_ptr<AudioEditor> mAudioEditorWindow;
|
||||||
|
std::shared_ptr<GameControlEditor::GameControlEditorWindow> mGameControlEditorWindow;
|
||||||
|
std::shared_ptr<CosmeticsEditorWindow> mCosmeticsEditorWindow;
|
||||||
|
std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
|
||||||
|
std::shared_ptr<ColViewerWindow> mColViewerWindow;
|
||||||
|
std::shared_ptr<SaveEditorWindow> mSaveEditorWindow;
|
||||||
|
std::shared_ptr<DLViewerWindow> mDLViewerWindow;
|
||||||
|
std::shared_ptr<GameplayStatsWindow> mGameplayStatsWindow;
|
||||||
|
std::shared_ptr<CheckTracker::CheckTrackerSettingsWindow> mCheckTrackerSettingsWindow;
|
||||||
|
std::shared_ptr<CheckTracker::CheckTrackerWindow> mCheckTrackerWindow;
|
||||||
|
std::shared_ptr<EntranceTrackerWindow> mEntranceTrackerWindow;
|
||||||
|
std::shared_ptr<ItemTrackerSettingsWindow> mItemTrackerSettingsWindow;
|
||||||
|
std::shared_ptr<ItemTrackerWindow> mItemTrackerWindow;
|
||||||
|
std::shared_ptr<RandomizerSettingsWindow> mRandomizerSettingsWindow;
|
||||||
|
|
||||||
|
void SetupGuiElements() {
|
||||||
|
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui();
|
||||||
|
|
||||||
|
mSohMenuBar = std::make_shared<SohMenuBar>("gOpenMenuBar", CVarGetInteger("gOpenMenuBar", 0));
|
||||||
|
gui->SetMenuBar(std::reinterpret_pointer_cast<LUS::GuiMenuBar>(mSohMenuBar));
|
||||||
|
|
||||||
|
if (gui->GetMenuBar() && !gui->GetMenuBar()->IsVisible()) {
|
||||||
|
#if defined(__SWITCH__) || defined(__WIIU__)
|
||||||
|
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press - to access enhancements menu");
|
||||||
|
#else
|
||||||
|
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press F1 to access enhancements menu");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
mStatsWindow = gui->GetGuiWindow("Stats");
|
||||||
|
if (mStatsWindow == nullptr) {
|
||||||
|
SPDLOG_ERROR("Could not find stats window");
|
||||||
|
}
|
||||||
|
|
||||||
|
mConsoleWindow = gui->GetGuiWindow("Console");
|
||||||
|
if (mConsoleWindow == nullptr) {
|
||||||
|
SPDLOG_ERROR("Could not find console window");
|
||||||
|
}
|
||||||
|
|
||||||
|
mInputEditorWindow = gui->GetGuiWindow("Input Editor");
|
||||||
|
if (mInputEditorWindow == nullptr) {
|
||||||
|
SPDLOG_ERROR("Could not find input editor window");
|
||||||
|
}
|
||||||
|
|
||||||
|
mAudioEditorWindow = std::make_shared<AudioEditor>("gAudioEditor.WindowOpen", "Audio Editor");
|
||||||
|
gui->AddGuiWindow(mAudioEditorWindow);
|
||||||
|
mGameControlEditorWindow = std::make_shared<GameControlEditor::GameControlEditorWindow>("gGameControlEditorEnabled", "Game Control Editor");
|
||||||
|
gui->AddGuiWindow(mGameControlEditorWindow);
|
||||||
|
mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>("gCosmeticsEditorEnabled", "Cosmetics Editor");
|
||||||
|
gui->AddGuiWindow(mCosmeticsEditorWindow);
|
||||||
|
mActorViewerWindow = std::make_shared<ActorViewerWindow>("gActorViewerEnabled", "Actor Viewer");
|
||||||
|
gui->AddGuiWindow(mActorViewerWindow);
|
||||||
|
mColViewerWindow = std::make_shared<ColViewerWindow>("gCollisionViewerEnabled", "Collision Viewer");
|
||||||
|
gui->AddGuiWindow(mColViewerWindow);
|
||||||
|
mSaveEditorWindow = std::make_shared<SaveEditorWindow>("gSaveEditorEnabled", "Save Editor");
|
||||||
|
gui->AddGuiWindow(mSaveEditorWindow);
|
||||||
|
mDLViewerWindow = std::make_shared<DLViewerWindow>("gDLViewerEnabled", "Display List Viewer");
|
||||||
|
gui->AddGuiWindow(mDLViewerWindow);
|
||||||
|
mGameplayStatsWindow = std::make_shared<GameplayStatsWindow>("gGameplayStatsEnabled", "Gameplay Stats");
|
||||||
|
gui->AddGuiWindow(mGameplayStatsWindow);
|
||||||
|
mCheckTrackerWindow = std::make_shared<CheckTracker::CheckTrackerWindow>("gCheckTrackerEnabled", "Check Tracker");
|
||||||
|
gui->AddGuiWindow(mCheckTrackerWindow);
|
||||||
|
mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>("gCheckTrackerSettingsEnabled", "Check Tracker Settings");
|
||||||
|
gui->AddGuiWindow(mCheckTrackerSettingsWindow);
|
||||||
|
mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>("gEntranceTrackerEnabled","Entrance Tracker");
|
||||||
|
gui->AddGuiWindow(mEntranceTrackerWindow);
|
||||||
|
mItemTrackerWindow = std::make_shared<ItemTrackerWindow>("gItemTrackerEnabled", "Item Tracker");
|
||||||
|
gui->AddGuiWindow(mItemTrackerWindow);
|
||||||
|
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>("gItemTrackerSettingsEnabled", "Item Tracker Settings");
|
||||||
|
gui->AddGuiWindow(mItemTrackerSettingsWindow);
|
||||||
|
mRandomizerSettingsWindow = std::make_shared<RandomizerSettingsWindow>("gRandomizerSettingsEnabled", "Randomizer Settings");
|
||||||
|
gui->AddGuiWindow(mRandomizerSettingsWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Destroy() {
|
||||||
|
mRandomizerSettingsWindow = nullptr;
|
||||||
|
mItemTrackerWindow = nullptr;
|
||||||
|
mItemTrackerSettingsWindow = nullptr;
|
||||||
|
mEntranceTrackerWindow = nullptr;
|
||||||
|
mCheckTrackerWindow = nullptr;
|
||||||
|
mCheckTrackerSettingsWindow = nullptr;
|
||||||
|
mGameplayStatsWindow = nullptr;
|
||||||
|
mDLViewerWindow = nullptr;
|
||||||
|
mSaveEditorWindow = nullptr;
|
||||||
|
mColViewerWindow = nullptr;
|
||||||
|
mActorViewerWindow = nullptr;
|
||||||
|
mCosmeticsEditorWindow = nullptr;
|
||||||
|
mGameControlEditorWindow = nullptr;
|
||||||
|
mAudioEditorWindow = nullptr;
|
||||||
|
mInputEditorWindow = nullptr;
|
||||||
|
mStatsWindow = nullptr;
|
||||||
|
mConsoleWindow = nullptr;
|
||||||
|
mSohMenuBar = nullptr;
|
||||||
|
}
|
||||||
|
}
|
42
soh/soh/SohGui.hpp
Normal file
42
soh/soh/SohGui.hpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//
|
||||||
|
// SohGui.hpp
|
||||||
|
// soh
|
||||||
|
//
|
||||||
|
// Created by David Chavez on 24.08.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef SohGui_hpp
|
||||||
|
#define SohGui_hpp
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "SohMenuBar.h"
|
||||||
|
#include "Enhancements/audio/AudioEditor.h"
|
||||||
|
#include "Enhancements/controls/GameControlEditor.h"
|
||||||
|
#include "Enhancements/cosmetics/CosmeticsEditor.h"
|
||||||
|
#include "Enhancements/debugger/actorViewer.h"
|
||||||
|
#include "Enhancements/debugger/colViewer.h"
|
||||||
|
#include "Enhancements/debugger/debugSaveEditor.h"
|
||||||
|
#include "Enhancements/debugger/dlViewer.h"
|
||||||
|
#include "Enhancements/gameplaystatswindow.h"
|
||||||
|
#include "Enhancements/randomizer/randomizer_check_tracker.h"
|
||||||
|
#include "Enhancements/randomizer/randomizer_entrance_tracker.h"
|
||||||
|
#include "Enhancements/randomizer/randomizer_item_tracker.h"
|
||||||
|
#include "Enhancements/randomizer/randomizer_settings_window.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void enableBetaQuest();
|
||||||
|
void disableBetaQuest();
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace SohGui {
|
||||||
|
void SetupHooks();
|
||||||
|
void SetupGuiElements();
|
||||||
|
void Draw();
|
||||||
|
void Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SohGui_hpp */
|
1463
soh/soh/SohMenuBar.cpp
Normal file
1463
soh/soh/SohMenuBar.cpp
Normal file
File diff suppressed because it is too large
Load Diff
16
soh/soh/SohMenuBar.h
Normal file
16
soh/soh/SohMenuBar.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
#include "window/gui/GuiMenuBar.h"
|
||||||
|
#include "window/gui/GuiElement.h"
|
||||||
|
|
||||||
|
namespace SohGui {
|
||||||
|
class SohMenuBar : public LUS::GuiMenuBar {
|
||||||
|
public:
|
||||||
|
using LUS::GuiMenuBar::GuiMenuBar;
|
||||||
|
protected:
|
||||||
|
void DrawElement() override;
|
||||||
|
void InitElement() override {};
|
||||||
|
void UpdateElement() override {};
|
||||||
|
};
|
||||||
|
} // namespace SohGui
|
@ -9,8 +9,7 @@
|
|||||||
|
|
||||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
#include <ImGui/imgui_internal.h>
|
#include <ImGui/imgui_internal.h>
|
||||||
#include <ImGuiImpl.h>
|
#include <libultraship/libultraship.h>
|
||||||
#include <libultraship/bridge.h>
|
|
||||||
|
|
||||||
#include <libultraship/libultra/types.h>
|
#include <libultraship/libultra/types.h>
|
||||||
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
|
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
|
||||||
@ -206,7 +205,7 @@ namespace UIWidgets {
|
|||||||
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
|
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
|
||||||
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
|
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
|
||||||
CVarSetInteger(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +245,7 @@ namespace UIWidgets {
|
|||||||
CVarSetInteger(cvarName, i);
|
CVarSetInteger(cvarName, i);
|
||||||
selected = i;
|
selected = i;
|
||||||
changed = true;
|
changed = true;
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,7 +258,7 @@ namespace UIWidgets {
|
|||||||
if (disabledValue >= 0 && selected != disabledValue) {
|
if (disabledValue >= 0 && selected != disabledValue) {
|
||||||
CVarSetInteger(cvarName, disabledValue);
|
CVarSetInteger(cvarName, disabledValue);
|
||||||
changed = true;
|
changed = true;
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +347,7 @@ namespace UIWidgets {
|
|||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
CVarSetInteger(cvarName, val);
|
CVarSetInteger(cvarName, val);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
@ -424,7 +423,7 @@ namespace UIWidgets {
|
|||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
CVarSetFloat(cvarName, val);
|
CVarSetFloat(cvarName, val);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
@ -471,7 +470,7 @@ namespace UIWidgets {
|
|||||||
int val = CVarGetInteger(cvarName, 0);
|
int val = CVarGetInteger(cvarName, 0);
|
||||||
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
|
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
|
||||||
CVarSetInteger(cvarName, id);
|
CVarSetInteger(cvarName, id);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -498,7 +497,7 @@ namespace UIWidgets {
|
|||||||
|
|
||||||
CVarSetColor(cvarName, colorsRGBA);
|
CVarSetColor(cvarName, colorsRGBA);
|
||||||
CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color");
|
Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color");
|
||||||
@ -523,7 +522,7 @@ namespace UIWidgets {
|
|||||||
NewColors.b = fmin(fmax(colors->z * 255, 0), 255);
|
NewColors.b = fmin(fmax(colors->z * 255, 0), 255);
|
||||||
CVarSetColor(cvarName, NewColors);
|
CVarSetColor(cvarName, NewColors);
|
||||||
CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
|
CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
Tooltip("Chooses a random color\nOverwrites previously chosen color");
|
Tooltip("Chooses a random color\nOverwrites previously chosen color");
|
||||||
@ -584,7 +583,7 @@ namespace UIWidgets {
|
|||||||
colors.a = 255.0;
|
colors.a = 255.0;
|
||||||
|
|
||||||
CVarSetColor(cvarName, colors);
|
CVarSetColor(cvarName, colors);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -600,7 +599,7 @@ namespace UIWidgets {
|
|||||||
colors.a = ColorRGBA.w * 255.0;
|
colors.a = ColorRGBA.w * 255.0;
|
||||||
|
|
||||||
CVarSetColor(cvarName, colors);
|
CVarSetColor(cvarName, colors);
|
||||||
LUS::RequestCvarSaveOnNextTick();
|
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> AnimationFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
AnimationFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<Animation>(initData);
|
||||||
auto resource = std::make_shared<Animation>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<AnimationFactoryV0>();
|
factory = std::make_shared<AnimationFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Animation with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Animation with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ std::shared_ptr<Resource> AnimationFactory::ReadResource(std::shared_ptr<Resourc
|
|||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) {
|
void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<Animation> animation = std::static_pointer_cast<Animation>(resource);
|
std::shared_ptr<Animation> animation = std::static_pointer_cast<Animation>(resource);
|
||||||
|
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, animation);
|
ResourceVersionFactory::ParseFileBinary(reader, animation);
|
||||||
|
@ -6,13 +6,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class AnimationFactory : public ResourceFactory {
|
class AnimationFactory : public ResourceFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AnimationFactoryV0 : public ResourceVersionFactory {
|
class AnimationFactoryV0 : public ResourceVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> AudioSampleFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
AudioSampleFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<AudioSample>(initData);
|
||||||
auto resource = std::make_shared<AudioSample>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 2:
|
case 2:
|
||||||
factory = std::make_shared<AudioSampleFactoryV0>();
|
factory = std::make_shared<AudioSampleFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> AudioSampleFactory::ReadResource(std::shared_ptr<Resou
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
||||||
|
@ -7,14 +7,13 @@ namespace LUS {
|
|||||||
class AudioSampleFactory : public ResourceFactory
|
class AudioSampleFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioSampleFactoryV0 : public ResourceVersionFactory
|
class AudioSampleFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,13 +3,12 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
AudioSequenceFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<AudioSequence>(initData);
|
||||||
auto resource = std::make_shared<AudioSequence>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 2:
|
case 2:
|
||||||
factory = std::make_shared<AudioSequenceFactoryV0>();
|
factory = std::make_shared<AudioSequenceFactoryV0>();
|
||||||
break;
|
break;
|
||||||
@ -17,7 +16,7 @@ std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<Res
|
|||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
||||||
|
|
||||||
|
@ -7,14 +7,13 @@ namespace LUS {
|
|||||||
class AudioSequenceFactory : public ResourceFactory
|
class AudioSequenceFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioSequenceFactoryV0 : public ResourceVersionFactory
|
class AudioSequenceFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
#include "libultraship/libultraship.h"
|
#include "libultraship/libultraship.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
AudioSoundFontFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<AudioSoundFont>(initData);
|
||||||
auto resource = std::make_shared<AudioSoundFont>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 2:
|
case 2:
|
||||||
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
||||||
break;
|
break;
|
||||||
@ -18,7 +17,7 @@ std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<Re
|
|||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<Re
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
|||||||
drum.sound.sample = nullptr;
|
drum.sound.sample = nullptr;
|
||||||
} else {
|
} else {
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
||||||
drum.sound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
|
drum.sound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioSoundFont->drums.push_back(drum);
|
audioSoundFont->drums.push_back(drum);
|
||||||
@ -132,7 +131,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
|||||||
std::string sampleFileName = reader->ReadString();
|
std::string sampleFileName = reader->ReadString();
|
||||||
instrument.lowNotesSound.tuning = reader->ReadFloat();
|
instrument.lowNotesSound.tuning = reader->ReadFloat();
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
||||||
instrument.lowNotesSound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
|
instrument.lowNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
|
||||||
} else {
|
} else {
|
||||||
instrument.lowNotesSound.sample = nullptr;
|
instrument.lowNotesSound.sample = nullptr;
|
||||||
instrument.lowNotesSound.tuning = 0;
|
instrument.lowNotesSound.tuning = 0;
|
||||||
@ -144,7 +143,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
|||||||
std::string sampleFileName = reader->ReadString();
|
std::string sampleFileName = reader->ReadString();
|
||||||
instrument.normalNotesSound.tuning = reader->ReadFloat();
|
instrument.normalNotesSound.tuning = reader->ReadFloat();
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
||||||
instrument.normalNotesSound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
|
instrument.normalNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
|
||||||
} else {
|
} else {
|
||||||
instrument.normalNotesSound.sample = nullptr;
|
instrument.normalNotesSound.sample = nullptr;
|
||||||
instrument.normalNotesSound.tuning = 0;
|
instrument.normalNotesSound.tuning = 0;
|
||||||
@ -156,7 +155,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
|||||||
std::string sampleFileName = reader->ReadString();
|
std::string sampleFileName = reader->ReadString();
|
||||||
instrument.highNotesSound.tuning = reader->ReadFloat();
|
instrument.highNotesSound.tuning = reader->ReadFloat();
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
||||||
instrument.highNotesSound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
|
instrument.highNotesSound.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
|
||||||
} else {
|
} else {
|
||||||
instrument.highNotesSound.sample = nullptr;
|
instrument.highNotesSound.sample = nullptr;
|
||||||
instrument.highNotesSound.tuning = 0;
|
instrument.highNotesSound.tuning = 0;
|
||||||
@ -181,7 +180,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
|||||||
std::string sampleFileName = reader->ReadString();
|
std::string sampleFileName = reader->ReadString();
|
||||||
soundEffect.tuning = reader->ReadFloat();
|
soundEffect.tuning = reader->ReadFloat();
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
|
||||||
soundEffect.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
|
soundEffect.sample = static_cast<Sample*>(res ? res->GetRawPointer() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioSoundFont->soundEffects.push_back(soundEffect);
|
audioSoundFont->soundEffects.push_back(soundEffect);
|
||||||
|
@ -7,14 +7,13 @@ namespace LUS {
|
|||||||
class AudioSoundFontFactory : public ResourceFactory
|
class AudioSoundFontFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AudioSoundFontFactoryV0 : public ResourceVersionFactory
|
class AudioSoundFontFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> BackgroundFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
BackgroundFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<Background>(initData);
|
||||||
auto resource = std::make_shared<Background>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<BackgroundFactoryV0>();
|
factory = std::make_shared<BackgroundFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Background with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Background with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ std::shared_ptr<Resource> BackgroundFactory::ReadResource(std::shared_ptr<Resour
|
|||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) {
|
void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<Background> background = std::static_pointer_cast<Background>(resource);
|
std::shared_ptr<Background> background = std::static_pointer_cast<Background>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, background);
|
ResourceVersionFactory::ParseFileBinary(reader, background);
|
||||||
|
|
||||||
|
@ -6,13 +6,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class BackgroundFactory : public ResourceFactory {
|
class BackgroundFactory : public ResourceFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BackgroundFactoryV0 : public ResourceVersionFactory {
|
class BackgroundFactoryV0 : public ResourceVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
CollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<CollisionHeader>(initData);
|
||||||
auto resource = std::make_shared<CollisionHeader>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
factory = std::make_shared<CollisionHeaderFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(std::shared_ptr<R
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
ResourceVersionFactory::ParseFileBinary(reader, collisionHeader);
|
||||||
|
@ -6,13 +6,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class CollisionHeaderFactory : public ResourceFactory {
|
class CollisionHeaderFactory : public ResourceFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CollisionHeaderFactoryV0 : public ResourceVersionFactory {
|
class CollisionHeaderFactoryV0 : public ResourceVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> CutsceneFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
CutsceneFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<Cutscene>(initData);
|
||||||
auto resource = std::make_shared<Cutscene>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<CutsceneFactoryV0>();
|
factory = std::make_shared<CutsceneFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ static inline uint32_t read_CMD_HH(std::shared_ptr<BinaryReader> reader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
ResourceVersionFactory::ParseFileBinary(reader, cutscene);
|
||||||
|
@ -7,14 +7,13 @@ namespace LUS {
|
|||||||
class CutsceneFactory : public ResourceFactory
|
class CutsceneFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CutsceneFactoryV0 : public ResourceVersionFactory
|
class CutsceneFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> PathFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
PathFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<Path>(initData);
|
||||||
auto resource = std::make_shared<Path>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<PathFactoryV0>();
|
factory = std::make_shared<PathFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Path with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Path with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> PathFactory::ReadResource(std::shared_ptr<ResourceMana
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, path);
|
ResourceVersionFactory::ParseFileBinary(reader, path);
|
||||||
|
|
||||||
|
@ -7,14 +7,13 @@ namespace LUS {
|
|||||||
class PathFactory : public ResourceFactory
|
class PathFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PathFactoryV0 : public ResourceVersionFactory
|
class PathFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,13 +3,12 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
PlayerAnimationFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<PlayerAnimation>(initData);
|
||||||
auto resource = std::make_shared<PlayerAnimation>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
factory = std::make_shared<PlayerAnimationFactoryV0>();
|
||||||
break;
|
break;
|
||||||
@ -17,7 +16,7 @@ std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(std::shared_ptr<R
|
|||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(std::shared_ptr<R
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
ResourceVersionFactory::ParseFileBinary(reader, playerAnimation);
|
||||||
|
@ -6,13 +6,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class PlayerAnimationFactory : public ResourceFactory {
|
class PlayerAnimationFactory : public ResourceFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayerAnimationFactoryV0 : public ResourceVersionFactory {
|
class PlayerAnimationFactoryV0 : public ResourceVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -30,9 +30,8 @@
|
|||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
|
|
||||||
std::shared_ptr<Resource> SceneFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SceneFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
|
||||||
if (SceneFactory::sceneCommandFactories.empty()) {
|
if (SceneFactory::sceneCommandFactories.empty()) {
|
||||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
|
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
|
||||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
|
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
|
||||||
@ -61,17 +60,17 @@ std::shared_ptr<Resource> SceneFactory::ReadResource(std::shared_ptr<ResourceMan
|
|||||||
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
|
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto resource = std::make_shared<Scene>(resourceMgr, initData);
|
auto resource = std::make_shared<Scene>(initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SceneFactoryV0>();
|
factory = std::make_shared<SceneFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Scene with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Scene with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ std::shared_ptr<Resource> SceneFactory::ReadResource(std::shared_ptr<ResourceMan
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void SceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
std::shared_ptr<Scene> scene = std::static_pointer_cast<Scene>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
ResourceVersionFactory::ParseFileBinary(reader, scene);
|
||||||
@ -98,27 +97,27 @@ void SceneFactoryV0::ParseSceneCommands(std::shared_ptr<Scene> scene, std::share
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SceneCommand> SceneFactoryV0::ParseSceneCommand(std::shared_ptr<Scene> scene,
|
std::shared_ptr<ISceneCommand> SceneFactoryV0::ParseSceneCommand(std::shared_ptr<Scene> scene,
|
||||||
std::shared_ptr<BinaryReader> reader, uint32_t index) {
|
std::shared_ptr<BinaryReader> reader, uint32_t index) {
|
||||||
SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32();
|
SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32();
|
||||||
|
|
||||||
reader->Seek(-sizeof(int32_t), SeekOffsetType::Current);
|
reader->Seek(-sizeof(int32_t), SeekOffsetType::Current);
|
||||||
|
|
||||||
std::shared_ptr<SceneCommand> result = nullptr;
|
std::shared_ptr<ISceneCommand> result = nullptr;
|
||||||
std::shared_ptr<SceneCommandFactory> commandFactory = SceneFactory::sceneCommandFactories[cmdID];
|
std::shared_ptr<SceneCommandFactory> commandFactory = SceneFactory::sceneCommandFactories[cmdID];
|
||||||
|
|
||||||
if (commandFactory != nullptr) {
|
if (commandFactory != nullptr) {
|
||||||
auto initData = std::make_shared<ResourceInitData>();
|
auto initData = std::make_shared<ResourceInitData>();
|
||||||
initData->Id = scene->InitData->Id;
|
initData->Id = scene->GetInitData()->Id;
|
||||||
initData->Type = ResourceType::SOH_SceneCommand;
|
initData->Type = ResourceType::SOH_SceneCommand;
|
||||||
initData->Path = scene->InitData->Path + "/SceneCommand" + std::to_string(index);
|
initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index);
|
||||||
initData->ResourceVersion = scene->InitData->ResourceVersion;
|
initData->ResourceVersion = scene->GetInitData()->ResourceVersion;
|
||||||
result = std::static_pointer_cast<SceneCommand>(commandFactory->ReadResource(scene->ResourceManager, initData, reader));
|
result = std::static_pointer_cast<ISceneCommand>(commandFactory->ReadResource(initData, reader));
|
||||||
// Cache the resource?
|
// Cache the resource?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == nullptr) {
|
if (result == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, scene->InitData->Path);
|
SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, scene->GetInitData()->Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -9,9 +9,8 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SceneFactory : public ResourceFactory {
|
class SceneFactory : public ResourceFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
|
|
||||||
// Doing something very similar to what we do on the ResourceLoader.
|
// Doing something very similar to what we do on the ResourceLoader.
|
||||||
// Eventually, scene commands should be moved up to the ResourceLoader as well.
|
// Eventually, scene commands should be moved up to the ResourceLoader as well.
|
||||||
@ -22,9 +21,9 @@ class SceneFactory : public ResourceFactory {
|
|||||||
|
|
||||||
class SceneFactoryV0 : public ResourceVersionFactory {
|
class SceneFactoryV0 : public ResourceVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
void ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader);
|
void ParseSceneCommands(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader);
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<SceneCommand> ParseSceneCommand(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader, uint32_t index);
|
std::shared_ptr<ISceneCommand> ParseSceneCommand(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader, uint32_t index);
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -4,20 +4,19 @@
|
|||||||
#include <libultraship/libultraship.h>
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SkeletonFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SkeletonFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<Skeleton>(initData);
|
||||||
auto resource = std::make_shared<Skeleton>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SkeletonFactoryV0>();
|
factory = std::make_shared<SkeletonFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,20 +25,19 @@ std::shared_ptr<Resource> SkeletonFactory::ReadResource(std::shared_ptr<Resource
|
|||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Resource> SkeletonFactory::ReadResourceXML(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SkeletonFactory::ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) {
|
||||||
tinyxml2::XMLElement* reader) {
|
auto resource = std::make_shared<Skeleton>(initData);
|
||||||
auto resource = std::make_shared<Skeleton>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SkeletonFactoryV0>();
|
factory = std::make_shared<SkeletonFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +47,7 @@ std::shared_ptr<Resource> SkeletonFactory::ReadResourceXML(std::shared_ptr<Resou
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Skeleton> skeleton = std::static_pointer_cast<Skeleton>(resource);
|
std::shared_ptr<Skeleton> skeleton = std::static_pointer_cast<Skeleton>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, skeleton);
|
ResourceVersionFactory::ParseFileBinary(reader, skeleton);
|
||||||
@ -86,7 +84,7 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
|||||||
for (size_t i = 0; i < skeleton->limbTable.size(); i++) {
|
for (size_t i = 0; i < skeleton->limbTable.size(); i++) {
|
||||||
std::string limbStr = skeleton->limbTable[i];
|
std::string limbStr = skeleton->limbTable[i];
|
||||||
auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str());
|
auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str());
|
||||||
skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr);
|
skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skeleton->type == LUS::SkeletonType::Normal) {
|
if (skeleton->type == LUS::SkeletonType::Normal) {
|
||||||
@ -99,7 +97,7 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
|||||||
SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type);
|
SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource)
|
void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Skeleton> skel = std::static_pointer_cast<Skeleton>(resource);
|
std::shared_ptr<Skeleton> skel = std::static_pointer_cast<Skeleton>(resource);
|
||||||
|
|
||||||
@ -143,7 +141,7 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p
|
|||||||
skel->limbTable.push_back(limbName);
|
skel->limbTable.push_back(limbName);
|
||||||
|
|
||||||
auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str());
|
auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str());
|
||||||
skel->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr);
|
skel->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
child = child->NextSiblingElement();
|
child = child->NextSiblingElement();
|
||||||
|
@ -7,19 +7,17 @@ namespace LUS {
|
|||||||
class SkeletonFactory : public ResourceFactory
|
class SkeletonFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<Resource> ReadResourceXML(std::shared_ptr<ResourceManager> resourceMgr,
|
ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) override;
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
|
||||||
tinyxml2::XMLElement* reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SkeletonFactoryV0 : public ResourceVersionFactory
|
class SkeletonFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
|
||||||
|
@ -4,20 +4,19 @@
|
|||||||
#include "libultraship/libultraship.h"
|
#include "libultraship/libultraship.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SkeletonLimbFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<SkeletonLimb>(initData);
|
||||||
auto resource = std::make_shared<SkeletonLimb>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,20 +25,19 @@ std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(std::shared_ptr<Reso
|
|||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResourceXML(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SkeletonLimbFactory::ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) {
|
||||||
tinyxml2::XMLElement* reader) {
|
auto resource = std::make_shared<SkeletonLimb>(initData);
|
||||||
auto resource = std::make_shared<SkeletonLimb>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
factory = std::make_shared<SkeletonLimbFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +47,7 @@ std::shared_ptr<Resource> SkeletonLimbFactory::ReadResourceXML(std::shared_ptr<R
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb);
|
||||||
@ -135,14 +133,14 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
|||||||
|
|
||||||
if (skeletonLimb->dListPtr != "") {
|
if (skeletonLimb->dListPtr != "") {
|
||||||
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
||||||
skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
|
skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||||
} else {
|
} else {
|
||||||
skeletonLimb->limbData.lodLimb.dLists[0] = nullptr;
|
skeletonLimb->limbData.lodLimb.dLists[0] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skeletonLimb->dList2Ptr != "") {
|
if (skeletonLimb->dList2Ptr != "") {
|
||||||
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
|
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
|
||||||
skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
|
skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||||
} else {
|
} else {
|
||||||
skeletonLimb->limbData.lodLimb.dLists[1] = nullptr;
|
skeletonLimb->limbData.lodLimb.dLists[1] = nullptr;
|
||||||
}
|
}
|
||||||
@ -156,7 +154,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
|||||||
|
|
||||||
if (!skeletonLimb->dListPtr.empty()) {
|
if (!skeletonLimb->dListPtr.empty()) {
|
||||||
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
||||||
skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetPointer() : nullptr);
|
skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||||
}
|
}
|
||||||
} else if (skeletonLimb->limbType == LUS::LimbType::Curve) {
|
} else if (skeletonLimb->limbType == LUS::LimbType::Curve) {
|
||||||
skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex;
|
skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex;
|
||||||
@ -166,12 +164,12 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
|||||||
|
|
||||||
if (!skeletonLimb->dListPtr.empty()) {
|
if (!skeletonLimb->dListPtr.empty()) {
|
||||||
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
||||||
skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
|
skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skeletonLimb->dList2Ptr.empty()) {
|
if (!skeletonLimb->dList2Ptr.empty()) {
|
||||||
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
|
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
|
||||||
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
|
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||||
}
|
}
|
||||||
} else if (skeletonLimb->limbType == LUS::LimbType::Skin) {
|
} else if (skeletonLimb->limbType == LUS::LimbType::Skin) {
|
||||||
skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX;
|
skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX;
|
||||||
@ -192,13 +190,13 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
|||||||
|
|
||||||
if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) {
|
if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) {
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList.c_str());
|
||||||
skeletonLimb->limbData.skinLimb.segment = res ? res->GetPointer() : nullptr;
|
skeletonLimb->limbData.skinLimb.segment = res ? res->GetRawPointer() : nullptr;
|
||||||
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) {
|
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) {
|
||||||
skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt;
|
skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt;
|
||||||
skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount;
|
skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount;
|
||||||
skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data();
|
skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data();
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList2.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList2.c_str());
|
||||||
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)(res ? res->GetPointer() : nullptr);
|
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)(res ? res->GetRawPointer() : nullptr);
|
||||||
|
|
||||||
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) {
|
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) {
|
||||||
skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size();
|
skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size();
|
||||||
@ -214,7 +212,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource)
|
void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SkeletonLimb> skelLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
std::shared_ptr<SkeletonLimb> skelLimb = std::static_pointer_cast<SkeletonLimb>(resource);
|
||||||
|
|
||||||
@ -257,7 +255,7 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar
|
|||||||
|
|
||||||
if (skelLimb->dListPtr != "") {
|
if (skelLimb->dListPtr != "") {
|
||||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess((const char*)skelLimb->dListPtr.c_str());
|
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess((const char*)skelLimb->dListPtr.c_str());
|
||||||
limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetPointer() : nullptr);
|
limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetRawPointer() : nullptr);
|
||||||
} else {
|
} else {
|
||||||
limbData.lodLimb.dLists[0] = nullptr;
|
limbData.lodLimb.dLists[0] = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -7,19 +7,17 @@ namespace LUS {
|
|||||||
class SkeletonLimbFactory : public ResourceFactory
|
class SkeletonLimbFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<Resource> ReadResourceXML(std::shared_ptr<ResourceManager> resourceMgr,
|
ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) override;
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
|
||||||
tinyxml2::XMLElement* reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SkeletonLimbFactoryV0 : public ResourceVersionFactory
|
class SkeletonLimbFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
|
||||||
|
@ -3,13 +3,12 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> TextFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
TextFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<Text>(initData);
|
||||||
auto resource = std::make_shared<Text>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<TextFactoryV0>();
|
factory = std::make_shared<TextFactoryV0>();
|
||||||
break;
|
break;
|
||||||
@ -19,7 +18,7 @@ std::shared_ptr<Resource> TextFactory::ReadResource(std::shared_ptr<ResourceMana
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Text with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,20 +27,19 @@ std::shared_ptr<Resource> TextFactory::ReadResource(std::shared_ptr<ResourceMana
|
|||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Resource> TextFactory::ReadResourceXML(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
TextFactory::ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) {
|
||||||
tinyxml2::XMLElement* reader) {
|
auto resource = std::make_shared<Text>(initData);
|
||||||
auto resource = std::make_shared<Text>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<TextFactoryV0>();
|
factory = std::make_shared<TextFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load Text with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +49,7 @@ std::shared_ptr<Resource> TextFactory::ReadResourceXML(std::shared_ptr<ResourceM
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
|
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, text);
|
ResourceVersionFactory::ParseFileBinary(reader, text);
|
||||||
|
|
||||||
@ -68,7 +66,7 @@ void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
|||||||
text->messages.push_back(entry);
|
text->messages.push_back(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource) {
|
void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<Text> txt = std::static_pointer_cast<Text>(resource);
|
std::shared_ptr<Text> txt = std::static_pointer_cast<Text>(resource);
|
||||||
|
|
||||||
auto child = reader->FirstChildElement();
|
auto child = reader->FirstChildElement();
|
||||||
|
@ -7,19 +7,17 @@ namespace LUS {
|
|||||||
class TextFactory : public ResourceFactory
|
class TextFactory : public ResourceFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<Resource> ReadResourceXML(std::shared_ptr<ResourceManager> resourceMgr,
|
ReadResourceXML(std::shared_ptr<ResourceInitData> initData, tinyxml2::XMLElement *reader) override;
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
|
||||||
tinyxml2::XMLElement* reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextFactoryV0 : public ResourceVersionFactory
|
class TextFactoryV0 : public ResourceVersionFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> EndMarkerFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
EndMarkerFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<EndMarker>(initData);
|
||||||
auto resource = std::make_shared<EndMarker>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<EndMarkerFactoryV0>();
|
factory = std::make_shared<EndMarkerFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> EndMarkerFactory::ReadResource(std::shared_ptr<Resourc
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
|
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, endMarker);
|
ResourceVersionFactory::ParseFileBinary(reader, endMarker);
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class EndMarkerFactory : public SceneCommandFactory {
|
class EndMarkerFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EndMarkerFactoryV0 : public SceneCommandVersionFactory {
|
class EndMarkerFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr<SceneCommand> command, std::shared_ptr<BinaryReader> reader) {
|
void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr<ISceneCommand> command, std::shared_ptr<BinaryReader> reader) {
|
||||||
command->cmdId = (SceneCommandID)reader->ReadInt32();
|
command->cmdId = (SceneCommandID)reader->ReadInt32();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@ class SceneCommandFactory : public ResourceFactory {};
|
|||||||
|
|
||||||
class SceneCommandVersionFactory : public ResourceVersionFactory {
|
class SceneCommandVersionFactory : public ResourceVersionFactory {
|
||||||
protected:
|
protected:
|
||||||
void ReadCommandId(std::shared_ptr<SceneCommand> command, std::shared_ptr<BinaryReader> reader);
|
void ReadCommandId(std::shared_ptr<ISceneCommand> command, std::shared_ptr<BinaryReader> reader);
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,13 +3,12 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetActorListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SetActorListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<SetActorList>(initData);
|
||||||
auto resource = std::make_shared<SetActorList>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetActorListFactoryV0>();
|
factory = std::make_shared<SetActorListFactoryV0>();
|
||||||
break;
|
break;
|
||||||
@ -17,7 +16,7 @@ std::shared_ptr<Resource> SetActorListFactory::ReadResource(std::shared_ptr<Reso
|
|||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ std::shared_ptr<Resource> SetActorListFactory::ReadResource(std::shared_ptr<Reso
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
|
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
|
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
|
||||||
|
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetActorListFactory : public SceneCommandFactory {
|
class SetActorListFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetActorListFactoryV0 : public SceneCommandVersionFactory {
|
class SetActorListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
#include "libultraship/libultraship.h"
|
#include "libultraship/libultraship.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource> SetAlternateHeadersFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
auto resource = std::make_shared<SetAlternateHeaders>(resourceMgr, initData);
|
auto resource = std::make_shared<SetAlternateHeaders>(initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
|
factory = std::make_shared<SetAlternateHeadersFactoryV0>();
|
||||||
break;
|
break;
|
||||||
@ -18,7 +17,7 @@ std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(std::shared_p
|
|||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(std::shared_p
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
|
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders);
|
ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders);
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetAlternateHeadersFactory : public SceneCommandFactory {
|
class SetAlternateHeadersFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory {
|
class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource> SetCameraSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
auto resource = std::make_shared<SetCameraSettings>(resourceMgr, initData);
|
auto resource = std::make_shared<SetCameraSettings>(initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetCameraSettingsFactoryV0>();
|
factory = std::make_shared<SetCameraSettingsFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(std::shared_ptr
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
|
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings);
|
ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings);
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetCameraSettingsFactory : public SceneCommandFactory {
|
class SetCameraSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory {
|
class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -4,20 +4,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource> SetCollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceInitData> initData,
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
std::shared_ptr<BinaryReader> reader) {
|
||||||
auto resource = std::make_shared<SetCollisionHeader>(resourceMgr, initData);
|
auto resource = std::make_shared<SetCollisionHeader>(initData);
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
|
factory = std::make_shared<SetCollisionHeaderFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(std::shared_pt
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
|
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
|
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
|
||||||
|
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetCollisionHeaderFactory : public SceneCommandFactory {
|
class SetCollisionHeaderFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory {
|
class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SetCsCameraFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<SetCsCamera>(initData);
|
||||||
auto resource = std::make_shared<SetCsCamera>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetCsCameraFactoryV0>();
|
factory = std::make_shared<SetCsCameraFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(std::shared_ptr<Resou
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
|
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
|
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
|
||||||
|
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetCsCameraFactory : public SceneCommandFactory {
|
class SetCsCameraFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetCsCameraFactoryV0 : public SceneCommandVersionFactory {
|
class SetCsCameraFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SetCutscenesFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<SetCutscenes>(initData);
|
||||||
auto resource = std::make_shared<SetCutscenes>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetCutscenesFactoryV0>();
|
factory = std::make_shared<SetCutscenesFactoryV0>();
|
||||||
break;
|
break;
|
||||||
@ -18,7 +17,7 @@ std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(std::shared_ptr<Reso
|
|||||||
|
|
||||||
if (factory == nullptr)
|
if (factory == nullptr)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(std::shared_ptr<Reso
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
|
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
|
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
|
||||||
|
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetCutscenesFactory : public SceneCommandFactory {
|
class SetCutscenesFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetCutscenesFactoryV0 : public SceneCommandVersionFactory {
|
class SetCutscenesFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SetEchoSettingsFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<SetEchoSettings>(initData);
|
||||||
auto resource = std::make_shared<SetEchoSettings>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetEchoSettingsFactoryV0>();
|
factory = std::make_shared<SetEchoSettingsFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(std::shared_ptr<R
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource)
|
std::shared_ptr<IResource> resource)
|
||||||
{
|
{
|
||||||
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
|
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings);
|
ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings);
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetEchoSettingsFactory : public SceneCommandFactory {
|
class SetEchoSettingsFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory {
|
class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SetEntranceListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<SetEntranceList>(initData);
|
||||||
auto resource = std::make_shared<SetEntranceList>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetEntranceListFactoryV0>();
|
factory = std::make_shared<SetEntranceListFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(std::shared_ptr<R
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
|
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
|
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
|
||||||
|
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetEntranceListFactory : public SceneCommandFactory {
|
class SetEntranceListFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetEntranceListFactoryV0 : public SceneCommandVersionFactory {
|
class SetEntranceListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
@ -3,20 +3,19 @@
|
|||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
std::shared_ptr<Resource> SetExitListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
SetExitListFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||||
std::shared_ptr<BinaryReader> reader) {
|
auto resource = std::make_shared<SetExitList>( initData);
|
||||||
auto resource = std::make_shared<SetExitList>(resourceMgr, initData);
|
|
||||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||||
|
|
||||||
switch (resource->InitData->ResourceVersion) {
|
switch (resource->GetInitData()->ResourceVersion) {
|
||||||
case 0:
|
case 0:
|
||||||
factory = std::make_shared<SetExitListFactoryV0>();
|
factory = std::make_shared<SetExitListFactoryV0>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->InitData->ResourceVersion);
|
SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->GetInitData()->ResourceVersion);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ std::shared_ptr<Resource> SetExitListFactory::ReadResource(std::shared_ptr<Resou
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||||
std::shared_ptr<Resource> resource) {
|
std::shared_ptr<IResource> resource) {
|
||||||
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
|
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
|
||||||
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
|
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
|
||||||
|
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
namespace LUS {
|
namespace LUS {
|
||||||
class SetExitListFactory : public SceneCommandFactory {
|
class SetExitListFactory : public SceneCommandFactory {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
|
std::shared_ptr<IResource>
|
||||||
std::shared_ptr<ResourceInitData> initData,
|
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||||
std::shared_ptr<BinaryReader> reader) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetExitListFactoryV0 : public SceneCommandVersionFactory {
|
class SetExitListFactoryV0 : public SceneCommandVersionFactory {
|
||||||
public:
|
public:
|
||||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
|
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||||
};
|
};
|
||||||
}; // namespace LUS
|
}; // namespace LUS
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user