summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2025-05-18 19:28:26 +0000
committerGitHub <noreply@github.com>2025-05-18 19:28:26 +0000
commit089f845144da87a33fea21d6ba364d42de5fda60 (patch)
tree150721525c96ca7632011e1eba616a280ef46166
parentbde6fcfc15c0a7f737d48f2b6cee9bcc54ed49aa (diff)
LUS update (#1142)
* LUS update * Commit backend refactor * Cleanup tinyxml includes * Add LUS again * Rebase LUS * LUS bump * Point to LUS main * Fix metal * Bump LUS to test * Chagnes for removed cvar dropped file
-rw-r--r--CMake/lus-cvars.cmake2
m---------libultraship0
-rw-r--r--mm/2s2h/BenGui/BenGui.cpp2
-rw-r--r--mm/2s2h/BenGui/BenInputEditorWindow.cpp1
-rw-r--r--mm/2s2h/BenGui/BenMenu.h8
-rw-r--r--mm/2s2h/BenGui/Menu.cpp1
-rw-r--r--mm/2s2h/BenGui/UIWidgets.hpp1
-rw-r--r--mm/2s2h/BenPort.cpp16
-rw-r--r--mm/2s2h/BenPort.h2
-rw-r--r--mm/2s2h/DeveloperTools/DebugConsole.cpp2
-rw-r--r--mm/2s2h/Enhancements/Audio/AudioCollection.cpp1
-rw-r--r--mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp3
-rw-r--r--mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp1
-rw-r--r--mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp1
-rw-r--r--mm/2s2h/GameInteractor/GameInteractor_HookTable.h2
-rw-r--r--mm/2s2h/PresetManager/PresetManager.cpp2
-rw-r--r--mm/2s2h/PresetManager/PresetManager.h2
-rw-r--r--mm/2s2h/Rando/Spoiler/File.cpp4
-rw-r--r--mm/2s2h/Rando/Spoiler/HandleFileDropped.cpp3
-rw-r--r--mm/2s2h/Rando/Spoiler/RefreshOptions.cpp2
-rw-r--r--mm/2s2h/Rando/Spoiler/Spoiler.h6
-rw-r--r--mm/2s2h/SaveManager/BinarySaveConverter.cpp3
-rw-r--r--mm/2s2h/SaveManager/SaveManager.cpp11
-rw-r--r--mm/2s2h/SaveManager/SaveManager.h6
-rw-r--r--mm/2s2h/ShipUtils.cpp1
-rw-r--r--mm/2s2h/resource/importer/AnimationFactory.cpp3
-rw-r--r--mm/2s2h/resource/importer/AudioSampleFactory.cpp5
-rw-r--r--mm/2s2h/resource/importer/AudioSequenceFactory.cpp3
-rw-r--r--mm/2s2h/resource/importer/AudioSoundFontFactory.cpp2
-rw-r--r--mm/2s2h/resource/importer/CollisionHeaderFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/KeyFrameFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/SkeletonFactory.cpp2
-rw-r--r--mm/2s2h/resource/importer/SkeletonLimbFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/TextMMFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp1
-rw-r--r--mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp1
-rw-r--r--mm/2s2h/z_message_OTR.cpp1
-rw-r--r--mm/2s2h/z_play_2SH.cpp19
-rw-r--r--mm/assets/custom/shaders/opengl/default.shader.fs31
42 files changed, 100 insertions, 58 deletions
diff --git a/CMake/lus-cvars.cmake b/CMake/lus-cvars.cmake
index 8c553cc45..e4c54c4ae 100644
--- a/CMake/lus-cvars.cmake
+++ b/CMake/lus-cvars.cmake
@@ -1,7 +1,5 @@
set(CVAR_VSYNC_ENABLED "${CVAR_PREFIX_SETTING}.VsyncEnabled")
set(CVAR_Z_FIGHTING_MODE "${CVAR_PREFIX_SETTING}.ZFightingMode")
-set(CVAR_NEW_FILE_DROPPED "${CVAR_PREFIX_GENERAL}.NewFileDropped")
-set(CVAR_DROPPED_FILE "${CVAR_PREFIX_GENERAL}.DroppedFile")
set(CVAR_INTERNAL_RESOLUTION "${CVAR_PREFIX_SETTING}.InternalResolution")
set(CVAR_MSAA_VALUE "${CVAR_PREFIX_SETTING}.MSAAValue")
set(CVAR_SDL_WINDOWED_FULLSCREEN "${CVAR_PREFIX_SETTING}.SdlWindowedFullscreen")
diff --git a/libultraship b/libultraship
-Subproject dda07c8ac6033ff98d37a05bc28406440c7769e
+Subproject 7135d1494e74c38aa7fca734b92ec50bba543b4
diff --git a/mm/2s2h/BenGui/BenGui.cpp b/mm/2s2h/BenGui/BenGui.cpp
index 46295da51..9c264c2a7 100644
--- a/mm/2s2h/BenGui/BenGui.cpp
+++ b/mm/2s2h/BenGui/BenGui.cpp
@@ -11,7 +11,7 @@
#include "2s2h/Rando/CheckTracker/CheckTracker.h"
#ifdef __APPLE__
-#include "graphic/Fast3D/gfx_metal.h"
+#include "graphic/Fast3D/backends/gfx_metal.h"
#endif
#ifdef __SWITCH__
diff --git a/mm/2s2h/BenGui/BenInputEditorWindow.cpp b/mm/2s2h/BenGui/BenInputEditorWindow.cpp
index 8657a29df..b7062b264 100644
--- a/mm/2s2h/BenGui/BenInputEditorWindow.cpp
+++ b/mm/2s2h/BenGui/BenInputEditorWindow.cpp
@@ -2,6 +2,7 @@
#include <Context.h>
#include "public/bridge/consolevariablebridge.h"
#include "controller/controldevice/controller/mapping/ControllerRumbleMapping.h"
+#include "controller/controldeck/ControlDeck.h"
#include "utils/StringHelper.h"
#ifndef __WIIU__
#include "controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.h"
diff --git a/mm/2s2h/BenGui/BenMenu.h b/mm/2s2h/BenGui/BenMenu.h
index c6d35d864..2ad05c65c 100644
--- a/mm/2s2h/BenGui/BenMenu.h
+++ b/mm/2s2h/BenGui/BenMenu.h
@@ -5,7 +5,7 @@
#include "Menu.h"
#include "2s2h/Enhancements/Enhancements.h"
#include "2s2h/DeveloperTools/DeveloperTools.h"
-#include "graphic/Fast3D/gfx_rendering_api.h"
+#include "graphic/Fast3D/backends/gfx_rendering_api.h"
namespace BenGui {
@@ -51,9 +51,9 @@ static const std::unordered_map<int32_t, const char*> clockTypeOptions = {
};
static const std::unordered_map<int32_t, const char*> textureFilteringMap = {
- { FILTER_THREE_POINT, "Three-Point" },
- { FILTER_LINEAR, "Linear" },
- { FILTER_NONE, "None" },
+ { Fast::FILTER_THREE_POINT, "Three-Point" },
+ { Fast::FILTER_LINEAR, "Linear" },
+ { Fast::FILTER_NONE, "None" },
};
static const std::unordered_map<int32_t, const char*> motionBlurOptions = {
diff --git a/mm/2s2h/BenGui/Menu.cpp b/mm/2s2h/BenGui/Menu.cpp
index 951159981..59de4ebcf 100644
--- a/mm/2s2h/BenGui/Menu.cpp
+++ b/mm/2s2h/BenGui/Menu.cpp
@@ -8,6 +8,7 @@
#include <spdlog/fmt/fmt.h>
#include "variables.h"
#include <tuple>
+#include "Config.h"
extern "C" {
#include "z64.h"
diff --git a/mm/2s2h/BenGui/UIWidgets.hpp b/mm/2s2h/BenGui/UIWidgets.hpp
index 540ad023f..6903d56c6 100644
--- a/mm/2s2h/BenGui/UIWidgets.hpp
+++ b/mm/2s2h/BenGui/UIWidgets.hpp
@@ -13,6 +13,7 @@
#include "GuiWindow.h"
#include "Context.h"
#include "public/bridge/consolevariablebridge.h"
+#include "Window.h"
namespace UIWidgets {
diff --git a/mm/2s2h/BenPort.cpp b/mm/2s2h/BenPort.cpp
index c37d1650e..e872eba98 100644
--- a/mm/2s2h/BenPort.cpp
+++ b/mm/2s2h/BenPort.cpp
@@ -29,7 +29,7 @@
#include "build.h"
#include <Fast3D/interpreter.h>
-#include <Fast3D/gfx_rendering_api.h>
+#include <Fast3D/backends/gfx_rendering_api.h>
#ifdef __APPLE__
#include <SDL_scancode.h>
@@ -104,6 +104,7 @@ CrowdControl* CrowdControl::Instance;
#include "2s2h/resource/importer/TextureAnimationFactory.h"
#include "2s2h/resource/importer/KeyFrameFactory.h"
#include "window/gui/resource/Font.h"
+#include "window/FileDropMgr.h"
#include "window/gui/resource/FontFactory.h"
#include "2s2h/Enhancements/Audio/AudioCollection.h"
#include "BenGui/BenInputEditorWindow.h"
@@ -170,7 +171,7 @@ OTRGlobals::OTRGlobals() {
std::unordered_set<uint32_t> validHashes = { MM_NTSC_US_10, MM_NTSC_US_GC };
context = Ship::Context::CreateUninitializedInstance("2 Ship 2 Harkinian", appShortName, "2ship2harkinian.json");
-
+ context->InitFileDropMgr();
context->InitLogging();
context->InitGfxDebugger();
context->InitConfiguration();
@@ -467,7 +468,7 @@ extern "C" void OTRExtScanner() {
}
}
-void Ben_ProcessDroppedFiles(std::string filePath) {
+void Ben_ProcessDroppedFiles(const std::string& filePath) {
SPDLOG_INFO("Processing dropped file: {}", filePath);
bool handled = false;
@@ -904,14 +905,13 @@ extern "C" void Graph_StartFrame() {
}
}
#endif
-
- if (CVarGetInteger(CVAR_NEW_FILE_DROPPED, 0)) {
- std::string filePath = CVarGetString(CVAR_DROPPED_FILE, "");
+ auto dropMgr = Ship::Context::GetInstance()->GetFileDropMgr();
+ if (dropMgr->FileDropped()) {
+ std::string filePath = dropMgr->GetDroppedFile();
if (!filePath.empty()) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnFileDropped>(filePath);
}
- CVarClear(CVAR_NEW_FILE_DROPPED);
- CVarClear(CVAR_DROPPED_FILE);
+ dropMgr->ClearDroppedFile();
}
}
diff --git a/mm/2s2h/BenPort.h b/mm/2s2h/BenPort.h
index 8a7fef0bd..0b20e00a6 100644
--- a/mm/2s2h/BenPort.h
+++ b/mm/2s2h/BenPort.h
@@ -17,6 +17,8 @@
#include <vector>
+struct ImFont;
+
const std::string customMessageTableID = "BaseGameOverrides";
const std::string appShortName = "2ship";
diff --git a/mm/2s2h/DeveloperTools/DebugConsole.cpp b/mm/2s2h/DeveloperTools/DebugConsole.cpp
index 54ede922f..65e7a2837 100644
--- a/mm/2s2h/DeveloperTools/DebugConsole.cpp
+++ b/mm/2s2h/DeveloperTools/DebugConsole.cpp
@@ -1,6 +1,8 @@
#include "DebugConsole.h"
#include "public/bridge/consolevariablebridge.h"
+#include "Window.h"
+#include "ConsoleWindow.h"
#include "2s2h/BenPort.h"
#include <vector>
#include <string>
diff --git a/mm/2s2h/Enhancements/Audio/AudioCollection.cpp b/mm/2s2h/Enhancements/Audio/AudioCollection.cpp
index afeb710ef..0d29b900f 100644
--- a/mm/2s2h/Enhancements/Audio/AudioCollection.cpp
+++ b/mm/2s2h/Enhancements/Audio/AudioCollection.cpp
@@ -2,6 +2,7 @@
#include "sequence.h"
#include <utils/StringHelper.h>
#include "public/bridge/consolevariablebridge.h"
+#include "Window.h"
#include <2s2h/BenPort.h>
#include <locale>
#include <filesystem>
diff --git a/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp b/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp
index 7c1c103d5..5476887ce 100644
--- a/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp
+++ b/mm/2s2h/Enhancements/DifficultyOptions/DeleteFileOnDeath.cpp
@@ -1,6 +1,7 @@
#include "public/bridge/consolevariablebridge.h"
#include "ConsoleWindow.h"
#include "Context.h"
+#include "Window.h"
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/ShipInit.hpp"
@@ -11,7 +12,7 @@ extern "C" {
#define CVAR_NAME "gEnhancements.DifficultyOptions.DeleteFileOnDeath"
#define CVAR CVarGetInteger(CVAR_NAME, 0)
-void SaveManager_DeleteSaveFile(std::filesystem::path fileName);
+void SaveManager_DeleteSaveFile(const std::filesystem::path& fileName);
std::string SaveManager_GetFileName(int fileNum, bool isBackup);
void RegisterDeleteFileOnDeath() {
diff --git a/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp b/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp
index 45494bf3d..240ee8be2 100644
--- a/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp
+++ b/mm/2s2h/Enhancements/Modes/PlayAsKafei.cpp
@@ -1,5 +1,6 @@
#include "public/bridge/consolevariablebridge.h"
#include "Context.h"
+#include "ResourceManager.h"
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/ShipInit.hpp"
diff --git a/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp b/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp
index 97a1fe30c..389fb0217 100644
--- a/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp
+++ b/mm/2s2h/Enhancements/Trackers/DisplayOverlay.cpp
@@ -3,6 +3,7 @@
#include <spdlog/fmt/fmt.h>
#include "public/bridge/consolevariablebridge.h"
#include "Context.h"
+#include "Window.h"
extern "C" {
#include "variables.h"
diff --git a/mm/2s2h/GameInteractor/GameInteractor_HookTable.h b/mm/2s2h/GameInteractor/GameInteractor_HookTable.h
index 63aad1a13..7e786757e 100644
--- a/mm/2s2h/GameInteractor/GameInteractor_HookTable.h
+++ b/mm/2s2h/GameInteractor/GameInteractor_HookTable.h
@@ -1,4 +1,4 @@
-DEFINE_HOOK(OnFileDropped, (std::string path))
+DEFINE_HOOK(OnFileDropped, (const std::string& path))
DEFINE_HOOK(OnGameStateMainStart, ())
DEFINE_HOOK(OnGameStateMainFinish, ())
diff --git a/mm/2s2h/PresetManager/PresetManager.cpp b/mm/2s2h/PresetManager/PresetManager.cpp
index 70d62bdd5..930044c87 100644
--- a/mm/2s2h/PresetManager/PresetManager.cpp
+++ b/mm/2s2h/PresetManager/PresetManager.cpp
@@ -384,7 +384,7 @@ void PresetManager_CreatePreset(std::string presetName) {
} catch (...) { Notification::Emit({ .suffix = "Failed to create preset" }); }
}
-bool PresetManager_HandleFileDropped(std::string filePath) {
+bool PresetManager_HandleFileDropped(const std::string& filePath) {
try {
std::ifstream fileStream(filePath);
diff --git a/mm/2s2h/PresetManager/PresetManager.h b/mm/2s2h/PresetManager/PresetManager.h
index e41ac9556..7b55c97f7 100644
--- a/mm/2s2h/PresetManager/PresetManager.h
+++ b/mm/2s2h/PresetManager/PresetManager.h
@@ -4,7 +4,7 @@
#include <string>
-bool PresetManager_HandleFileDropped(std::string filePath);
+bool PresetManager_HandleFileDropped(const std::string& filePath);
void PresetManager_Draw();
#endif // PRESET_MANAGER_H
diff --git a/mm/2s2h/Rando/Spoiler/File.cpp b/mm/2s2h/Rando/Spoiler/File.cpp
index 44292985c..c54f6ac3b 100644
--- a/mm/2s2h/Rando/Spoiler/File.cpp
+++ b/mm/2s2h/Rando/Spoiler/File.cpp
@@ -6,7 +6,7 @@ namespace Rando {
namespace Spoiler {
-void SaveToFile(std::string fileName, nlohmann::json spoiler) {
+void SaveToFile(const std::string& fileName, nlohmann::json spoiler) {
std::string filePath = Ship::Context::GetPathRelativeToAppDirectory("randomizer/" + fileName, appShortName);
std::ofstream fileStream(filePath);
if (!fileStream.is_open()) {
@@ -16,7 +16,7 @@ void SaveToFile(std::string fileName, nlohmann::json spoiler) {
fileStream << spoiler.dump(4);
}
-nlohmann::json LoadFromFile(std::string fileName) {
+nlohmann::json LoadFromFile(const std::string& fileName) {
std::string spoilerFilePath = Ship::Context::GetPathRelativeToAppDirectory("randomizer/" + fileName, appShortName);
std::ifstream fileStream(spoilerFilePath);
if (!fileStream.is_open()) {
diff --git a/mm/2s2h/Rando/Spoiler/HandleFileDropped.cpp b/mm/2s2h/Rando/Spoiler/HandleFileDropped.cpp
index 00a296eea..b59826760 100644
--- a/mm/2s2h/Rando/Spoiler/HandleFileDropped.cpp
+++ b/mm/2s2h/Rando/Spoiler/HandleFileDropped.cpp
@@ -5,12 +5,13 @@
#include <spdlog/spdlog.h>
#include "BenPort.h"
#include "public/bridge/consolevariablebridge.h"
+#include "Window.h"
extern "C" {
#include "sfx.h"
}
-bool Rando::Spoiler::HandleFileDropped(std::string filePath) {
+bool Rando::Spoiler::HandleFileDropped(const std::string& filePath) {
try {
std::ifstream fileStream(filePath);
diff --git a/mm/2s2h/Rando/Spoiler/RefreshOptions.cpp b/mm/2s2h/Rando/Spoiler/RefreshOptions.cpp
index 7b3772d69..e4e78acea 100644
--- a/mm/2s2h/Rando/Spoiler/RefreshOptions.cpp
+++ b/mm/2s2h/Rando/Spoiler/RefreshOptions.cpp
@@ -3,6 +3,8 @@
#include <filesystem>
#include "BenPort.h"
+#include <libultraship/libultra/types.h>
+
std::vector<std::string> Rando::Spoiler::spoilerOptions;
const std::filesystem::path randomizerFolderPath(Ship::Context::GetPathRelativeToAppDirectory("randomizer",
appShortName));
diff --git a/mm/2s2h/Rando/Spoiler/Spoiler.h b/mm/2s2h/Rando/Spoiler/Spoiler.h
index 09401d3f9..08b0c4272 100644
--- a/mm/2s2h/Rando/Spoiler/Spoiler.h
+++ b/mm/2s2h/Rando/Spoiler/Spoiler.h
@@ -12,10 +12,10 @@ namespace Spoiler {
extern std::vector<std::string> spoilerOptions;
void RefreshOptions();
nlohmann::json GenerateFromSaveContext();
-void SaveToFile(std::string fileName, nlohmann::json spoiler);
-nlohmann::json LoadFromFile(std::string filePath);
+void SaveToFile(const std::string& fileName, nlohmann::json spoiler);
+nlohmann::json LoadFromFile(const std::string& filePath);
void ApplyToSaveContext(nlohmann::json spoiler);
-bool HandleFileDropped(std::string filePath);
+bool HandleFileDropped(const std::string& path);
} // namespace Spoiler
diff --git a/mm/2s2h/SaveManager/BinarySaveConverter.cpp b/mm/2s2h/SaveManager/BinarySaveConverter.cpp
index 31a9f389b..9b6056759 100644
--- a/mm/2s2h/SaveManager/BinarySaveConverter.cpp
+++ b/mm/2s2h/SaveManager/BinarySaveConverter.cpp
@@ -7,6 +7,7 @@
#include <string>
#include "spdlog/spdlog.h"
#include "Context.h"
+#include "Window.h"
extern "C" {
#include "z64math.h"
@@ -639,7 +640,7 @@ void BinarySaveConverter_ReadBufferToSave(Legacy_SaveContext* saveContext, std::
saveContext->save.saveInfo.checksum = 1;
}
-bool BinarySaveConverter_HandleFileDropped(std::string filePath) {
+bool BinarySaveConverter_HandleFileDropped(const std::string& filePath) {
try {
std::ifstream fileStream(filePath, std::ios::binary | std::ios::ate);
diff --git a/mm/2s2h/SaveManager/SaveManager.cpp b/mm/2s2h/SaveManager/SaveManager.cpp
index 0e99f1426..15b35e88a 100644
--- a/mm/2s2h/SaveManager/SaveManager.cpp
+++ b/mm/2s2h/SaveManager/SaveManager.cpp
@@ -6,6 +6,7 @@
#include "BenJsonConversions.hpp"
#include "BenPort.h"
+#include "Window.h"
extern "C" {
#include "z64save.h"
@@ -101,7 +102,7 @@ int SaveManager_MigrateSave(nlohmann::json& j) {
}
}
-void SaveManager_WriteSaveFile(std::filesystem::path fileName, nlohmann::json j) {
+void SaveManager_WriteSaveFile(const std::filesystem::path& fileName, nlohmann::json j) {
const std::filesystem::path filePath = savesFolderPath / fileName;
if (!std::filesystem::exists(savesFolderPath)) {
@@ -115,7 +116,7 @@ void SaveManager_WriteSaveFile(std::filesystem::path fileName, nlohmann::json j)
} catch (...) { SPDLOG_ERROR("Failed to write save file"); }
}
-void SaveManager_DeleteSaveFile(std::filesystem::path fileName) {
+void SaveManager_DeleteSaveFile(const std::filesystem::path& fileName) {
const std::filesystem::path filePath = savesFolderPath / fileName;
try {
@@ -125,7 +126,7 @@ void SaveManager_DeleteSaveFile(std::filesystem::path fileName) {
} catch (...) { SPDLOG_ERROR("Failed to delete save file"); }
}
-int SaveManager_ReadSaveFile(std::filesystem::path fileName, nlohmann::json& j) {
+int SaveManager_ReadSaveFile(const std::filesystem::path& fileName, nlohmann::json& j) {
const std::filesystem::path filePath = savesFolderPath / fileName;
if (!std::filesystem::exists(filePath)) {
@@ -143,7 +144,7 @@ int SaveManager_ReadSaveFile(std::filesystem::path fileName, nlohmann::json& j)
}
}
-void SaveManager_MoveInvalidSaveFile(std::filesystem::path fileName, std::string message) {
+void SaveManager_MoveInvalidSaveFile(const std::filesystem::path& fileName, const std::string& message) {
const std::filesystem::path filePath = savesFolderPath / fileName;
const std::filesystem::path backupFilePath =
savesFolderPath / (fileName.stem().string() + "_invalid_" + std::to_string(std::time(nullptr)) + ".json");
@@ -241,7 +242,7 @@ std::string SaveManager_GetFileNameFromFlashSave(FlashSave flashSave) {
return "file" + std::to_string(fileNum) + (isBackup ? "backup" : "") + ".json";
}
-bool SaveManager_HandleFileDropped(std::string filePath) {
+bool SaveManager_HandleFileDropped(const std::string& filePath) {
try {
std::ifstream fileStream(filePath);
diff --git a/mm/2s2h/SaveManager/SaveManager.h b/mm/2s2h/SaveManager/SaveManager.h
index e375d3868..f9560ed0a 100644
--- a/mm/2s2h/SaveManager/SaveManager.h
+++ b/mm/2s2h/SaveManager/SaveManager.h
@@ -7,10 +7,10 @@
#include <filesystem>
#include <nlohmann/json.hpp>
std::string SaveManager_GetFileName(int fileNum, bool isBackup = false);
-bool SaveManager_HandleFileDropped(std::string filePath);
-bool BinarySaveConverter_HandleFileDropped(std::string filePath);
+bool SaveManager_HandleFileDropped(const std::string& filePath);
+bool BinarySaveConverter_HandleFileDropped(const std::string& filePath);
int SaveManager_GetOpenFileSlot();
-void SaveManager_WriteSaveFile(std::filesystem::path fileName, nlohmann::json j);
+void SaveManager_WriteSaveFile(const std::filesystem::path& fileName, nlohmann::json j);
#else
void SaveManager_SysFlashrom_WriteData(u8* addr, u32 pageNum, u32 pageCount);
s32 SaveManager_SysFlashrom_ReadData(void* addr, u32 pageNum, u32 pageCount);
diff --git a/mm/2s2h/ShipUtils.cpp b/mm/2s2h/ShipUtils.cpp
index 337cd4fc8..08a0be183 100644
--- a/mm/2s2h/ShipUtils.cpp
+++ b/mm/2s2h/ShipUtils.cpp
@@ -8,6 +8,7 @@
#include <boost_custom/container_hash/hash_32.hpp>
#include "public/bridge/consolevariablebridge.h"
#include "Context.h"
+#include "Window.h"
// Image Icons
#include "assets/interface/parameter_static/parameter_static.h"
#include "assets/archives/icon_item_24_static/icon_item_24_static_yar.h"
diff --git a/mm/2s2h/resource/importer/AnimationFactory.cpp b/mm/2s2h/resource/importer/AnimationFactory.cpp
index eb74bc331..a5e73e088 100644
--- a/mm/2s2h/resource/importer/AnimationFactory.cpp
+++ b/mm/2s2h/resource/importer/AnimationFactory.cpp
@@ -2,6 +2,9 @@
#include "2s2h/resource/type/Animation.h"
#include "2s2h/resource/importer/PlayerAnimationFactory.h"
#include "Context.h"
+#include "ResourceManager.h"
+
+#include <spdlog/spdlog.h>
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/AudioSampleFactory.cpp b/mm/2s2h/resource/importer/AudioSampleFactory.cpp
index 04b438a47..b2cc9c068 100644
--- a/mm/2s2h/resource/importer/AudioSampleFactory.cpp
+++ b/mm/2s2h/resource/importer/AudioSampleFactory.cpp
@@ -4,6 +4,9 @@
#include "audio/soundfont.h"
#include "Context.h"
#include "resource/archive/Archive.h"
+#include <tinyxml2.h>
+#include <thread>
+
#define DR_WAV_IMPLEMENTATION
#include <dr_wav.h>
@@ -11,6 +14,8 @@
#include <dr_mp3.h>
#define DR_FLAC_IMPLEMENTATION
+#include "ResourceManager.h"
+
#include <dr_flac.h>
#include <ogg/ogg.h>
diff --git a/mm/2s2h/resource/importer/AudioSequenceFactory.cpp b/mm/2s2h/resource/importer/AudioSequenceFactory.cpp
index 2033f6cd2..530ff3de7 100644
--- a/mm/2s2h/resource/importer/AudioSequenceFactory.cpp
+++ b/mm/2s2h/resource/importer/AudioSequenceFactory.cpp
@@ -4,7 +4,10 @@
#include "Context.h"
#include "resource/archive/Archive.h"
#include "BinaryWriter.h"
+#include "ResourceManager.h"
+
#include <type_traits>
+#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp b/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp
index 72d4ca7e0..b2109d7d1 100644
--- a/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp
+++ b/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp
@@ -3,7 +3,9 @@
#include "audio/soundfont.h"
#include "audio/load.h"
#include "Context.h"
+#include "ResourceManager.h"
#include "resource/archive/Archive.h"
+#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp b/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp
index d2b930bee..34070c46c 100644
--- a/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp
+++ b/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp
@@ -1,5 +1,6 @@
#include "2s2h/resource/importer/CollisionHeaderFactory.h"
#include "2s2h/resource/type/CollisionHeader.h"
+#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/KeyFrameFactory.cpp b/mm/2s2h/resource/importer/KeyFrameFactory.cpp
index 46df46a55..1403b8f57 100644
--- a/mm/2s2h/resource/importer/KeyFrameFactory.cpp
+++ b/mm/2s2h/resource/importer/KeyFrameFactory.cpp
@@ -1,6 +1,7 @@
#include "2s2h/resource/importer/KeyFrameFactory.h"
#include "2s2h/resource/type/KeyFrame.h"
#include "Context.h"
+#include "ResourceManager.h"
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/SkeletonFactory.cpp b/mm/2s2h/resource/importer/SkeletonFactory.cpp
index a1b4d44ff..a1fa8b9f0 100644
--- a/mm/2s2h/resource/importer/SkeletonFactory.cpp
+++ b/mm/2s2h/resource/importer/SkeletonFactory.cpp
@@ -1,7 +1,9 @@
#include "2s2h/resource/importer/SkeletonFactory.h"
#include "2s2h/resource/type/Skeleton.h"
#include <spdlog/spdlog.h>
+#include <tinyxml2.h>
#include "Context.h"
+#include "ResourceManager.h"
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp b/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp
index d0a0eb714..ea0e410e8 100644
--- a/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp
+++ b/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp
@@ -1,5 +1,6 @@
#include "2s2h/resource/importer/SkeletonLimbFactory.h"
#include "2s2h/resource/type/SkeletonLimb.h"
+#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/TextMMFactory.cpp b/mm/2s2h/resource/importer/TextMMFactory.cpp
index dc3256a5a..9f3d1746e 100644
--- a/mm/2s2h/resource/importer/TextMMFactory.cpp
+++ b/mm/2s2h/resource/importer/TextMMFactory.cpp
@@ -1,5 +1,6 @@
#include "2s2h/resource/importer/TextMMFactory.h"
#include "2s2h/resource/type/TextMM.h"
+#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp
index f27101490..cb9e04e80 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp
@@ -1,6 +1,7 @@
#include "2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.h"
#include "2s2h/resource/type/scenecommand/SetAlternateHeaders.h"
#include "Context.h"
+#include "ResourceManager.h"
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp
index 7c3a2320c..394820587 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp
@@ -2,6 +2,7 @@
#include "2s2h/resource/type/scenecommand/SetAnimatedMaterialList.h"
#include "2s2h/resource/type/TextureAnimation.h"
#include "Context.h"
+#include "ResourceManager.h"
namespace SOH {
diff --git a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp
index 62405f90e..7f19c6701 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp
@@ -1,6 +1,7 @@
#include "2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.h"
#include "2s2h/resource/type/scenecommand/SetCollisionHeader.h"
#include "Context.h"
+#include "ResourceManager.h"
namespace SOH {
std::shared_ptr<Ship::IResource>
diff --git a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp
index 80931530d..76e2c8557 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp
@@ -1,6 +1,7 @@
#include "2s2h/resource/importer/scenecommand/SetCutscenesFactory.h"
#include "2s2h/resource/type/scenecommand/SetCutscenes.h"
#include "Context.h"
+#include "ResourceManager.h"
namespace SOH {
std::shared_ptr<Ship::IResource> SetCutsceneFactoryMM::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,
diff --git a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp
index f63d2ff39..bac70b9be 100644
--- a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp
+++ b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp
@@ -1,6 +1,7 @@
#include "2s2h/resource/importer/scenecommand/SetPathwaysFactory.h"
#include "2s2h/resource/type/scenecommand/SetPathways.h"
#include "Context.h"
+#include "ResourceManager.h"
namespace SOH {
std::shared_ptr<Ship::IResource> SetPathwaysMMFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,
diff --git a/mm/2s2h/z_message_OTR.cpp b/mm/2s2h/z_message_OTR.cpp
index 45cb82297..8b7307136 100644
--- a/mm/2s2h/z_message_OTR.cpp
+++ b/mm/2s2h/z_message_OTR.cpp
@@ -1,4 +1,5 @@
#include "BenPort.h"
+#include "ResourceManager.h"
#include "2s2h/resource/type/Scene.h"
#include <utils/StringHelper.h>
#include "2s2h/resource/type/TextMM.h"
diff --git a/mm/2s2h/z_play_2SH.cpp b/mm/2s2h/z_play_2SH.cpp
index 2ccb9f9d3..1a00264db 100644
--- a/mm/2s2h/z_play_2SH.cpp
+++ b/mm/2s2h/z_play_2SH.cpp
@@ -2,6 +2,7 @@
#include "2s2h/resource/type/Scene.h"
#include <utils/StringHelper.h>
#include "2s2h/GameInteractor/GameInteractor.h"
+#include "ResourceManager.h"
extern "C" {
#include "global.h"
@@ -17,14 +18,14 @@ s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene);
extern "C" void OTRPlay_InitScene(PlayState* play, s32 spawn) {
play->curSpawn = spawn;
- play->linkActorEntry = NULL;
- play->actorCsCamList = NULL;
- play->setupEntranceList = NULL;
- play->setupExitList = NULL;
- play->naviQuestHints = NULL;
- play->setupPathList = NULL;
- play->sceneMaterialAnims = NULL;
- play->roomCtx.unk74 = NULL;
+ play->linkActorEntry = nullptr;
+ play->actorCsCamList = nullptr;
+ play->setupEntranceList = nullptr;
+ play->setupExitList = nullptr;
+ play->naviQuestHints = nullptr;
+ play->setupPathList = nullptr;
+ play->sceneMaterialAnims = nullptr;
+ play->roomCtx.unk74 = nullptr;
play->numSetupActors = 0;
Object_InitContext(&play->state, &play->objectCtx);
LightContext_Init(play, &play->lightCtx);
@@ -54,7 +55,7 @@ extern "C" void OTRPlay_SpawnScene(PlayState* play, s32 sceneId, s32 spawn) {
extern "C" s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx) {
if (roomCtx->status == 1) {
- // if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) {
+ // if (!osRecvMesg(&roomCtx->loadQueue, nullptr, OS_MESG_NOBLOCK)) {
if (1) {
roomCtx->status = 0;
roomCtx->curRoom.segment = roomCtx->activeRoomVram;
diff --git a/mm/assets/custom/shaders/opengl/default.shader.fs b/mm/assets/custom/shaders/opengl/default.shader.fs
index b15e1598c..404caae62 100644
--- a/mm/assets/custom/shaders/opengl/default.shader.fs
+++ b/mm/assets/custom/shaders/opengl/default.shader.fs
@@ -44,6 +44,10 @@ out vec4 vOutColor;
uniform int frame_count;
uniform float noise_scale;
+uniform int texture_width[2];
+uniform int texture_height[2];
+uniform int texture_filtering[2];
+
#define TEX_OFFSET(off) @{texture}(tex, texCoord - off / texSize)
#define WRAP(x, low, high) mod((x)-(low), (high)-(low)) + (low)
@@ -59,7 +63,6 @@ vec4 fromLinear(vec4 linearRGB){
return vec4(mix(higher, lower, cutoff), linearRGB.a);
}
-@if(o_current_filter == FILTER_THREE_POINT)
vec4 filter3point(in sampler2D tex, in vec2 texCoord, in vec2 texSize) {
vec2 offset = fract(texCoord*texSize - vec2(0.5));
offset -= step(1.0, offset.x + offset.y);
@@ -69,14 +72,16 @@ vec4 filter3point(in sampler2D tex, in vec2 texCoord, in vec2 texSize) {
return c0 + abs(offset.x)*(c1-c0) + abs(offset.y)*(c2-c0);
}
-vec4 hookTexture2D(in sampler2D tex, in vec2 uv, in vec2 texSize) {
- return filter3point(tex, uv, texSize);
-}
-@else
-vec4 hookTexture2D(in sampler2D tex, in vec2 uv, in vec2 texSize) {
+vec4 hookTexture2D(in int id, sampler2D tex, in vec2 uv, in vec2 texSize) {
+@if(o_three_point_filtering)
+ if(texture_filtering[id] == @{FILTER_THREE_POINT}) {
+ return filter3point(tex, uv, texSize);
+ }
+@end
return @{texture}(tex, uv);
}
-@end
+
+#define TEX_SIZE(tex) vec2(texture_width[tex], texture_height[tex])
void main() {
@for(i in 0..2)
@@ -84,11 +89,7 @@ void main() {
@{s = o_clamp[i][0]}
@{t = o_clamp[i][1]}
- @if(opengles)
- vec2 texSize@{i} = vec2(textureSize(uTex@{i}, 0));
- @else
- vec2 texSize@{i} = textureSize(uTex@{i}, 0);
- @end
+ vec2 texSize@{i} = TEX_SIZE(@{i});
@if(!s && !t)
vec2 vTexCoordAdj@{i} = vTexCoord@{i};
@@ -102,7 +103,7 @@ void main() {
@end
@end
- vec4 texVal@{i} = hookTexture2D(uTex@{i}, vTexCoordAdj@{i}, texSize@{i});
+ vec4 texVal@{i} = hookTexture2D(@{i}, uTex@{i}, vTexCoordAdj@{i}, texSize@{i});
@if(o_masks[i])
@if(opengles)
@@ -111,10 +112,10 @@ void main() {
vec2 maskSize@{i} = textureSize(uTexMask@{i}, 0);
@end
- vec4 maskVal@{i} = hookTexture2D(uTexMask@{i}, vTexCoordAdj@{i}, maskSize@{i});
+ vec4 maskVal@{i} = hookTexture2D(@{i}, uTexMask@{i}, vTexCoordAdj@{i}, maskSize@{i});
@if(o_blend[i])
- vec4 blendVal@{i} = hookTexture2D(uTexBlend@{i}, vTexCoordAdj@{i}, texSize@{i});
+ vec4 blendVal@{i} = hookTexture2D(@{i}, uTexBlend@{i}, vTexCoordAdj@{i}, texSize@{i});
@else
vec4 blendVal@{i} = vec4(0, 0, 0, 0);
@end