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